In a two-dimensional array I want to store some calculated values. However, for example for a 2 on 2 matrix I get identical values for [1,2] and [2,1]. What am I am doing wrong?
documentclass[11pt]{scrartcl}
usepackage[utf8x]{inputenc}
usepackage{fp} % fp-package
usepackage{forloop,arrayjobx}
begin{document}
newcommand{CreateArray}[2]{
FPevalmaxi{1+#1} FPevalmaxj{1+#2}
FPclipmaxi{maxi} FPclipmaxj{maxj}
newcounter{i} newcounter{j}
newarrayMatrixA
expandarrayelementtrue
When I set up the matrix everything works fine:
forloop{i}{1}{thei < maxi}{ % Rows
forloop{j}{1}{thej < maxj}{ % Columns
FPevalcalcvar{thej+100*thei} % use variables i and j for calculation
FPclipcalcvar{calcvar}
MatrixA(thei,thej)={calcvar} % save calcvar value in matrix
FPprint{thei} - FPprint{thej} - FPprint{calcvar} \
}
}
But once I want to se the values stored the fields [2,1] and [1,2] are identical:
forloop{i}{1}{thei < maxi}{ % Rows
forloop{j}{1}{thej < maxj}{ % Columns
thei - thej - MatrixA(thei,thej) \
}
}
}
CreateArray{2}{2} % crete matrix
end{document}