# Metric signatures

`CliffordNumbers.Metrics`

— Module`CliffordNumbers.Metrics`

Contains tools for working with metric signatures associated with `AbstractCliffordNumber`

subtypes and instances. This includes the `Metrics.AbstractSignature`

type and its subtypes.

## Signature types

`CliffordNumbers.Metrics.AbstractSignature`

— Type`Metrics.AbstractSignature <: AbstractVector{Int8}`

Supertype for all data types that represent metric signatures. This includes the generic `Signature`

type as well as other specialized types.

Metric signatures can be interpreted as the signs of the diagonal elements of the metric tensor. All elements are either -1, 0, or 1. All nondegenerate Clifford algebras admit an orthonormal basis corresponding to the metric.

Aside from the generic `Metrics.Signature`

subtype, types for commonly used algebras are available, including `Metrics.VGA`

, `Metrics.PGA`

, and `Metrics.CGA`

. Custom signatures with firmer bounds on their behavior can be implemented by subtyping this type.

`CliffordNumbers.Metrics.Signature`

— Type```
Metrics.Signature <: Metrics.AbstractSignature
Metrics.Signature(
dimensions::Integer,
negative::UInt,
degenerate::UInt,
[first_index::Integer = 1]
)
```

Contains information about the metric associated with a Clifford algebra or Clifford number. This type is constructed to be as generic as possible; other subtypes of `Metrics.AbstractSignature`

may provide firmer guarantees on behavior, such as `VGA`

.

The number which the dimensions square to is stored in a pair of `UInt`

fields. The `negative`

field consists of 1 bits for dimensions that square to a negative number, and 0 bits for those squaring to a positive number, matching the convention of sign bits in signed numbers.

The `degenerate`

field consists of 1 bits for degenerate dimensions (dimensions that square to zero) and 0 bits for nondegenerate dimensions.

The numerical index of the first basis vector is `first_index`

, which defaults to 1. Some algebras conventionally use 0 as the first index, such as projective geometric algebras and Lorentzian geometric algebras, and in some cases it may be useful to start with a negative index if there are a larger number of modeling dimensions.

`CliffordNumbers.Metrics.VGA`

— Type`VGA <: Metrics.AbstractSignature`

Represents the signature associated with a vanilla geometric algebra (VGA), a positive-definite geometric algebra which models space without any projective dimensions.

`CliffordNumbers.Metrics.PGA`

— Type`PGA <: Metrics.AbstractSignature`

Represents the signature associated with a PGA (projective geometric algebra) with the given number of modeled dimensions. The constructed algebra will contain the number of modeled dimensions plus one degenerate (zero-squaring) dimension represented by e₀. This degenerate dimension corresponds with the n∞ null vector in CGA (conformal geometric algebra).

`CliffordNumbers.Metrics.CGA`

— Type`CGA <: Metrics.AbstractSignature`

Represents the signature of a CGA (conformal geometric algebra) with the given number of modeled dimensions. The constructed algebra will contain the number of modeled dimensions plus one positive-squaring dimension and one negative-squaring dimension.

There are two common choices of vector basis for the extra dimensions added when working with CGA. The most straightforward one is e₊ and e₋, which square to +1 and -1, respectively, and this is what is used internally, with the negative-squaring dimension being the first one.

However, there is another commonly used basis: define null vectors n₀ = (e₋ - e₊)/2 and n∞ = e₋ - e₊, which represent the origin point and the point at infinity, respectively. n∞ corresponds to e₀ in PGA (projective geometric algebra).

`CliffordNumbers.Metrics.LGA`

— Type`LGA{C} <: Metrics.AbstractSignature`

Represents the signature of a Lorentzian geometric algebra (LGA), an algebra which models a given number of spatial dimensions associated with a single time dimension at index 0.

The type parameter `C`

corresponds to the sign bit associated with the square of the spatial 1-blades. For convenience, the following aliases are defined:

