API Reference
This page lists the public API and selected internal functions for advanced users.
Public API
CliffordAlgebras.CliffordAlgebra — TypeCliffordAlgebra(Npos::Integer, Nneg::Integer, Nzero::Integer, S::NTuple(N,Symbol))Singleton instance of the type CliffordAlgebra that describes a geometric algebra with the signature (Npos,Nneg,Nzero), base symbols S. The base symbols are in order of the signature.
CliffordAlgebras.CliffordAlgebra — MethodCliffordAlgebra(Npos::Integer, Nneg::Integer, Nzero::Integer)Generates a geometric algebra with signature (Npos,Nneg,Nzero).
CliffordAlgebras.CliffordAlgebra — MethodCliffordAlgebra(Npos::Integer, Nneg::Integer)Generates a geometric algebra with signature (Npos,Nneg,0).
CliffordAlgebras.CliffordAlgebra — MethodCliffordAlgebra(N::Integer)Generates a geometric algebra with signature (N,0,0).
CliffordAlgebras.CliffordAlgebra — MethodCliffordAlgebra(a::Symbol)Generates a predefined algebra from a identifier. Known algebras are - :Hyperbolic or :Hyper - :Complex or :ℂ - :Dual or :Grassmann - :Grassmann2D or :G2 - :Grassmann3D or :G3 - :Quaternions or :ℍ - :Cl2 and :Cl3 - :Spacetime - :PGA2D or :Projective2D or :Plane2D - :PGA3D or :Projective3D or :Plane3D - :CGA2D or :Conformal2D - :CGA3D or :Conformal3D - :DCGA3D or :DoubleConformal3D - :TCGA3D or :TripleConformal3D - :DCGSTA or :DoubleConformalSpacetime - :QCGA or :QuadricConformal
CliffordAlgebras.MultiVector — TypeMultiVector{CA,T,BI}Type for a multivector belonging to the algebra CA<:CliffordAlgebra with vector coefficients of type T. Coefficients are stored using a sparse coding, and only the coefficients of the basis indices stored in the tuple BI are considered.
CliffordAlgebras.MultiVector — MethodMultiVector(::CliffordAlgebra, v::NTuple{N,T}) where {N,T<:Real}
MultiVector(::Type{<:CliffordAlgebra}, v::NTuple{N,T}) where {N,T<:Real}Creates a MultiVector by converting the provided vector v to a 1-vector. The internal storage type of the MultiVector is T.
CliffordAlgebras.MultiVector — MethodMultiVector(::CliffordAlgebra, a::Real)
MultiVector(::Type{<:CliffordAlgebra}, a::Real)Creates a MultiVector from the real number a with only a scalar component. The internal storage type of the MultiVector is the type of a.
Base.:* — Methoda * bCompute the geometric product of multivectors a and b.
The geometric product is the fundamental operation in Clifford algebra, combining the inner and outer products. It encodes both the magnitude and orientation relationships between multivectors.
Mathematical Definition
The geometric product decomposes as:
a * b = a·b + a∧bwhere · is the inner product and ∧ is the exterior product.
Properties
- Associative:
(a * b) * c = a * (b * c) - Distributive:
a * (b + c) = a * b + a * c - Generally non-commutative:
a * b ≠ b * ain general - For vectors:
u * v = u·v + u∧v
Special Cases
- Parallel vectors:
u * v = u·v(pure scalar) - Orthogonal vectors:
u * v = u∧v(pure bivector) - Same vector:
v * v = |v|²(squared magnitude)
Examples
cl3 = CliffordAlgebra(3)
e1, e2 = cl3.e1, cl3.e2
# Vector geometric product
u = 2*e1 + 3*e2
v = 4*e1 + 5*e2
result = u * v # Returns scalar part (dot) + bivector part (wedge)
# Basis vector products
e1 * e1 # Returns 1 (squares to +1 in Euclidean signature)
e1 * e2 # Returns e1e2 (creates bivector)
e2 * e1 # Returns -e1e2 (anticommutative for orthogonal vectors)Base.:/ — Methoda / b
(/)(a::MultiVector{CA}, b::MuliVector{CA}) where CACalculates the MultiVector quotient a/b by evaluating a*inv(b).
Base.:\ — Methoda \ b
(\)(a::MultiVector{CA}, b::MultiVector{CA}) where CALeft division defined as inv(a) * b.
Base.:~ — Method~a
(~)(::MultiVector)Returns the reversed MultiVector reverse(a).
Base.conj — Methodconj(mv::MultiVector)Return the conjugate of the MultiVector, i.e. reverse(grin(mv)).
Base.inv — Methodinv(::MultiVector)Finds the inverse of the MultiVector. If no inverse exists a SingularException is thrown.
Base.isapprox — Methodisapprox(mv1::MultiVector, mv2::MultiVector; kw...)Check if mv1 and mv2 belong to the same algebra and their coefficients are close.
Base.reverse — Methodreverse(::MultiVector)Returns the MultiVector that has all the basis vector products reversed.
CliffordAlgebras.:×₊ — Methoda ×₊ bCalculates the anti-commutator ab+ba of two MultiVectors a and b.
CliffordAlgebras.:×₋ — Methoda ×₋ bCalculates the commutator ab-ba of two MultiVectors a and b.
CliffordAlgebras.:∧ — Methoda ∧ bCompute the exterior (wedge) product of multivectors a and b.
The exterior product is anti-commutative and associative, creating higher-grade elements. It represents the "oriented volume" spanned by the input multivectors.
Properties
- Anti-commutative:
a ∧ b = -b ∧ a - Associative:
(a ∧ b) ∧ c = a ∧ (b ∧ c) - Nilpotent:
a ∧ a = 0for any multivector - Grade additive:
grade(a ∧ b) = grade(a) + grade(b)(for homogeneous multivectors)
Examples
cl3 = CliffordAlgebra(3)
e1, e2, e3 = cl3.e1, cl3.e2, cl3.e3
# Vector exterior products create bivectors (oriented areas)
e1 ∧ e2 # Creates the e1e2 bivector
# Bivector ∧ vector creates trivector (oriented volume)
(e1 ∧ e2) ∧ e3 # Creates the e1e2e3 trivector (pseudoscalar)
# Self-exterior is always zero
e1 ∧ e1 # Returns 0CliffordAlgebras.:∨ — Methoda ∨ bCalculates the regressive product of the MultiVectors a and b.
CliffordAlgebras.:≀ — Methoda ≀ bCalculates the sandwich product a*b*reverse(a) for two MultiVectors a and b.
CliffordAlgebras.:⋅ — Methoda ⋅ bCompute the "fat dot" product between multivectors a and b.
The fat dot product is the symmetric part of the geometric product, extracting components where the grade difference is minimized. It's related to the generalized inner product in geometric algebra.
Mathematical Definition
For homogeneous multivectors of grades p and q:
a ⋅ b = ⟨ab⟩_{|p-q|}Properties
- Symmetric:
a ⋅ b = b ⋅ a - Linear in both arguments
- Grade selective: extracts the |grade(a) - grade(b)| part
Examples
cl3 = CliffordAlgebra(3)
e1, e2 = cl3.e1, cl3.e2
# Vector dot product gives scalar
v1 = e1 + e2
v2 = 2*e1 + 3*e2
scalar_part = v1 ⋅ v2 # Returns 5.0 (the scalar part)
# Mixed grade operations
bivector = e1 ∧ e2
vector = e1
result = bivector ⋅ vector # Returns -e2CliffordAlgebras.:⋆ — Methoda ⋆ bCalculates the scalar product of the MultiVectors a and b.
CliffordAlgebras.:⨼ — Methoda ⨼ bCalculates the left contraction of the MultiVectors a and b.
CliffordAlgebras.:⨽ — Methoda ⨽ bCalculates the right contraction of the MultiVectors a and b.
CliffordAlgebras.algebra — Methodalgebra(::MultiVector)
algebra(::Type{<:MultiVector})Returns the CliffordAlgebra instance to which the MultiVector belongs.
CliffordAlgebras.baseindices — Methodbaseindices(::MultiVector)
baseindices(::Type{<:MultiVector})Returns the indices for the sparse MultiVector basis.
CliffordAlgebras.basesymbol — Methodbasesymbol(::CliffordAlgebra, n::Integer)
basesymbol(::Type{<:CliffordAlgebra}, n::Integer)Returns the symbol used for the n-th basis multivector of the algebra.
CliffordAlgebras.basevector — Methodbasevector(::CliffordAlgebra, n::Integer)
basevector(::Type{<:CliffordAlgebra}, n::Integer)Returns the n-th basis MultiVector of the given CliffordAlgebra.
CliffordAlgebras.basevector — Methodbasevector(::CliffordAlgebra, name::Symbol)
basevector(::Type{<:CliffordAlgebra}, name::Symbol)Returns the basis MultiVector with the specified name from the given Clifford Algebra.
CliffordAlgebras.cayleytable — Methodcayleytable(io::IO, ca::CliffordAlgebra)
cayleytable(io::IO, CA::Type{<:CliffordAlgebra})Generates a Cayley table view of the algebra.
CliffordAlgebras.character — Methodcharacter(::CliffordAlgebra)
character(::Type{<:CliffordAlgebra})Returns the square of the pseudoscalar of the algebra.
CliffordAlgebras.coefficient — Methodcoefficient(::MultiVector, n::Integer)Returns the multivector coefficients for the n-th basis vector. Returns 0 if n is out of bounds.
CliffordAlgebras.coefficient — Methodcoefficient(::MultiVector, s::Symbol)Returns the multivector coefficients for the basis vector belonging to the symbol s. Returns 0 if the symbol is not a valid basis symbol.
CliffordAlgebras.coefficients — Methodcoefficients(::MultiVector)Returns the sparse coefficients of the MultiVector.
CliffordAlgebras.dimension — Methoddimension(::CliffordAlgebra)
dimension(::Type{<:CliffordAlgebra})Returns the dimension of the algebra, i.e. the number of coefficients in a general multivector.
CliffordAlgebras.dual — Methoddual(mv::MultiVector)Returns the Poincaré dual of the MultiVector, such that for all basis MultiVectors mv * dual(mv) = pseudoscalar. Dual is a linear map and the images of other MultiVectors follow from the images of the basis MultiVectors.
CliffordAlgebras.even — Methodeven(::MultiVector)Returns the even grade projection of the MultiVector.
CliffordAlgebras.extend — Methodextend(::MultiVector)Returns a new MultiVector with a non-sparse coefficient coding. This can be useful to manage type stability.
CliffordAlgebras.grade — Methodgrade(::MultiVector, k::Integer)Projects the MultiVector onto the k-vectors.
CliffordAlgebras.grin — Methodgrin(mv::MultiVector)Returns the grade involution of the MultiVector, i.e. even(mv) - odd(mv).
CliffordAlgebras.isgrade — Methodisgrade(::MultiVector, k::Integer)Returns true if the MultiVector is of grade k, false if not.
CliffordAlgebras.matrix — Methodmatrix(::MultiVector)Returns the matrix algebra representation of the MultiVector.
CliffordAlgebras.maxgrade — Methodmaxgrade(::MultiVector ; rtol = 1e-8)Projects the MultiVector onto the subspace of the largest grade with non-vanishing norm. Returns a tuple of the resulting multivector and its grade.
CliffordAlgebras.mingrade — Methodmingrade(::MultiVector ; rtol = 1e-8)Projects the MultiVector onto the subspace of the largest grade with non-vanishing norm. Returns a tuple of the resulting multivector and its grade.
CliffordAlgebras.odd — Methododd(::MultiVector)Returns the odd grade projection of the MultiVector.
CliffordAlgebras.order — Methodorder(::CliffordAlgebra)
order(::Type{<:CliffordAlgebra})Returns the order of the algebra. The order is the sum of the signature and the dimension of the underlying 1-vector space and the maximum grade for multivectors.
CliffordAlgebras.outermorphism — Methodoutermorphism(A::AbstractMatrix, mv::MultiVector)Calculates the outermorphism f of the MultiVector defined by f(v) = Av if v is in the grade-1 subspace of the algebra.
CliffordAlgebras.polarize — Methodpolarize(mv::MultiVector)
mv'Calculates the polarization of the MultiVector, i.e. mv * pseudoscalar.
CliffordAlgebras.prune — Methodprune(::MultiVector ; rtol = 1e-8 )Returns a new MultiVector with all basis vectors removed from the sparse basis whose coefficients fall below the relative magnitude threshold. This function is not type stable, because the return type depends on the sparse basis.
CliffordAlgebras.pseudoscalar — Methodpseudoscalar(::CliffordAlgebra)
pseudoscalar(::Type{<:CliffordAlgebra})Returns the pseudoscalar of the given algebra.
CliffordAlgebras.scalar — Methodscalar(mv::MultiVector)Returns the scalar component of the multivector. The result if of the internal storage type eltype(mv).
CliffordAlgebras.signature — Methodsignature(::CliffordAlgebra)
signature(::Type{<:CliffordAlgebra})Returns the signature of the algebra.
CliffordAlgebras.signaturetable — Methodsignaturetable(io::IO, ca::CliffordAlgebra)
signaturetable(io::IO, CA::Type{<:CliffordAlgebra})Prints the 1-vector basis symbols and their squares.
CliffordAlgebras.vector — Methodvector(::MultiVector)Returns the non-sparse vector representation of the MutliVector.
CliffordAlgebras.Λᵏ — MethodΛᵏ(::MultiVector, ::Val{k}) where k
Λᵏ(::MultiVector, k::Integer)Projects the MultiVector onto k-vectors. Similar to grade(mv,k), but uses @generated code and compile time optimizations.
LinearAlgebra.norm — Methodnorm(::MultiVector)Calculates the MultiVector norm defined as sqrt(scalar(mv*reverse(mv))).
LinearAlgebra.norm_sqr — Methodnorm_sqr(::MultiVector)Calculates the MultiVector squared norm defined as grade(mv*reverse(mv),0)
Internal API (advanced)
The following internal item is documented for completeness:
CliffordAlgebras._multtable_cache — ConstantInternal cache for multiplication tables keyed by the CliffordAlgebra type.