Re: [Pkg-octave-devel] Broken packages? (splines)
* Jordi Gutiérrez Hermoso <jordigh@octave.org> [2012-03-12 18:23]:
> What's broken about the splines package? It seems to be in high demand.
The test below fails miserably:
x = linspace(0,2*pi,15); y = sin(x);
assert (ppval(csape(x,[y;y]),x), [ppval(csape(x,y),x);ppval(csape(x,y),x)], 10*eps)
with the following error message:
!!!!! test failed
assert (ppval (csape (x, [y; y]), x),[ppval(csape (x, y), x); ppval(csape (x, y), x)],10 * eps) expected
0.00000 0.43388 0.78183 0.97493 0.97493 0.78183 0.43388 0.00000 -0.43388 -0.78183 -0.97493 -0.97493 -0.78183 -0.43388 -0.00000
0.00000 0.43388 0.78183 0.97493 0.97493 0.78183 0.43388 0.00000 -0.43388 -0.78183 -0.97493 -0.97493 -0.78183 -0.43388 -0.00000
but got
0.00000 0.78183 0.97493 0.43388 -0.43388 -0.97493 -0.78183 0.00000 0.78183 0.97493 0.43388 -0.43388 -0.97493 -0.78183 -0.43388
0.43388 0.97493 0.78183 0.00000 -0.78183 -0.97493 -0.43388 0.43388 0.97493 0.78183 0.00000 -0.78183 -0.97493 -0.43388 -0.00000
Besides that, function fnder is also buggy, because it relies on the old
struct names returned by mkpp. I fixed that (I think) with the patch
attached below, but I have no clue on how to fix csape.
Rafael
--- octave-splines-1.0.7.orig/inst/fnder.m
+++ octave-splines-1.0.7/inst/fnder.m
@@ -31,19 +31,16 @@ function dpp = fnder (pp, o)
if (nargin < 2)
o = 1;
endif
-
- P = pp.P;
+
+ [X, P, N, K, D] = unmkpp (pp);
c = columns (P);
r = rows (P);
for i = 1:o
#pp.P = polyder (pp.P); matrix capable polyder is needed.
P = P(:, 1:c - 1) .* kron ((c - 1):- 1:1, ones (r,1));
- c = columns (P);
endfor
- dpp = pp;
- dpp.P = P;
- dpp.k = c;
+ dpp = mkpp (X, P);
endfunction
Reply to: