Mercurial > octave
comparison scripts/ode/ode15s.m @ 30895:360d330cc30e
don't change ode options.havejacfun (reverts part of e1788b1a315f)
* ode15i.m, ode15s.m: Revert change of havejacfun -> havejacfcn field
name used in options struct that is passed to __ode15__. If we change
that field, we'll also need to change __ode15__, possibly providing a
path for backward compatibility?
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 05 Apr 2022 01:06:00 -0400 |
parents | e1788b1a315f |
children | 260ce8667d96 |
comparison
equal
deleted
inserted
replaced
30894:9c686fa8132e | 30895:360d330cc30e |
---|---|
214 endif | 214 endif |
215 | 215 |
216 ## Jacobian | 216 ## Jacobian |
217 options.havejac = false; | 217 options.havejac = false; |
218 options.havejacsparse = false; | 218 options.havejacsparse = false; |
219 options.havejacfcn = false; | 219 options.havejacfun = false; |
220 | 220 |
221 if (! isempty (options.Jacobian)) | 221 if (! isempty (options.Jacobian)) |
222 options.havejac = true; | 222 options.havejac = true; |
223 if (is_function_handle (options.Jacobian)) | 223 if (is_function_handle (options.Jacobian)) |
224 options.havejacfcn = true; | 224 options.havejacfun = true; |
225 if (nargin (options.Jacobian) == 2) | 225 if (nargin (options.Jacobian) == 2) |
226 A = options.Jacobian (trange(1), y0); | 226 A = options.Jacobian (trange(1), y0); |
227 if (! issquare (A) || rows (A) != n || ! isnumeric (A) || ! isreal (A)) | 227 if (! issquare (A) || rows (A) != n || ! isnumeric (A) || ! isreal (A)) |
228 error ("Octave:invalid-input-arg", | 228 error ("Octave:invalid-input-arg", |
229 'ode15s: "Jacobian" function must evaluate to a real square matrix'); | 229 'ode15s: "Jacobian" function must evaluate to a real square matrix'); |
261 options.havejacsparse = false; | 261 options.havejacsparse = false; |
262 endif | 262 endif |
263 | 263 |
264 ## If Mass or Jacobian is fcn, then new Jacobian is fcn | 264 ## If Mass or Jacobian is fcn, then new Jacobian is fcn |
265 if (options.havejac) | 265 if (options.havejac) |
266 if (options.havejacfcn || options.havetimedep) | 266 if (options.havejacfun || options.havetimedep) |
267 options.Jacobian = @ (t, y, yp) wrapjacfcn (t, y, yp, | 267 options.Jacobian = @ (t, y, yp) wrapjacfcn (t, y, yp, |
268 options.Jacobian, | 268 options.Jacobian, |
269 options.Mass, | 269 options.Mass, |
270 options.havetimedep, | 270 options.havetimedep, |
271 options.havejacfcn); | 271 options.havejacfun); |
272 options.havejacfcn = true; | 272 options.havejacfun = true; |
273 else # All matrices are constant | 273 else # All matrices are constant |
274 if (! isempty (options.Mass)) | 274 if (! isempty (options.Mass)) |
275 options.Jacobian = {[- options.Jacobian], [options.Mass]}; | 275 options.Jacobian = {[- options.Jacobian], [options.Mass]}; |
276 else | 276 else |
277 if (options.havejacsparse) | 277 if (options.havejacsparse) |