Skip to content

Commit

Permalink
Added AbstractCliffordNumber{Q,T}(::AbstractCliffordNumber{Q}) cons…
Browse files Browse the repository at this point in the history
…tructor that converts scalar type
  • Loading branch information
brainandforce committed Nov 11, 2024
1 parent ef6c3fe commit 6047b4a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/abstract.jl
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ similar_type(x, Q::Val) = similar_type(x, scalar_type(x), Q)
similar(C::Type{<:AbstractCliffordNumber}, args...) = zero(similar_type(C, args...))
similar(x::AbstractCliffordNumber, args...) = zero(similar_type(x, args...))

# Perform conversion of the scalar type
# UNDERSTAND: The type constraint on T is required. Why?
function AbstractCliffordNumber{Q,T}(x::AbstractCliffordNumber{Q}) where {Q,T<:BaseNumber}
return similar_type(x, T)(x)
end

"""
CliffordNumbers.complement_type(C::Type{<:AbstractCliffordNumber})
CliffordNumbers.complement_type(x::AbstractCliffordNumber)
Expand Down

0 comments on commit 6047b4a

Please sign in to comment.