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

Home » Public Forums » archive » 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 
Return to the default flat view 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 #82632 is a reply to message #82553] Thu, 27 December 2012 15:06 Go to previous messageGo to previous message
tom.grydeland is currently offline  tom.grydeland
Messages: 51
Registered: September 2012
Member
On Thursday, December 27, 2012 12:12:40 AM UTC+1, Mats Löfdahl wrote:
> Den onsdagen den 26:e december 2012 kl. 15:12:35 UTC+1 skrev Tom Grydeland:

>> In my mind, the fix is to make things behave _less_ arbitrarily, not _more_ so.
> So then we agree.

Good!

>> That solution is worse than the problem, IMO. How many other functions will I have to replace?
> How would I know? Total() is the only one you mentioned...

Yes -- I believe in making my posted examples as succinct as possible.

You pointed out something of which I wasn't aware -- that adding an extra [ ... , 0] index does not raise an exception or change the returned values. This is valuable information, but not something I would base my code on. In my mind, it means indexing has one special case with erratic behavior. Before I start modifying (parts of) the IDL standard library to also behave erratically (and then have to keep track of which parts are so modified), I would try almost any other solution which mean that my array has the number of dimensions I want before I start:

pro atleast_n_dim, a, n
adim = size(a, /dimensions)
if n_elements(adim) eq n then return

adim = [adim, 1+intarr(n-n_elements(adim))]
a = reform(a, adim, /overwrite)
return
end

--T
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Undocumented behavior of TRANSPOSE
Next Topic: Putting an overbar on text in a plot

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

Current Time: Sat Nov 29 11:06:40 PST 2025

Total time taken to generate the page: 0.11860 seconds