Skip to content

Commit 1aa8317

Browse files
committed
leverage symengine_classes approach
1 parent 5370e25 commit 1aa8317

File tree

3 files changed

+37
-10
lines changed

3 files changed

+37
-10
lines changed

ext/SymEngineTermInterfaceExt.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,17 @@ import TermInterface
2121
λ(::Val{:Csch}) = csch; λ(::Val{:Sech}) = sech; λ(::Val{:Coth}) = coth
2222
λ(::Val{:Asinh}) = asinh; λ(::Val{:Acosh}) = acosh; λ(::Val{:Atanh}) = atanh
2323
λ(::Val{:Acsch}) = acsch; λ(::Val{:Asech}) = asech; λ(::Val{:Acoth}) = acoth
24-
λ(::Val{:Gamma}) = gamma; λ(::Val{:Zeta}) = zeta; λ(::Val{:LambertW}) = lambertw
24+
λ(::Val{:ATan2}) = atan;
25+
λ(::Val{:Beta}) = SymEngine.SpecialFunctions.beta;
26+
λ(::Val{:Gamma}) = SymEngine.SpecialFunctions.gamma;
27+
λ(::Val{:PolyGamma}) = SymEngine.SpecialFunctions.polygamma;
28+
λ(::Val{:LogGamma}) = SymEngine.SpecialFunctions.loggamma;
29+
λ(::Val{:Erf}) = SymEngine.SpecialFunctions.erf;
30+
λ(::Val{:Erfc}) = SymEngine.SpecialFunctions.erfc;
31+
λ(::Val{:Zeta}) = SymEngine.SpecialFunctions.zeta;
32+
λ(::Val{:LambertW}) = SymEngine.SpecialFunctions.lambertw
33+
34+
2535

2636
const julia_operations = Vector{Any}(missing, length(SymEngine.symengine_classes))
2737
for (i,s) enumerate(SymEngine.symengine_classes)

src/mathfuns.jl

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,42 @@ for (meth, libnm, modu) in [
5151
(:acsch,:acsch,:Base),
5252
(:atanh,:atanh,:Base),
5353
(:acoth,:acoth,:Base),
54-
(:gamma,:gamma,:SpecialFunctions),
5554
(:log,:log,:Base),
5655
(:sqrt,:sqrt,:Base),
5756
(:exp,:exp,:Base),
5857
(:sign, :sign, :Base),
59-
(:eta,:dirichlet_eta,:SpecialFunctions),
60-
(:zeta,:zeta,:SpecialFunctions),
58+
(:ceil, :ceiling, :Base),
59+
(:floor, :floor, :Base)
6160
]
6261
eval(:(import $modu.$meth))
6362
IMPLEMENT_ONE_ARG_FUNC(:($modu.$meth), libnm)
6463
end
64+
65+
for (meth, libnm, modu) in [
66+
(:gamma,:gamma,:SpecialFunctions),
67+
(:loggamma,:loggamma,:SpecialFunctions),
68+
(:eta,:dirichlet_eta,:SpecialFunctions),
69+
(:zeta,:zeta,:SpecialFunctions),
70+
(:erf, :erf, :SpecialFunctions),
71+
(:erfc, :erfc, :SpecialFunctions)
72+
]
73+
eval(:(import $modu.$meth))
74+
IMPLEMENT_ONE_ARG_FUNC(:($modu.$meth), libnm)
75+
end
76+
77+
for (meth, libnm, modu) in [
78+
(:beta, :beta, :SpecialFunctions),
79+
(:polygamma, :polygamma, :SpecialFunctions),
80+
(:loggamma,:loggamma,:SpecialFunctions),
81+
]
82+
eval(:(import $modu.$meth))
83+
IMPLEMENT_TWO_ARG_FUNC(:($modu.$meth), libnm)
84+
end
85+
6586
Base.abs2(x::SymEngine.Basic) = abs(x)^2
6687

88+
89+
6790
if get_symbol(:basic_atan2) != C_NULL
6891
import Base.atan
6992
IMPLEMENT_TWO_ARG_FUNC(:(Base.atan), :atan2)

src/numerics.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,6 @@ end
262262
trunc(x::Basic, args...) = Basic(trunc(N(x), args...))
263263
trunc(::Type{T},x::Basic, args...) where {T <: Integer} = convert(T, trunc(x,args...))
264264

265-
ceil(x::Basic) = Basic(ceil(N(x)))
266-
ceil(::Type{T},x::Basic) where {T <: Integer} = convert(T, ceil(x))
267-
268-
floor(x::Basic) = Basic(floor(N(x)))
269-
floor(::Type{T},x::Basic) where {T <: Integer} = convert(T, floor(x))
270-
271265
round(x::Basic; kwargs...) = Basic(round(N(x); kwargs...))
272266
round(::Type{T},x::Basic; kwargs...) where {T <: Integer} = convert(T, round(x; kwargs...))
273267

0 commit comments

Comments
 (0)