Grades and indices

Grades

CliffordNumbers.nonzero_gradesFunction
nonzero_grades(::Type{<:AbstractCliffordNumber{Q}}) -> AbstractVector{Int}
nonzero_grades(::Number)

Returns an AbstractVector{Int} whose elements are all nonzero grades of a Clifford number or type. Any subtype T of AbstractCliffordNumber should define this method for Type{T}; it is automatically implemented for instance arguments.

For arguments that are Real or Complex, this function returns 0:0.

Examples

julia> CliffordNumbers.nonzero_grades(CliffordNumber{VGA(3)})
0:3

julia> CliffordNumbers.nonzero_grades(EvenCliffordNumber{VGA(3)})
0:2:2

julia> CliffordNumbers.nonzero_grades(KVector{2,VGA(3)})
2:2

julia> nonzero_grades(Float64)
0:0
source
CliffordNumbers.has_grades_ofFunction
has_grades_of(S::Type{<:AbstractCliffordNumber}, T::Type{<:AbstractCliffordNumber}) -> Bool
has_grades_of(x::AbstractCliffordNumber, y::AbstractCliffordNumber) -> Bool

Returns true if the grades represented in S are also represented in T; false otherwise.

source

BladeIndex and BladeIndices

CliffordNumbers.BladeIndexType
BladeIndex{Q}

A representation of an index corresponding to a basis blade of the geometric algebra with quadratic form Q.

source
CliffordNumbers.BladeIndicesType
BladeIndices{Q,C<:AbstractCliffordNumber{Q}} <: AbstractVector{BladeIndex{Q}}

Represents all valid nonzero indices of an AbstractCliffordNumber in a lazily generated array of static size.

New subtypes of AbstractCliffordNumber{Q} should define Base.getindex(::BladeIndex{Q,C}, ::Int). For performance, this definition should be annotated with the macros @inline and Base.@propagate_inbounds (to preserve the @inbounds context).

Construction

BladeIndices can be constructed by calling the type constructor with the Clifford number or its type. This will automatically strip some type parameters so that identical BladeIndices objects are constructed regardless of the scalar type.

For this reason, you should not use BladeIndices{Q,C}(); instead use BladeIndices(C).

Implementation

This type is implemented as an alias of CliffordNumbers.CGNBladeIndices{Q,C<:AbstractCliffordNumber{Q},false,false,false}. More information is available at the docstring for CliffordNumbers.CGNBladeIndices.

source

Special indices

CliffordNumbers.scalar_indexFunction
scalar_index(x::AbstractCliffordNumber{Q}) -> BladeIndex{Q}

Constructs the BladeIndex used to obtain the scalar (grade zero) portion of x.

source
CliffordNumbers.pseudoscalar_indexFunction
pseudoscalar_index(x::AbstractCliffordNumber{Q}) -> BladeIndex{Q}

Constructs the BladeIndex used to obtain the pseudoscalar (highest grade) portion of x.

source

Tools for implementing mathematical operations

Base.reverseMethod
reverse(i::BladeIndex) = i' -> BladeIndex
reverse(x::AbstractCliffordNumber) = x' -> typeof(x)

Performs the reverse operation on the basis blade indexed by b or the Clifford number x. The sign of the reverse depends on the grade of the basis blade g, and is positive for g % 4 in 0:1 and negative for g % 4 in 2:3.

source
CliffordNumbers.grade_involutionMethod
grade_involution(i::BladeIndex) -> BladeIndex
grade_involution(x::AbstractCliffordNumber) -> typeof(x)

Calculates the grade involution of the basis blade indexed by b or the Clifford number x. This effectively reflects all of the basis vectors of the space along their own mirror operation, which makes elements of odd grade flip sign.

source
Base.conjMethod
conj(i::BladeIndex) -> BladeIndex
conj(x::AbstractCliffordNumber) -> typeof(x)

Calculates the Clifford conjugate of the basis blade indexed by b or the Clifford number x. This is equal to grade_involution(reverse(x)).

source
CliffordNumbers.left_complementMethod
left_complement(b::BladeIndex{Q}) -> BladeIndex{Q}

