Skip to content

Commit 6f6131b

Browse files
elaine-ranmoble
authored andcommitted
removed methods that are already in FastDifferentiation
1 parent ddad64b commit 6f6131b

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

ext/QuaternionicFastDifferentiationExt.jl

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,6 @@ using PrecompileTools
1111
isdefined(Base, :get_extension) ? (using FastDifferentiation) : (using ..FastDifferentiation)
1212

1313

14-
### TYPE PIRACY!!!
15-
# The following Base functions should be added to FastDifferentiation itself; meanwhile
16-
# we'll define them here.
17-
18-
# This is a workaround that should be fixed in FastDifferentiation.jl; Elaine will probably
19-
# make a PR to fix this. The problem is that FD only defines
20-
# `Base.promote_rule(::Type{<:Real}, ::Type{Node})`. But julia/src/bool.jl defines
21-
# `promote_rule(::Type{Bool}, ::Type{T}) where T<:Number` and `Node <: Number`, so there is
22-
# an ambiguity.
23-
Base.promote_rule(::Type{Bool}, ::Type{FastDifferentiation.Node}) = FastDifferentiation.Node
24-
25-
# These are essentially copied from Symbolics.jl:
26-
# https://github.com/JuliaSymbolics/Symbolics.jl/blob/e4c328103ece494eaaab2a265524a64bfbe43dbd/src/num.jl#L31-L34
27-
Base.eps(::Type{FastDifferentiation.Node}) = FastDifferentiation.Node(0)
28-
Base.typemin(::Type{FastDifferentiation.Node}) = FastDifferentiation.Node(-Inf)
29-
Base.typemax(::Type{FastDifferentiation.Node}) = FastDifferentiation.Node(Inf)
30-
Base.float(x::FastDifferentiation.Node) = x
31-
32-
# This one is needed because julia/base/float.jl only defines `isinf` for `Real`, but `Node
33-
# <: Number`. (See https://github.com/brianguenter/FastDifferentiation.jl/issues/73)
34-
Base.isinf(x::FastDifferentiation.Node) = !isnan(x) & !isfinite(x)
35-
36-
3714
normalize(v::AbstractVector{FastDifferentiation.Node}) = v ./ sum(x->x^2, v)
3815
Base.abs(q::AbstractQuaternion{FastDifferentiation.Node}) = sum(x->x^2, components(q))
3916
Base.abs(q::QuatVec{FastDifferentiation.Node}) = sum(x->x^2, vec(q))

0 commit comments

Comments
 (0)