[Maxima] Discussion about arrays and matrices in Maxima
toy.raymond at gmail.com
Tue May 19 06:32:33 CDT 2009
Robert Dodier wrote:
> I agree that a matrix should use a Lisp array for storage, but
> I'm inclined to use a 1-d array, since it makes some restructuring
> operations (e.g. transpose, row/column extraction) simpler.
> I can't tell if the translated Fortran code wants 1-d or 2-d arrays.
> Fortran would be happy with 1-d, but there seems to be some
> code to present 1-d as 2-d or vice versa, I'm not sure what's
> going on.
The translated Fortran code uses 1-d arrays for several reasons:
1. Fortran arrays are in column-major order (unlike Lisp and C which are
2. Fortran code often treats multidimensional arrays as single and vice
3. Fortran code often takes a "slice" of an array.
For all of this to work, it's easiest to treat the Fortran array as it
would be laid out in memory as a contiguous set of numbers.
More information about the Maxima