Skip to main content

CausalMultiField

Struct CausalMultiField 

Source
pub struct CausalMultiField<T> { /* private fields */ }
Expand description

A field of multivectors stored as tensors.

CausalMultiField stores multivector data in Matrix Isomorphism representation using CausalTensor for efficient computation.

§Type Parameters

  • T - The scalar type (typically f32 or f64).

§Memory Layout

Shape: [Nx, Ny, Nz, Matrix_Dim, Matrix_Dim]

Implementations§

Source§

impl<T> CausalMultiField<T>
where T: Field + Copy + Default + PartialOrd,

Source

pub fn scale(&self, scalar: T) -> Self

Scales the field by a scalar: result = scalar * self.

§Arguments
  • scalar - The scalar value to multiply by
Source§

impl<T> CausalMultiField<T>

Source

pub fn normalize(&self) -> Self

Normalizes the field: result = self / ||self||.

Returns the field scaled to unit magnitude.

Source

pub fn squared_magnitude(&self) -> T

Computes the squared magnitude of the field.

Uses the L2 norm of the matrix representation.

Source§

impl<T> CausalMultiField<T>
where T: Field + Copy + Default + PartialOrd + Neg<Output = T> + 'static,

Source

pub fn reversion(&self) -> Self

Computes the reversion (reversal) of the field.

The reversion is computed by extracting multivectors, applying the reversion operation, and reconstructing.

Source

pub fn inverse(&self) -> Self
where T: RealField,

Computes the multiplicative inverse of the field.

Uses matrix inverse for each cell.

Source§

impl<T> CausalMultiField<T>

Source

pub fn commutator_lie(&self, rhs: &Self) -> Self

Computes the Lie commutator: [A, B] = AB - BA.

The Lie bracket measures the non-commutativity of the geometric product.

Source

pub fn commutator_geometric(&self, rhs: &Self) -> Self

Computes the geometric commutator: (AB - BA) / 2.

Equivalent to the Lie commutator scaled by 1/2.

Source§

impl<T> CausalMultiField<T>

Source

pub fn metric(&self) -> Metric

Returns the metric signature of the algebra.

Source

pub fn dx(&self) -> &[T; 3]

Returns the grid spacing.

Source

pub fn shape(&self) -> &[usize; 3]

Returns the grid shape [Nx, Ny, Nz].

Source

pub fn num_cells(&self) -> usize

Returns the total number of grid cells.

Source

pub fn matrix_dim(&self) -> usize

Returns the matrix dimension for the algebra.

For Cl(p,q,r), the matrix dimension is 2^⌈N/2⌉ where N = p + q + r.

Source

pub fn data(&self) -> &CausalTensor<T>

Returns a reference to the underlying tensor.

Source§

impl<T> CausalMultiField<T>
where T: Field + Copy + Default + PartialOrd,

Source

pub fn zeros(shape: [usize; 3], metric: Metric, dx: [T; 3]) -> Self

Creates a field filled with zero multivectors.

§Arguments
  • shape - Grid dimensions [Nx, Ny, Nz]
  • metric - The metric signature of the algebra
  • dx - Grid spacing [dx, dy, dz]
Source

pub fn ones(shape: [usize; 3], metric: Metric, dx: [T; 3]) -> Self

Creates a field filled with identity matrices (scalar 1).

Each cell contains the identity element of the algebra.

Source

pub fn from_coefficients( mvs: &[CausalMultiVector<T>], shape: [usize; 3], dx: [T; 3], ) -> Self
where T: Neg<Output = T>,

Creates a field from a collection of CausalMultiVectors.

§Arguments
  • mvs - Flat array of multivectors in row-major order
  • shape - Grid dimensions [Nx, Ny, Nz]
  • dx - Grid spacing [dx, dy, dz]
Source

pub fn to_coefficients(&self) -> Vec<CausalMultiVector<T>>
where T: Neg<Output = T>,

Downloads the field to a collection of CausalMultiVectors.

Converts from Matrix Representation back to coefficient form using trace projection.

Source

pub fn compute_matrix_dim(n: usize) -> usize

Computes the matrix dimension for a given algebra dimension.

For Cl(p,q,r), the matrix dimension is 2^⌈N/2⌉ where N = p + q + r.

Source§

impl<T> CausalMultiField<T>
where T: Field + Copy + Default + PartialOrd,

Source

pub fn curl(&self) -> Self
where T: Ring + Neg<Output = T>,

Computes the curl: ∇ × F.

Returns the grade-2 component of the gradient ∇F.

Source

pub fn divergence(&self) -> Self
where T: Ring + Neg<Output = T>,

Computes the divergence: ∇ · F.

Returns the scalar part (Grade 0) of the gradient ∇F.

Source

