Hello,
I am trying to write a code to multiply 2x2 matrices intrinsically with a loop function. I have managed to do this for an extrinsic example but this has required a fair few line of code and I would like to see if MiniZinc can do it in another way. The code I have written is as follows:
int: dim = 2;
array[1..dim,1..dim] of var float: A;
array[1..dim,1..dim] of var float: AA;
constraint A[1,1]=1.0;
constraint A[2,1]=2.0;
constraint A[1,2]=1.0;
constraint A[2,2]=3.0;
constraint forall (i in 1..dim, j in 1..dim) (
sum (k in 1..dim) (A[i,k]*A[k,j]) = AA[i,j]
);
solve satisfy;
output [show(A)];
Thank you,
Harry