changeset 6014:437f9086b967

[project @ 2006-09-30 15:27:06 by jwe]
author jwe
date Sat, 30 Sep 2006 15:27:06 +0000
parents 13c4326d3501
children a104f362b5d4
files scripts/ChangeLog scripts/polynomial/ppval.m scripts/polynomial/spline.m
diffstat 3 files changed, 20 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,8 @@
+2006-09-30  Benjamin Lindner  <lindnerben@gmx.net>
+
+	* polynomial/ppval.m: Use .' instead of '.
+	* polynomial/spline.m: Likewise.  New tests.
+
 2006-09-26  David Bateman  <dbateman@free.fr>
 
 	* __plt3__.m: Using global variables __plot_data__,
--- a/scripts/polynomial/ppval.m
+++ b/scripts/polynomial/ppval.m
@@ -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.';
--- a/scripts/polynomial/spline.m
+++ b/scripts/polynomial/spline.m
@@ -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) );