Subject: Discussion about arrays and matrices in Maxima
From: Žiga Lenarčič
Date: Tue, 19 May 2009 16:56:23 +0200
On 19. May, 2009, at 1:54 PM, Barton Willis wrote:
>
> (3) Converting Maxima matrices to arrays is a huge change. Maxima
> might need to be patched in 100s of places. It could take years to
> find and correct all the bugs that result from this change. The
> coverage in the test suite is uneven--don't count on it picking up all
> such bugs.
>
> Barton
>
I'm aware of current Maxima possibilities of working with matices
numerically - lapack and linearalgebra. I don't think importing
Fortran functions into user level language is what we want.
'linearalgebra' package suffers from irregular naming of functions
and it's somewhat foreign (to core Maxima) concept of 'rings'. I
don't think this is a satisfactory solution.
Besides, both linearalgebra and lapack convert Maxima matrices into
arrays first and then back. Another implication (besides inefficient
memory storage and indexing speed) of having Maxima matrices
implemented as list is, that anybody who wants to write some
efficient algorithms for working on larger matrices, has to write/
copy routines for converting a Maxima matrix into an array and back,
before he can start implementing his algorithm. I think this is bad
practice. Matrices should be made into arrays as soon as possible...
Regarding 1-d vs n-d arrays: I think I misunderstood Dodier's
explaination - I thought matrices would be implemented via arrays of
arrays - but what I realised later was, that Dodier ment that a
matrix is stored in a single 1-d array and elements are accesed via
(aref arry (+ (* j ncols) i)). That is OK (esp. if thats the form
LAPACK routines expect a matrix to be). Purely from 'extending
Maxima' point of view I still think n-dimensional lisp arrays produce
cleaner, more readable code...
As for 'it's a huge change'... Once a list of functions is made, that
have to be rewritten/modified because of this change, it's only a
matter of rewriting all these functions (which might be an
opportunity to improve Maxima's handling of matrices in general and
provide proper functions). It's a big task, I agree. I would be
willing to contribute in the form of rewriting some of the matrix
related functions...
Regards,
Ziga Lenarcic