Skip to content

StackOverflowError in gradient computation #458

@gianmariomanca

Description

@gianmariomanca
using Interpolations
xs = 0.5:0.1:5
A = [log(x) for x in xs]
interp_cubic = CubicSplineInterpolation(xs, A)
g = zeros(1)
Interpolations.gradient!(g,interp_cubic,1.0)

you get


julia> Interpolations.gradient!(g,interp_cubic,1.0)
1-element Vector{Float64}:
 1.0001435205929399

julia> g
1-element Vector{Float64}:
 1.0001435205929399

so far so good.

Then I tried

g = zeros(2)
Interpolations.gradient!(g,interp_cubic,[1.0,1.05])

and I get

julia> Interpolations.gradient!(g,interp_cubic,[1.0,1.05])
ERROR: StackOverflowError:
Stacktrace:
 [1] gradient!(dest::Vector{Float64}, itp::Interpolations.Extrapolation{Float64, 1, ScaledInterpolation{Float64, 1, Interpolations.BSplineInterpolation{Float64, 1, OffsetArrays.OffsetVector{Float64, Vector{Float64}}, BSpline{Cubic{Line{OnGrid}}}, Tuple{Base.OneTo{Int64}}}, BSpline{Cubic{Line{OnGrid}}}, Tuple{StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}}}, BSpline{Cubic{Line{OnGrid}}}, Throw{Nothing}}, x::Vector{Float64}) (repeats 79984 times)
   @ Interpolations ~/.julia/packages/Interpolations/QLbbu/src/Interpolations.jl:423

any chance this is a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions