linear algebra question



	[David Holmgren]  Many thanks!  I suspected that one would have to
do something like your ListMatrixEntries.
>  
> Question About Matrices: 
> 
> 1)  A matrix is ALWAYS represented internally as a list of rows, each row
> of which is a maxima list.
> 
> If M is a matrix then M[i] is the ith row, and hence a list.  Similarly
> M[i,j] is an entry the i,j entry with 1,1 top left corner entry. 
> 
> 2)  If you do transpose(x) and x is a matrix or list the result is always
> a matrix.
> The case of x a list is a convenient way of building a column matrix
> 
> 3)  To turn a matrix into a simple list of all the entries, with first row
> then
> second row etc.. you could do:
> 
> ListMatrixEntries(m):=block([ans:[]],
>        for v in m do ans:append(ans,v),
>        ans);
> 
> ListMatrixEntries(matrix([a,b],[c,d]))==>[a,b,c,d]
> ListMatrixEntries(transpose([a,b,c])) ==> [a,b,c]
> 
> In lisp to define the same thing you could do
> (defun $LIST_MATRIX_ENTRIES (m)
>    (or ($matrixp m) (error "not a matrix"))
>    (cons '(mlist) (sloop for v in (cdr m) append (cdr v))))
> 
> 
> I will add this function to maxima
> since I know from experience it is useful.   I call it
> $LIST_MATRIX_ENTRIES to be compatible with the usual conventions in
> maxima.
> 
> Note
> (defun |$ListMatrixEntries| (m) ...) would have defined the one with the
> mixed
> case name.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>