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

Home » Public Forums » archive » really stupid matrix question
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: really stupid matrix question [message #94835 is a reply to message #94830] Mon, 30 October 2017 13:15 Go to previous messageGo to previous message
Burch is currently offline  Burch
Messages: 28
Registered: December 2013
Junior Member
On Monday, October 30, 2017 at 12:49:27 PM UTC-5, Ann Nonymous wrote:
> OK, before my head explodes, can anyone tell me the answer to this?
>
> a=indgen(4,3)
> print, a
> 0,1,2,3
> 4,5,6,7
> 8,9,10,11
>
> OK, are the horizontal lines really vertical vectors? I think they would be based on idl being column-major, which means the columns are contiguous in memory. If. I. understand. correctly.
>
> If this is correct, then why does IDL print them out in rows????
>
> Someone please shoot me.

In IDL the first dimension is stored contiguously in memory. When printing, this dimension corresponds to the column (this is how IDL maps it, some other languages map the first dimension to rows when printing/displaying). For your example, the elements are stored in memory in the order [0, 0], [1, 0], [2, 0], [3, 0], [0, 1], [1, 1], [2, 1], [3, 1], [0, 2], [1, 2], [2, 2], [3, 2].

Note that how the creators of a language choose to DISPLAY an array is NOT THE SAME as whether or not the language is described as row- or column-major, which is based strictly on the mathematical [row, column] notation (which is the opposite of how IDL displays it). You can read more about this, and why it's particularly confusing in IDL, here: http://www.harrisgeospatial.com/docs/Columns__Rows__and_Arra y.html

-Jeff
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: display direction
Next Topic: Re: harrisgeospatial unreachable...

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

Current Time: Wed Oct 08 09:21:16 PDT 2025

Total time taken to generate the page: 0.24972 seconds