pub struct Su3Adjoint { /* private fields */ }
Expand description

Adjoint representation of SU(3), it is su(3) (i.e. the lie algebra). See su3::GENERATORS to view the order of generators. Note that the generators are normalize such that Tr[T^a T^b] = \delta^{ab} / 2

Implementations§

source§

impl Su3Adjoint

source

pub const fn new(data: Vector8<Real>) -> Self

create a new Su3Adjoint representation where M = M^a T^a, where T are generators given in su3::GENERATORS.

Example
use lattice_qcd_rs::field::Su3Adjoint;
use nalgebra::SVector;

let su3 = Su3Adjoint::new(SVector::<f64, 8>::from_element(1_f64));
source

pub fn new_from_array(data: [Real; 8]) -> Self

create a new Su3Adjoint representation where M = M^a T^a, where T are generators given in su3::GENERATORS.

Example
let su3 = Su3Adjoint::new_from_array([0_f64; 8]);
source

pub const fn data(&self) -> &Vector8<Real>

get the data inside the Su3Adjoint.

source

pub const fn as_vector(&self) -> &Vector8<Real>

Get the su3 adjoint as a Vector8.

Example
let max = adj.as_vector().max();
let norm = adj.as_ref().norm();
source

pub fn as_vector_mut(&mut self) -> &mut Vector8<Real>

Get the su3 adjoint as mut ref to a Vector8.

Example
let mut adj = Su3Adjoint::default(); // filled with 0.
adj.as_vector_mut().apply(|el| *el += 1_f64);
assert_eq!(adj.as_vector(), &Vector8::from_element(1_f64));

adj.as_mut().set_magnitude(1_f64);

let mut v = Vector8::from_element(1_f64);
v.set_magnitude(1_f64);

assert_eq!(adj.as_vector(), &v);
source

pub fn to_matrix(self) -> Matrix3<Complex<Real>>

Returns the su(3) (Lie algebra) matrix.

Example
let su3 = Su3Adjoint::new_from_array([1_f64, 0_f64, 0_f64, 0_f64, 0_f64, 0_f64, 0_f64, 0_f64]);
assert_eq!(su3.to_matrix(), *lattice_qcd_rs::su3::GENERATORS[0]);
source

pub fn to_su3(self) -> Matrix3<Complex<Real>>

Return the SU(3) matrix associated with this generator. Note that the function consume self.

Example
let su3 = Su3Adjoint::new_from_array([1_f64, 0_f64, 0_f64, 0_f64, 0_f64, 0_f64, 0_f64, 0_f64]);
assert_eq!(su3.to_su3().determinant(), nalgebra::Complex::from(1_f64));
source

pub fn exp(self) -> Matrix3<Complex<Real>>

Return exp( T^a v^a) where v is self. Note that the function consume self.

source

pub fn random<Rng>(rng: &mut Rng, d: &impl Distribution<Real>) -> Selfwhere Rng: Rng + ?Sized,

Create a new random SU3 adjoint.

Example
use lattice_qcd_rs::field::Su3Adjoint;

let mut rng = rand::thread_rng();
let distribution = rand::distributions::Uniform::from(-1_f64..1_f64);
let su3 = Su3Adjoint::random(&mut rng, &distribution);
source

pub fn trace_squared(&self) -> Real

Returns the trace squared Tr(X^2).

It is more accurate and faster than computing

(m.to_matrix() * m.to_matrix()).trace().real();
source

pub fn t(&self) -> Real

Return the t coeff t = - 1/2 * Tr(X^2). If you are looking for the trace square use Self::trace_squared instead.

It is used for su3::su3_exp_i.

Example
let su3 = Su3Adjoint::from([1_f64; 8]);
let m = su3.to_matrix();
assert_eq!(
    nalgebra::Complex::new(su3.t(), 0_f64),
    -nalgebra::Complex::from(0.5_f64) * (m * m).trace()
);
source

pub fn d(&self) -> Complex<Real>

Return the t coeff d = i * det(X). Used for su3::su3_exp_i.

