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

Home » Public Forums » archive » Sky Falling, etc. : Array substitution + addition with plus-equal (+=)
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: Sky Falling, etc. : Array substitution + addition with plus-equal (+=) [message #53033 is a reply to message #52941] Tue, 13 March 2007 00:19 Go to previous message
Y.T. is currently offline  Y.T.
Messages: 25
Registered: December 2004
Junior Member
On Mar 12, 2:17 pm, "Ed Hyer" <ejh...@gmail.com> wrote:
> Tentatively filed under "The Sky Is Falling!," and I hope it will be
> resolved in the same fashion.
>
> Here is the test case, which gives the correct result:
>
> IDL> test=fltarr(2,2,4)
> IDL> testadd=fltarr(2,2,2) + 1
> IDL> print,total(test),total(testadd)
> 0.00000 8.00000
> IDL> test[0,0,1] += testadd
[...etc... snipped for brevity]
> 0.00000 0.00000
> 0.00000 0.00000 ; Not even JD Smith
> expected _that_.
>
> Any ideas?

I have no idea, but it persists when you

- strip the leading dimension
- switch from += to traditional addition:

IDL> test=fltarr(2,4)
IDL> testadd=fltarr(2,2)
IDL> testadd[0,*]=1
IDL> print,total(test),total(testadd)
0.000000 2.00000
IDL> test[0,1] = test[0,1]+testadd
IDL> print,total(test),total(testadd)
2.00000 2.00000
IDL> test[0,1] = test[0,1]+testadd
IDL> print,total(test),total(testadd)
6.00000 2.00000
IDL> print,test
0.000000 0.000000
2.00000 1.00000
2.00000 1.00000
0.000000 0.000000


No, I have no idea what's going on there...
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: randomn problem
Next Topic: Re: Array resize with arbitrary arithmetic

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

Current Time: Fri Oct 10 10:07:11 PDT 2025

Total time taken to generate the page: 0.80080 seconds