Matrix multiplication in GAMS

Problems with syntax of GAMS
Post Reply
Luca
User
User
Posts: 23
Joined: 6 years ago

Matrix multiplication in GAMS

Post by Luca »

Dear all,

what is the best way to multiply two matrix in GAMS?

Thanks for all your answer,
Luca
Manassaldi
User
User
Posts: 118
Joined: 7 years ago
Location: Rosario - Argentina

Re: Matrix multiplication in GAMS

Post by Manassaldi »

hi, the matrix dimensions must be compatible to carry out the multiplication.
Here are some examples:

Code: Select all

eq(i,j).. C(i,j) =e= sum(k,A(i,k)*B(k,j));
or

Code: Select all

eq(i,j).. C(i,j) =e=  sum((k,m)$(ord(m) eq ord(k)), A(i,k)*B(m,j) );
Bye!
Post Reply