Change to vander.m

Thomas Weber thomas.weber.mail at gmail.com
Wed Jan 16 15:00:40 CST 2008


Am Dienstag, den 15.01.2008, 16:43 -0500 schrieb John W. Eaton:
> On 15-Jan-2008, Thomas Weber wrote:
> | ? plot/.hg
> | Index: special-matrix/vander.m
> | ===================================================================
> | RCS file: /cvs/octave/scripts/special-matrix/vander.m,v
> | retrieving revision 1.25
> | diff -u -r1.25 vander.m
> | --- special-matrix/vander.m	12 Oct 2007 21:27:26 -0000	1.25
> | +++ special-matrix/vander.m	15 Jan 2008 20:23:18 -0000
> | @@ -58,13 +58,17 @@
> |  
> |    if (isvector (c))
> |      n = length (c);
> | -    retval = zeros (n, n);
> | -    j = 1:n;
> | -    for i = 1:n
> | -      retval(i,:) = c(i) .^ (n - j);
> | -    endfor
> | +    N = ones(n,1) * [n-1:-1:0];
> | +    C = c(:) * ones(1,n);
> | +    retval = C .^ N;
> 
> Is there any need for the variables N and C?  why not just write
> 
>   retval = (c(:) * ones (1, n)) .^ (ones (n, 1) * (n-1:-1:0));

I used them to check what I'm doing. 

	Thomas



More information about the Octave-maintainers mailing list