comparison test/mk-sparse-tst.sh @ 29261:f36ca61488e0 stable

tests: Make tests that depend on CXSparse conditional. * libinterp/corefcn/qr.cc, scripts/sparse/spaugment.m, test/mk-sparse-tst.sh: Make BISTs conditional on HAVE_CXSPARSE.
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 05 Jan 2021 14:42:18 +0100
parents bd51beb6205e
children 7e378993e8fa bbbe4dcc7200
comparison
equal deleted inserted replaced
29257:87ca5976c648 29261:f36ca61488e0
1030 %! assert (sparse (a * x), b, feps); 1030 %! assert (sparse (a * x), b, feps);
1031 %! b = sprandn (sz(1),sz(2),0.2) + 1i*sprandn (sz(1),sz(2),0.2); 1031 %! b = sprandn (sz(1),sz(2),0.2) + 1i*sprandn (sz(1),sz(2),0.2);
1032 %! x = a \ b; 1032 %! x = a \ b;
1033 %! assert (sparse (a * x), b, feps); 1033 %! assert (sparse (a * x), b, feps);
1034 %!endfunction 1034 %!endfunction
1035 %!testif HAVE_UMFPACK 1035 %!testif HAVE_UMFPACK, HAVE_CXSPARSE
1036 %! a = alpha*sprandn (10,11,0.2) + speye (10,11); 1036 %! a = alpha*sprandn (10,11,0.2) + speye (10,11);
1037 %! f (a,[10,2],1e-10); 1037 %! f (a,[10,2],1e-10);
1038 %! ## Test this by forcing matrix_type, as can't get a certain 1038 %! ## Test this by forcing matrix_type, as can't get a certain
1039 %! ## result for over-determined systems. 1039 %! ## result for over-determined systems.
1040 %! a = alpha*sprandn (10,10,0.2) + speye (10,10); 1040 %! a = alpha*sprandn (10,10,0.2) + speye (10,10);
1067 %! pdf = full (pds); 1067 %! pdf = full (pds);
1068 %!assert (pds\xf, pdf\xf, 100*eps) 1068 %!assert (pds\xf, pdf\xf, 100*eps)
1069 %!assert (pds\xs, sparse (pdf\xs), 100*eps) 1069 %!assert (pds\xs, sparse (pdf\xs), 100*eps)
1070 %!test 1070 %!test
1071 %! us = alpha*[[speye(10,10);sparse(1,10)],[[1,1];sparse(9,2);[1,1]]]; 1071 %! us = alpha*[[speye(10,10);sparse(1,10)],[[1,1];sparse(9,2);[1,1]]];
1072 %!testif HAVE_UMFPACK 1072 %!testif HAVE_UMFPACK, HAVE_CXSPARSE
1073 %! assert (us*(us\xf), xf, 100*eps); 1073 %! assert (us*(us\xf), xf, 100*eps);
1074 %!testif HAVE_UMFPACK 1074 %!testif HAVE_UMFPACK, HAVE_CXSPARSE
1075 %! assert (us*(us\xs), xs, 100*eps); 1075 %! assert (us*(us\xs), xs, 100*eps);
1076 %!test 1076 %!test
1077 %! pus = us(:,[2,1,3:12]); 1077 %! pus = us(:,[2,1,3:12]);
1078 %!testif HAVE_UMFPACK 1078 %!testif HAVE_UMFPACK, HAVE_CXSPARSE
1079 %! assert (pus*(pus\xf), xf, 100*eps); 1079 %! assert (pus*(pus\xf), xf, 100*eps);
1080 %!testif HAVE_UMFPACK 1080 %!testif HAVE_UMFPACK, HAVE_CXSPARSE
1081 %! assert (pus*(pus\xs), xs, 100*eps); 1081 %! assert (pus*(pus\xs), xs, 100*eps);
1082 %!test 1082 %!test
1083 %! us = alpha*[speye(11,9),[1;sparse(8,1);1;0]]; 1083 %! us = alpha*[speye(11,9),[1;sparse(8,1);1;0]];
1084 %!testif HAVE_CXSPARSE 1084 %!testif HAVE_CXSPARSE
1085 %! [c,r] = qr (us, xf); 1085 %! [c,r] = qr (us, xf);
1086 %! assert (us\xf, r\c, 100*eps); 1086 %! assert (us\xf, r\c, 100*eps);
1087 %!testif HAVE_UMFPACK 1087 %!testif HAVE_UMFPACK, HAVE_CXSPARSE
1088 %! [c,r] = qr (us, xs); 1088 %! [c,r] = qr (us, xs);
1089 %! r = matrix_type (r, "Singular"); ## Force Matrix Type 1089 %! r = matrix_type (r, "Singular"); ## Force Matrix Type
1090 %! assert (us\xs, r\c, 100*eps); 1090 %! assert (us\xs, r\c, 100*eps);
1091 %!test 1091 %!test
1092 %! pus = us(:,[1:8,10,9]); 1092 %! pus = us(:,[1:8,10,9]);
1093 %!testif HAVE_UMFPACK 1093 %!testif HAVE_UMFPACK, HAVE_CXSPARSE
1094 %! [c,r] = qr (pus, xf); 1094 %! [c,r] = qr (pus, xf);
1095 %! r = matrix_type (r, "Singular"); ## Force Matrix Type 1095 %! r = matrix_type (r, "Singular"); ## Force Matrix Type
1096 %! assert (pus\xf, r\c, 100*eps); 1096 %! assert (pus\xf, r\c, 100*eps);
1097 %!testif HAVE_UMFPACK 1097 %!testif HAVE_UMFPACK, HAVE_CXSPARSE
1098 %! [c,r] = qr (pus, xs); 1098 %! [c,r] = qr (pus, xs);
1099 %! r = matrix_type (r, "Singular"); ## Force Matrix Type 1099 %! r = matrix_type (r, "Singular"); ## Force Matrix Type
1100 %! assert (pus\xs, r\c, 100*eps); 1100 %! assert (pus\xs, r\c, 100*eps);
1101 %!test 1101 %!test
1102 %! ls = alpha*[speye(9,11);[1, sparse(1,8),1,0]]; 1102 %! ls = alpha*[speye(9,11);[1, sparse(1,8),1,0]];
1110 %!assert (pls*(pls\xs), xs, 100*eps) 1110 %!assert (pls*(pls\xs), xs, 100*eps)
1111 %!test 1111 %!test
1112 %! ls = alpha*[speye(10,10), sparse(10,1);[1;1], sparse(2,9),[1;1]]; 1112 %! ls = alpha*[speye(10,10), sparse(10,1);[1;1], sparse(2,9),[1;1]];
1113 %! xf = beta * ones (12,2); 1113 %! xf = beta * ones (12,2);
1114 %! xs = speye (12,12); 1114 %! xs = speye (12,12);
1115 %!testif HAVE_UMFPACK 1115 %!testif HAVE_UMFPACK, HAVE_CXSPARSE
1116 %! [c,r] = qr (ls, xf); 1116 %! [c,r] = qr (ls, xf);
1117 %! assert (ls\xf, r\c, 100*eps); 1117 %! assert (ls\xf, r\c, 100*eps);
1118 %!testif HAVE_UMFPACK 1118 %!testif HAVE_UMFPACK, HAVE_CXSPARSE
1119 %! [c,r] = qr (ls, xs); 1119 %! [c,r] = qr (ls, xs);
1120 %! r = matrix_type (r, "Singular"); ## Force Matrix Type 1120 %! r = matrix_type (r, "Singular"); ## Force Matrix Type
1121 %! assert (ls\xs, r\c, 100*eps); 1121 %! assert (ls\xs, r\c, 100*eps);
1122 %!testif HAVE_CXSPARSE 1122 %!test
1123 %! pls = ls(:,[1:8,10,9]); 1123 %! pls = ls(:,[1:8,10,9]);
1124 %!testif HAVE_UMFPACK 1124 %!testif HAVE_UMFPACK, HAVE_CXSPARSE
1125 %! [c,r] = qr (pls, xf); 1125 %! [c,r] = qr (pls, xf);
1126 %! r = matrix_type (r, "Singular"); ## Force Matrix Type 1126 %! r = matrix_type (r, "Singular"); ## Force Matrix Type
1127 %! assert (pls\xf, r\c, 100*eps); 1127 %! assert (pls\xf, r\c, 100*eps);
1128 %!testif HAVE_UMFPACK 1128 %!testif HAVE_UMFPACK, HAVE_CXSPARSE
1129 %! [c,r] = qr (pls, xs); 1129 %! [c,r] = qr (pls, xs);
1130 %! r = matrix_type (r, "Singular"); ## Force Matrix Type 1130 %! r = matrix_type (r, "Singular"); ## Force Matrix Type
1131 %! assert (pls\xs, r\c, 100*eps); 1131 %! assert (pls\xs, r\c, 100*eps);
1132 1132
1133 EOF 1133 EOF