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

Home » Public Forums » archive » matrix multiplication
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: matrix multiplication [message #63073 is a reply to message #911] Tue, 28 October 2008 13:59 Go to previous messageGo to previous message
Chris[6] is currently offline  Chris[6]
Messages: 84
Registered: July 2008
Member
On Oct 28, 8:42 am, David Fanning <n...@dfanning.com> wrote:
> russ writes:
>> Probably a stupid question but I haven't used idl for a while
>
>> Is there a quicker way of doing this?
>
>> a=fltarr(1000,20)
>> b=fltarr(20)
>
>> for i=0,999 do begin
>>  a(i,*)=a(i,*)*b
>> endfor
>
> It might be faster to realize the end result is going
> to be an array of zeros than it would be to actually
> write the code. :-)
>
> But, I think you want this:
>
>    a = a * rebin(reform(b, 1, 20) ,1000, 20)
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Coyote's Guide to IDL Programming (www.dfanning.com)
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

I also like this shortcut for reform:
a = a * rebin(1#b, 1000, 20)

chris
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: DLM unload
Next Topic: DLM unload

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

Current Time: Sat Oct 11 12:35:58 PDT 2025

Total time taken to generate the page: 1.19981 seconds