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

Home » Public Forums » archive » Re: Array to Scalar
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 to Scalar [message #4937 is a reply to message #4929] Wed, 23 August 1995 00:00 Go to previous message
afl is currently offline  afl
Messages: 51
Registered: December 1994
Member
In article <41fg1d$69h@mojo.eng.umd.edu>, sanjay@windvane.umd.edu (Sanjay K)
writes:
|> I noticed, accidentally, that the multiplication of an array
|> by a scalar and multiplication of an array by an array of length 1
|> gives two different answers. Even though this is to be expected
|> for general arrays, there needs to be an exception for array of
|> size 1.
|>
|> Consider the following example:
|>
|> a=findgen(10)
|> ; unrelated code
|> factor=interpol(....)
|>
|> factor returns array of size 1 and if I use
|>
|> a=a*factor
|>
|> I am left with just one value whereas I expect
|> an array of size 10 each of the elments multiplied by factor!
|>
|> My 2 cents worth!.

Yes. This is the exact behavior one should expect.
Maybe you wish to perform a matrix multiply.

IDL> a = findgen(10)
IDL> factor= fltarr(1) + 2.0 ; Assign 2.0 to factor vector
IDL> d = a # factor
IDL> help, d
IDL> print, d

Andy Loughe
afl@cdc.noaa.gov
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Query: How to import Color Tables
Next Topic: MachTen and IDL

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

Current Time: Sat Oct 25 01:32:44 PDT 2025

Total time taken to generate the page: 3.20026 seconds