Hi,
Newbie here, sorry if this is trivial, how can you multiply two vectors into a matrix (say a n*1 times an 1*m into a n*m) ? Just multiplying them will surely send an error since the order sets are different, is there a trick here?
With apologies,
Thanks
Sal.
Vector multiplication into a matrix
Re: Vector multiplication into a matrix
Hi
For this you can use a double loop:
Cheers
Renger
For this you can use a double loop:
Code: Select all
set i /i1*i4/, j /j1*j5/;
parameter vector1(i), vector2(j), matrix(i,j);
* Give some random values:
vector1(i) = ord(i);
vector2(j) = ord(j)
loop(i,
loop(j,
matrix(i,j) = vector1(i) * vector2(j);
);
);
display matrix;
Renger

 User
 Posts: 2
 Joined: 2 months ago
Re: Vector multiplication into a matrix
Thanks ! This is very helpful !