Matrix multiplication in GAMS

Problems with syntax of GAMS
Post Reply
Luca
User
User
Posts: 23
Joined: 1 year ago

Matrix multiplication in GAMS

Post by Luca » 9 months ago

Dear all,

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

Thanks for all your answer,
Luca

Manassaldi
User
User
Posts: 84
Joined: 2 years ago
Location: Rosario - Argentina

Re: Matrix multiplication in GAMS

Post by Manassaldi » 9 months ago

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