comparison scripts/sparse/gmres.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 9fc020886ae9
comparison
equal deleted inserted replaced
19733:2e9f17872f36 19734:00e31f316a3a
78 print_usage (); 78 print_usage ();
79 endif 79 endif
80 80
81 if (ischar (A)) 81 if (ischar (A))
82 Ax = str2func (A); 82 Ax = str2func (A);
83 elseif (ismatrix (A)) 83 elseif (isnumeric (A) && ismatrix (A))
84 Ax = @(x) A*x; 84 Ax = @(x) A*x;
85 elseif (isa (A, "function_handle")) 85 elseif (isa (A, "function_handle"))
86 Ax = A; 86 Ax = A;
87 else 87 else
88 error ("gmres: A must be a function or matrix"); 88 error ("gmres: A must be a function or matrix");
102 102
103 if (nargin < 6 || isempty (M1)) 103 if (nargin < 6 || isempty (M1))
104 M1m1x = @(x) x; 104 M1m1x = @(x) x;
105 elseif (ischar (M1)) 105 elseif (ischar (M1))
106 M1m1x = str2func (M1); 106 M1m1x = str2func (M1);
107 elseif (ismatrix (M1)) 107 elseif (isnumeric (M1) && ismatrix (M1))
108 M1m1x = @(x) M1 \ x; 108 M1m1x = @(x) M1 \ x;
109 elseif (isa (M1, "function_handle")) 109 elseif (isa (M1, "function_handle"))
110 M1m1x = M1; 110 M1m1x = M1;
111 else 111 else
112 error ("gmres: preconditioner M1 must be a function or matrix"); 112 error ("gmres: preconditioner M1 must be a function or matrix");
114 114
115 if (nargin < 7 || isempty (M2)) 115 if (nargin < 7 || isempty (M2))
116 M2m1x = @(x) x; 116 M2m1x = @(x) x;
117 elseif (ischar (M2)) 117 elseif (ischar (M2))
118 M2m1x = str2func (M2); 118 M2m1x = str2func (M2);
119 elseif (ismatrix (M2)) 119 elseif (isnumeric (M2) && ismatrix (M2))
120 M2m1x = @(x) M2 \ x; 120 M2m1x = @(x) M2 \ x;
121 elseif (isa (M2, "function_handle")) 121 elseif (isa (M2, "function_handle"))
122 M2m1x = M2; 122 M2m1x = M2;
123 else 123 else
124 error ("gmres: preconditioner M2 must be a function or matrix"); 124 error ("gmres: preconditioner M2 must be a function or matrix");