-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Currently, when attempting to use unitful numbers from Unitful.jl with the functions in this library, one gets MethodErrors
related to the fact that Unitful.Quantity{...} <: Number
instead of Unitful.Quantity{...} <: Real
:
ERROR: MethodError: no method matching (::FiniteDifferences.AdaptedFiniteDifferenceMethod{…})(::var"#35#36", ::Quantity{…})
The object of type `FiniteDifferences.AdaptedFiniteDifferenceMethod{3, 1, FiniteDifferences.UnadaptedFiniteDifferenceMethod{5, 3}}` exists, but no method is defined for this combination of argument types when trying to treat it as a callable object.
Closest candidates are:
(::FiniteDifferences.AdaptedFiniteDifferenceMethod)(::TF, ::Real) where TF
@ FiniteDifferences ~/.julia/packages/FiniteDifferences/IPGFN/src/methods.jl:191
(::FiniteDifferences.AdaptedFiniteDifferenceMethod{P, Q})(::TF, ::Real, ::Real) where {P, Q, TF}
@ FiniteDifferences ~/.julia/packages/FiniteDifferences/IPGFN/src/methods.jl:238
At this point I am not sure whether simply relaxing the argument type restriction of functions like FiniteDifferences.central_fdm
from Real
to Number
would suffice (with the possible risk of introducing silent semantic errors), or whether separate methods, that explicitly handle the units in some way (e.g. first stripping them and then reattaching the proper ones to the results) should be defined for Unitful numbers.
Regardless, it would be very nice if this library supported unitful numbers out of the box.
Metadata
Metadata
Assignees
Labels
No labels