Skip to content

Commit

Permalink
Fixed definitions of left and right complement
Browse files Browse the repository at this point in the history
  • Loading branch information
brainandforce committed Jun 5, 2024
1 parent 13a29ad commit 4079734
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/bitindex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ end
dual(b::BitIndex{Q}) where Q = b * BitIndex{Q}(false, typemax(UInt))
undual(b::BitIndex{Q}) where Q = b * BitIndex{Q}(!iszero(dimension(Q) & 2), typemax(UInt))

# This calculates the "inverse" of i
# TODO: document this fully
_inv(i::T) where T<:BitIndex = T(xor(signbit(i), signbit_of_square(i)), UInt(i))

"""
left_complement(b::BitIndex{Q}) -> BitIndex{Q}
Expand All @@ -314,7 +318,7 @@ signature of `Q`, depending only on the dimension.
Lengyel's convention for the left complement is an underbar.
"""
left_complement(b::BitIndex{Q}) where Q = BitIndex{Q}(false, typemax(UInt)) * b'
left_complement(b::BitIndex{Q}) where Q = BitIndex{Q}(false, typemax(UInt)) * _inv(b)

"""
right_complement(b::BitIndex{Q}) -> BitIndex{Q}
Expand All @@ -330,4 +334,4 @@ of the signature of `Q`, depending only on the dimension.
Lengyel's convention for the right complement is an overbar.
"""
right_complement(b::BitIndex{Q}) where Q = b' * BitIndex{Q}(false, typemax(UInt))
right_complement(b::BitIndex{Q}) where Q = _inv(b) * BitIndex{Q}(false, typemax(UInt))
4 changes: 0 additions & 4 deletions src/multiply.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#---Efficient multiplication kernels---------------------------------------------------------------#

# This calculates the "inverse" of i
# TODO: document this fully
_inv(i::T) where T<:BitIndex = T(xor(signbit(i), signbit_of_square(i)), UInt(i))

"""
CliffordNumbers.bitindex_shuffle(a::BitIndex{Q}, B::NTuple{L,BitIndex{Q}})
CliffordNumbers.bitindex_shuffle(a::BitIndex{Q}, B::BitIndices{Q})
Expand Down

0 comments on commit 4079734

Please sign in to comment.