Re: Matrix algebra and index order, A # B vs A ## B [message #79847 is a reply to message #79655] |
Thu, 05 April 2012 09:48   |
Kenneth P. Bowman
Messages: 585 Registered: May 2000
|
Senior Member |
|
|
In article <MPG.29e766a33cd1eb35989a43@news.giganews.com>,
David Fanning <news@idlcoyote.com> wrote:
> Mats L�fdahl writes:
>
>> I'm writing some code where matrix algebra is at the heart of things so I
>> really wanted to understand the conventions and convince myself that I can
>> use them in a consistent way.
The "Manipulating Arrays" section of the documentation is some help.
As is so often the case with IDL, the ultimate solution to understanding
how it actually works is to create a trivial example and make sure
that you understand it.
This is easier than trying to figure out row-major, column-major, etc.
Such as
IDL> a = FINDGEN(3,3)
IDL> x = REPLICATE(1.0, 3)
IDL> print, x
1.00000 1.00000 1.00000
IDL> print, TRANSPOSE(a)
0.00000 3.00000 6.00000
1.00000 4.00000 7.00000
2.00000 5.00000 8.00000
IDL> print, a#x
9.00000 12.0000 15.0000
IDL> print, a
0.00000 1.00000 2.00000
3.00000 4.00000 5.00000
6.00000 7.00000 8.00000
IDL> print, a##x
3.00000
12.0000
21.0000
Ken Bowman
|
|
|