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

Home » Public Forums » archive » Array multiplication: implicit loop query
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: Array Multiplication [message #79659 is a reply to message #26191] Sun, 25 March 2012 08:09 Go to previous message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
On 25 mar, 11:22, IDL beginner <moxam...@gmail.com> wrote:
> Dear All,
>
> I have the following question. Let's say we have a vector A and matrix
> array B so that:
>
> A = [1, 2, 5, 2, 3]
>
> B = [[2, 4], [1, 9]]
>
> I want to multiply each element of the vector A with the matrix array
> B but WITHOUT using a FOR loop. Is that possible??? I need to do so in
> order to save execution time.
>
> The output result should be an array C with dimensions C[2, 2, 5, 1].
>
> Any help is appreciated.
>
> MD
>
>

C = reform(reform(B, 4, OVER=over) # A, 2, 2, 5)

Regarding any optimization, using over=1 is faster, but will change
dimensions of B; using over=0 will keep B unchanged, but a temporary
copy of B is created.
alx.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Coyote Library Updates
Next Topic: Ask Mr. Cosmology

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

Current Time: Sun Oct 12 03:58:03 PDT 2025

Total time taken to generate the page: 0.72701 seconds