pub fn gradient(&self) -> Self
where T: Ring + Neg<Output = T>,

Computes the gradient: ∇F.

Returns the full geometric derivative field (all grades).

Source

pub fn partial_derivative(&self, axis: Axis) -> CausalTensor<T>
where T: Ring,

Computes the partial derivative along a given axis.

Uses central difference: ∂F/∂x ≈ (F[x+1] - F[x-1]) / (2dx)

This implementation works on the flat data vector to avoid needing range-based slice operations.

Source§

impl<T> CausalMultiField<T>
where T: Field + Copy + Default + PartialOrd,

Source

pub fn grade_project(&self, k: usize) -> Self
where T: Neg<Output = T>,

Projects the field onto grade k: ⟨F⟩_k.

§Arguments
  • k - The grade to project onto (0=scalar, 1=vector, 2=bivector, etc.)
Source

pub fn scalar_part(&self) -> Self
where T: Neg<Output = T>,

Extracts the scalar part (grade 0): ⟨F⟩₀.

Source

pub fn vector_part(&self) -> Self
where T: Neg<Output = T>,

Extracts the vector part (grade 1): ⟨F⟩₁.

Source

pub fn bivector_part(&self) -> Self
where T: Neg<Output = T>,

Extracts the bivector part (grade 2): ⟨F⟩₂.

Source

pub fn trivector_part(&self) -> Self
where T: Neg<Output = T>,

Extracts the trivector part (grade 3): ⟨F⟩₃.

Source

pub fn pseudoscalar_part(&self) -> Self
where T: Neg<Output = T>,

Extracts the pseudoscalar part (highest grade).

Source§

impl<T> CausalMultiField<T>

Source

pub fn inner_product(&self, rhs: &Self) -> Self
where T: Neg<Output = T>,

Computes the inner product (grade-0 projection of geometric product).

Source

pub fn outer_product(&self, rhs: &Self) -> Self
where T: Neg<Output = T> + AddAssign + SubAssign,

Computes the outer product (wedge product).

Implemented via coefficient extraction and basis blade logic to ensure correctness for mixed-grade multivectors. (AB - BA)/2 is only valid for vectors.

Source

pub fn cross(&self, rhs: &Self) -> Self
where T: AddAssign + SubAssign + Neg<Output = T>,

Computes the cross product via Hodge dual of wedge.

A × B = -I(A ∧ B) where I is the pseudoscalar.

Source

pub fn hodge_dual(&self) -> Self
where T: AddAssign + SubAssign + Neg<Output = T>,

Applies the Hodge dual operation.

A* = A · I⁻¹ where I is the pseudoscalar.

Trait Implementations§

Source§

impl<T> Add for &CausalMultiField<T>
where T: Field + Copy + Default + PartialOrd,

Source§

type Output = CausalMultiField<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add for CausalMultiField<T>
where T: Field + Copy + Default + PartialOrd,

Source§

type Output = CausalMultiField<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<T: Clone> Clone for CausalMultiField<T>

Source§

fn clone(&self) -> CausalMultiField<T>

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: Debug> Debug for CausalMultiField<T>

Source§

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

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

impl<T> Mul<&CausalMultiField<T>> for CausalMultiField<T>

Source§

type Output = CausalMultiField<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &CausalMultiField<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul for &CausalMultiField<T>

Source§

type Output = CausalMultiField<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul for CausalMultiField<T>

Source§

type Output = CausalMultiField<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Neg for CausalMultiField<T>
where T: Field + Copy + Default + PartialOrd + Neg<Output = T>,

Source§

type Output = CausalMultiField<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<T> Sub for &CausalMultiField<T>
where T: Field + Copy + Default + PartialOrd,

Source§

type Output = CausalMultiField<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub for CausalMultiField<T>
where T: Field + Copy + Default + PartialOrd,

Source§

type Output = CausalMultiField<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Zero for CausalMultiField<T>
where T: Field + Copy + Default + PartialOrd + Zero + Neg<Output = T>,

Source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.

Auto Trait Implementations§

§

impl<T> Freeze for CausalMultiField<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for CausalMultiField<T>
where T: RefUnwindSafe,

§

impl<T> Send for CausalMultiField<T>
where T: Send,

§

impl<T> Sync for CausalMultiField<T>
where T: Sync,

§

impl<T> Unpin for CausalMultiField<T>
where T: Unpin,

§

impl<T> UnwindSafe for CausalMultiField<T>
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.
Source§

impl<T> AddGroup for T
where T: Sub<Output = T> + Add<Output = T> + Zero + Clone,

Source§

impl<T> Group for T
where T: AddGroup,

Source§

impl<T> MulMagma for T
where T: Mul<Output = T> + Clone,

Source§

impl<T> Satisfies<NoConstraint> for T