Types

Type Hierarchy

The relationships between GeometricAlgebra types mirror the hierarchical relationships between the mathematical objects they represent.

  • AbstractMultivector represents an arbitrary multivector. All concrete GeometricAlgebra types are subtypes of AbstractMultivector.

  • AbstractBlade represents an arbitrary blade. Any mathematical objects that is logically a blade (i.e., a blade, a pseudoscalar, or a scalar) is represented by a concrete GeometricAlgebra type that is a subtype of AbstractBlade.

  • AbstractScalar represents an arbitrary scalar value. Any mathematical objects that is logically a scalar (i.e., a scalar or a special scalar value) is represented by a concrete GeometricAlgebra type that is a subtype of AbstractScalar.

AbstractMultivector
├─ Multivector
└─ AbstractBlade
   ├─ Blade
   ├─ Pseudoscalar
   └─ AbstractScalar
      ├─ Scalar
      ├─ One
      └─ Zero

AbstractMultivector

Interface

The AbstractMultivector interface is defined by the following functions.

Properties

GeometricAlgebra.dimFunction
dim(M::AbstractMultivector)::Int

Return the dimension of the real space that M is embedded within.

source
GeometricAlgebra.gradesFunction
grades(M::AbstractMultivector; collect=true)::Vector{Int}

Return the grades of the nonzero k-vector components of M. When collect is false, an iterator over the grades is returned.

source
Base.getindexFunction
getindex(M::AbstractMultivector, k::Int)::Vector{<:AbstractBlade}

Return the k-vector component of M.

source

Utility Functions

Base.zeroFunction
zero(M::AbstractMultivector)::Zero
zero(::Type{<:AbstractMultivector})::Zero
zero(::Type{<:AbstractMultivector{T}})::Zero{T} where {T<:AbstractFloat}

Return the additive identity for the geometric algebra that M is an element of.

source
Base.iszeroFunction
iszero(M::AbstractMultivector)

Return true if M == zero(M); return false otherwise.

source
Base.oneFunction
one(M::AbstractMultivector)::One
one(::Type{<:AbstractMultivector})::One
one(::Type{<:AbstractMultivector{T}})::One{T} where {T<:AbstractFloat}

Return the multiplicative identity for the geometric algebra that M is an element of.

source
Base.isoneFunction
isone(M::AbstractMultivector)

Return true if M == one(M); return false otherwise.

source
Base.convertFunction
convert(::Type{T}, M::AbstractMultivector)::AbstractMultivector{T}
    where {T<:AbstractFloat}

Convert M to have the floating-point precision of type T.

source

AbstractBlade Interface

Interface

The AbstractBlade interface is defined by the following functions.

Properties

GeometricAlgebra.basisFunction
basis(B::AbstractBlade)::Matrix

Return an orthonormal basis for the subspace represented by B.

When B is an AbstractScalar, 1 (at the precision of B) is returned. When B is a Pseudoscalar, LinearAlgebra.I is returned.

source
GeometricAlgebra.volumeFunction
volume(B::AbstractBlade)::AbstractFloat

Return the signed volume of B.

When B is a Blade, volume(B) is the signed norm of the blade relative to its unit basis.

Note

The volume of a blade encodes both norm and orientation information of a blade.

source
Base.signFunction
sign(B::AbstractBlade)::Int8

Return the sign of B relative to its unit basis.

source

AbstractScalar Interface

The AbstractScalar interface is defined by the following functions.

Properties


Concrete Types

Multivector

Warning

Support for the Multivector type is not fully implemented yet. Full support for the AbstractMultivector interface and all operations is expected in v0.2.0.

GeometricAlgebra.MultivectorType
struct Multivector{T<:AbstractFloat} <: AbstractMultivector

Multivector represented with the floating-point precision of type T.

source
GeometricAlgebra.MultivectorMethod
Multivector{T}(blades::Vector{<:AbstractBlade}) where {T<:AbstractFloat}

Multivector(blades::Vector{<:AbstractBlade})

Construct a multivector from a collection of blades. For each grade $k$, the blades used to represent the $k$-vector part of the multivector form an orthogonal basis for the subspace of $k$-vectors.

Note

When the precision parameter T of the Multivector not explicitly specified, the precision of the Multivector is inferred from the precision of the first element of blades.

source
GeometricAlgebra.MultivectorMethod
Multivector(multivectors::Vector{<:AbstractMultivector})

Construct a multivector from a collection of multivectors. For each grade $k$, the blades used to represent the $k$-vector part of the multivector form an orthogonal basis for the subspace of $k$-vectors.

The precision of the Multivector is inferred from the precision of the first element of multivectors.

source

Blade

GeometricAlgebra.BladeType
struct Blade{T<:AbstractFloat} <: AbstractBlade{T}

Blade represented with the floating-point precision of type T. The norm and orientation of a Blade are encoded by its volume. The norm of a Blade is equal to abs(volume) and the orientation of a Blade relative to its basis is equal to sign(volume).

Note

The grade of a Blade type is always stricly greater than 0 and strictly less than the dimension of the space that the blade is embedded in.

