Mercurial > hg > octave-nkf
changeset 8997:187a9d9c2f04
simplifications to fsolve
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 19 Mar 2009 08:54:56 +0100 |
parents | af43309a59f4 |
children | a48fba01e4ac |
files | scripts/ChangeLog scripts/optimization/fsolve.m |
diffstat | 2 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2009-03-19 Jaroslav Hajek <highegg@gmail.com> + + * optimization/fsolve.m (guarded_eval): Simplify & fix missing + semicolon. + 2009-03-17 Jaroslav Hajek <highegg@gmail.com> * optimization/__fdjac__.m: Pass in fvec to save one evaluation.
--- a/scripts/optimization/fsolve.m +++ b/scripts/optimization/fsolve.m @@ -406,12 +406,12 @@ [fx, jx] = fun (x); else fx = fun (x); - jx = [] + jx = []; endif - if (! complexeqn && ! (all (isreal (fx(:))) && all (isreal (jx(:))))) + if (! complexeqn && ! (isreal (fx) && isreal (jx))) error ("fsolve:notreal", "fsolve: non-real value encountered"); - elseif (complexeqn && ! (all (isnumeric (fx(:))) && all (isnumeric(jx(:))))) + elseif (complexeqn && ! (isnumeric (fx) && isnumeric(jx))) error ("fsolve:notnum", "fsolve: non-numeric value encountered"); elseif (any (isnan (fx(:)))) error ("fsolve:isnan", "fsolve: NaN value encountered");