Mercurial > octave
changeset 23474:70edb5512c6e
fsolve.m: Issue an error for incorrectly sized user Jacobian (bug #50454).
* fsolve.m: Check size of user-supplied Jacobian before using.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 08 May 2017 20:58:14 -0700 |
parents | 55916f99b8b6 |
children | d691ed308237 |
files | scripts/optimization/fsolve.m |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/optimization/fsolve.m Mon May 08 13:08:11 2017 -0400 +++ b/scripts/optimization/fsolve.m Mon May 08 20:58:14 2017 -0700 @@ -235,6 +235,10 @@ ## Calculate function value and Jacobian (possibly via FD). if (has_jac) [fvec, fjac] = fcn (reshape (x, xsiz)); + if (! all (size (fjac) == [m, n])) + error ("fsolve: Jacobian size should be (%d,%d), not (%d,%d)", + m, n, rows (fjac), columns (fjac)); + endif ## If the Jacobian is sparse, disable Broyden updating. if (issparse (fjac)) updating = false;