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

Home » Public Forums » archive » Re: Multiplication changes array dimensions since a scalar and a 1x1 array are not the same
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Multiplication changes array dimensions since a scalar and a 1x1 array are not the same [message #53259] Sat, 31 March 2007 21:13
swingnut is currently offline  swingnut
Messages: 30
Registered: September 2005
Member
Haha. So, all those SIZE statements sunk in. Here's the workaround I
came up with.

;SIZE of testVirtHeight =
; 1 1 4 1

;SIZE of referenceHeight =
; 0 4 1

deltaVirtHeight = testVirtHeight - referenceHeight

signOfDifference -> 1x1 array instead of a scalar.

adjustmentIncrement = adjustmentIncrement * signOfDifference

adjustmentIncrement -> 1x3 array before operation, 1x1 array
afterwards

SOLUTION: Extract scalar from array element -> testVirtHeight =
testVirtHeight[0,0]

----------

Clearly my calculation of deltaVirtHeight assumed that you could treat
a 1x1 scalar, while IDL is treating them as different types of
variables during array multiplications. Now, why a scalar and a 1x1
array are different escapes me, but at least I've found this
workaround and can continue on. And hopefully knowing about this might
help someone else.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Multiplication turning array into scalar -- who wants to try?
Next Topic: Re: Multiplication turning array into scalar -- who wants to try?

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

Current Time: Wed Oct 08 11:51:06 PDT 2025

Total time taken to generate the page: 0.00808 seconds