Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
GiggleLiu committed Oct 7, 2023
1 parent 0b9a7db commit 70e341c
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions lib/YaoSym/src/symengine/blocks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ sangle = SymFunction("angle")
Base.promote_rule(::Type{Bool}, ::Type{Basic}) = Basic
# NOTE: need to annotate the output because otherwise it is type unstable!
Base.abs(x::Basic)::Basic = Basic(abs(SymEngine.BasicType(x)))
#Base.abs(x::BasicComplexNumber)::Basic = sqrt(real(x)^2 + imag(x)^2)
# abs(a) ^ real(b) * exp(-angle(a) * imag(b))
function Base.abs(x::BasicType{Val{:Pow}})
a, b = get_args(x.x)
abs(a)^real(b) * exp(-angle(a) * imag(b))
end

Base.angle(x::Basic)::Basic = Basic(angle(SymEngine.BasicType(x)))
#Base.angle(x::BasicComplexNumber)::Basic = atan(imag(x), real(x))
Base.angle(x::BasicType)::Basic = sangle(x.x)
Base.angle(::BasicType{Val{:Symbol}})::Basic = Basic(0)

Check warning on line 18 in lib/YaoSym/src/symengine/blocks.jl

View check run for this annotation

Codecov / codecov/patch

lib/YaoSym/src/symengine/blocks.jl#L17-L18

Added lines #L17 - L18 were not covered by tests
Base.angle(::BasicType{Val{:Constant}})::Basic = Basic(0)
Expand Down

0 comments on commit 70e341c

Please sign in to comment.