3140
|
1 ## Copyright (C) 1996, 1997 John W. Eaton |
|
2 ## |
|
3 ## This file is part of Octave. |
|
4 ## |
|
5 ## Octave is free software; you can redistribute it and/or modify it |
|
6 ## under the terms of the GNU General Public License as published by |
|
7 ## the Free Software Foundation; either version 2, or (at your option) |
|
8 ## any later version. |
|
9 ## |
|
10 ## Octave is distributed in the hope that it will be useful, but |
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 ## General Public License for more details. |
|
14 ## |
|
15 ## You should have received a copy of the GNU General Public License |
|
16 ## along with Octave; see the file COPYING. If not, write to the Free |
|
17 ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA |
|
18 ## 02111-1307, USA. |
|
19 |
3369
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {} sylvester_matrix (@var{k}) |
|
22 ## Return the Sylvester matrix of order |
|
23 ## @iftex |
|
24 ## @tex |
|
25 ## $n = 2^k$. |
|
26 ## @end tex |
|
27 ## @end iftex |
|
28 ## @ifinfo |
|
29 ## n = 2^k. |
|
30 ## @end ifinfo |
|
31 ## @end deftypefn |
3408
|
32 ## @seealso{hankel, vander, hilb, invhilb, and toeplitz} |
3140
|
33 |
|
34 ## Author: jwe |
|
35 |
|
36 function retval = sylvester_matrix (k) |
|
37 |
|
38 if (nargin != 1) |
|
39 usage ("sylvester_matrix (n)"); |
|
40 endif |
|
41 |
|
42 if (is_scalar (k)) |
|
43 if (k < 1) |
|
44 retval = 1; |
|
45 else |
|
46 tmp = sylvester_matrix (k-1); |
|
47 retval = [tmp, tmp; tmp, -tmp]; |
|
48 endif |
|
49 else |
|
50 error ("sylvester_matrix: expecting scalar argument"); |
|
51 endif |
|
52 |
|
53 endfunction |