VerifiedMultivector

Struct VerifiedMultivector 

Source
pub struct VerifiedMultivector<T, const P: usize, const Q: usize, const R: usize>
where T: Float + Zero + One,
{ /* private fields */ }
Expand description

A verified multivector with compile-time signature guarantees

This structure ensures at the type level that:

  1. The signature is fixed and consistent
  2. Operations preserve algebraic laws
  3. Dimension bounds are respected

Implementations§

Source§

impl<T, const P: usize, const Q: usize, const R: usize> VerifiedMultivector<T, P, Q, R>
where T: Float + Zero + One,

Source

pub const DIM: usize

The total dimension of the algebra

Source

pub const BASIS_SIZE: usize

The number of basis blades (2^n)

Source

pub fn new(coefficients: Vec<T>) -> Result<Self, &'static str>

Create a new verified multivector from coefficients

§Type Invariants
  • Coefficients array must have exactly 2^(P+Q+R) elements
  • Signature is encoded at type level and cannot be violated
Source

pub fn scalar(value: T) -> Self

Create a scalar multivector

Source

pub fn basis_vector(index: usize) -> Result<Self, &'static str>

Create a basis vector e_i

§Type Safety

The index is bounds-checked against the signature dimensions

Source

pub fn is_scalar(&self) -> bool

Check if this is a pure scalar

Source

pub fn grade(&self) -> usize

Compute the grade (highest non-zero grade component)

Source

pub fn add(&self, other: &Self) -> Self

Addition of multivectors (same signature enforced by types)

Source

pub fn geometric_product(&self, other: &Self) -> Self

Geometric product with compile-time signature matching

§Mathematical Properties (verified by Creusot when enabled)
  • Associativity: (AB)C = A(BC)
  • Distributivity: A(B+C) = AB + AC
  • Identity: 1A = A1 = A

Trait Implementations§

Source§

impl<T, const P: usize, const Q: usize, const R: usize> Clone for VerifiedMultivector<T, P, Q, R>
where T: Float + Zero + One + Clone,

Source§

fn clone(&self) -> VerifiedMultivector<T, P, Q, R>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T, const P: usize, const Q: usize, const R: usize> Debug for VerifiedMultivector<T, P, Q, R>
where T: Float + Zero + One + Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T, const P: usize, const Q: usize, const R: usize> Freeze for VerifiedMultivector<T, P, Q, R>

§

impl<T, const P: usize, const Q: usize, const R: usize> RefUnwindSafe for VerifiedMultivector<T, P, Q, R>
where T: RefUnwindSafe,

§

impl<T, const P: usize, const Q: usize, const R: usize> Send for VerifiedMultivector<T, P, Q, R>
where T: Send,

§

impl<T, const P: usize, const Q: usize, const R: usize> Sync for VerifiedMultivector<T, P, Q, R>
where T: Sync,

§

impl<T, const P: usize, const Q: usize, const R: usize> Unpin for VerifiedMultivector<T, P, Q, R>
where T: Unpin,

§

impl<T, const P: usize, const Q: usize, const R: usize> UnwindSafe for VerifiedMultivector<T, P, Q, R>
where T: UnwindSafe,

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.