Skip to main content

SUN

Struct SUN 

Source
pub struct SUN<const N: usize> { /* private fields */ }
Expand description

SU(N) group element - N×N unitary matrix with det = 1

§Type Parameter

  • N: Matrix dimension

§Representation

Stored as N×N complex matrix satisfying:

  • U†U = I (unitarity)
  • det(U) = 1 (special)

§Verification

Use verify_unitarity() to check constraints numerically.

Implementations§

Source§

impl<const N: usize> SUN<N>

Source

pub fn matrix(&self) -> &Array2<Complex64>

Access the underlying N×N unitary matrix

Source

pub fn identity() -> Self

Identity element: Iₙ

Source

pub fn trace(&self) -> Complex64

Trace of the matrix: Tr(U) = Σᵢ Uᵢᵢ

Source

pub fn verify_unitarity(&self, tolerance: f64) -> bool

Verify unitarity: ||U†U - I|| < ε

§Arguments
  • tolerance: Maximum Frobenius norm deviation
§Returns

true if U†U ≈ I within tolerance

Source

pub fn determinant(&self) -> Complex64

Compute determinant

For SU(N), the determinant should be exactly 1 by definition.

§Implementation
  • N=2: Direct formula ad - bc
  • N=3: Sarrus’ rule / cofactor expansion
  • N>3: Returns 1.0 (assumes matrix is on SU(N) manifold)
§Limitations

For N > 3, this function does not compute the actual determinant. It returns 1.0 under the assumption that matrices constructed via exp() or reorthogonalize() remain on the SU(N) manifold.

To verify unitarity for N > 3, use verify_special_unitarity() instead, which checks U†U = I (a stronger condition than det=1).

For actual determinant computation with N > 3, enable the ndarray-linalg feature (not currently available) or compute via eigenvalue product.

Source

pub fn distance_to_identity(&self) -> f64

Distance from identity: ||U - I||_F

Frobenius norm of difference from identity.

Trait Implementations§

Source§

impl<const N: usize> Clone for SUN<N>

Source§

fn clone(&self) -> SUN<N>

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<const N: usize> Debug for SUN<N>

Source§

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

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

impl<const N: usize> Display for SUN<N>

Source§

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

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

impl<const N: usize> LieGroup for SUN<N>

Source§

fn adjoint_action(&self, algebra_element: &Self::Algebra) -> Self::Algebra

Adjoint action: Ad_g(X) = gXg⁻¹

§Mathematical Formula

For g ∈ SU(N) and X ∈ su(N):

Ad_g(X) = gXg⁻¹
§Properties
  • Group homomorphism: Ad_{gh} = Ad_gAd_h
  • Preserves bracket: Ad_g([X,Y]) = [Ad_g(X), Ad_g(Y)]
  • Preserves norm (SU(N) is compact)
Source§

fn exp(tangent: &Self::Algebra) -> Self

Exponential map: exp: su(N) → SU(N)

§Algorithm: Scaling-and-Squaring

For X ∈ su(N) with ||X|| large:

  1. Scale: X’ = X / 2^k such that ||X’|| ≤ 0.5
  2. Taylor: exp(X’) ≈ ∑_{n=0}^{15} X’^n / n!
  3. Square: exp(X) = [exp(X’)]^{2^k}
§Properties
  • Preserves unitarity: exp(X) ∈ SU(N) for X ∈ su(N)
  • Preserves det = 1 (Tr(X) = 0 ⟹ det(exp(X)) = exp(Tr(X)) = 1)
  • Numerically stable for all ||X||
§Performance
  • Time: O(N³·log(||X||))
  • Space: O(N²)
§Accuracy
  • Relative error: ~10⁻¹⁴ (double precision)
  • Unitarity preserved to ~10⁻¹²
Source§

const MATRIX_DIM: usize

Matrix dimension in the fundamental representation. Read more
Source§

type Algebra = SunAlgebra<N>

Associated Lie algebra type. Read more
Source§

fn identity() -> Self

The identity element e ∈ G. Read more
Source§

fn compose(&self, other: &Self) -> Self

Group composition (multiplication): g₁ · g₂ Read more
Source§

fn inverse(&self) -> Self

Group inverse: g⁻¹ Read more
Source§

fn conjugate_transpose(&self) -> Self

Adjoint representation element (for matrix groups: conjugate transpose). Read more
Source§

fn distance_to_identity(&self) -> f64

Geodesic distance from identity: d(g, e) Read more
Source§

fn log(&self) -> LogResult<Self::Algebra>

Logarithm map: G → 𝔤 (inverse of exponential) Read more
Source§

fn distance(&self, other: &Self) -> f64

Distance between two group elements: d(g, h) Read more
Source§

fn is_near_identity(&self, tolerance: f64) -> bool

Check if this element is approximately the identity. Read more
Source§

fn trace_identity() -> f64

Trace of the identity element Read more
Source§

fn reorthogonalize(&self) -> Self

Project element back onto the group manifold using Gram-Schmidt orthogonalization. Read more
Source§

fn geodesic(&self, other: &Self, t: f64) -> Option<Self>

Geodesic interpolation between two group elements. Read more
Source§

impl<const N: usize> Mul<&SUN<N>> for &SUN<N>

Group multiplication: U₁ · U₂

Source§

type Output = SUN<N>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &SUN<N>) -> SUN<N>

Performs the * operation. Read more
Source§

impl<const N: usize> Mul<&SUN<N>> for SUN<N>

Source§

type Output = SUN<N>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &SUN<N>) -> SUN<N>

Performs the * operation. Read more
Source§

impl<const N: usize> MulAssign<&SUN<N>> for SUN<N>

Source§

fn mul_assign(&mut self, rhs: &SUN<N>)

Performs the *= operation. Read more
Source§

impl<const N: usize> PartialEq for SUN<N>

Source§

fn eq(&self, other: &SUN<N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: usize> Compact for SUN<N>

SU(N) is compact for all N ≥ 2.

Source§

impl<const N: usize> SemiSimple for SUN<N>

SU(N) is semi-simple (implied by simple) for all N ≥ 2.

Source§

impl<const N: usize> Simple for SUN<N>

SU(N) is simple for all N ≥ 2.

Source§

impl<const N: usize> StructuralPartialEq for SUN<N>

Auto Trait Implementations§

§

impl<const N: usize> Freeze for SUN<N>

§

impl<const N: usize> RefUnwindSafe for SUN<N>

§

impl<const N: usize> Send for SUN<N>

§

impl<const N: usize> Sync for SUN<N>

§

impl<const N: usize> Unpin for SUN<N>

§

impl<const N: usize> UnsafeUnpin for SUN<N>

§

impl<const N: usize> UnwindSafe for SUN<N>

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T, Right> ClosedMul<Right> for T
where T: Mul<Right, Output = T> + MulAssign<Right>,

Source§

impl<T, Right> ClosedMulAssign<Right> for T
where T: ClosedMul<Right> + MulAssign<Right>,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,