Skip to content

Commit

Permalink
Added promotion rules for KVector
Browse files Browse the repository at this point in the history
  • Loading branch information
brainandforce committed Feb 19, 2024
1 parent 528a09c commit 217cf16
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/promote.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,14 @@ end
# Note that complex numbers aren't automatically treated as pseudoscalars
# (this only works in some dimensions...)
promote_rule(C::Type{<:AbstractCliffordNumber}, N::Type{<:BaseNumber}) = similar_type(C, N)

#---Promotion rules for various representations----------------------------------------------------#

function promote_rule(S::Type{<:KVector{K,Q}}, T::Type{<:KVector{K,Q}}) where {K,Q}
return KVector{K,Q,promote_numeric_type(S,T),binomial(dimension(Q),K)}
end

function promote_rule(S::Type{<:KVector{K1,Q}}, T::Type{<:KVector{K2,Q}}) where {K1,K2,Q}
# TODO: logic for even/odd multivector types
return CliffordNumber{Q,promote_numeric_type(S,T),elements(Q)}
end

0 comments on commit 217cf16

Please sign in to comment.