Example
let su3 = Su3Adjoint::from([1_f64; 8]);
let m = su3.to_matrix();
assert_eq!(
    su3.d(),
    nalgebra::Complex::new(0_f64, 1_f64) * m.determinant()
);
source

pub fn len(&self) -> usize

Return the number of data. This number is 8

assert_eq!(su3.len(), 8);
source

pub const fn len_const() -> usize

Return the number of data. This number is 8

let su3 = Su3Adjoint::new(nalgebra::SVector::<f64, 8>::zeros());
assert_eq!(Su3Adjoint::len_const(), su3.len());
source

pub fn iter( &self ) -> impl Iterator<Item = &Real> + ExactSizeIterator + FusedIterator

Get an iterator over the elements.

Example
let sum_abs = adj.iter().map(|el| el.abs()).sum::<f64>();
source

pub fn iter_mut( &mut self ) -> impl Iterator<Item = &mut Real> + ExactSizeIterator + FusedIterator

Get an iterator over the mutable ref of elements.

Example
adj.iter_mut().for_each(|el| *el = *el / 2_f64);
source

pub fn data_mut(&mut self) -> &mut Vector8<Real>

Get a mutable reference over the data.

Trait Implementations§

source§

impl Add<&Su3Adjoint> for &Su3Adjoint

§

type Output = Su3Adjoint

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<&Su3Adjoint> for Su3Adjoint

§

type Output = Su3Adjoint

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<Su3Adjoint> for &Su3Adjoint

§

type Output = Su3Adjoint

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<Su3Adjoint> for Su3Adjoint

§

type Output = Su3Adjoint

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl AddAssign<Su3Adjoint> for Su3Adjoint

source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
source§

impl AsMut<Matrix<f64, Const<8>, Const<1>, ArrayStorage<f64, 8, 1>>> for Su3Adjoint

source§

fn as_mut(&mut self) -> &mut Vector8<f64>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<Matrix<f64, Const<8>, Const<1>, ArrayStorage<f64, 8, 1>>> for Su3Adjoint

source§

fn as_ref(&self) -> &Vector8<f64>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for Su3Adjoint

source§

fn clone(&self) -> Su3Adjoint

Returns a copy 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 Debug for Su3Adjoint

source§

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

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

impl Default for Su3Adjoint

Return the representation for the zero matrix.

source§

fn default() -> Self

Return the representation for the zero matrix.

Example
assert_eq!(
    Su3Adjoint::default(),
    Su3Adjoint::new_from_array([0_f64; 8])
);
source§

impl<'de> Deserialize<'de> for Su3Adjoint

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Su3Adjoint

source§

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

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

impl Div<&f64> for &Su3Adjoint

§

type Output = Su3Adjoint

The resulting type after applying the / operator.
source§

fn div(self, rhs: &Real) -> Self::Output

Performs the / operation. Read more
source§

impl Div<&f64> for Su3Adjoint

§

type Output = Su3Adjoint

The resulting type after applying the / operator.
source§

fn div(self, rhs: &Real) -> Self::Output

Performs the / operation. Read more
source§

impl Div<f64> for &Su3Adjoint

§

type Output = Su3Adjoint

The resulting type after applying the / operator.
source§

fn div(self, rhs: Real) -> Self::Output

Performs the / operation. Read more
source§

impl Div<f64> for Su3Adjoint

§

type Output = Su3Adjoint

The resulting type after applying the / operator.
source§

fn div(self, rhs: Real) -> Self::Output

Performs the / operation. Read more
source§

impl DivAssign<&f64> for Su3Adjoint

source§

fn div_assign(&mut self, rhs: &f64)

Performs the /= operation. Read more
source§

impl DivAssign<f64> for Su3Adjoint

source§

fn div_assign(&mut self, rhs: f64)

Performs the /= operation. Read more
source§

impl From<&Su3Adjoint> for Vector8<Real>

source§

fn from(v: &Su3Adjoint) -> Self

Converts to this type from the input type.
source§

impl From<[f64; 8]> for Su3Adjoint

source§

fn from(v: [Real; 8]) -> Self

