Is there any way to get the nth power of a matrix?
I try to find an expression that later allows me to adapt it as a constraint to a model.
The code I have worked with is as follows:
sets i/1*3/;
alias(i,j,k,m);
Parameter A(i,j)
/
1.1 2
1.2 3
1.3 4
2.1 1
2.2 3
2.3 2
3.1 0
3.2 2
3.3 1/;
Parameter C(i,j),H;
*A² = C
C(i,j) = sum(k,A(i,k)*A(k,j));
I’ve also been trying with loops, however, as I understand (I apologize if not), it is not possible to formulate equations in a model with loops staments.
I appreciate any help or comments.