Matrix Multiplication in IDL [message #35997] |
Mon, 04 August 2003 13:31 |
K Banerjee
Messages: 14 Registered: September 2001
|
Junior Member |
|
|
Folks,
In IDL:
VB> a = indgen(2, 4) - 2
VB> print, a ; Actually prints transpose(a)
-2 -1
0 1
2 3
4 5
VB> help, a ; a is a (2 x 4) matrix.
A INT = Array[2, 4]
VB> b = indgen(4, 2) + 2
VB> print, b ; Actually prints transpose(b)
2 3 4 5
6 7 8 9
VB> help, b ; b is a (4 x 2) matrix.
B INT = Array[4, 2]
VB> c = a ## b
VB> print, c ; Actually prints transpose(c)
-10 -13 -16 -19
6 7 8 9
22 27 32 37
38 47 56 65
Since the matrix C is 4 by 4, the IDL operator "##" performs
the matrix computation:
transpose(a) * transpose(b)
Keeping the above points in mind, I am trying to understand the
IDL command:
transpose(G)##G
(In my case, G is (296 x 4).)
In IDL, the above matrix product turns out to be (4 x 4). However,
I was expecting the matrix product to be (296 x 296) since I
interpret the above IDL command as carrying out the matrix
multiplication:
G * transpose(G)
Clearly, I am not understanding something correctly. Where am
I erring? Thanks.
K. Banerjee
|
|
|