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

Home » Public Forums » archive » Reverse function and degenerate dimensions
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Reverse function and degenerate dimensions [message #40664] Wed, 25 August 2004 08:19
btt is currently offline  btt
Messages: 345
Registered: December 2000
Senior Member
Hello,

This is an FYI update on IDL's behavior regarding degenerate dimensions (see
http://tinyurl.com/452xd) I just bumped into another one of those awkward (and
sometimes maddening) situations where IDL drops degenerate dimensions
automatically. It maybe old news, but I thought I should post anyway.

Buried in the REVERSE procedure is this nice option to OVERWRITE the array you
are manipulating. This works fine unless the dimension you want to reverse is
the degenerate one. Here is the line...

b = KEYWORD_SET(overwrite) ? TEMPORARY(a) : a


Here is what happens in each case...


IDL> a = REFORM(fltarr(4,3,1), 4,3,1)
IDL> help, a
A FLOAT = Array[4, 3, 1]
IDL> b = a
IDL> help, b
B FLOAT = Array[4, 3]
IDL> c = temporary(a)
IDL> help, c
C FLOAT = Array[4, 3, 1]


So, it looks like simply copying the array drops the degenerate dimension but
copying with TEMPORARY does not.


My solution is to replace the offending line in REVERSE with ...

b = KEYWORD_SET(overwrite) ? TEMPORARY(a) : Reform(a, size(a, /dim))


Now you might ask why I might want to reverse that particular dimension of such
an array - but please don't ask 'cause I can't explain it.

Cheers,
Ben
[Message index]
 
Read Message
Previous Topic: Re: Running DOS-based programs from IDL
Next Topic: Re: Avoiding FOR loops ?

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

Current Time: Fri Oct 10 15:33:26 PDT 2025

Total time taken to generate the page: 1.75771 seconds