diff scripts/polynomial/unmkpp.m @ 9768:31900e17b5f5

improve Matlab compatibility & performance of ppval/mkpp and some associated funcs
author Jaroslav Hajek <highegg@gmail.com>
date Mon, 02 Nov 2009 14:04:06 +0100
parents 16f53d29049f
children 693e22af08ae
line wrap: on
line diff
--- a/scripts/polynomial/unmkpp.m
+++ b/scripts/polynomial/unmkpp.m
@@ -30,10 +30,7 @@
 ## (@var{i}, :)} contains the coefficients for the polynomial over
 ## interval @var{i} ordered from highest to lowest.  If @code{@var{d} >
 ## 1}, @code{@var{p} (@var{r}, @var{i}, :)} contains the coefficients for 
-## the r-th polynomial defined on interval @var{i}.  However, this is 
-## stored as a 2-D array such that @code{@var{c} = reshape (@var{p} (:,
-## @var{j}), @var{n}, @var{d})} gives @code{@var{c} (@var{i},  @var{r})}
-## is the j-th coefficient of the r-th polynomial over the i-th interval.
+## the r-th polynomial defined on interval @var{i}.
 ## @item @var{n}
 ## Number of polynomial pieces.
 ## @item @var{k}
@@ -54,7 +51,10 @@
   endif
   x = pp.x;
   P = pp.P;
-  n = pp.n;
-  k = pp.k;
+  n = size (P, 2);
+  k = size (P, 3);
   d = pp.d;
+  if (d == 1)
+    P = reshape (P, n, k);
+  endif
 endfunction