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

Home » Public Forums » archive » Re: how can i get an [n,1] array without reform?
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: how can i get an [n,1] array without reform? [message #63823] Thu, 20 November 2008 20:58 Go to next message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Nov 20, 3:54 pm, James McCreight <mccre...@gmail.com> wrote:
> I now understand that this is an age-old debate in the IDL community,
> which really stirs emotions!
>
> I'll just accept that IDL truncates trailing dimensions by default and
> make the call to reform to get it back.
>

Whew! I didn't want to go down that road again 8^)
Re: how can i get an [n,1] array without reform? [message #63826 is a reply to message #63823] Thu, 20 November 2008 15:25 Go to previous messageGo to next message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
James McCreight schrieb:
> I now understand that this is an age-old debate in the IDL community,
> which really stirs emotions!
>
> I'll just accept that IDL truncates trailing dimensions by default and
> make the call to reform to get it back.
>
>

Hi

that can be also solved by

if size(a, /n_dim) eq 1 and size(b, /n_dim) eq 1 then $
c = [[a],[b]] $
else ....

cheers
Reimar


>
>
> On Nov 20, 11:20 am, James McCreight <mccre...@gmail.com> wrote:
>> for clarity, i should have used in the first example:
>>
>> IDL> a=transpose([0,1])
>> IDL> b=transpose([2,3])
>> IDL> c=[a,b]
>> IDL> print,c
>> 0 2
>> 1 3
>
Re: how can i get an [n,1] array without reform? [message #63830 is a reply to message #63826] Thu, 20 November 2008 13:54 Go to previous messageGo to next message
mccreigh is currently offline  mccreigh
Messages: 13
Registered: January 2008
Junior Member
I now understand that this is an age-old debate in the IDL community,
which really stirs emotions!

I'll just accept that IDL truncates trailing dimensions by default and
make the call to reform to get it back.




On Nov 20, 11:20 am, James McCreight <mccre...@gmail.com> wrote:
> for clarity, i should have used in the first example:
>
> IDL> a=transpose([0,1])
> IDL> b=transpose([2,3])
> IDL> c=[a,b]
> IDL> print,c
>        0       2
>        1       3
Re: how can i get an [n,1] array without reform? [message #63842 is a reply to message #63830] Thu, 20 November 2008 10:20 Go to previous messageGo to next message
mccreigh is currently offline  mccreigh
Messages: 13
Registered: January 2008
Junior Member
for clarity, i should have used in the first example:

IDL> a=transpose([0,1])
IDL> b=transpose([2,3])
IDL> c=[a,b]
IDL> print,c
0 2
1 3
Re: how can i get an [n,1] array without reform? [message #63898 is a reply to message #63826] Fri, 21 November 2008 07:28 Go to previous message
mccreigh is currently offline  mccreigh
Messages: 13
Registered: January 2008
Junior Member
> Hi
>
> that can be also solved by
>
> if size(a, /n_dim) eq 1 and size(b, /n_dim) eq 1 then $
>     c = [[a],[b]] $
> else ....
>
> cheers
> Reimar

In my version of IDL (6.4.1), that gives a column vector of dimension
[1,2]. Which is not a solution, no free beer for you. Try again! :)

But that's OK, i will accept that it cant be done without reform.
Fortunately, in my code i already have a surrogate variable which
implies the dimension of a and b. But I still have to test (n eq
max-1) unnecessarily in all but one case, seems like a waste.

Should we all avoid using and concatenating column vectors then and
just use row vectors? I guess I could just put these in an array right
off the bat and avoid concatenation all together. That seems like it
would be faster anyway, if i'm really concerned with speed.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Adding sparse matrices
Next Topic: AVIs for the Mac

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

Current Time: Wed Oct 08 13:38:45 PDT 2025

Total time taken to generate the page: 0.00603 seconds