From 217cf16f138965047e1440874dcdf9f62cdeee2c Mon Sep 17 00:00:00 2001 From: Brandon Flores Date: Mon, 19 Feb 2024 03:03:02 -0600 Subject: [PATCH] Added promotion rules for `KVector` --- src/promote.jl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/promote.jl b/src/promote.jl index 4fc42f3..6af4e61 100644 --- a/src/promote.jl +++ b/src/promote.jl @@ -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