changeset 9880:2da3952924f6 octave-forge

Fixed, by analogy with spline.m, bug in call to mkpp that was causing tests to fail with matrix input y; all tests passed now
author nir-krakauer
date Mon, 26 Mar 2012 17:44:22 +0000
parents c81e7476fda3
children 9ea261201db5
files main/splines/inst/csape.m
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/main/splines/inst/csape.m	Mon Mar 26 10:32:49 2012 +0000
+++ b/main/splines/inst/csape.m	Mon Mar 26 17:44:22 2012 +0000
@@ -53,17 +53,18 @@
   ## Check the size and shape of y
   ndy = ndims (y);
   szy = size (y);
-  if (ndy == 2 && (szy(1) == 1 || szy(2) == 1))
-    if (szy(1) == 1)
+  if (ndy == 2 && (szy(1) == n || szy(2) == n))
+    if (szy(2) == n)
       a = y.';
     else
       a = y;
       szy = fliplr (szy);
     endif
   else
-    a = reshape (y, [prod(szy(1:end-1)), szy(end)]).';
+    a = shiftdim (reshape (y, [prod(szy(1:end-1)), szy(end)]), 1);
   endif
 
+
   b = c = zeros (size (a));
   h = diff (x);
   idx = ones (columns(a),1);
@@ -218,8 +219,7 @@
   endif
 
   d = d(1:n-1,:); c=c(1:n-1,:); b=b(1:n-1,:); a=a(1:n-1,:);
-  coeffs = [d(:), c(:), b(:), a(:)];
-  pp = mkpp (x, coeffs, szy(1:end-1));
+  pp = mkpp (x, cat (2, d'(:), c'(:), b'(:), a'(:)), szy(1:end-1));
 
 endfunction