Mercurial > hg > octave-avbm
changeset 3885:f49111e2d8a4
[project @ 2002-04-03 17:33:19 by jwe]
author | jwe |
---|---|
date | Wed, 03 Apr 2002 17:33:19 +0000 |
parents | fcb4931ec48a |
children | 96919c87953c |
files | scripts/ChangeLog scripts/special-matrix/vander.m |
diffstat | 2 files changed, 10 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2002-04-03 Paul Kienzle <pkienzle@users.sf.net> + + * special-matrix/vander.m: Code tidy and vectorize. + 2002-04-02 Paul Kienzle <pkienzle@users.sf.net> * linear-algebra/cross.m: Accept nx3 and 3xn matrices, in addition
--- a/scripts/special-matrix/vander.m +++ b/scripts/special-matrix/vander.m @@ -57,21 +57,13 @@ usage ("vander (c)"); endif - nr = rows (c); - nc = columns (c); - if (nr == 1 && nc == 1) - retval = 1; - elseif (nr == 1 || nc == 1) + if (is_vector (c)) n = length (c); - if (n > 0) - retval = zeros (n, n); - for i = 1:n - tmp = c(i); - for j = 1:n - retval (i, j) = tmp ^ (n - j); - endfor - endfor - endif + retval = zeros (n, n); + j = 1:n; + for i = 1:n + retval(i,:) = c(i) .^ (n - j); + endfor else error ("vander: argument must be a vector"); endif