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

Home » Public Forums » archive » Re: What are the rules for automatic removal of singleton dimensions, and can I have a way of disabling them, please?
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: What are the rules for automatic removal of singleton dimensions, and can I have a way of disabling them, please? [message #82549] Sun, 23 December 2012 20:25 Go to next message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On 12/23/12 6:01 PM, Tom Grydeland wrote:
> Hello all,
>
> I was trying to visualize subsections of a windowing function when this bit me.
>
> I was creating piecewise results in an array res[ix, iy, ii, jj], where the partial results were sums up to some value in the final two indices
>
> for ii = 0, Kx-1 do begin
> for jj = 0, Ky-1 do begin
> visualize, total(total(res[*,*,0:ii,0:jj], 4), 3)
> endfor
> endfor
>
> but the problem is that IDL (arbitrarily, IMO) discards trailing singleton dimensions on my indexing, so that res[*,*,0:ii,0:jj] ends up as a two-dimensional array when both ii and jj are zero, and a three-dimensional index on subsequent cases of jj being zero, which again causes the calls to 'total' to fail. The innermost portion of these loops become extraordinarily messy if trying to fix this problem.
>
> I've fixed my program by reordering the indices (to [ii, jj, ix, iy]), but I am still miffed that this should be necessary.
>
> Similarly, when I concatenate arrays of dimensions [x, j] and [y, j], I expect a result with dimensions [x+y, j], even when j is equal to 1. I'm trying to write programs independent of the actual value of j, but these arbitrary removals of singleton dimensions make my task that much harder.
>
> Is there a way to disable this stripping of singleton dimensions?
>
> --Tom Grydeland
>

I would give my full support to having a compile_opt to do this
(Chris?)... as David says, there's no way in hell that's ever going to
be the default behaviour, but I would kill to not have to worry about
these cases in some of my more dimension-juggling code!

-Jeremy.
Re: What are the rules for automatic removal of singleton dimensions, and can I have a way of disabling them, please? [message #82552 is a reply to message #82549] Sun, 23 December 2012 15:37 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Tom Grydeland writes:

> Is there a way to disable this stripping of singleton dimensions?

After 25 years? I don't think so. :-)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: What are the rules for automatic removal of singleton dimensions, and can I have a way of disabling them, please? [message #82647 is a reply to message #82549] Tue, 25 December 2012 15:45 Go to previous message
tom.grydeland is currently offline  tom.grydeland
Messages: 51
Registered: September 2012
Member
On Monday, December 24, 2012 5:25:56 AM UTC+1, Jeremy Bailin wrote:
>> I would give my full support to having a compile_opt to do this

For sure I meant a compile_opt, I understand that default behavior cannot be changed for something like this.

> -Jeremy.

--T
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Get values from one image according to pixel locations of maxima on another image
Next Topic: Physical constants in IDL with !CONST

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

Current Time: Wed Oct 08 15:07:13 PDT 2025

Total time taken to generate the page: 0.07104 seconds