# HG changeset patch # User jwe # Date 1159630026 0 # Node ID 437f9086b967b4a1144e76b94d0397b8f86bb540 # Parent 13c4326d3501bf4a36c916d57f75a5857d910390 [project @ 2006-09-30 15:27:06 by jwe] diff -r 13c4326d3501 -r 437f9086b967 scripts/ChangeLog --- a/scripts/ChangeLog Fri Sep 29 20:50:35 2006 +0000 +++ b/scripts/ChangeLog Sat Sep 30 15:27:06 2006 +0000 @@ -1,3 +1,8 @@ +2006-09-30 Benjamin Lindner + + * polynomial/ppval.m: Use .' instead of '. + * polynomial/spline.m: Likewise. New tests. + 2006-09-26 David Bateman * __plt3__.m: Using global variables __plot_data__, diff -r 13c4326d3501 -r 437f9086b967 scripts/polynomial/ppval.m --- a/scripts/polynomial/ppval.m Fri Sep 29 20:50:35 2006 +0000 +++ b/scripts/polynomial/ppval.m Sat Sep 30 15:27:06 2006 +0000 @@ -41,13 +41,13 @@ xi = xi(:); xn = length (xi); idx = lookup (pp.x(2:pp.n), xi) + 1; - dx = (xi - pp.x(idx))'; + dx = (xi - pp.x(idx)).'; dx = reshape (dx(ones(1,prod(pp.d)),:),[pp.d,xn]); c = reshape (pp.P(:,1), pp.n, prod (pp.d)); - yi = reshape (c(idx,:)', [pp.d, xn]); + yi = reshape (c(idx,:).', [pp.d, xn]); for i = 2 : pp.k; c = reshape (pp.P(:,i), pp.n, prod (pp.d)); - yi = yi .* dx + reshape (c(idx,:)', [pp.d, xn]); + yi = yi .* dx + reshape (c(idx,:).', [pp.d, xn]); endfor if (transposed && isscalar (pp.d) && pp.d == 1) yi = yi.'; diff -r 13c4326d3501 -r 437f9086b967 scripts/polynomial/spline.m --- a/scripts/polynomial/spline.m Fri Sep 29 20:50:35 2006 +0000 +++ b/scripts/polynomial/spline.m Sat Sep 30 15:27:06 2006 +0000 @@ -94,13 +94,13 @@ szy = size (y); if (ndy == 2 && (szy(1) == 1 || szy(2) == 1)) if (szy(1) == 1) - a = y'; + a = y.'; else a = y; szy = fliplr (szy); endif else - a = reshape (y, [prod(szy(1:end-1)), szy(end)])'; + a = reshape (y, [prod(szy(1:end-1)), szy(end)]).'; endif complete = false; if (size (a, 1) == n + 2) @@ -227,3 +227,13 @@ %!assert (isempty(spline(x',y',[]))); %!assert (isempty(spline(x,y,[]))); %!assert (spline(x,[y;y],x), [spline(x,y,x);spline(x,y,x)]) +%! y = cos(x) + i*sin(x); +%!assert ( spline(x,y,x), y ) +%!assert ( real(spline(x,y,x)), real(y) ); +%!assert ( real(spline(x,y,x.')), real(y).' ); +%!assert ( real(spline(x.',y.',x.')), real(y).' ); +%!assert ( real(spline(x.',y,x)), real(y) ); +%!assert ( imag(spline(x,y,x)), imag(y) ); +%!assert ( imag(spline(x,y,x.')), imag(y).' ); +%!assert ( imag(spline(x.',y.',x.')), imag(y).' ); +%!assert ( imag(spline(x.',y,x)), imag(y) );