Skip to content

Commit

Permalink
refactor: add integrals for BSpline methods to error out
Browse files Browse the repository at this point in the history
  • Loading branch information
sathvikbhagavan committed Nov 24, 2023
1 parent 0ced7ac commit cf76d19
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/integrals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,29 @@ function _integral(A::CubicSpline{<:AbstractVector{<:Number}}, idx::Number, t::N
end

samples(A::AkimaInterpolation{<:AbstractVector{<:Number}}) = (0, 1)
function _integral(A::AkimaInterpolation{<:AbstractVector{<:Number}}, idx::Number, t::Number)
function _integral(A::AkimaInterpolation{<:AbstractVector{<:Number}},
idx::Number,
t::Number)
t1 = A.t[idx]
A.u[idx]*(t - t1) + A.b[idx]*((t - t1)^2/2) + A.c[idx]*((t - t1)^3/3) + A.d[idx]*((t - t1)^4/4)
A.u[idx] * (t - t1) + A.b[idx] * ((t - t1)^2 / 2) + A.c[idx] * ((t - t1)^3 / 3) +
A.d[idx] * ((t - t1)^4 / 4)
end

integral(A::LagrangeInterpolation, t1::Number, t2::Number) = throw(IntegralNotFoundError())
integral(A::LagrangeInterpolation, t::Number) = throw(IntegralNotFoundError())

function integral(A::BSplineInterpolation{<:AbstractVector{<:Number}},
t1::Number,
t2::Number)
throw(IntegralNotFoundError())
end
function integral(A::BSplineInterpolation{<:AbstractVector{<:Number}}, t::Number)
throw(IntegralNotFoundError())
end

function integral(A::BSplineApprox{<:AbstractVector{<:Number}}, t1::Number, t2::Number)
throw(IntegralNotFoundError())
end
function integral(A::BSplineApprox{<:AbstractVector{<:Number}}, t::Number)
throw(IntegralNotFoundError())
end

0 comments on commit cf76d19

Please sign in to comment.