timholy / Grid.jl

Interpolation and related operations on grids
MIT License
47 stars 26 forks source link

valgradhess does not work with CoordInterpGrid #33

Open simonp0420 opened 10 years ago

simonp0420 commented 10 years ago

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

tomasaschan commented 10 years ago

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.

simonp0420 commented 10 years ago

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.

tomasaschan commented 10 years ago

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

simonp0420 commented 10 years ago

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