Skip to content

Commit

Permalink
Derivatives POC
Browse files Browse the repository at this point in the history
  • Loading branch information
SouthEndMusic committed Nov 22, 2024
1 parent 16766f6 commit 0c3b360
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/derivatives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@ function _extrapolate_derivative_down(A, t, order)
typed_zero
elseif extrapolation_left == ExtrapolationType.linear
(order == 1) ? derivative(A, first(A.t)) : typed_zero
else
# extrapolation_left == ExtrapolationType.extension
elseif extrapolation_left == ExtrapolationType.extension
iguess = A.iguesser
(order == 1) ? _derivative(A, t, iguess) :
ForwardDiff.derivative(t -> begin
_derivative(A, t, iguess)
end, t)
elseif extrapolation_left == ExtrapolationType.periodic
t_, _ = transformation_periodic(A, t)
derivative(A, t_, order)
else
# extrapolation_left == ExtrapolationType.reflective
t_, _ = transformation_reflective(A, t)
derivative(A, t_, order)
end
end

Expand All @@ -41,13 +47,19 @@ function _extrapolate_derivative_up(A, t, order)
typed_zero
elseif extrapolation_right == ExtrapolationType.linear
(order == 1) ? derivative(A, last(A.t)) : typed_zero
else
# extrapolation_right == ExtrapolationType.extension
elseif extrapolation_right == ExtrapolationType.extension
iguess = A.iguesser
(order == 1) ? _derivative(A, t, iguess) :
ForwardDiff.derivative(t -> begin
_derivative(A, t, iguess)
end, t)
elseif extrapolation_right == ExtrapolationType.periodic
t_, _ = transformation_periodic(A, t)
derivative(A, t_, order)
else
# extrapolation_right == ExtrapolationType.reflective
t_, _ = transformation_reflective(A, t)
derivative(A, t_, order)
end
end

Expand Down

0 comments on commit 0c3b360

Please sign in to comment.