Skip to content

Commit

Permalink
Remove obsolete utils and update default diff_method
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeingold committed Dec 2, 2024
1 parent bc4e591 commit 3178e8f
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,11 @@ _ones(N::Int) = _ones(Float64, N)
# DifferentiationMethod
################################################################################

# Throw an ArgumentError if Analytical() jacobian not defined for this type
function _guarantee_analytical(
::Type{G},
::DifferentiationMethod
) where {G <: Geometry}
throw(ArgumentError("$G geometries require kwarg diff_method = Analytical()"))
end

_guarantee_analytical(::Type{G}, ::Analytical) where {G <: Geometry} = nothing

# Return whether a geometry type has jacobian methods defined
_has_analytical(::Type{G}) where {G <: Geometry} = false
_has_analytical(g::G) where {G <: Geometry} = _has_analytical(G)

# Return the default DifferentiationMethod instance for a particular geometry type
function _default_method(
g::Type{G}
) where {G <: Geometry}
return _has_analytical(G) ? Analytical() : FiniteDifference()
return FiniteDifference()
end

# Return the default DifferentiationMethod instance for a particular geometry instance
Expand Down

0 comments on commit 3178e8f

Please sign in to comment.