HOW TO MULTIPLY MATRICES

Hello everybody,

Does anyone know how to multiply matrices in GAMS? It is something
very common, but especially hard in GAMS. I don’t know if there is any
function for that or if anybody knows how to make it in any other way.
I give an example:

[1 2 * [4 3 = [8 5
3 4] 2 1] 20 13]

or this other case:

[1 2 * [4 = [8
3 4] 2 ] 20]

I think the second one is easier, that one is enough for me.

Thanks
Pedro

\

Dear Pedro
Although there is a Matrix utility in GAMS:

http://gams.com/mccarl/mccarlhtml/index.html?execution_time_selected_item_gdx_file_creation.htm

I am not sure if there is any built in function in GAMS for multiplication purposes or not. Once you start working with GAMS you should know that it is a different platform from , let’s say MATLAB. It will give you a lot of good computational abilities, and of course has some limitation.

The easy way of doing matrix product, to my limited understanding, is to use the definition of matrix product:

Let’s say in matrix form C(I)=A(I,K)*B(K,1) , which equivalently in GAMS syntax it is:
C(I)=sum(K,A(I,K)*B(K));

I hope it will help.

محمد صادق تولّلی
Mohammad Sadegh Tavallali
National University of Singapore



On Fri, May 20, 2011 at 1:23 AM, Pedro wrote:

Hello everybody,

Does anyone know how to multiply matrices in GAMS? It is something
very common, but especially hard in GAMS. I don’t know if there is any
function for that or if anybody knows how to make it in any other way.
I give an example:

[1 2 * [4 3 = [8 5
3 4] 2 1] 20 13]

or this other case:

[1 2 * [4 = [8
3 4] 2 ] 20]

I think the second one is easier, that one is enough for me.

Thanks
Pedro


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.