Mercurial > hg > octave-terminal
changeset 3140:990ea337e950
[project @ 1998-02-03 08:07:51 by jwe]
author | jwe |
---|---|
date | Tue, 03 Feb 1998 08:07:51 +0000 |
parents | d0384ceed762 |
children | 292ff0bf484b |
files | scripts/special-matrix/hadamard.m scripts/special-matrix/hankel.m scripts/special-matrix/hilb.m scripts/special-matrix/invhilb.m scripts/special-matrix/sylvester_matrix.m scripts/special-matrix/toeplitz.m scripts/special-matrix/vander.m |
diffstat | 7 files changed, 50 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
deleted file mode 100644 --- a/scripts/special-matrix/hadamard.m +++ /dev/null @@ -1,45 +0,0 @@ -## Copyright (C) 1996, 1997 John W. Eaton -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, 59 Temple Place - Suite 330, Boston, MA -## 02111-1307, USA. - -## usage: hadamard (k) -## -## Return the Hadamard matrix of order n = 2^k. -## -## See also: hankel, vander, hilb, invhilb, toeplitz - -## Author: jwe - -function retval = hadamard (k) - - if (nargin != 1) - usage ("hadamard (n)"); - endif - - if (is_scalar (k)) - if (k < 1) - retval = 1; - else - tmp = hadamard (k-1); - retval = [tmp, tmp; tmp, -tmp]; - endif - else - error ("hadamard: expecting scalar argument"); - endif - -endfunction
--- a/scripts/special-matrix/hankel.m +++ b/scripts/special-matrix/hankel.m @@ -26,7 +26,7 @@ ## 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 +## See also: vander, sylvester_matrix, hilb, invhilb, toeplitz ## Author: jwe
--- a/scripts/special-matrix/hilb.m +++ b/scripts/special-matrix/hilb.m @@ -24,7 +24,7 @@ ## ## H (i, j) = 1 / (i + j - 1); ## -## See also: hankel, vander, hadamard, invhilb, toeplitz +## See also: hankel, vander, sylvester_matrix, invhilb, toeplitz ## Author: jwe
--- a/scripts/special-matrix/invhilb.m +++ b/scripts/special-matrix/invhilb.m @@ -22,7 +22,7 @@ ## Return the inverse of a Hilbert matrix of order n. This is slow but ## exact. Compare with inv (hilb (n)). ## -## See also: hankel, vander, hadamard, hilb, toeplitz +## See also: hankel, vander, sylvester_matrix, hilb, toeplitz ## Author: jwe
new file mode 100644 --- /dev/null +++ b/scripts/special-matrix/sylvester_matrix.m @@ -0,0 +1,45 @@ +## Copyright (C) 1996, 1997 John W. Eaton +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. + +## usage: sylvester_matrix (k) +## +## Return the Sylvester matrix of order n = 2^k. +## +## See also: hankel, vander, hilb, invhilb, toeplitz + +## Author: jwe + +function retval = sylvester_matrix (k) + + if (nargin != 1) + usage ("sylvester_matrix (n)"); + endif + + if (is_scalar (k)) + if (k < 1) + retval = 1; + else + tmp = sylvester_matrix (k-1); + retval = [tmp, tmp; tmp, -tmp]; + endif + else + error ("sylvester_matrix: expecting scalar argument"); + endif + +endfunction
--- a/scripts/special-matrix/toeplitz.m +++ b/scripts/special-matrix/toeplitz.m @@ -26,7 +26,7 @@ ## same as the first column. If the first element of c is not the same ## as the first element of r, the first element of c is used. ## -## See also: hankel, vander, hadamard, hilb, invhib +## See also: hankel, vander, sylvester_matrix, hilb, invhib ## Author: jwe