## [Maxima-commits] CVS: maxima/share/linearalgebra linalg.mac,1.7,1.8 linearalgebra.texi,1.5,1.6 test-lu.mac,1.2,1.3

 [Maxima-commits] CVS: maxima/share/linearalgebra linalg.mac,1.7,1.8 linearalgebra.texi,1.5,1.6 test-lu.mac,1.2,1.3 From: Barton Willis - 2005-12-27 00:50:32 ```Update of /cvsroot/maxima/maxima/share/linearalgebra In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13239/share/linearalgebra Modified Files: linalg.mac linearalgebra.texi test-lu.mac Log Message: (1) Make zeromatrixp block matrix friendly. (2) Update user documentation for zeromatrixp. (3) Added test for LU factorization using noncommutingring. Index: linalg.mac =================================================================== RCS file: /cvsroot/maxima/maxima/share/linearalgebra/linalg.mac,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- linalg.mac 22 Dec 2005 22:31:43 -0000 1.7 +++ linalg.mac 27 Dec 2005 00:50:24 -0000 1.8 @@ -240,12 +240,12 @@ pos : locate_matrix_entry(m, i, i, nr, i, lambda([e], e # 0), 'bool), if listp(pos) then m : rowswap(m,i, first(pos))), [m, proviso]); - + zeromatrixp(m) := - if matrixp(m) then - every(lambda([e],is(equal(rectform(e),0))), apply('append,args(m))) - else - error("Argument to 'zeromatrixp' must be a matrix"); + if not(matrixp(m)) then is(equal(rectform(e),0)) + else if matrixp(m) then + every(lambda([e],zeromatrixp(e)), apply('append,args(m))); + blockmatrixp(m) := matrixp(m,'matrixp); Index: linearalgebra.texi =================================================================== RCS file: /cvsroot/maxima/maxima/share/linearalgebra/linearalgebra.texi,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- linearalgebra.texi 23 Dec 2005 06:46:09 -0000 1.5 +++ linearalgebra.texi 27 Dec 2005 00:50:24 -0000 1.6 @@ -751,9 +751,9 @@ @deffn {Function} zeromatrixp (@var{M}) -If @code{is (equal (@var{e}, 0))} is true for each element @var{e} of the matrix @var{M}, -return @code{true}; otherwise, -return @code{false}. When @var{M} is not a matrix, signal an error. +If @var{M} is not a block matrix, return @code{true} if @code{is (equal (@var{e}, 0))} +is true for each element @var{e} of the matrix @var{M}. If @var{M} is a block matrix, return +@code{true} if @code{zeromatrixp} evaluates to true for each element of @var{e}. @end deffn Index: test-lu.mac =================================================================== RCS file: /cvsroot/maxima/maxima/share/linearalgebra/test-lu.mac,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- test-lu.mac 21 Dec 2005 20:19:53 -0000 1.2 +++ test-lu.mac 27 Dec 2005 00:50:24 -0000 1.3 @@ -125,6 +125,19 @@ lu_backsub(lu_factor(m, crering), b); matrix([x],[y],[z])\$ +(m : matrix([matrix([0,1],[1,0]), matrix([1,0],[%i,0])], + [matrix([1,0],[0,1]), matrix([1,1],[-1,1])]),0); +0\$ + +(m1 : get_lu_factors(lu_factor(m, noncommutingring)),0); +0\$ + +(matrix_element_mult : ".",0); +0\$ + +zeromatrixp(m1[1] . m1[2] . m1[3] - m); +true\$ + (ratprint : saveratprint, float2bf : savefloat2bf, 0); 0\$ @@ -134,7 +147,8 @@ (kill(lu_test),0); 0\$ - +(matrix_element_mult : "*",0); +0\$ ```

 [Maxima-commits] CVS: maxima/share/linearalgebra linalg.mac,1.7,1.8 linearalgebra.texi,1.5,1.6 test-lu.mac,1.2,1.3 From: Barton Willis - 2005-12-27 00:50:32 ```Update of /cvsroot/maxima/maxima/share/linearalgebra In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13239/share/linearalgebra Modified Files: linalg.mac linearalgebra.texi test-lu.mac Log Message: (1) Make zeromatrixp block matrix friendly. (2) Update user documentation for zeromatrixp. (3) Added test for LU factorization using noncommutingring. Index: linalg.mac =================================================================== RCS file: /cvsroot/maxima/maxima/share/linearalgebra/linalg.mac,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- linalg.mac 22 Dec 2005 22:31:43 -0000 1.7 +++ linalg.mac 27 Dec 2005 00:50:24 -0000 1.8 @@ -240,12 +240,12 @@ pos : locate_matrix_entry(m, i, i, nr, i, lambda([e], e # 0), 'bool), if listp(pos) then m : rowswap(m,i, first(pos))), [m, proviso]); - + zeromatrixp(m) := - if matrixp(m) then - every(lambda([e],is(equal(rectform(e),0))), apply('append,args(m))) - else - error("Argument to 'zeromatrixp' must be a matrix"); + if not(matrixp(m)) then is(equal(rectform(e),0)) + else if matrixp(m) then + every(lambda([e],zeromatrixp(e)), apply('append,args(m))); + blockmatrixp(m) := matrixp(m,'matrixp); Index: linearalgebra.texi =================================================================== RCS file: /cvsroot/maxima/maxima/share/linearalgebra/linearalgebra.texi,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- linearalgebra.texi 23 Dec 2005 06:46:09 -0000 1.5 +++ linearalgebra.texi 27 Dec 2005 00:50:24 -0000 1.6 @@ -751,9 +751,9 @@ @deffn {Function} zeromatrixp (@var{M}) -If @code{is (equal (@var{e}, 0))} is true for each element @var{e} of the matrix @var{M}, -return @code{true}; otherwise, -return @code{false}. When @var{M} is not a matrix, signal an error. +If @var{M} is not a block matrix, return @code{true} if @code{is (equal (@var{e}, 0))} +is true for each element @var{e} of the matrix @var{M}. If @var{M} is a block matrix, return +@code{true} if @code{zeromatrixp} evaluates to true for each element of @var{e}. @end deffn Index: test-lu.mac =================================================================== RCS file: /cvsroot/maxima/maxima/share/linearalgebra/test-lu.mac,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- test-lu.mac 21 Dec 2005 20:19:53 -0000 1.2 +++ test-lu.mac 27 Dec 2005 00:50:24 -0000 1.3 @@ -125,6 +125,19 @@ lu_backsub(lu_factor(m, crering), b); matrix([x],[y],[z])\$ +(m : matrix([matrix([0,1],[1,0]), matrix([1,0],[%i,0])], + [matrix([1,0],[0,1]), matrix([1,1],[-1,1])]),0); +0\$ + +(m1 : get_lu_factors(lu_factor(m, noncommutingring)),0); +0\$ + +(matrix_element_mult : ".",0); +0\$ + +zeromatrixp(m1[1] . m1[2] . m1[3] - m); +true\$ + (ratprint : saveratprint, float2bf : savefloat2bf, 0); 0\$ @@ -134,7 +147,8 @@ (kill(lu_test),0); 0\$ - +(matrix_element_mult : "*",0); +0\$ ```