Grid.jl
Grid.jl copied to clipboard
valgradhess does not work with CoordInterpGrid
The following code:
using Grid
x = 0:0.1:6
y = 10:0.1:15
z = sin(x * y')
zi = CoordInterpGrid((x,y),z, BCnil,InterpQuadratic)
v,g,h = valgradhess(zi, x[2], y[2])
generates the error:
no method valgradhess(Array{Float64,1}, Array{Float64,2}, CoordInterpGrid{Float64,2,BCnil,InterpQuadratic,(FloatRange{Float64},FloatRange{Float64})}, Float64, Float64) while loading In[8], in expression starting on line 1 in valgradhess at c:\home\simonp.julia\v0.3\Grid\src\interp.jl:242
valgradhess isn't supposed to work for InterpQuadratic anyway, since quadratic splines don't have continuous second order derivatives. However, it should work for cubic splines, but since cubic splines and CoordInterpGrid are slightly broken anyway, I can't get them to work at all now.
As you say, it makes sense that valgradhess shouldn’t work for quadratic splines, except that the example presented in the README.md documentation uses a 1-dimensional quadratic spline and successfully calls valgradhess. I assumed that this would extend to any number of dimensions.
You're right - this is partly a documentation issue as well. I'll see if I can fix at least the docs promptly.
Thanks. BTW, this is a great, useful package. Thanks for all the work from you and Tim on this.