comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Using two different arrays in tha same calculation
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Using two different arrays in tha same calculation [message #2295 is a reply to message #2243] Fri, 10 June 1994 00:44 Go to previous messageGo to previous message
steinhh is currently offline  steinhh
Messages: 260
Registered: June 1994
Senior Member
In article <thompson.771168039@serts.gsfc.nasa.gov>, thompson@serts.gsfc.nasa.gov (William Thompson) writes:
|> ragnar@kvark.fi.uib.no (Ragnar Aas) writes:
|>
|> >I have the following problem :
|>
|> >I have two different arrays, (8) of float and (300,8) of float.
|> >I want to vectorize the equation and therefore I need to use both
|> >arrays in the same equation. For example :
|>
|> >newarray=cos(small_array)*sin(large_array)
|>
|> >where I want the data in small_array to be used over and over 300 times
|> >in this calculation.
|>
|> That's simple,
|>
|> newarray = cos(replicate(1,300)#small_array) * sin(large_array)

It certainly does the trick, Bill, but I wouldn't think that it's more efficient
doing 8*300 cosine operations just to vectorize a multiplication of 8*300 elements :-)
I'd suggest instead:

newarray = replicate(1,300)#cos(small_array) * sin(large_array)

or (I don't know which is the more efficient - would be nice to get some feedback):

small_array = reform(small_array,1,8)
newarray = rebin(cos(small_array),300,8,/sample) * sin(large_array)

Stein Vidar
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Does PVWAVE V4.2 work with Motif V1.2 under VMS?
Next Topic: Re: Problems with Idl and Irix 5.2-alpha

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 15:25:54 PDT 2025

Total time taken to generate the page: 1.60313 seconds