Grid.jl icon indicating copy to clipboard operation
Grid.jl copied to clipboard

valgradhess does not work with CoordInterpGrid

Open simonp0420 opened this issue 11 years ago • 4 comments

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

simonp0420 avatar Jul 15 '14 02:07 simonp0420

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.

tomasaschan avatar Jul 15 '14 11:07 tomasaschan

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.

simonp0420 avatar Jul 15 '14 14:07 simonp0420

You're right - this is partly a documentation issue as well. I'll see if I can fix at least the docs promptly.

tomasaschan avatar Jul 15 '14 14:07 tomasaschan

Thanks. BTW, this is a great, useful package. Thanks for all the work from you and Tim on this.

simonp0420 avatar Jul 15 '14 14:07 simonp0420