array multiplying (for a change) [message #38030] |
Tue, 17 February 2004 02:50 |
Chris Lee
Messages: 101 Registered: August 2003
|
Senior Member |
|
|
So...
Every 3rd function or so that I write, I find a need to write a vector
multiplying routine which uses two matrices of different order.
e.g I have a field with 3 dimensions and a field with 1 dimension.
a(10,20,30)
b(20)
The IDL result is to give me an array with 1 dimension or somewhat
indeterminate origin (I assume a[0,*,0] * b[*] but I've never really
checked).
What I want is result = a * b'
where b' = rebin(reform(b, [1,20,1]), 10,20,30)
, which (clearly :) I know how to do in principle.
I also know that this can be very bad for my poor computer, especially
when my arrays are 72 x 36 x 31 x 1000 or similar.
My question is:
Are there any functions, buit-in or otherwise, that I can use? I found
CMAPPLY, which I can beat into a form which works. (I use a similar
function now but it's very _VERY_ bad code).
A quick test using loops versus rebin/reform of the shows loops to be
slower (for a matrix 72,36,31,200) which I'm not really surprised by. Is
this a case where a DLM would be faster?
Chris.
|
|
|