comparison scripts/sparse/qmr.m @ 19734:00e31f316a3a

Fix Matlab incompatibility of "ismatrix" (bug #42422). * data.cc (isvector): new tests * data.cc (isrow): documentation improved, new tests * data.cc (iscolumn): documentation improved, new tests * data.cc (ismatrix): is matrix now only checks the dimension due to Matlab compatibility, documentation improved, new tests * accumarray.m: use more appropriate function, than ismatrix * gradient.m: use more appropriate function, than ismatrix * num2str.m: use more appropriate functions, than ismatrix * ntsc2rgb.m: use more appropriate function, than ismatrix * condest.m: use more appropriate function, than ismatrix * expm.m: use more appropriate function, than ismatrix * onenormest.m: use more appropriate function, than ismatrix * isocolors.m: use more appropriate function, than ismatrix * isonormals.m: use more appropriate function, than ismatrix * isosurface.m: use more appropriate function, than ismatrix * __errcomm__.m: use more appropriate function, than ismatrix * __interp_cube__.m: use more appropriate function, than ismatrix * __marching_cube__.m: use more appropriate function, than ismatrix * __stem__.m: use more appropriate function, than ismatrix * stairs.m: use more appropriate function, than ismatrix * validsetargs.m: use more appropriate functions, than ismatrix * unique.m: use more appropriate functions, than ismatrix * bicg.m: additional tests for numerical value * bicgstab.m: additional tests for numerical value * cgs.m: additional tests for numerical value * gmres.m: additional tests for numerical value * qmr.m: additional tests for numerical value
author Kai T. Ohlhus <k.ohlhus@gmail.com>
date Thu, 12 Feb 2015 18:34:56 +0100
parents 4197fc428c7d
children 5f2c0ca0ef51
comparison
equal deleted inserted replaced
19733:2e9f17872f36 19734:00e31f316a3a
96 Ax = @(x) feval (fun, x, "notransp"); 96 Ax = @(x) feval (fun, x, "notransp");
97 Atx = @(x) feval (fun, x, "transp"); 97 Atx = @(x) feval (fun, x, "transp");
98 elseif (isa (A, "function_handle")) 98 elseif (isa (A, "function_handle"))
99 Ax = @(x) feval (A, x, "notransp"); 99 Ax = @(x) feval (A, x, "notransp");
100 Atx = @(x) feval (A, x, "transp"); 100 Atx = @(x) feval (A, x, "transp");
101 elseif (ismatrix (A)) 101 elseif (isnumeric (A) && ismatrix (A))
102 Ax = @(x) A * x; 102 Ax = @(x) A * x;
103 Atx = @(x) A' * x; 103 Atx = @(x) A' * x;
104 else 104 else
105 error (["qmr: first argument is expected to " ... 105 error (["qmr: first argument is expected to " ...
106 "be a function or a square matrix"]); 106 "be a function or a square matrix"]);
122 M1m1x = @(x) feval (fun, x, "notransp"); 122 M1m1x = @(x) feval (fun, x, "notransp");
123 M1tm1x = @(x) feval (fun, x, "transp"); 123 M1tm1x = @(x) feval (fun, x, "transp");
124 elseif (isa (M1, "function_handle")) 124 elseif (isa (M1, "function_handle"))
125 M1m1x = @(x) feval (M1, x, "notransp"); 125 M1m1x = @(x) feval (M1, x, "notransp");
126 M1tm1x = @(x) feval (M1, x, "transp"); 126 M1tm1x = @(x) feval (M1, x, "transp");
127 elseif (ismatrix (M1)) 127 elseif (isnumeric (M1) && ismatrix (M1))
128 M1m1x = @(x) M1 \ x; 128 M1m1x = @(x) M1 \ x;
129 M1tm1x = @(x) M1' \ x; 129 M1tm1x = @(x) M1' \ x;
130 else 130 else
131 error (["qmr: preconditioner is expected to " ... 131 error (["qmr: preconditioner is expected to " ...
132 "be a function or matrix"]); 132 "be a function or matrix"]);
140 M2m1x = @(x) feval (fun, x, "notransp"); 140 M2m1x = @(x) feval (fun, x, "notransp");
141 M2tm1x = @(x) feval (fun, x, "transp"); 141 M2tm1x = @(x) feval (fun, x, "transp");
142 elseif (isa (M2, "function_handle")) 142 elseif (isa (M2, "function_handle"))
143 M2m1x = @(x) feval (M2, x, "notransp"); 143 M2m1x = @(x) feval (M2, x, "notransp");
144 M2tm1x = @(x) feval (M2, x, "transp"); 144 M2tm1x = @(x) feval (M2, x, "transp");
145 elseif (ismatrix (M2)) 145 elseif (isnumeric (M2) && ismatrix (M2))
146 M2m1x = @(x) M2 \ x; 146 M2m1x = @(x) M2 \ x;
147 M2tm1x = @(x) M2' \ x; 147 M2tm1x = @(x) M2' \ x;
148 else 148 else
149 error (["qmr: preconditioner is expected to " ... 149 error (["qmr: preconditioner is expected to " ...
150 "be a function or matrix"]); 150 "be a function or matrix"]);