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

Home » Public Forums » archive » Re: Question/Bug on Transpose
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: Question/Bug on Transpose [message #26333] Thu, 23 August 2001 00:36 Go to next message
J�lio Maranh�o is currently offline  J�lio Maranh�o
Messages: 8
Registered: May 2000
Junior Member
I think TRANSPOSE only works with basic types. I tried your examples with
structures and null objects with the same results. Strangely when
transposing a 2D array without the order vector it does the job. With the
vector we have the same error. It has the same time a bug's aspect and a
limitation's one too. In www.rsinc.com I haven't found any info.

P.S.: My system is also IDL 5.4/Win2kPro

J�lio Maranh�o


"Joe Means" <joe.means@orst.edu> escreveu na mensagem
news:3B83F5A9.4050808@orst.edu...
> Hello IDL group,
> I have this problem transposing 3-D pointer arrays. Try this example:
>
> testptr = ptrarr(2,3,4)
> ccc = Transpose(testptr)
> ;This gives an error:
> % TRANSPOSE: Pointer expression not allowed in this context: TESTPTR.
>
> ;What I really want to do is:
> ccc = Transpose(testptr,[1,0,2]) ;But this gives the same error
>
> ;The problem does not occur with a 2-D pointer array:
> testptr2d = ptrarr(2,3)
> bbb = Transpose(testptr2d)
> I run IDL 5.4 on Win2000Pro. I'd like workaround suggestions!
>
> --
> Joseph E. Means
> Assistant Professor, joe.means@orst.edu
> Department of Forest Science
> Oregon State University
> Corvallis, OR 97331-5752
> 541-750-7351
>
Re: Question/Bug on Transpose [message #26338 is a reply to message #26333] Wed, 22 August 2001 16:06 Go to previous messageGo to next message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Joe Means <joe.means@orst.edu> writes:

> Hello IDL group,
> I have this problem transposing 3-D pointer arrays. Try this example:
>
> testptr = ptrarr(2,3,4)
> ccc = Transpose(testptr)
> ;This gives an error:
> % TRANSPOSE: Pointer expression not allowed in this context: TESTPTR.
>
> ;What I really want to do is:
> ccc = Transpose(testptr,[1,0,2]) ;But this gives the same error

This is truly annoying and I think it is a bug.

A simple workaround is to use a FOR loop and copy each plane of your
cube one at a time. It's not luxurious but it will work:

inptr = ptrarr(nx, ny, nz)
outptr = ptrarr(ny, nx, nz)
for i = 0, nx-1 do outptr(*,i,*) = inptr(i,*,*)

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: Question/Bug on Transpose [message #26432 is a reply to message #26338] Mon, 27 August 2001 18:09 Go to previous message
majewski is currently offline  majewski
Messages: 15
Registered: March 2000
Junior Member
On 22 Aug 2001 18:06:45 -0500, Craig Markwardt
<craigmnet@cow.physics.wisc.edu> wrote:

> inptr = ptrarr(nx, ny, nz)
> outptr = ptrarr(ny, nx, nz)
> for i = 0, nx-1 do outptr(*,i,*) = inptr(i,*,*)

or just perform the transpose on a simple index array and then subscript
your pointer array with that

nx = 2 & ny = 3 & nz = 4
testptr = ptrarr(nx, ny, nz)
outptr = testptr[transpose(indgen(nx,ny,nz))]
help, outptr

IDL> <Expression> POINTER = Array[4, 3, 2]

you can then fidget with the transpose command to get the correct output
array dimensions
leon


-------------------------
Leon Majewski

Remote Sensing & Satellite Research Group
Curtin University of Technology, Perth, Australia

email: majewski@ses.curtin.edu.au
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: tetra_volume
Next Topic: Re: is this a managed usegroup or not ?

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

Current Time: Sat Oct 11 09:18:29 PDT 2025

Total time taken to generate the page: 0.63902 seconds