Mercurial > hg > octave-terminal
changeset 11654:087af2a4ca26 release-3-0-x
fsolve: detect nonsquare systems
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 21 Feb 2008 03:05:27 -0500 |
parents | 5d50ebf98273 |
children | 4bfe1ab20e99 |
files | src/ChangeLog src/DLD-FUNCTIONS/fsolve.cc |
diffstat | 2 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2008-02-21 John W. Eaton <jwe@octave.org> + + * DLD-FUNCTIONS/fsolve.cc (fsolve_user_jacobian): + Check dimensions of user-supplied Jacobian matrix. + (fsolve_user_function): Check for non-square systems. + 2008-02-12 David Bateman <dbateman@free.fr? * graphics.h.in: Implement the cdatamapping property in patch,
--- a/src/DLD-FUNCTIONS/fsolve.cc +++ b/src/DLD-FUNCTIONS/fsolve.cc @@ -139,6 +139,8 @@ if (error_state || retval.length () <= 0) gripe_user_supplied_eval ("fsolve"); + else if (retval.length () != x.length ()) + error ("fsolve: unable to solve non-square systems"); } else gripe_user_supplied_eval ("fsolve"); @@ -188,6 +190,9 @@ if (error_state || retval.length () <= 0) gripe_user_supplied_eval ("fsolve"); + else if (! (retval.rows () == x.length () + && retval.columns () == x.length ())) + error ("fsolve: invalid Jacobian matrix dimensions"); } else gripe_user_supplied_eval ("fsolve");