```
const LGAEast = LGA{false}
const LGAWest = LGA{true}
```

The names correspond to the "East Coast" and "West Coast" conventions for the metric signature of spacetime, with the East Coast convention having positive squares for spatial 1-blades and the West Coast convention having negative squares for spatial 1-blades.

`CliffordNumbers.Metrics.LGAEast`

— Type`LGA{C} <: Metrics.AbstractSignature`

Represents the signature of a Lorentzian geometric algebra (LGA), an algebra which models a given number of spatial dimensions associated with a single time dimension at index 0.

The type parameter `C`

corresponds to the sign bit associated with the square of the spatial 1-blades. For convenience, the following aliases are defined:

```
const LGAEast = LGA{false}
const LGAWest = LGA{true}
```

The names correspond to the "East Coast" and "West Coast" conventions for the metric signature of spacetime, with the East Coast convention having positive squares for spatial 1-blades and the West Coast convention having negative squares for spatial 1-blades.

`CliffordNumbers.Metrics.LGAWest`

— Type`LGA{C} <: Metrics.AbstractSignature`

Represents the signature of a Lorentzian geometric algebra (LGA), an algebra which models a given number of spatial dimensions associated with a single time dimension at index 0.

The type parameter `C`

corresponds to the sign bit associated with the square of the spatial 1-blades. For convenience, the following aliases are defined:

```
const LGAEast = LGA{false}
const LGAWest = LGA{true}
```

The names correspond to the "East Coast" and "West Coast" conventions for the metric signature of spacetime, with the East Coast convention having positive squares for spatial 1-blades and the West Coast convention having negative squares for spatial 1-blades.

`CliffordNumbers.Metrics.Exterior`

— Type`Exterior <: Metrics.AbstractSignature`

Represents a signature corresponding to an exterior algebra. In an exterior algebra, all 1-blades square to 0, and the geometric product is equivalent ot the wedge product.

Unlike `VGA`

, `PGA`

, `CGA`

, and `LGA`

, the first index is not assumed when constructing this object, and can be manually specified. If it is not specified, it defaults to 1.

## Aliases for common signatures

`CliffordNumbers.Metrics.VGA2D`

— Constant`VGA2D (alias for VGA(2))`

The algebra of 2D space. The even subalgebra of this algebra is isomorphic to ℂ, the complex numbers.

`CliffordNumbers.Metrics.VGA3D`

— Constant```
VGA3D (alias for VGA(3))
const APS = VGA3D
```

The algebra of physical space, a 3D VGA which is commonly used (explicitly and implicitly) to model non-relativistic physics. It also serves as the subalgebra of both signature conventions of the spacetime algebra (available as `STAEast`

and `STAWest`

).

The even subalgebra of this algebra is isomorphic to ℍ, the quaternions.

`CliffordNumbers.Metrics.PGA2D`

— Constant`PGA2D (alias for PGA(2))`

The projective geometric algebra of 2D space, which represents points and lines on the plane.

`CliffordNumbers.Metrics.PGA3D`

— Constant`PGA3D (alias for PGA(3))`

The projective geometric algebra of 3D space, which represents points, lines, and planes in a 3D space.

`CliffordNumbers.Metrics.CGA2D`

— Constant`CGA2D (alias for CGA(2))`

The conformal geometric algebra of 2D space, which represents points, lines, and circles on the plane. This algebra constitutes a framework for compass and straightedge constructions.

This algebra is isomorphic to `STAEast`

, and this isomorphism is the reason why the default convention for spacetime algebras in this package is the West Coast (mostly negative) convention.

`CliffordNumbers.Metrics.CGA3D`

— Constant`CGA3D (alias for CGA(3))`

The conformal geometric algebra of 3D space, which represents points, lines, and planes, as well as circles and spheres. This algebra constitutes a framework for extending compass and straightedge constructions to 3 dimensions.

