Su3Adjoint

Struct Su3Adjoint 

Source
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>) -> Self
where 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

Source§

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

Source§

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

Source§

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 for Su3Adjoint

Source§

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 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 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 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

Source§

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

Source§

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

Source§

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

Source§

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];
Source§

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

Source§

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?
Source§

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

Source§

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?
Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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 for Su3Adjoint

Source§

fn eq(&self, other: &Su3Adjoint) -> 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 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

Source§

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

Source§

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

Source§

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 for Su3Adjoint

Source§

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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> ClosedAdd<Right> for T
where T: Add<Right, Output = T> + AddAssign<Right>,

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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