Mercurial > octave-nkf
comparison libinterp/dldfcn/chol.cc @ 20614:10ec79b47808
use new string_value method to handle value extraction errors
* __voronoi__.cc, chol.cc, colamd.cc, fftw.cc:
Use new string_value method.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 08 Oct 2015 18:15:56 -0400 |
parents | 0650b8431037 |
children |
comparison
equal
deleted
inserted
replaced
20613:647db46ad754 | 20614:10ec79b47808 |
---|---|
160 } | 160 } |
161 | 161 |
162 int n = 1; | 162 int n = 1; |
163 while (n < nargin) | 163 while (n < nargin) |
164 { | 164 { |
165 std::string tmp = args(n++).string_value (); | 165 std::string tmp = args(n++).string_value ("chol: expecting trailing string arguments"); |
166 | 166 |
167 if (! error_state) | 167 if (tmp.compare ("vector") == 0) |
168 { | 168 vecout = true; |
169 if (tmp.compare ("vector") == 0) | 169 else if (tmp.compare ("lower") == 0) |
170 vecout = true; | 170 LLt = true; |
171 else if (tmp.compare ("lower") == 0) | 171 else if (tmp.compare ("upper") == 0) |
172 LLt = true; | 172 LLt = false; |
173 else if (tmp.compare ("upper") == 0) | |
174 LLt = false; | |
175 else | |
176 error ("chol: unexpected second or third input"); | |
177 } | |
178 else | 173 else |
179 error ("chol: expecting trailing string arguments"); | 174 error ("chol: unexpected second or third input"); |
180 } | 175 } |
181 | 176 |
182 octave_value arg = args(0); | 177 octave_value arg = args(0); |
183 | 178 |
184 octave_idx_type nr = arg.rows (); | 179 octave_idx_type nr = arg.rows (); |
348 %! assert (p != 0); | 343 %! assert (p != 0); |
349 | 344 |
350 %!error chol () | 345 %!error chol () |
351 %!error <matrix must be positive definite> chol ([1, 2; 3, 4]) | 346 %!error <matrix must be positive definite> chol ([1, 2; 3, 4]) |
352 %!error <requires square matrix> chol ([1, 2; 3, 4; 5, 6]) | 347 %!error <requires square matrix> chol ([1, 2; 3, 4; 5, 6]) |
353 %!error <unexpected second or third input> chol (1, 2) | 348 %!error <expecting trailing string arguments> chol (1, 2) |
349 %!error <unexpected second or third input> chol (1, "foobar") | |
354 */ | 350 */ |
355 | 351 |
356 DEFUN_DLD (cholinv, args, , | 352 DEFUN_DLD (cholinv, args, , |
357 "-*- texinfo -*-\n\ | 353 "-*- texinfo -*-\n\ |
358 @deftypefn {Loadable Function} {} cholinv (@var{A})\n\ | 354 @deftypefn {Loadable Function} {} cholinv (@var{A})\n\ |