Mercurial > hg > octave-lyh
diff scripts/polynomial/polyvalm.m @ 3085:e6d14959bea9
[project @ 1997-09-19 22:06:12 by jwe]
author | jwe |
---|---|
date | Fri, 19 Sep 1997 22:08:32 +0000 |
parents | 8b262e771614 |
children | 44d82b369c78 |
line wrap: on
line diff
--- a/scripts/polynomial/polyvalm.m +++ b/scripts/polynomial/polyvalm.m @@ -42,16 +42,16 @@ function y = polyvalm (c, x) - if(nargin != 2) + if (nargin != 2) usage ("polyvalm (c, x)"); endif if (! (is_vector (c) || isempty (c))) - error("poly: first argument must be a vector."); + error ("polyvalm: first argument must be a vector."); endif - if(! is_square (x)) - error("poly: second argument must be a square matrix."); + if (! is_square (x)) + error("polyvalm: second argument must be a square matrix."); endif if (isempty (c)) @@ -61,6 +61,10 @@ [v, d] = eig (x); - y = v * diag (polyval (c, diag (d))) * v'; + if (is_symmetric (x)) + y = v * diag (polyval (c, diag (d))) * v'; + else + y = v * (diag (polyval (c, diag (d))) / v); + endif endfunction