[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Faster than this...
- Subject: Re: Faster than this...
- From: Ricardo Fonseca <zamb(at)physics.ucla.edu>
- Date: Fri, 04 Feb 2000 18:57:30 -0800
- Newsgroups: comp.lang.idl-pvwave
- Organization: University of California, Los Angeles
- References: <B4BF43D9.41CC%zamb@physics.ucla.edu><onpuudye6l.fsf@cow.physics.wisc.edu>
- User-Agent: Microsoft Outlook Express Macintosh Edition - 5.0 (1513)
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:18271
Nope, not a trick question, just a vary basic one
Thanks, Ricardo
> From: Craig Markwardt <craigmnet@cow.physics.wisc.edu>
> Organization: U. Wisc. Madison Physics -- Compact Objects
> Reply-To: craigmnet@cow.physics.wisc.edu
> Newsgroups: comp.lang.idl-pvwave
> Date: 03 Feb 2000 19:00:34 -0600
> Subject: Re: Faster than this...
>
>
> Ricardo Fonseca <zamb@physics.ucla.edu> writes:
>>
>> I have this line of code in IDL 5.2a
>>
>> for j=0, N-1 do Data[j]=XAxisData[j]^2*Data[j]
>>
>> Where both Data and XAxisData have the same dimension N.
>> Does anyone know if there is a faster way of doing this
>> (i.e. avoiding the for cicle) ?
>
> I hope this isn't a trick question. The expression
>
> Data = XAxisDAta^2 * Data
>
> should work fine. Don't worry about Data being overwritten. The
> right hand side is fully evaluated with the "old" value of Data,
> before the "new" value of Data is assigned.
>
> Craig
>
> --
> --------------------------------------------------------------------------
> Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
> Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
> --------------------------------------------------------------------------