# HG changeset patch # User Jaroslav Hajek # Date 1237449296 -3600 # Node ID 187a9d9c2f04f6b8ec2cc9b9372e52cb55471704 # Parent af43309a59f40209aaa58c1e5a6901acc4b3845d simplifications to fsolve diff -r af43309a59f4 -r 187a9d9c2f04 scripts/ChangeLog --- a/scripts/ChangeLog Thu Mar 19 06:57:50 2009 -0400 +++ b/scripts/ChangeLog Thu Mar 19 08:54:56 2009 +0100 @@ -1,3 +1,8 @@ +2009-03-19 Jaroslav Hajek + + * optimization/fsolve.m (guarded_eval): Simplify & fix missing + semicolon. + 2009-03-17 Jaroslav Hajek * optimization/__fdjac__.m: Pass in fvec to save one evaluation. diff -r af43309a59f4 -r 187a9d9c2f04 scripts/optimization/fsolve.m --- a/scripts/optimization/fsolve.m Thu Mar 19 06:57:50 2009 -0400 +++ b/scripts/optimization/fsolve.m Thu Mar 19 08:54:56 2009 +0100 @@ -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");