octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Matlab compatiable spline/csape


From: David Bateman
Subject: Matlab compatiable spline/csape
Date: Wed, 17 May 2006 10:51:19 +0200
User-agent: Thunderbird 1.5 (Windows/20051201)

Trying to port some of the matlab core functions to octave core, I was looking at the spline, mkpp and ppval functions last night. Firstly, as csape is not a matlab core function, it should be ported to octave core, and so some portion of csape need to be cut and paste into spline.m. Also when y is two elements longer than x, a complete spline should be used, and I made this change. I also replaced things like

     c(2:n - 1,:) = trisolve(ldg,dg,udg,g);

with

c(2:n - 1,:) = spdiags([[ldg(:);0],dg,[0;udg(:)]],[-1,0,1],n-2,n-2) \ g;

as the octave core sparse solver uses the lapack tridiagonal solvers if it can. However, I have one compatibility issue in the case where y is a matrix or an NDArray. Currently the octave-forge spline function allows an n-by-d matrix to be passed for y where n is the length of x, and the matrix y is treated column by column, whereas the matlab function allows an NDArray of the form d1-by-d2-by- ... -dk-by-n which is exactly the reverse. I can probably support both in the majority of cases, however ppval and mkpp would need to be modified to store and/or determine which is used. Alternatively, just using the matlab syntax would keep mkpp and ppval pretty much identical to what they currently are (with minor mods for NDArrays). Should I attempt to support both formats for NDArrays, or should I just drop the current octave-forge way of treating Matrixs y?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]