Power of a matrix

Problems with syntax of GAMS
Post Reply
spinzon
User
User
Posts: 1
Joined: 3 years ago

Power of a matrix

Post by spinzon »

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:

Code: Select all

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.
cnbrksnr
User
User
Posts: 13
Joined: 4 years ago

Re: Power of a matrix

Post by cnbrksnr »

Hello,

Cayley-Hamilton theorem may be useful for calculating powers of a matrix without actually computing A^n

https://en.wikipedia.org/wiki/Cayley%E2 ... _of_matrix
Post Reply