[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Row majority vs. Column majority

From: Paul Kienzle
Subject: Re: Row majority vs. Column majority
Date: Thu, 13 Sep 2001 15:02:16 -0400

"E. Joshua Rigler" wrote:

> I realize that if do_fortran_indexing is turned on, 2 dimensional array
> elements can be accessed sequentially in a Column Major indexing
> scheme.  I have two related questions regarding this, and one slightly
> off-topic question for this list (but I hope folks will humor me):
> 1.0) Is this optimal?  In otherwords, are the array elements truly
> sequential in memory, or is this simply to emulate Matlab?  I ask
> because it seems to me that C/C++ is row major.

The underlying computational libraries are written in FORTRAN, so unless
they are explicitly programmed otherwise, they will require column major
order.   IIRC, lapack and blas have row-major and column-major variants
for their functions.  Multidimensional C arrays are not used in Octave, so
what C/C++ do is irrelevant.

> 1.5) How exactly are matrices stored (internally) in Octave?  Are they a
> part of some object that has its dimensinality specified?  Just curious.

See liboctave.  In particular Array.h defines the block of memory with a
index, Array2.h provides two indices, MArray2.h adds transpose, dMatrix.h
defines arithmetic operations on real matrices,  and LSODE.h, EIG.h, etc.,
provide various other operations on matrices.

> 2.0) Would anyone care to explain to me, or point me at literature, that
> explains how row/column majority is interpreted in N-dimensional
> arrays?  I am writing some functions that may, at times, access
> N-dimensional arrays in binary data files.  I am currently only reading
> them into a linear vector, and passing this to Octave, and hoping that
> standardized N-D functionality will be available in the near future.

Look at liboctave/ArrayN*.h

> I thought I actually posted a similar question once before, but I never
> received and answer, and I couldn't find it in the archives, so forgive
> me if I repeat myself.

Use the source  :-)

Paul Kienzle

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]