BasisMatrices.jl
BasisMatrices.jl copied to clipboard
Spline derivatives issue
using BasisMatrices
x = linspace(0.0, 5.0, 25)
p = SplineParams(x, 0, 3)
itp = BasisMatrices.Interpoland(Basis(p), [nodes(p).^2 nodes(p).^3])
pts = [1.0, 2.0, 3.0]
println(itp(1.0, reshape([0, 1], (2, 1))))
println(itp(1.0, reshape([0, 1], (1, 2))))
println(itp(1.0, reshape([1], (1, 1))))
The first print command should give the level and first derivative of the two functions
The second print command should compute df(x)/dy and should fail because there isn't a second dimension to take a derivative with respect to.
The third print command reacts as expected.
ouch... you seem to have hit three errors here.
-
This method should only be calling
vec
whenorder::Int
. Whenorder::AbstractMatrix
then we should be squeezing the first dimension instead of all dimensions. splitting that method in two should make the fix easy. - We shouldn't accept things like
itp(1.0, [0 1])
. The specification for theorder
argument should be either an integer for evaluating all dimensions at the same order of derivative or a matrix that hasN
columns -- whereN
is the dimensionality of the basis. Having a 1d basis and passing a 2 column order should be an error - Spline derivatives look accurate when we only ask for the derivative. There is something funky going on when we ask for more than one thing at a time. We need to debug this... I'd start by making sure the two basis matrices