Mercurial > forge
comparison FIXES/vander.m @ 0:6b33357c7561 octave-forge
Initial revision
author | pkienzle |
---|---|
date | Wed, 10 Oct 2001 19:54:49 +0000 |
parents | |
children | 2ac2777b30bc |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:6b33357c7561 |
---|---|
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 | |
20 ## -*- texinfo -*- | |
21 ## @deftypefn {Function File} {} vander (@var{c}) | |
22 ## Return the Vandermonde matrix whose next to last column is @var{c}. | |
23 ## | |
24 ## A Vandermonde matrix has the form | |
25 ## @iftex | |
26 ## @tex | |
27 ## $$ | |
28 ## \left[\matrix{c_0^n & \ldots & c_0^2 & c_0 & 1\cr | |
29 ## c_1^n & \ldots & c_1^2 & c_1 & 1\cr | |
30 ## \vdots & & \vdots & \vdots & \vdots\cr | |
31 ## c_n^n & \ldots & c_n^2 & c_n & 1}\right]. | |
32 ## $$ | |
33 ## @end tex | |
34 ## @end iftex | |
35 ## @ifinfo | |
36 ## | |
37 ## @example | |
38 ## @group | |
39 ## c(0)^n ... c(0)^2 c(0) 1 | |
40 ## c(1)^n ... c(1)^2 c(1) 1 | |
41 ## . . . . | |
42 ## . . . . | |
43 ## . . . . | |
44 ## | |
45 ## c(n)^n ... c(n)^2 c(n) 1 | |
46 ## @end group | |
47 ## @end example | |
48 ## @end ifinfo | |
49 ## @end deftypefn | |
50 ## @seealso{hankel, sylvester_matrix, hilb, invhilb, and toeplitz} | |
51 | |
52 ## Author: jwe | |
53 ## Paul Kienzle <pkienzle@kienzle.powernet.co.uk> | |
54 ## vectorized for speed | |
55 | |
56 function retval = vander (c) | |
57 | |
58 if (nargin != 1) | |
59 usage ("vander (c)"); | |
60 endif | |
61 | |
62 if (!is_vector (c)) | |
63 error ("vander: argument must be a vector"); | |
64 endif | |
65 | |
66 n = length (c); | |
67 retval = c ([1:n]' * ones (1, n)); | |
68 retval = reshape (retval, n, n); | |
69 retval = retval .^ (ones (n, 1) * [n-1:-1:0]); | |
70 | |
71 endfunction |