Converts to this type from the input type.
source§

impl From<Matrix<f64, Const<8>, Const<1>, ArrayStorage<f64, 8, 1>>> for Su3Adjoint

source§

fn from(v: Vector8<Real>) -> Self

Converts to this type from the input type.
source§

impl From<Su3Adjoint> for Vector8<Real>

source§

fn from(v: Su3Adjoint) -> Self

Converts to this type from the input type.
source§

impl Index<usize> for Su3Adjoint

source§

fn index(&self, pos: usize) -> &Self::Output

Get the element at position pos.

Panic

Panics if the position is out of bound (greater or equal to 8).

let su3 = Su3Adjoint::new_from_array([0_f64; 8]);
let _ = su3[8];
§

type Output = f64

The returned type after indexing.
source§

impl IndexMut<usize> for Su3Adjoint

source§

fn index_mut(&mut self, pos: usize) -> &mut Self::Output

Get the element at position pos.

Panic

Panics if the position is out of bound (greater or equal to 8).

let mut su3 = Su3Adjoint::new_from_array([0_f64; 8]);
su3[8] += 1_f64;
source§

impl<'a> IntoIterator for &'a Su3Adjoint

§

type IntoIter = <&'a Matrix<f64, Const<8>, Const<1>, ArrayStorage<f64, 8, 1>> as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
§

type Item = &'a f64

The type of the elements being iterated over.
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<'a> IntoIterator for &'a mut Su3Adjoint

§

type IntoIter = <&'a mut Matrix<f64, Const<8>, Const<1>, ArrayStorage<f64, 8, 1>> as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
§

type Item = &'a mut f64

The type of the elements being iterated over.
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl Mul<&Su3Adjoint> for &Real

§

type Output = Su3Adjoint

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl Mul<&Su3Adjoint> for Real

§

type Output = Su3Adjoint

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl Mul<&f64> for &Su3Adjoint

§

type Output = Su3Adjoint

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl Mul<&f64> for Su3Adjoint

§

type Output = Su3Adjoint

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl Mul<Su3Adjoint> for &Real

§

type Output = Su3Adjoint

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl Mul<Su3Adjoint> for Real

§

type Output = Su3Adjoint

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl Mul<f64> for &Su3Adjoint

§

type Output = Su3Adjoint

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl Mul<f64> for Su3Adjoint

§

type Output = Su3Adjoint

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl MulAssign<f64> for Su3Adjoint

source§

fn mul_assign(&mut self, rhs: f64)

Performs the *= operation. Read more
source§

impl Neg for &Su3Adjoint

§

type Output = Su3Adjoint

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl Neg for Su3Adjoint

§

type Output = Su3Adjoint

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl PartialEq<Su3Adjoint> for Su3Adjoint

source§

fn eq(&self, other: &Su3Adjoint) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Su3Adjoint

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Sub<&Su3Adjoint> for &Su3Adjoint

§

type Output = Su3Adjoint

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl Sub<&Su3Adjoint> for Su3Adjoint

§

type Output = Su3Adjoint

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl Sub<Su3Adjoint> for &Su3Adjoint

§

type Output = Su3Adjoint

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl Sub<Su3Adjoint> for Su3Adjoint

§

type Output = Su3Adjoint

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl SubAssign<Su3Adjoint> for Su3Adjoint

source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
source§

impl Copy for Su3Adjoint

source§

impl StructuralPartialEq for Su3Adjoint

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

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

§

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

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

fn is_in_subset(&self) -> bool

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

fn to_subset_unchecked(&self) -> SS

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

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T, Right> ClosedAdd<Right> for Twhere T: Add<Right, Output = T> + AddAssign<Right>,

§

impl<T, Right> ClosedDiv<Right> for Twhere T: Div<Right, Output = T> + DivAssign<Right>,

§

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

§

impl<T> ClosedNeg for Twhere T: Neg<Output = T>,

§

impl<T, Right> ClosedSub<Right> for Twhere T: Sub<Right, Output = T> + SubAssign<Right>,

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,

source§

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