`CliffordNumbers.Metrics.STAEast`

— Constant`STAEast (alias for LGAEast(3))`

The spacetime algebra using the East Coast sign convention (spatial dimensions square positive, temporal dimensions square negative), with the temporal dimension at index 0.

This convention is *not* the default STA convention, since this signature is identical to that of the 2D conformal geometric algebra.

`CliffordNumbers.Metrics.STAWest`

— Constant```
STAWest (alias for LGAWest(3))
const STA = STAWest
```

The spacetime algebra using the West Coast sign convention (spatial dimensions square negative, temporal dimensions square positive), with the temporal dimension at index 0.

This convention is the default STA convention in this package, since the signature for the East Coast convention can be interpreted as that of the 2D conformal geometric algebra.

`CliffordNumbers.Metrics.STA`

— Constant```
STAWest (alias for LGAWest(3))
const STA = STAWest
```

The spacetime algebra using the West Coast sign convention (spatial dimensions square negative, temporal dimensions square positive), with the temporal dimension at index 0.

This convention is the default STA convention in this package, since the signature for the East Coast convention can be interpreted as that of the 2D conformal geometric algebra.

`CliffordNumbers.Metrics.STAPEast`

— Constant`STAPEast (alias for Signature(5, 0b00010, 0b00001, -1))`

The projective spacetime algebra using the East Coast sign convention (spatial dimensions square positive, temporal dimensions square negative). The degenerate dimension is at index -1.

As with `STA`

, the default convention for `STAP`

is the West Coast metric. For an explanation, see `STA`

.

`CliffordNumbers.Metrics.STAPWest`

— Constant```
STAPWest (alias for Signature(5, 0b11100, 0b00001, -1))
const STAP = STAPWest
```

The projective spacetime algebra using the West Coast sign convention (spatial dimensions square negative, temporal dimensions square positive). The degenerate dimension is at index -1.

As with `STA`

, the default convention for `STAP`

is the West Coast metric. For an explanation, see `STA`

.

`CliffordNumbers.Metrics.STAP`

— Constant```
STAPWest (alias for Signature(5, 0b11100, 0b00001, -1))
const STAP = STAPWest
```

The projective spacetime algebra using the West Coast sign convention (spatial dimensions square negative, temporal dimensions square positive). The degenerate dimension is at index -1.

As with `STA`

, the default convention for `STAP`

is the West Coast metric. For an explanation, see `STA`

.

## Associated methods

`CliffordNumbers.Metrics.dimension`

— Function`dimension(s::AbstractSignature) -> Int8`

Returns the total number of dimensions associated with `s`

. The default implementation returns `signed(s.dimensions)`

.

The total number of basis blades is equal to to the size of the power set of all basis vectors, and is equal to `2^dimension(s)`

.

`CliffordNumbers.signature`

— Function```
signature(T::Type{<:AbstractCliffordNumber{Q}}) = Q
signature(x::AbstractCliffordNumber{Q}) = Q
```

Returns the metric signature object associated with an `AbstractCliffordNumber`

`x`

or its type `T`

.

`CliffordNumbers.Metrics.blade_count`

— Function`blade_count(s) -> Int`

Returns the total number of blades associated with metric signature `s`

, which is equal to `2^dimension(s)`

.

`CliffordNumbers.Metrics.grades`

— Function`grades(s::AbstractSignature) -> UnitRange{Int8}`

Returns the total number of grades associated with `s`

, which is equal to `0:dimension(s)`

.

`CliffordNumbers.Metrics.is_degenerate`

— Function`is_degenerate(s::AbstractSignature)`

Returns `true`

if any basis elements of `s`

square to 0.

This does not imply that no elements of the associated Clifford algebra square to 0.

`CliffordNumbers.Metrics.is_positive_definite`

— Function`is_positive_definite(s::AbstractSignature)`

Returns `true`

if all basis 1-blades of `s`

square to a positive value.