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

Home » Public Forums » archive » How to increase the speed
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: How to increase the speed [message #85792 is a reply to message #85790] Mon, 09 September 2013 07:06 Go to previous message
sivan is currently offline  sivan
Messages: 13
Registered: August 2012
Junior Member
Hi Moritz,

Thanks a lot. I really appreciated. Your advise gave me a perfect idea and I solved the problem.

Best wishes,
Sivan.

On Monday, September 9, 2013 1:44:59 PM UTC+3, Moritz Fischer wrote:
> Hi!
>
>
>
> Try the '#' operator (and some algebra to remove the multiplication):
>
>
>
> result = exp( a#replicate(1d,2e5) - replicate(1d,250)#(b-c) )
>
>
>
> You could use reform/rebin with the SAMPLE keyword to do somthing similar.
>
>
>
>
>
> Am 09.09.2013 12:11, schrieb sivan:
>
>> Hello everyone,
>
>>
>
>> I'll directly tell you the problem. I have three arrays, one of them
>
>> contains hundreds of elements, the others have the same number of
>
>> elements and contain much more.
>
>>
>
>> Let say (a is the first, b is the 2nd, and c is the 3rd array)
>
>> a=findgen(250)+1 b=randomn(seed, 2e5) c=randomn(seed, 2e5)
>
>>
>
>> What I want to do is to calculate the following equation for each
>
>> element of a and every element of b and c without using the for
>
>> loop.
>
>>
>
>> exp(a(i) - b)*exp(c)
>
>>
>
>> The result should be a two dimensional array (array[250, 2e5]).
>
>>
>
>> Problem is also shown via this picture
>
>> (http://oi42.tinypic.com/10zcx7p.jpg).
>
>>
>
>> I use the following code but it is very slow.
>
>>
>
>> result=dblarr(250, 2e5) for i=0, 249 do result(i,*)=exp(a(i) -
>
>> b)*exp(c)
>
>>
>
>> Thanks in advice, Sivan.
>
>>
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: How to re-use object methods
Next Topic: CONV_DOIT

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

Current Time: Wed Oct 08 17:19:06 PDT 2025

Total time taken to generate the page: 0.00800 seconds