API Reference

This page lists the public API and selected internal functions for advanced users.

Public API

CliffordAlgebras.CliffordAlgebraType
CliffordAlgebra(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.

source
CliffordAlgebras.CliffordAlgebraMethod
CliffordAlgebra(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

source
CliffordAlgebras.MultiVectorType
MultiVector{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.

source
CliffordAlgebras.MultiVectorMethod
MultiVector(::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.

source
CliffordAlgebras.MultiVectorMethod
MultiVector(::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.

source
Base.:*Method
a * b

Compute 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∧b

where · 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 * a in 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)

See also: , , ,

source
Base.:/Method
a / b
(/)(a::MultiVector{CA}, b::MuliVector{CA}) where CA

Calculates the MultiVector quotient a/b by evaluating a*inv(b).

source
Base.:\Method
a \ b
(\)(a::MultiVector{CA}, b::MultiVector{CA}) where CA

Left division defined as inv(a) * b.

source
Base.:~Method
~a
(~)(::MultiVector)

Returns the reversed MultiVector reverse(a).

source
Base.conjMethod
conj(mv::MultiVector)

Return the conjugate of the MultiVector, i.e. reverse(grin(mv)).

source
Base.invMethod
inv(::MultiVector)

Finds the inverse of the MultiVector. If no inverse exists a SingularException is thrown.

source
Base.isapproxMethod
isapprox(mv1::MultiVector, mv2::MultiVector; kw...)

Check if mv1 and mv2 belong to the same algebra and their coefficients are close.

source
Base.reverseMethod
reverse(::MultiVector)

Returns the MultiVector that has all the basis vector products reversed.

source
CliffordAlgebras.:∧Method
a ∧ b

Compute 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 = 0 for 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 0

See also: , , , *

source
CliffordAlgebras.:⋅Method
a ⋅ b

Compute 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 -e2

See also: , , ,

source
CliffordAlgebras.algebraMethod
algebra(::MultiVector)
algebra(::Type{<:MultiVector})

Returns the CliffordAlgebra instance to which the MultiVector belongs.

source
CliffordAlgebras.basesymbolMethod
basesymbol(::CliffordAlgebra, n::Integer)
basesymbol(::Type{<:CliffordAlgebra}, n::Integer)

Returns the symbol used for the n-th basis multivector of the algebra.

source
CliffordAlgebras.basevectorMethod
basevector(::CliffordAlgebra, n::Integer)
basevector(::Type{<:CliffordAlgebra}, n::Integer)

Returns the n-th basis MultiVector of the given CliffordAlgebra.

source
CliffordAlgebras.basevectorMethod
basevector(::CliffordAlgebra, name::Symbol)
basevector(::Type{<:CliffordAlgebra}, name::Symbol)

Returns the basis MultiVector with the specified name from the given Clifford Algebra.

source
CliffordAlgebras.cayleytableMethod
cayleytable(io::IO, ca::CliffordAlgebra)
cayleytable(io::IO, CA::Type{<:CliffordAlgebra})

Generates a Cayley table view of the algebra.

source
CliffordAlgebras.characterMethod
character(::CliffordAlgebra)
character(::Type{<:CliffordAlgebra})

Returns the square of the pseudoscalar of the algebra.

source
CliffordAlgebras.coefficientMethod
coefficient(::MultiVector, n::Integer)

Returns the multivector coefficients for the n-th basis vector. Returns 0 if n is out of bounds.

source
CliffordAlgebras.coefficientMethod
coefficient(::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.

source
CliffordAlgebras.dimensionMethod
dimension(::CliffordAlgebra)
dimension(::Type{<:CliffordAlgebra})

Returns the dimension of the algebra, i.e. the number of coefficients in a general multivector.

source
CliffordAlgebras.dualMethod
dual(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.

source
CliffordAlgebras.extendMethod
extend(::MultiVector)

Returns a new MultiVector with a non-sparse coefficient coding. This can be useful to manage type stability.

source
CliffordAlgebras.maxgradeMethod
maxgrade(::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.

source
CliffordAlgebras.mingradeMethod
mingrade(::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.

source
CliffordAlgebras.orderMethod
order(::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.

source
CliffordAlgebras.outermorphismMethod
outermorphism(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.

source
CliffordAlgebras.pruneMethod
prune(::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.

source
CliffordAlgebras.scalarMethod
scalar(mv::MultiVector)

Returns the scalar component of the multivector. The result if of the internal storage type eltype(mv).

source
CliffordAlgebras.signaturetableMethod
signaturetable(io::IO, ca::CliffordAlgebra)
signaturetable(io::IO, CA::Type{<:CliffordAlgebra})

Prints the 1-vector basis symbols and their squares.

source
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.

source
LinearAlgebra.normMethod
norm(::MultiVector)

Calculates the MultiVector norm defined as sqrt(scalar(mv*reverse(mv))).

source

Internal API (advanced)

The following internal item is documented for completeness: