Re: Fast matrix filling in IDL [message #13875 is a reply to message #13792] |
Mon, 14 December 1998 00:00   |
David Foster
Messages: 341 Registered: January 1996
|
Senior Member |
|
|
Phillip & Suzanne David wrote:
>
> David Fanning wrote:
>>
>> Stein Vidar Hagfors Haugan (steinhh@ulrik.uio.no) writes:
>>>
>>> A slight modification of David's program, and adding
>>> my favourite speedup method:
>>>
>>> time = systime(1)
>>> array = rebin(reform(v,m,1,/overwrite),m,n,/sample)
>>> print, 'Time for Rebin Operations: ', systime(1) - time
>>>
>>> On { alpha OSF unix 5.2 Oct 30 1998}, this gives:
>>>
>>> Time for Loop: 0.27343702
>>> Time for Matrix Operations: 0.093750000
>>> Time for Rebin Operations: 0.067382932
>>>
>>> Note that the relative speeds can vary quite a lot on
>>> different architectures.
>>
>> I guess. Here is what I get with Stein Vidar's modifications
>> on my Windows NT machine:
>>
>> IDL> Print, !Version
>> { x86 Win32 Windows 5.2 Oct 30 1998}
>> IDL> test
>> Time for Loop: 0.10000002
>> Time for Matrix Operations: 0.019999981
>> Time for Rebin Operations: 0.039999962
>>
>> The Rebin operations are twice as slow as the matric operations.
>> Hummm. Why!?
>
> Here's another result from IDL 5.0.2 on the Mac:
> Time for Loop: 0.30000007
> Time for Matrix Operations: 0.13333333
> Time for Rebin Operations: 0.50000000
>
> Phillip
Hopefully everyone is running this a few times and noting when
the times have become "stable". Here are three sequential runs
on a Sun Sparc 2 (IDL 5.1):
IDL> test
Time for Loop: 2.7740721
Time for Matrix Operations: 5.2337180 ; OUT OF WHACK!
Time for Rebin Operations: 0.16969705
IDL> test
Time for Loop: 2.6756930
Time for Matrix Operations: 0.27333605
Time for Rebin Operations: 0.16920698
IDL> test
Time for Loop: 2.7509290
Time for Matrix Operations: 0.27153599
Time for Rebin Operations: 0.16843796
Dave
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2240
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
|
|
|