# HG changeset patch # User jwe # Date 1036173836 0 # Node ID b02ada83de67a33d37c3aaf1de7cde5f022ff713 # Parent 62afb31c1f852d04888d1ace698ac9b8d6282d0e [project @ 2002-11-01 18:03:56 by jwe] diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,5 +1,10 @@ 2002-11-01 John W. Eaton + * DASPK.cc (DASPK::do_integrate): Resize rwork and iwork before + using them. Accept inequality contraint option of 0. Assign + pabs_tol and prel_tol before calling DASPK. Don't redeclare + abs_tol and rel_tol. + * cmd-edit.h (command_editor::filename_completion_desired): New static function. (command_editor::do_filename_completion_desired): New virtual function. diff --git a/liboctave/DASPK.cc b/liboctave/DASPK.cc --- a/liboctave/DASPK.cc +++ b/liboctave/DASPK.cc @@ -203,10 +203,32 @@ DAEFunc::reset = false; + int eiq = enforce_inequality_constraints (); + int ccic = compute_consistent_initial_condition (); + int eavfet = exclude_algebraic_variables_from_error_test (); + + liw = 40 + n; + if (eiq == 1 || eiq == 3) + liw += n; + if (ccic == 1 || eavfet == 1) + liw += n; + + lrw = 50 + 9*n; + if (! user_jac) + lrw += n*n; + if (eavfet == 1) + lrw += n; + + iwork.resize (liw); + rwork.resize (lrw); + + piwork = iwork.fortran_vec (); + prwork = rwork.fortran_vec (); + // DASPK_options - Array abs_tol = absolute_tolerance (); - Array rel_tol = relative_tolerance (); + abs_tol = absolute_tolerance (); + rel_tol = relative_tolerance (); int abs_tol_len = abs_tol.length (); int rel_tol_len = rel_tol.length (); @@ -228,6 +250,9 @@ return retval; } + pabs_tol = abs_tol.fortran_vec (); + prel_tol = rel_tol.fortran_vec (); + double hmax = maximum_step_size (); if (hmax >= 0.0) { @@ -263,7 +288,6 @@ } } - int eiq = enforce_inequality_constraints (); switch (eiq) { case 1: @@ -296,6 +320,7 @@ } // Fall through... + case 0: case 2: info(9) = eiq; break; @@ -307,7 +332,6 @@ return retval; } - int ccic = compute_consistent_initial_condition (); if (ccic) { if (ccic == 1) @@ -348,7 +372,6 @@ info(10) = ccic; } - int eavfet = exclude_algebraic_variables_from_error_test (); if (eavfet) { info(15) = 1; @@ -416,24 +439,6 @@ DASPK_options::reset = false; - liw = 40 + n; - if (eiq == 1 || eiq == 3) - liw += n; - if (ccic == 1 || eavfet == 1) - liw += n; - - lrw = 50 + 9*n; - if (! user_jac) - lrw += n*n; - if (eavfet == 1) - lrw += n; - - iwork.resize (liw); - rwork.resize (lrw); - - piwork = iwork.fortran_vec (); - prwork = rwork.fortran_vec (); - restart = false; } diff --git a/src/DLD-FUNCTIONS/daspk.cc b/src/DLD-FUNCTIONS/daspk.cc --- a/src/DLD-FUNCTIONS/daspk.cc +++ b/src/DLD-FUNCTIONS/daspk.cc @@ -266,7 +266,6 @@ If @var{fcn} is a two-element string array, the first element names\n\ the function @math{f} described above, and the second element names\n\ a function to compute the modified Jacobian\n\ -\n\ @tex\n\ $$\n\ J = {\\partial f \\over \\partial x}\n\ @@ -274,12 +273,12 @@ $$\n\ @end tex\n\ @ifinfo\n\ +\n\ +@example\n\ df df\n\ jac = -- + c ------\n\ dx d xdot\n\ -@example\n\ @end example\n\ -\n\ @end ifinfo\n\ \n\ The modified Jacobian function must have the form\n\ diff --git a/src/DLD-FUNCTIONS/fsolve.cc b/src/DLD-FUNCTIONS/fsolve.cc --- a/src/DLD-FUNCTIONS/fsolve.cc +++ b/src/DLD-FUNCTIONS/fsolve.cc @@ -219,6 +219,22 @@ and an initial starting point @var{x0}, @code{fsolve} solves the set of\n\ equations such that @code{f(@var{x}) == 0}.\n\ \n\ +If @var{fcn} is a two-element string array, the first element names\n\ +the function @math{f} described above, and the second element names\n\ +a function of the form @code{j (@var{x})} to compute the Jacobian\n\ +matrix with elements\n\ +@tex\n\ +$$ J = {\\partial f_i \\over \\partial x_j} $$\n\ +@end tex\n\ +@ifinfo\n\ +\n\ +@example\n\ + df_i +jac = ---- + dx_j +@end example\n\ +@end ifinfo\n\ +\n\ You can use the function @code{fsolve_options} to set optional\n\ parameters for @code{fsolve}.\n\ @end deftypefn")