G.A.V Christiansson wrote on 04/20/2006 07:23:48 AM:
> I would also like to humbly ask for a few other matrix functions if
> you are working on this issue:
>
> concatenation: (putting two matrices into one, e.g. A(2x2) B(2x2)
> and [A B] is 2x4.
Maybe you would like to try the linearalgebra package. After
load("linearalgebra"), try:
(%i3) mat: matrix([1,1],[1,-1])$
(%i4) diag_matrix(mat,mat);
(%o4)
matrix([matrix([1,1],[1,-1]),matrix([0,0],[0,0])],[matrix([0,0],[0,0]),matrix([1,1],[1,-1])])
(%i5) mat_unblocker(%);
(%o5) matrix([1,1,0,0],[1,-1,0,0],[0,0,1,1],[0,0,1,-1])
To concatenate matrices, use addcol or addrow (not a part of
linearalgebra)
(%i6) addcol(matrix([1,2],[3,4]), matrix([a,b],[c,d]));
(%o6) matrix([1,2,a,b],[3,4,c,d])
(%i7) matrix([mat,mat],[mat,mat]);
(%o7)
matrix([matrix([1,1],[1,-1]),matrix([1,1],[1,-1])],[matrix([1,1],[1,-1]),matrix([1,1],[1,-1])])
Block matrix LU factorization:
(%i8) lu_factor(%, noncommutingring);
(%o8)
[matrix([matrix([1,1],[1,-1]),matrix([1,1],[1,-1])],[matrix([1,0],[0,1]),matrix([0,0],[0,0])]),[1,2],noncommutingring]
(%i9) get_lu_factors(%);
(%o9)
[matrix([matrix([1,0],[0,1]),matrix([0,0],[0,0])],[matrix([0,0],[0,0]),matrix([1,0],[0,1])]),matrix([matrix([1,0],[0,1]),matrix([0,0],[0,0])],[matrix([1,0],[0,1]),matrix([1,0],[0,1])]),matrix([matrix([1,1],[1,-1]),matrix([1,1],[1,-1])],[matrix([0,0],[0,0]),matrix([0,0],[0,0])])]
(%i10) matrix_element_mult : "."$
(%i11) %o9[1] . %o9[2] . %o9[3];
(%o11)
matrix([matrix([1,1],[1,-1]),matrix([1,1],[1,-1])],[matrix([1,1],[1,-1]),matrix([1,1],[1,-1])])
Barton