Re: Accelerating a one-line program doing matrix multiplication [message #72757 is a reply to message #72696] |
Wed, 29 September 2010 08:24  |
Axel Martínez
Messages: 22 Registered: June 2010
|
Junior Member |
|
|
On Sep 29, 4:49 pm, chris <rog...@googlemail.com> wrote:
> On 29 Sep., 12:48, Axel M <axe...@gmail.com> wrote:
>
>> I have to admit that I did not understand this proposed use of
>> REPLICATE:
>
>>>> sometimes (replicate({temp:input},newsize)).(0) is faster then rebin
>
>> But it brought me a related question in mind: does IDL have a
>> "REPLICATE" function for vectors instead of scalar values? I am using
>> REBIN, but REBIN is thought for more advanced uses and probably
>> suboptimal for a "replicate-like" use... right?
>
> Yes, it has as I mentioned uncommented above:
>
> sometimes (replicate({temp:input},newsize)).(0) is faster then rebin
>
> -> this means:
>
> IDL> a=findgen(3)
> IDL> print,a
> 0.000000 1.00000 2.00000
> IDL> print, rebin(a,3,5)
> 0.000000 1.00000 2.00000
> 0.000000 1.00000 2.00000
> 0.000000 1.00000 2.00000
> 0.000000 1.00000 2.00000
> 0.000000 1.00000 2.00000
> IDL> print, (replicate({temp:a},5)).(0)
> 0.000000 1.00000 2.00000
> 0.000000 1.00000 2.00000
> 0.000000 1.00000 2.00000
> 0.000000 1.00000 2.00000
> 0.000000 1.00000 2.00000
>
> Regards
>
> CR
Thanks!!
Great, I did not know about this construction, and honestly I do not
understand how it works (is there any documentation about it?).
Anyways, I tried it, and unfortunately I saw that it needed ~20%
longer (the complete function, not the rebin only). So, it is not
faster.. but it is great though.
|
|
|