comparison test/build_sparse_tests.sh @ 14190:68fd9f95e1f9 stable

Don't process comments in %!testif specifications. * test.m: Strip comments before processing testif specification line. * build_sparse_tests.sh: Make comments on %!testif lines look attractive.
author Rik <octave@nomad.inbox5.com>
date Tue, 10 Jan 2012 18:10:33 -0800
parents 72c96de7a403
children
comparison
equal deleted inserted replaced
14189:c27491205e48 14190:68fd9f95e1f9
644 %!testif HAVE_UMFPACK 644 %!testif HAVE_UMFPACK
645 %! [l,u] = lu (sparse ([1,1;1,1+i])); 645 %! [l,u] = lu (sparse ([1,1;1,1+i]));
646 %! assert (l, sparse ([1,2,2],[1,1,2],1), 10*eps); 646 %! assert (l, sparse ([1,2,2],[1,1,2],1), 10*eps);
647 %! assert (u, sparse ([1,1,2],[1,2,2],[1,1,1i]), 10*eps); 647 %! assert (u, sparse ([1,1,2],[1,2,2],[1,1,1i]), 10*eps);
648 648
649 %!testif HAVE_UMFPACK ;# permuted LU 649 %!testif HAVE_UMFPACK # permuted LU
650 %! [L,U] = lu (bs); 650 %! [L,U] = lu (bs);
651 %! assert (L*U, bs, 1e-10); 651 %! assert (L*U, bs, 1e-10);
652 652
653 %!testif HAVE_UMFPACK ;# simple LU + row permutations 653 %!testif HAVE_UMFPACK # simple LU + row permutations
654 %! [L,U,P] = lu (bs); 654 %! [L,U,P] = lu (bs);
655 %! assert (P'*L*U, bs, 1e-10); 655 %! assert (P'*L*U, bs, 1e-10);
656 %! # triangularity 656 %! # triangularity
657 %! [i,j,v] = find (L); 657 %! [i,j,v] = find (L);
658 %! assert (i-j>=0); 658 %! assert (i-j>=0);
659 %! [i,j,v] = find (U); 659 %! [i,j,v] = find (U);
660 %! assert (j-i>=0); 660 %! assert (j-i>=0);
661 661
662 %!testif HAVE_UMFPACK ;# simple LU + row/col permutations 662 %!testif HAVE_UMFPACK # simple LU + row/col permutations
663 %! [L,U,P,Q] = lu (bs); 663 %! [L,U,P,Q] = lu (bs);
664 %! assert (P'*L*U*Q', bs, 1e-10); 664 %! assert (P'*L*U*Q', bs, 1e-10);
665 %! # triangularity 665 %! # triangularity
666 %! [i,j,v] = find (L); 666 %! [i,j,v] = find (L);
667 %! assert (i-j>=0); 667 %! assert (i-j>=0);
668 %! [i,j,v] = find (U); 668 %! [i,j,v] = find (U);
669 %! assert (j-i>=0); 669 %! assert (j-i>=0);
670 670
671 %!testif HAVE_UMFPACK ;# LU with vector permutations 671 %!testif HAVE_UMFPACK # LU with vector permutations
672 %! [L,U,P,Q] = lu (bs,'vector'); 672 %! [L,U,P,Q] = lu (bs,'vector');
673 %! assert (L(P,:)*U(:,Q), bs, 1e-10); 673 %! assert (L(P,:)*U(:,Q), bs, 1e-10);
674 %! # triangularity 674 %! # triangularity
675 %! [i,j,v] = find (L); 675 %! [i,j,v] = find (L);
676 %! assert (i-j>=0); 676 %! assert (i-j>=0);
677 %! [i,j,v] = find (U); 677 %! [i,j,v] = find (U);
678 %! assert (j-i>=0); 678 %! assert (j-i>=0);
679 679
680 %!testif HAVE_UMFPACK ;# LU with scaling 680 %!testif HAVE_UMFPACK # LU with scaling
681 %! [L,U,P,Q,R] = lu (bs); 681 %! [L,U,P,Q,R] = lu (bs);
682 %! assert (R*P'*L*U*Q', bs, 1e-10); 682 %! assert (R*P'*L*U*Q', bs, 1e-10);
683 %! # triangularity 683 %! # triangularity
684 %! [i,j,v] = find (L); 684 %! [i,j,v] = find (L);
685 %! assert (i-j>=0); 685 %! assert (i-j>=0);
686 %! [i,j,v] = find (U); 686 %! [i,j,v] = find (U);
687 %! assert (j-i>=0); 687 %! assert (j-i>=0);
688 688
689 %!testif HAVE_UMFPACK ;# inverse 689 %!testif HAVE_UMFPACK # inverse
690 %! assert (inv (bs)*bs, sparse (eye (rows (bs))), 1e-10); 690 %! assert (inv (bs)*bs, sparse (eye (rows (bs))), 1e-10);
691 691
692 %!assert (bf\as', bf\af', 100*eps); 692 %!assert (bf\as', bf\af', 100*eps);
693 %!assert (bs\af', bf\af', 100*eps); 693 %!assert (bs\af', bf\af', 100*eps);
694 %!assert (bs\as', sparse (bf\af'), 100*eps); 694 %!assert (bs\as', sparse (bf\af'), 100*eps);
704 %!testif HAVE_CHOLMOD 704 %!testif HAVE_CHOLMOD
705 %! assert (chol (bs,'lower')*chol (bs,'lower')', bs, 1e-10); 705 %! assert (chol (bs,'lower')*chol (bs,'lower')', bs, 1e-10);
706 %!testif HAVE_CHOLMOD 706 %!testif HAVE_CHOLMOD
707 %! assert (chol (bs,'lower'), chol (bs)', 1e-10); 707 %! assert (chol (bs,'lower'), chol (bs)', 1e-10);
708 708
709 %!testif HAVE_CHOLMOD ;# Return Partial Cholesky factorization 709 %!testif HAVE_CHOLMOD # Return Partial Cholesky factorization
710 %! [RS,PS] = chol (bs); 710 %! [RS,PS] = chol (bs);
711 %! assert (RS'*RS, bs, 1e-10); 711 %! assert (RS'*RS, bs, 1e-10);
712 %! assert (PS, 0); 712 %! assert (PS, 0);
713 %! [LS,PS] = chol (bs,'lower'); 713 %! [LS,PS] = chol (bs,'lower');
714 %! assert (LS*LS', bs, 1e-10); 714 %! assert (LS*LS', bs, 1e-10);
715 %! assert (PS, 0); 715 %! assert (PS, 0);
716 716
717 %!testif HAVE_CHOLMOD ;# Permuted Cholesky factorization 717 %!testif HAVE_CHOLMOD # Permuted Cholesky factorization
718 %! [RS,PS,QS] = chol (bs); 718 %! [RS,PS,QS] = chol (bs);
719 %! assert (RS'*RS, QS*bs*QS', 1e-10); 719 %! assert (RS'*RS, QS*bs*QS', 1e-10);
720 %! assert (PS, 0); 720 %! assert (PS, 0);
721 %! [LS,PS,QS] = chol (bs,'lower'); 721 %! [LS,PS,QS] = chol (bs,'lower');
722 %! assert (LS*LS', QS*bs*QS', 1e-10); 722 %! assert (LS*LS', QS*bs*QS', 1e-10);
748 gen_matrixop_tests 748 gen_matrixop_tests
749 # gen_divop_tests # Disable rectangular \ and / for now 749 # gen_divop_tests # Disable rectangular \ and / for now
750 gen_matrixdiag_tests 750 gen_matrixdiag_tests
751 gen_matrixreshape_tests 751 gen_matrixreshape_tests
752 cat >>$TESTS <<EOF 752 cat >>$TESTS <<EOF
753 %!testif HAVE_UMFPACK ;# permuted LU 753 %!testif HAVE_UMFPACK # permuted LU
754 %! [L,U] = lu (bs); 754 %! [L,U] = lu (bs);
755 %! assert (L*U, bs, 1e-10); 755 %! assert (L*U, bs, 1e-10);
756 756
757 %!testif HAVE_UMFPACK ;# simple LU + row permutations 757 %!testif HAVE_UMFPACK # simple LU + row permutations
758 %! [L,U,P] = lu (bs); 758 %! [L,U,P] = lu (bs);
759 %! assert (P'*L*U, bs, 1e-10); 759 %! assert (P'*L*U, bs, 1e-10);
760 %! # triangularity 760 %! # triangularity
761 %! [i,j,v] = find (L); 761 %! [i,j,v] = find (L);
762 %! assert (i-j>=0); 762 %! assert (i-j>=0);
763 %! [i,j,v] = find (U); 763 %! [i,j,v] = find (U);
764 %! assert (j-i>=0); 764 %! assert (j-i>=0);
765 765
766 %!testif HAVE_UMFPACK ;# simple LU + row/col permutations 766 %!testif HAVE_UMFPACK # simple LU + row/col permutations
767 %! [L,U,P,Q] = lu (bs); 767 %! [L,U,P,Q] = lu (bs);
768 %! assert (P'*L*U*Q', bs, 1e-10); 768 %! assert (P'*L*U*Q', bs, 1e-10);
769 %! # triangularity 769 %! # triangularity
770 %! [i,j,v] = find (L); 770 %! [i,j,v] = find (L);
771 %! assert (i-j>=0); 771 %! assert (i-j>=0);
772 %! [i,j,v] = find (U); 772 %! [i,j,v] = find (U);
773 %! assert (j-i>=0); 773 %! assert (j-i>=0);
774 774
775 %!testif HAVE_UMFPACK ;# LU with vector permutations 775 %!testif HAVE_UMFPACK # LU with vector permutations
776 %! [L,U,P,Q] = lu (bs,'vector'); 776 %! [L,U,P,Q] = lu (bs,'vector');
777 %! assert (L (P,:)*U (:,Q), bs, 1e-10); 777 %! assert (L (P,:)*U (:,Q), bs, 1e-10);
778 %! # triangularity 778 %! # triangularity
779 %! [i,j,v] = find (L); 779 %! [i,j,v] = find (L);
780 %! assert (i-j>=0); 780 %! assert (i-j>=0);
781 %! [i,j,v] = find (U); 781 %! [i,j,v] = find (U);
782 %! assert (j-i>=0); 782 %! assert (j-i>=0);
783 783
784 %!testif HAVE_UMFPACK ;# LU with scaling 784 %!testif HAVE_UMFPACK # LU with scaling
785 %! [L,U,P,Q,R] = lu (bs); 785 %! [L,U,P,Q,R] = lu (bs);
786 %! assert (R*P'*L*U*Q', bs, 1e-10); 786 %! assert (R*P'*L*U*Q', bs, 1e-10);
787 %! # triangularity 787 %! # triangularity
788 %! [i,j,v] = find (L); 788 %! [i,j,v] = find (L);
789 %! assert (i-j>=0); 789 %! assert (i-j>=0);
928 %! save ("-binary", savefile, "bf", "as_save", "af"); 928 %! save ("-binary", savefile, "bf", "as_save", "af");
929 %! clear as_save; 929 %! clear as_save;
930 %! load (savefile, "as_save"); 930 %! load (savefile, "as_save");
931 %! unlink (savefile); 931 %! unlink (savefile);
932 %! assert (as_save, sparse(af)); 932 %! assert (as_save, sparse(af));
933 %!testif HAVE_HDF5 # save hdf5 933 %!testif HAVE_HDF5 # save hdf5
934 %! savefile = tmpnam (); 934 %! savefile = tmpnam ();
935 %! as_save = as; 935 %! as_save = as;
936 %! save ("-hdf5", savefile, "bf", "as_save", "af"); 936 %! save ("-hdf5", savefile, "bf", "as_save", "af");
937 %! clear as_save; 937 %! clear as_save;
938 %! load (savefile, "as_save"); 938 %! load (savefile, "as_save");