Mercurial > hg > octave-lyh
diff test/build_sparse_tests.sh @ 8954:97c84c4c2247
Make the column permutation vector in sparse LU cols()-long.
author | Jason Riedy <jason@acm.org> |
---|---|
date | Tue, 10 Mar 2009 21:54:34 -0400 |
parents | eb63fbe60fab |
children | 25417bd9a3c7 |
line wrap: on
line diff
--- a/test/build_sparse_tests.sh +++ b/test/build_sparse_tests.sh @@ -665,8 +665,8 @@ %! assert(j-i>=0); %!testif HAVE_UMFPACK ;# LU with vector permutations -%! [L,U,P] = lu(bs,'vector'); -%! assert(L(P,:)*U,bs,1e-10); +%! [L,U,P,Q] = lu(bs,'vector'); +%! assert(L(P,:)*U(:,Q),bs,1e-10); %! # triangularity %! [i,j,v]=find(L); %! assert(i-j>=0); @@ -745,6 +745,48 @@ # gen_divop_tests # Disable rectangular \ and / for now gen_matrixdiag_tests gen_matrixreshape_tests + cat >>$TESTS <<EOF +%!testif HAVE_UMFPACK ;# permuted LU +%! [L,U] = lu(bs); +%! assert(L*U,bs,1e-10); + +%!testif HAVE_UMFPACK ;# simple LU + row permutations +%! [L,U,P] = lu(bs); +%! assert(P'*L*U,bs,1e-10); +%! # triangularity +%! [i,j,v]=find(L); +%! assert(i-j>=0); +%! [i,j,v]=find(U); +%! assert(j-i>=0); + +%!testif HAVE_UMFPACK ;# simple LU + row/col permutations +%! [L,U,P,Q] = lu(bs); +%! assert(P'*L*U*Q',bs,1e-10); +%! # triangularity +%! [i,j,v]=find(L); +%! assert(i-j>=0); +%! [i,j,v]=find(U); +%! assert(j-i>=0); + +%!testif HAVE_UMFPACK ;# LU with vector permutations +%! [L,U,P,Q] = lu(bs,'vector'); +%! assert(L(P,:)*U(:,Q),bs,1e-10); +%! # triangularity +%! [i,j,v]=find(L); +%! assert(i-j>=0); +%! [i,j,v]=find(U); +%! assert(j-i>=0); + +%!testif HAVE_UMFPACK ;# LU with scaling +%! [L,U,P,Q,R] = lu(bs); +%! assert(R*P'*L*U*Q',bs,1e-10); +%! # triangularity +%! [i,j,v]=find(L); +%! assert(i-j>=0); +%! [i,j,v]=find(U); +%! assert(j-i>=0); + +EOF }