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 ofAbstractMultivector
.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 ofAbstractBlade
.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 ofAbstractScalar
.
AbstractMultivector
├─ Multivector
└─ AbstractBlade
├─ Blade
├─ Pseudoscalar
└─ AbstractScalar
├─ Scalar
├─ One
└─ Zero
AbstractMultivector
GeometricAlgebra.AbstractMultivector
— TypeAbstractMultivector{<:AbstractFloat}
Supertype for all multivector types.
Interface
The AbstractMultivector
interface is defined by the following functions.
Properties
GeometricAlgebra.dim
— Functiondim(M::AbstractMultivector)::Int
Return the dimension of the real space that M
is embedded within.
GeometricAlgebra.grades
— Functiongrades(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.
GeometricAlgebra.blades
— Functionblades(M::AbstractMultivector)::Vector{<:AbstractBlade}
Return the blades that M
is composed of.
LinearAlgebra.norm
— Functionnorm(M::AbstractMultivector)::AbstractFloat
Compute the norm of M
.
Base.getindex
— Functiongetindex(M::AbstractMultivector, k::Int)::Vector{<:AbstractBlade}
Return the k
-vector component of M
.
Utility Functions
Base.zero
— Functionzero(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.
Base.iszero
— Functioniszero(M::AbstractMultivector)
Return true
if M == zero(M)
; return false otherwise.
Base.one
— Functionone(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.
Base.isone
— Functionisone(M::AbstractMultivector)
Return true
if M == one(M)
; return false otherwise.
Base.convert
— Functionconvert(::Type{T}, M::AbstractMultivector)::AbstractMultivector{T}
where {T<:AbstractFloat}
Convert M
to have the floating-point precision of type T
.
AbstractBlade
Interface
GeometricAlgebra.AbstractBlade
— TypeAbstractBlade{<:AbstractFloat}
Supertype for all blade types.
Interface
The AbstractBlade
interface is defined by the following functions.
Properties
GeometricAlgebra.grade
— Functiongrade(B::AbstractBlade)::Int
Return the grade of B
.
GeometricAlgebra.basis
— Functionbasis(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.
GeometricAlgebra.volume
— Functionvolume(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.
The volume
of a blade encodes both norm and orientation information of a blade.
Base.sign
— Functionsign(B::AbstractBlade)::Int8
Return the sign of B
relative to its unit basis.
AbstractScalar
Interface
GeometricAlgebra.AbstractScalar
— TypeAbstractScalar{<:AbstractFloat}
Supertype for all scalar types.
The AbstractScalar
interface is defined by the following functions.
Properties
GeometricAlgebra.value
— Functionvalue(B::AbstractScalar)::AbstractFloat
Return the value of B
(with the same precision as B
).
Concrete Types
Multivector
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.Multivector
— Typestruct Multivector{T<:AbstractFloat} <: AbstractMultivector
Multivector represented with the floating-point precision of type T
.
GeometricAlgebra.Multivector
— MethodMultivector{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.
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
.
GeometricAlgebra.Multivector
— MethodMultivector(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
.
Blade
GeometricAlgebra.Blade
— Typestruct 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)
.
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.
GeometricAlgebra.Blade
— MethodBlade{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.
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 ofvectors
(taken in order).When
volume
is negative, the orientation of the blade is the opposite of the orientation implied by thevectors
.
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 ofv
.When
volume
is negative, the orientation of the blade is the opposite of the direction ofv
.
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 theBlade
is inferred from the precision of the elements ofvector
.If
vectors
is an Array of integers, the precision of theBlade
is set toFloat64
.
GeometricAlgebra.Blade
— MethodBlade{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
.
GeometricAlgebra.Blade
— MethodBlade(x::Real)::Scalar
Blade(x::Scalar)::Scalar
Convenience constructors that return a Scalar
with value x
.
Pseudoscalar
GeometricAlgebra.Pseudoscalar
— Typestruct 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)
.
GeometricAlgebra.Pseudoscalar
— MethodPseudoscalar{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
.
If
value
is a floating-point value, the precision of thePseudoscalar
is inferred from the precision ofvalue
.If
value
is an integer, the precision of the Pseudoscalar is set toFloat64
.
GeometricAlgebra.Pseudoscalar
— MethodPseudoscalar(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
.
Scalar
GeometricAlgebra.Scalar
— Typestruct 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.
GeometricAlgebra.Scalar
— MethodScalar{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
.
If
value
is a floating-point value, the precision of theScalar
is inferred from the precision ofvalue
.If
value
is an integer, the precision of theScalar
is set to toFloat64
.
One
GeometricAlgebra.One
— Typestruct One{T<:AbstractFloat} <: AbstractScalar{T}
Multiplicative identity for a geometric algebra (extended from a real vector space of arbitrary dimension).
GeometricAlgebra.One
— MethodOne()
Alias for a One{Float64}().
Zero
GeometricAlgebra.Zero
— Typestruct Zero{T<:AbstractFloat} <: AbstractScalar{T}
Additive identity for a geometric algebra (extended from a real vector space of arbitrary dimension).
GeometricAlgebra.Zero
— MethodZero()
Alias for a Zero{Float64}().