Array operation question [message #33933] |
Fri, 07 February 2003 04:08 |
Edd Edmondson
Messages: 50 Registered: January 2003
|
Member |
|
|
It's yet another question about how to get an efficient operation on an
array:
I have one array
q=[num1,num2,num3,num4]
and an array
r=[ [num1a,num1b,num1c...],[num2a,num2b..],[num3a...],[num4a..] ]
and I want to find w=r-q such that
w=[ [num1a-num1,num1b-num1,num1c-num1...],[num2a-num2..],[num3a- num3..]..]
Is there an efficient way of doing it without expanding q so that it is
the same dimension as r? That'd be very expensive in terms of memory for
me, unfortunately. I could loop over the 4 elements of q and r and do that
seperately but I'd quite like to eliminate that last loop.
I've tried various things but all fall victim to the 'feature' mentioned
earlier that IDL will make the result have the dimensions of the smaller
array.
--
Edd
|
|
|