source
GeometricAlgebra.BladeMethod
Blade{T}(vectors::Matrix{<:Real};
         volume::Union{Real, Nothing}=nothing,
         atol::Real=blade_atol(T)) where {T<:AbstractFloat}

Blade{T}(v::Vector{<:Real};
         volume::Union{Real, Nothing}=nothing,
         atol::Real=blade_atol(T)) where {T<:AbstractFloat}

Blade(vectors::Array{T};
      volume::Union{Real, Nothing}=nothing,
      atol::Real=blade_atol(T)) where {T<:AbstractFloat}

Blade(vectors::Array{<:Integer};
      volume::Union{Real, Nothing}=nothing,
      atol::Real=blade_atol(Float64))

Construct a blade from a collection of vectors stored as (1) the columns of a matrix or (2) a single vector. If the norm of the blade is less than atol, a Scalar representing zero is returned. If the grade of the blade is equal to the dimension of the space that the blade is embedded in, a Pseudoscalar is returned.

By default, vectors determines the volume of the blade. However, if volume is specified, vectors is only used to define the subspace (including orientation) represented by the blade.

Orientation

If vectors contains more than one vector, the orientation of the blade is set as follows.

  • When volume is positive, the orientation of the blade is the same as the orientation of the exterior product of the columns of vectors (taken in order).

  • When volume is negative, the orientation of the blade is the opposite of the orientation implied by the vectors.

If vectors contains a single vector v, the orientation of the blade is set as follows.

  • When volume is positive, the orientation of the blade is the same as the direction of v.

  • When volume is negative, the orientation of the blade is the opposite of the direction of v.

Precision

When the precision is not specified, the following rules are applied to set the precision of the Blade.

  • If vectors is an Array of floating-point values, the precision of the Blade is inferred from the precision of the elements of vector.

  • If vectors is an Array of integers, the precision of the Blade is set to Float64.

source
GeometricAlgebra.BladeMethod
Blade{T}(B::Blade;
      volume::Real=volume(B),
      atol::Real=blade_atol(T),
      copy_basis=false) where {T<: AbstractFloat}

Blade(B::Blade;
      volume::Real=volume(B),
      atol::Real=blade_atol(typeof(volume(B))),
      copy_basis=false)

Copy constructors. Construct a Blade representing the same space as B having a specified oriented volume relative to B. A Scalar representing zero is returned if the absolute value of volume is less than atol.

When copy_basis is true, the basis of the new Blade is a copy of the basis of the original Blade; otherwise, the basis of the new Blade is reference to the basis of the original Blade.

source
GeometricAlgebra.BladeMethod
Blade(x::Real)::Scalar

Blade(x::Scalar)::Scalar

Convenience constructors that return a Scalar with value x.

source

Pseudoscalar

GeometricAlgebra.PseudoscalarType
struct Pseudoscalar{T<:AbstractFloat} <: AbstractBlade

Pseudoscalar (an $n$-blade) represented with the floating-point precision of type T. The basis for a Pseudoscalar is the standard basis for an $n$-dimensional real vector space. The norm and orientation of a Pseudoscalar are encoded in its value. The norm of a Pseudoscalar is equal to abs(value) and the orientation of a Pseudoscalar relative to the standard basis is equal to sign(value).

source
GeometricAlgebra.PseudoscalarMethod
Pseudoscalar{T}(dim::Integer, value::Real) where {T<:AbstractFloat}

Pseudoscalar(dim::Integer, value::Real)

Construct a pseudoscalar for a geometric algebra in dim dimensions having the specified value.

When the precision is not specified, the following rules are applied to set the precision of the Pseudoscalar.

Note
  • If value is a floating-point value, the precision of the Pseudoscalar is inferred from the precision of value.

  • If value is an integer, the precision of the Pseudoscalar is set to Float64.

source
GeometricAlgebra.PseudoscalarMethod
Pseudoscalar(B::Pseudoscalar{T};
             value::Real=value(B)) where {T<:AbstractFloat}

Copy constructor. Construct a Pseudoscalar representing the same space as B having the specified value.

source

Scalar

GeometricAlgebra.ScalarType
struct Scalar{T<:AbstractFloat} <: AbstractScalar{T}

Scalar (a 0-blade) represented with the floating-point precision of type T. The basis and volume of a Scalar are 1 and the value of the Scalar, respectively.

source
GeometricAlgebra.ScalarMethod
Scalar{T}(value::Real) where {T<:AbstractFloat}

Scalar(value::AbstractFloat)

Scalar(value::Integer)

Construct a scalar having the specified value.

When the precision is not specified, the following rules are applied to set the precision of the Scalar.

Note
  • If value is a floating-point value, the precision of the Scalar is inferred from the precision of value.

  • If value is an integer, the precision of the Scalar is set to to Float64.

source

One

GeometricAlgebra.OneType
struct One{T<:AbstractFloat} <: AbstractScalar{T}

Multiplicative identity for a geometric algebra (extended from a real vector space of arbitrary dimension).

source

Zero

GeometricAlgebra.ZeroType
struct Zero{T<:AbstractFloat} <: AbstractScalar{T}

Additive identity for a geometric algebra (extended from a real vector space of arbitrary dimension).

source