Mercurial > hg > octave-lyh
changeset 1396:1ff9a86e2ad5
[project @ 1995-09-14 19:46:14 by jwe]
author | jwe |
---|---|
date | Thu, 14 Sep 1995 19:46:14 +0000 |
parents | b6fe9503c6e1 |
children | 79fa3ca52a05 |
files | scripts/special-matrix/hankel.m |
diffstat | 1 files changed, 12 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/special-matrix/hankel.m +++ b/scripts/special-matrix/hankel.m @@ -23,14 +23,14 @@ # Return the Hankel matrix constructed given the first column # c, and (optionally) the last row r. # -# If the second argument is omitted, the last row is taken to be the -# same as the first column. If the last element of c is not the same -# as the first element of r, the last element of c is used. +# If the second argument is omitted, zeros are inserted below the main +# anti-diagonal. If the last element of c is not the same as the first +# element of r, the last element of c is used. # # See also: vander, hadamard, hilb, invhilb, toeplitz if (nargin == 1) - r = c; + r = zeros (size (c)); elseif (nargin != 2) usage ("hankel (c, r)"); endif @@ -42,6 +42,10 @@ error ("hankel: expecting vector arguments") endif + if (nargin == 1) + r (1) = c (length (c)); + endif + if (c_nc != 1) c = c.'; endif @@ -50,15 +54,15 @@ r = r.'; endif - if (r (1) != c (1)) + nc = length (r); + nr = length (c); + + if (r (1) != c (nr)) warning ("hankel: column wins anti-diagonal conflict"); endif # This should probably be done with the colon operator... - nc = length (r); - nr = length (c); - retval = zeros (nr, nc); for i = 1:min (nr, nc)