Returns the left complement of b, define so that left_complement(b) * b generates the pseudoscalar index of elements of the algebra Q.

When the left complement is applied twice, the original BladeIndex object is returned up to a change of sign, given by (-1)^(grade(b) * (dimension(Q) - grade(b))). This implies that in algebras of odd dimension, the left complement and [right complement](@ref right_complement) are identical because eithergrade(b)ordimension(Q) - grade(b)must be even. The complement is independent of the signature ofQ`, depending only on the dimension.

Lengyel's convention for the left complement is an underbar.

source
CliffordNumbers.right_complementMethod
right_complement(b::BladeIndex{Q}) -> BladeIndex{Q}

Returns the right complement of b, define so that b * right_complement(b) generates the pseudoscalar index of elements of the algebra Q.

When the right complement is applied twice, the original BladeIndex object is returned up to a change of sign, given by (-1)^(grade(b) * (dimension(Q) - grade(b))). This implies that in algebras of odd dimension, the [left complement](@ref left_complement) and right complement are identical because eithergrade(b)ordimension(Q) - grade(b)must be even. The complement is independent of the signature ofQ`, depending only on the dimension.

Lengyel's convention for the right complement is an overbar.

source
CliffordNumbers.gradeMethod
grade(i::BladeIndex) -> Int

Returns the grade of the basis blade represented by i, which ranges from 0 to the dimension of the space represented by i (equal to dimension(signature(i))).

source
CliffordNumbers.sign_of_squareFunction
CliffordNumbers.sign_of_square(b::BladeIndex) -> Int8

Returns the sign associated with squaring the basis blade indexed by b using an Int8 as proxy: positive signs return Int8(1), negative signs return Int8(-1), and zeros from degenerate components return Int8(0).

source
CliffordNumbers.signbit_of_squareFunction
CliffordNumbers.signbit_of_square(b::BladeIndex) -> Bool

Returns the signbit associated with squaring the basis blade indexed by b.

For basis blades squaring to zero, the result is not meaningful.

source
CliffordNumbers.nondegenerate_squareFunction
CliffordNumbers.nondegenerate_square(b::BladeIndex) -> Bool

Returns false if squaring the basis blade b is zero due to a degenerate component, true otherwise. For a nondegenerate metric, this is always true.

source
CliffordNumbers.sign_of_multFunction
CliffordNumbers.sign_of_mult(a::T, b::T) where T<:BladeIndex -> Int8

Returns an Int8 that carries the sign associated with the multiplication of two basis blades of Clifford/geometric algebras of the same quadratic form.

source
CliffordNumbers.signbit_of_multFunction
CliffordNumbers.signbit_of_mult(a::Integer, [b::Integer]) -> Bool
CliffordNumbers.signbit_of_mult(a::BladeIndex, [b::BladeIndex]) -> Bool

Calculates the sign bit associated with multiplying basis elements indexed with bit indices supplied as either integers or BladeIndex instances. The sign bit flips when the order of a and b are reversed, unless a === b.

As with Base.signbit(), true represents a negative sign and false a positive sign. However, in degenerate metrics (such as those of projective geometric algebras) the sign bit may be irrelevant as the multiplication of those basis blades would result in zero.

source
CliffordNumbers.nondegenerate_multFunction
CliffordNumbers.nondegenerate_mult(a::T, b::T) where T<:BladeIndex -> Bool

Returns false if the product of a and b is zero due to the squaring of a degenerate component, true otherwise. This function always returns true if R === 0.

source
Base.:*Method
*(a::BladeIndex{Q}, b::BladeIndex{Q}) -> BladeIndex{Q}

Returns the BladeIndex corresponding to the basis blade resulting from the geometric product of the basis blades indexed by a and b.

source
CliffordNumbers.has_wedgeFunction
CliffordNumbers.has_wedge(a::BladeIndex{Q}, b::BladeIndex{Q}, [c::BladeIndex{Q}...]) -> Bool

Returns true if the basis blades indexed by a, b, or any other blades c... have a nonzero wedge product; false otherwise. This is determined by comparing all bits of the arguments (except the sign bit) to identify any matching basis blades using bitwise AND.

source