Mercurial > octave-nkf
comparison libinterp/corefcn/lsode.cc @ 20587:f90c8372b7ba
eliminate many more simple uses of error_state
* Cell.cc, __ichol__.cc, __ilu__.cc, balance.cc, bsxfun.cc, colloc.cc,
det.cc, dlmread.cc, dynamic-ld.cc, eig.cc, fft.cc, fft2.cc, fftn.cc,
gcd.cc, getgrent.cc, getpwent.cc, givens.cc, hess.cc, input.cc,
levenshtein.cc, load-path.cc, lookup.cc, ls-mat-ascii.cc, ls-mat4.cc,
lsode.cc, lu.cc, max.cc, md5sum.cc, mex.cc, pager.cc, pinv.cc,
pr-output.cc, qz.cc, schur.cc, sparse.cc, sqrtm.cc, str2double.cc,
strfns.cc, sub2ind.cc, sysdep.cc, time.cc, toplev.cc, tril.cc,
tsearch.cc, typecast.cc, __init_gnuplot__.cc, __magick_read__.cc,
__osmesa_print__.cc, amd.cc, audiodevinfo.cc, dmperm.cc, fftw.cc,
symrcm.cc, ov-base-diag.cc, ov-base-sparse.cc, ov-base.cc,
ov-bool-sparse.cc, ov-builtin.cc, ov-complex.cc, ov-cx-diag.cc,
ov-cx-mat.cc, ov-cx-sparse.cc, ov-fcn-handle.cc, ov-fcn-inline.cc,
ov-float.cc, ov-flt-complex.cc, ov-flt-cx-diag.cc, ov-flt-cx-mat.cc,
ov-flt-re-diag.cc, ov-flt-re-mat.cc, ov-lazy-idx.cc, ov-mex-fcn.cc,
ov-perm.cc, ov-range.cc, ov-re-diag.cc, ov-re-mat.cc, ov-re-sparse.cc,
ov-scalar.cc, ov-str-mat.cc, op-bm-b.cc, op-bm-bm.cc, op-sbm-b.cc,
op-sbm-bm.cc, op-str-m.cc, op-str-s.cc, oct-parse.in.yy, pt-cbinop.cc,
pt-colon.cc, pt-decl.cc, pt-exp.cc, pt-id.cc, pt-misc.cc,
pt-select.cc, pt-unop.cc: Eliminate simple uses of error_state.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 05 Oct 2015 19:29:36 -0400 |
parents | 7ac907da9fba |
children |
comparison
equal
deleted
inserted
replaced
20586:b7ac1e94266e | 20587:f90c8372b7ba |
---|---|
365 | 365 |
366 case 2: | 366 case 2: |
367 { | 367 { |
368 string_vector tmp = f_arg.all_strings (); | 368 string_vector tmp = f_arg.all_strings (); |
369 | 369 |
370 if (! error_state) | 370 fcn_name = unique_symbol_name ("__lsode_fcn__"); |
371 fname = "function y = "; | |
372 fname.append (fcn_name); | |
373 fname.append (" (x, t) y = "); | |
374 lsode_fcn = extract_function (tmp(0), "lsode", fcn_name, | |
375 fname, "; endfunction"); | |
376 | |
377 if (lsode_fcn) | |
371 { | 378 { |
372 fcn_name = unique_symbol_name ("__lsode_fcn__"); | 379 jac_name = unique_symbol_name ("__lsode_jac__"); |
373 fname = "function y = "; | 380 jname = "function jac = "; |
374 fname.append (fcn_name); | 381 jname.append (jac_name); |
375 fname.append (" (x, t) y = "); | 382 jname.append (" (x, t) jac = "); |
376 lsode_fcn = extract_function (tmp(0), "lsode", fcn_name, | 383 lsode_jac = extract_function (tmp(1), "lsode", |
377 fname, "; endfunction"); | 384 jac_name, jname, |
378 | 385 "; endfunction"); |
379 if (lsode_fcn) | 386 |
387 if (!lsode_jac) | |
380 { | 388 { |
381 jac_name = unique_symbol_name ("__lsode_jac__"); | 389 if (fcn_name.length ()) |
382 jname = "function jac = "; | 390 clear_function (fcn_name); |
383 jname.append (jac_name); | 391 lsode_fcn = 0; |
384 jname.append (" (x, t) jac = "); | |
385 lsode_jac = extract_function (tmp(1), "lsode", | |
386 jac_name, jname, | |
387 "; endfunction"); | |
388 | |
389 if (!lsode_jac) | |
390 { | |
391 if (fcn_name.length ()) | |
392 clear_function (fcn_name); | |
393 lsode_fcn = 0; | |
394 } | |
395 } | 392 } |
396 } | 393 } |
397 } | 394 } |
398 break; | 395 break; |
399 | 396 |
449 if (fcn_name.length ()) | 446 if (fcn_name.length ()) |
450 clear_function (fcn_name); | 447 clear_function (fcn_name); |
451 if (jac_name.length ()) | 448 if (jac_name.length ()) |
452 clear_function (jac_name); | 449 clear_function (jac_name); |
453 | 450 |
454 if (! error_state) | 451 std::string msg = ode.error_message (); |
455 { | 452 |
456 std::string msg = ode.error_message (); | 453 retval(2) = msg; |
457 | 454 retval(1) = static_cast<double> (ode.integration_state ()); |
458 retval(2) = msg; | 455 |
459 retval(1) = static_cast<double> (ode.integration_state ()); | 456 if (ode.integration_ok ()) |
460 | 457 retval(0) = output; |
461 if (ode.integration_ok ()) | 458 else |
462 retval(0) = output; | 459 { |
463 else | 460 retval(0) = Matrix (); |
464 { | 461 |
465 retval(0) = Matrix (); | 462 if (nargout < 2) |
466 | 463 error ("lsode: %s", msg.c_str ()); |
467 if (nargout < 2) | |
468 error ("lsode: %s", msg.c_str ()); | |
469 } | |
470 } | 464 } |
471 } | 465 } |
472 else | 466 else |
473 print_usage (); | 467 print_usage (); |
474 | 468 |