# HG changeset patch # User Jaroslav Hajek # Date 1240220594 -7200 # Node ID eebc7f8e739865ceb9134251b5653c40a2584588 # Parent 537a73861cb7a1927e22222efa3fb511f023f20f extend vander to allow specified number of columns diff -r 537a73861cb7 -r eebc7f8e7398 scripts/ChangeLog --- a/scripts/ChangeLog Sun Apr 19 15:30:12 2009 +0200 +++ b/scripts/ChangeLog Mon Apr 20 11:43:14 2009 +0200 @@ -1,3 +1,7 @@ +2009-04-20 Jaroslav Hajek + + * special-matrix/vander.m: Allow second argument. + 2009-04-17 Rik * plot/__marching_cube__.m: Correct help Texinfo so manual will compile diff -r 537a73861cb7 -r eebc7f8e7398 scripts/special-matrix/vander.m --- a/scripts/special-matrix/vander.m Sun Apr 19 15:30:12 2009 +0200 +++ b/scripts/special-matrix/vander.m Mon Apr 20 11:43:14 2009 +0200 @@ -19,8 +19,10 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {} vander (@var{c}) +## @deftypefn {Function File} {} vander (@var{c}, @var{n}) ## Return the Vandermonde matrix whose next to last column is @var{c}. +## If @var{n} is specified, it determines the number of columns; +## otherwise, @var{n} is taken to be equal to the length of @var{c}. ## ## A Vandermonde matrix has the form: ## @iftex @@ -51,15 +53,16 @@ ## Author: jwe -function retval = vander (c) +function retval = vander (c, n) - if (nargin != 1) + if (nargin == 1) + n = length (c); + elseif (nargin != 2) print_usage (); endif if (isvector (c)) - n = length (c); - retval = zeros (n, n, class (c)); + retval = zeros (length (c), n, class (c)); ## avoiding many ^s appears to be faster for n >= 100. d = 1; c = c(:);