Skip to main content

Metric

Struct Metric 

Source
pub struct Metric<S: Scalar> { /* private fields */ }
Expand description

The metric of a possibly degenerate Clifford algebra.

For i < j, the stored data means B(e_i,e_i) = q[i], B(e_i,e_j) = a[(i,j)], and B(e_j,e_i) = b[(i,j)] - a[(i,j)]. Thus b is the polar or anticommutator form and a selects a general bilinear representative.

Implementations§

Source§

impl<S: Scalar> Metric<S>

Source

pub fn diagonal(q: Vec<S>) -> Self

Orthogonal metric from a list of squares (b = 0). Cl(p,q,r) style.

Source

pub fn grassmann(n: usize) -> Self

The fully-null metric: exterior/Grassmann algebra on n generators.

Source

pub fn new(q: Vec<S>, b: impl IntoIterator<Item = ((usize, usize), S)>) -> Self

An ordinary Clifford metric with squares q, anticommutators b, and no in-order contraction (a empty).

b may be any IntoIterator of ((i, j), value) pairs (a BTreeMap, a Vec, a slice, …) so call sites need not build the map explicitly.

Source

pub fn general( q: Vec<S>, b: impl IntoIterator<Item = ((usize, usize), S)>, a: impl IntoIterator<Item = ((usize, usize), S)>, ) -> Self

A general-bilinear-form metric: squares q, polar form b (i<j), and the in-order contraction a (i<j). See the struct docs.

Both b and a may be any IntoIterator of ((i, j), value) pairs.

Source

pub fn dim(&self) -> usize

The represented dimension, i.e. the length of the quadratic diagonal.

Source

pub fn q(&self) -> &[S]

Diagonal quadratic entries q[i] = e_i^2.

Source

pub fn b(&self) -> &BTreeMap<(usize, usize), S>

Polar/anticommutator entries b[(i,j)] = {e_i,e_j} with i < j.

Source

pub fn a(&self) -> &BTreeMap<(usize, usize), S>

Strictly-upper/in-order contraction entries with i < j.

Source

pub fn into_parts( self, ) -> (Vec<S>, BTreeMap<(usize, usize), S>, BTreeMap<(usize, usize), S>)

Consume the metric into its invariant-carrying parts.

Source

pub fn has_upper(&self) -> bool

Whether any in-order contraction entry is nonzero.

Source

pub fn direct_sum(&self, other: &Metric<S>) -> Metric<S>

Orthogonal direct sum M ⟂ M': a block-diagonal metric on the disjoint union of the two generator sets.

Source

pub fn map<T: Scalar>(&self, f: impl Fn(&S) -> T) -> Metric<T>

Applies f to every coefficient while preserving all q, b, and a indices. The caller is responsible for using a map compatible with the intended algebraic structure.

Source§

impl<S: ClassifyForm> Metric<S>

Ergonomic methods so callers can write metric.classify() / algebra.classify() instead of S::classify(&metric).

These methods return Result<_, ClassifyError> so callers can distinguish why a classification failed (unsupported field, diagonalizer failure, …). The underlying trait methods stay Option for partial operations with a single failure meaning.

Source

pub fn classify(&self) -> Result<S::Class, ClassifyError>

Classify the form (see ClassifyForm).

Source§

impl<S: ClassifyWitt> Metric<S>

Source

pub fn witt_class(&self) -> Result<WittClassG, ClassifyError>

The unified Witt class (see ClassifyWitt).

Source§

impl<S: ClassifyIsometry> Metric<S>

Source

pub fn isometric_to(&self, other: &Self) -> Result<bool, ClassifyError>

Test isometry against another form over the same scalar world.

Source§

impl<S: DecomposeWitt> Metric<S>

Source

pub fn witt_decompose(&self) -> Result<S::Decomp, ClassifyError>

Split the form into hyperbolic planes plus anisotropic kernel data.

Source§

impl<S: ClassifyBrauerWall> Metric<S>

Source

pub fn bw_class(&self) -> Result<S::BrauerWallClass, ClassifyError>

The Brauer-Wall class of the attached Clifford algebra.

Source§

impl<S: ClassifyMilnor> Metric<S>

Source

pub fn milnor_e0(&self) -> Result<MilnorK0Class, MilnorInvariantError>

The strict degree-zero mod-two Milnor invariant.

Source

pub fn milnor_e1(&self) -> Result<S::K1Class, MilnorInvariantError>

The strict e_1 : I/I^2 -> K^M_1/2 invariant.

Source

pub fn milnor_e2(&self) -> Result<S::K2Class, MilnorInvariantError>

The strict e_2 : I^2/I^3 -> K^M_2/2 invariant.

Source§

impl<S: ClassifyCliffordCenters> Metric<S>

Source

pub fn clifford_centers( &self, ) -> Result<CliffordCenterInvariants<S, S::CenterDiscriminant, S::CenterBrauerWallClass>, CliffordCenterError>

Construct the full and even Clifford centers and compare them with the Brauer–Wall coordinates.

Trait Implementations§

Source§

impl<S: Clone + Scalar> Clone for Metric<S>

Source§

fn clone(&self) -> Metric<S>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S: Debug + Scalar> Debug for Metric<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S: PartialEq + Scalar> PartialEq for Metric<S>

Source§

fn eq(&self, other: &Metric<S>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<S: PartialEq + Scalar> StructuralPartialEq for Metric<S>

Auto Trait Implementations§

§

impl<S> Freeze for Metric<S>

§

impl<S> RefUnwindSafe for Metric<S>
where S: RefUnwindSafe,

§

impl<S> Send for Metric<S>
where S: Send,

§

impl<S> Sync for Metric<S>
where S: Sync,

§

impl<S> Unpin for Metric<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for Metric<S>

§

impl<S> UnwindSafe for Metric<S>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.