comparison src/DLD-FUNCTIONS/lu.cc @ 10094:ab1101011a6d

lu.cc: avoid test failures if HAVE_QRUPDATE_LUU is not defined
author John W. Eaton <jwe@octave.org>
date Wed, 13 Jan 2010 06:00:14 -0500
parents cf70ee43077c
children 40dfc0c99116
comparison
equal deleted inserted replaced
10093:d90736774da2 10094:ab1101011a6d
793 %! vc = [0.85839 + 0.29468i; 793 %! vc = [0.85839 + 0.29468i;
794 %! 0.20820 + 0.93090i; 794 %! 0.20820 + 0.93090i;
795 %! 0.86184 + 0.34689i ]; 795 %! 0.86184 + 0.34689i ];
796 %! 796 %!
797 797
798 %!test 798 %!testif HAVE_QRUPDATE_LUU
799 %! [L,U,P] = lu(A); 799 %! [L,U,P] = lu(A);
800 %! [L,U] = luupdate(L,U,P*u,v); 800 %! [L,U] = luupdate(L,U,P*u,v);
801 %! assert(norm(vec(tril(L)-L),Inf) == 0) 801 %! assert(norm(vec(tril(L)-L),Inf) == 0)
802 %! assert(norm(vec(triu(U)-U),Inf) == 0) 802 %! assert(norm(vec(triu(U)-U),Inf) == 0)
803 %! assert(norm(vec(P'*L*U - A - u*v.'),Inf) < norm(A)*1e1*eps) 803 %! assert(norm(vec(P'*L*U - A - u*v.'),Inf) < norm(A)*1e1*eps)
804 %! 804 %!
805 %!test 805 %!testif HAVE_QRUPDATE_LUU
806 %! [L,U,P] = lu(Ac); 806 %! [L,U,P] = lu(Ac);
807 %! [L,U] = luupdate(L,U,P*uc,vc); 807 %! [L,U] = luupdate(L,U,P*uc,vc);
808 %! assert(norm(vec(tril(L)-L),Inf) == 0) 808 %! assert(norm(vec(tril(L)-L),Inf) == 0)
809 %! assert(norm(vec(triu(U)-U),Inf) == 0) 809 %! assert(norm(vec(triu(U)-U),Inf) == 0)
810 %! assert(norm(vec(P'*L*U - Ac - uc*vc.'),Inf) < norm(Ac)*1e1*eps) 810 %! assert(norm(vec(P'*L*U - Ac - uc*vc.'),Inf) < norm(Ac)*1e1*eps)
811 811
812 %!test 812 %!testif HAVE_QRUPDATE_LUU
813 %! [L,U,P] = lu(single(A)); 813 %! [L,U,P] = lu(single(A));
814 %! [L,U] = luupdate(L,U,P*single(u),single(v)); 814 %! [L,U] = luupdate(L,U,P*single(u),single(v));
815 %! assert(norm(vec(tril(L)-L),Inf) == 0) 815 %! assert(norm(vec(tril(L)-L),Inf) == 0)
816 %! assert(norm(vec(triu(U)-U),Inf) == 0) 816 %! assert(norm(vec(triu(U)-U),Inf) == 0)
817 %! assert(norm(vec(P'*L*U - single(A) - single(u)*single(v).'),Inf) < norm(single(A))*1e1*eps('single')) 817 %! assert(norm(vec(P'*L*U - single(A) - single(u)*single(v).'),Inf) < norm(single(A))*1e1*eps('single'))
818 %! 818 %!
819 %!test 819 %!testif HAVE_QRUPDATE_LUU
820 %! [L,U,P] = lu(single(Ac)); 820 %! [L,U,P] = lu(single(Ac));
821 %! [L,U] = luupdate(L,U,P*single(uc),single(vc)); 821 %! [L,U] = luupdate(L,U,P*single(uc),single(vc));
822 %! assert(norm(vec(tril(L)-L),Inf) == 0) 822 %! assert(norm(vec(tril(L)-L),Inf) == 0)
823 %! assert(norm(vec(triu(U)-U),Inf) == 0) 823 %! assert(norm(vec(triu(U)-U),Inf) == 0)
824 %! assert(norm(vec(P'*L*U - single(Ac) - single(uc)*single(vc).'),Inf) < norm(single(Ac))*1e1*eps('single')) 824 %! assert(norm(vec(P'*L*U - single(Ac) - single(uc)*single(vc).'),Inf) < norm(single(Ac))*1e1*eps('single'))
825 825
826 %!test 826 %!testif HAVE_QRUPDATE_LUU
827 %! [L,U,P] = lu(A); 827 %! [L,U,P] = lu(A);
828 %! [L,U,P] = luupdate(L,U,P,u,v); 828 %! [L,U,P] = luupdate(L,U,P,u,v);
829 %! assert(norm(vec(tril(L)-L),Inf) == 0) 829 %! assert(norm(vec(tril(L)-L),Inf) == 0)
830 %! assert(norm(vec(triu(U)-U),Inf) == 0) 830 %! assert(norm(vec(triu(U)-U),Inf) == 0)
831 %! assert(norm(vec(P'*L*U - A - u*v.'),Inf) < norm(A)*1e1*eps) 831 %! assert(norm(vec(P'*L*U - A - u*v.'),Inf) < norm(A)*1e1*eps)
832 %! 832 %!
833 %!test 833 %!testif HAVE_QRUPDATE_LUU
834 %! [L,U,P] = lu(Ac); 834 %! [L,U,P] = lu(Ac);
835 %! [L,U,P] = luupdate(L,U,P,uc,vc); 835 %! [L,U,P] = luupdate(L,U,P,uc,vc);
836 %! assert(norm(vec(tril(L)-L),Inf) == 0) 836 %! assert(norm(vec(tril(L)-L),Inf) == 0)
837 %! assert(norm(vec(triu(U)-U),Inf) == 0) 837 %! assert(norm(vec(triu(U)-U),Inf) == 0)
838 %! assert(norm(vec(P'*L*U - Ac - uc*vc.'),Inf) < norm(Ac)*1e1*eps) 838 %! assert(norm(vec(P'*L*U - Ac - uc*vc.'),Inf) < norm(Ac)*1e1*eps)
839 839
840 %!test 840 %!testif HAVE_QRUPDATE_LUU
841 %! [L,U,P] = lu(single(A)); 841 %! [L,U,P] = lu(single(A));
842 %! [L,U,P] = luupdate(L,U,P,single(u),single(v)); 842 %! [L,U,P] = luupdate(L,U,P,single(u),single(v));
843 %! assert(norm(vec(tril(L)-L),Inf) == 0) 843 %! assert(norm(vec(tril(L)-L),Inf) == 0)
844 %! assert(norm(vec(triu(U)-U),Inf) == 0) 844 %! assert(norm(vec(triu(U)-U),Inf) == 0)
845 %! assert(norm(vec(P'*L*U - single(A) - single(u)*single(v).'),Inf) < norm(single(A))*1e1*eps('single')) 845 %! assert(norm(vec(P'*L*U - single(A) - single(u)*single(v).'),Inf) < norm(single(A))*1e1*eps('single'))
846 %! 846 %!
847 %!test 847 %!testif HAVE_QRUPDATE_LUU
848 %! [L,U,P] = lu(single(Ac)); 848 %! [L,U,P] = lu(single(Ac));
849 %! [L,U,P] = luupdate(L,U,P,single(uc),single(vc)); 849 %! [L,U,P] = luupdate(L,U,P,single(uc),single(vc));
850 %! assert(norm(vec(tril(L)-L),Inf) == 0) 850 %! assert(norm(vec(tril(L)-L),Inf) == 0)
851 %! assert(norm(vec(triu(U)-U),Inf) == 0) 851 %! assert(norm(vec(triu(U)-U),Inf) == 0)
852 %! assert(norm(vec(P'*L*U - single(Ac) - single(uc)*single(vc).'),Inf) < norm(single(Ac))*1e1*eps('single')) 852 %! assert(norm(vec(P'*L*U - single(Ac) - single(uc)*single(vc).'),Inf) < norm(single(Ac))*1e1*eps('single'))