Skip to content

Commit

Permalink
Made implementations of reverse, grade involution, and Clifford conju…
Browse files Browse the repository at this point in the history
…gate for `KVector` simpler
brainandforce committed Nov 5, 2024
1 parent 12f988e commit f1f49a4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/math/duals.jl
Original file line number Diff line number Diff line change
@@ -7,9 +7,9 @@ end
reverse(x::AbstractCliffordNumber) = adjoint(x)

# Faster implementations for KVector that don't require indexing
adjoint(x::T) where T<:KVector = T(x.data .* Int8(-1)^!iszero(grade(x) & 2))
grade_involution(x::T) where T<:KVector = T(x.data .* Int8(-1)^isodd(grade(x)))
conj(x::T) where T<:KVector = T(x.data .* Int8(-1)^!iszero((grade(x) + 1) & 2))
adjoint(x::KVector{K}) where K = ifelse(iszero(K & 2), x, -x)
grade_involution(x::KVector{K}) where K = ifelse(iseven(K), x, -x)
conj(x::KVector{K}) where K = ifelse(iszero((K + 1) & 2), x, -x)

left_complement(x::AbstractCliffordNumber) = x[right_complement.(BitIndices(complement_type(x)))]
right_complement(x::AbstractCliffordNumber) = x[left_complement.(BitIndices(complement_type(x)))]

0 comments on commit f1f49a4

Please sign in to comment.