Struct lattice_qcd_rs::field::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
impl Su3Adjoint
sourcepub const fn new(data: Vector8<Real>) -> Self
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));
sourcepub fn new_from_array(data: [Real; 8]) -> Self
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]);
sourcepub fn as_vector_mut(&mut self) -> &mut Vector8<Real>
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);
sourcepub fn to_matrix(self) -> Matrix3<Complex<Real>>
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]);
sourcepub fn to_su3(self) -> Matrix3<Complex<Real>>
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));
sourcepub fn exp(self) -> Matrix3<Complex<Real>>
pub fn exp(self) -> Matrix3<Complex<Real>>
Return exp( T^a v^a) where v is self. Note that the function consume self.
sourcepub fn random<Rng>(rng: &mut Rng, d: &impl Distribution<Real>) -> Selfwhere
Rng: Rng + ?Sized,
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);
sourcepub fn trace_squared(&self) -> Real
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();
sourcepub fn t(&self) -> Real
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()
);
sourcepub fn d(&self) -> Complex<Real>
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()
);
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Return the number of data. This number is 8
assert_eq!(su3.len(), 8);
sourcepub const fn len_const() -> usize
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());
sourcepub fn iter(
&self
) -> impl Iterator<Item = &Real> + ExactSizeIterator + FusedIterator
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>();
sourcepub fn iter_mut(
&mut self
) -> impl Iterator<Item = &mut Real> + ExactSizeIterator + FusedIterator
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);
Trait Implementations§
source§impl Add<&Su3Adjoint> for &Su3Adjoint
impl Add<&Su3Adjoint> for &Su3Adjoint
§type Output = Su3Adjoint
type Output = Su3Adjoint
+
operator.source§impl Add<&Su3Adjoint> for Su3Adjoint
impl Add<&Su3Adjoint> for Su3Adjoint
source§impl Add<Su3Adjoint> for &Su3Adjoint
impl Add<Su3Adjoint> for &Su3Adjoint
§type Output = Su3Adjoint
type Output = Su3Adjoint
+
operator.source§impl Add<Su3Adjoint> for Su3Adjoint
impl Add<Su3Adjoint> for Su3Adjoint
source§impl AddAssign<Su3Adjoint> for Su3Adjoint
impl AddAssign<Su3Adjoint> for Su3Adjoint
source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
+=
operation. Read moresource§impl AsMut<Matrix<f64, Const<8>, Const<1>, ArrayStorage<f64, 8, 1>>> for Su3Adjoint
impl AsMut<Matrix<f64, Const<8>, Const<1>, ArrayStorage<f64, 8, 1>>> for Su3Adjoint
source§impl AsRef<Matrix<f64, Const<8>, Const<1>, ArrayStorage<f64, 8, 1>>> for Su3Adjoint
impl AsRef<Matrix<f64, Const<8>, Const<1>, ArrayStorage<f64, 8, 1>>> for Su3Adjoint
source§impl Clone for Su3Adjoint
impl Clone for Su3Adjoint
source§fn clone(&self) -> Su3Adjoint
fn clone(&self) -> Su3Adjoint
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Su3Adjoint
impl Debug for Su3Adjoint
source§impl Default for Su3Adjoint
impl Default for Su3Adjoint
Return the representation for the zero matrix.
source§impl<'de> Deserialize<'de> for Su3Adjoint
impl<'de> Deserialize<'de> for Su3Adjoint
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl Display for Su3Adjoint
impl Display for Su3Adjoint
source§impl Div<&f64> for &Su3Adjoint
impl Div<&f64> for &Su3Adjoint
source§impl Div<&f64> for Su3Adjoint
impl Div<&f64> for Su3Adjoint
source§impl Div<f64> for &Su3Adjoint
impl Div<f64> for &Su3Adjoint
source§impl Div<f64> for Su3Adjoint
impl Div<f64> for Su3Adjoint
source§impl DivAssign<&f64> for Su3Adjoint
impl DivAssign<&f64> for Su3Adjoint
source§fn div_assign(&mut self, rhs: &f64)
fn div_assign(&mut self, rhs: &f64)
/=
operation. Read moresource§impl DivAssign<f64> for Su3Adjoint
impl DivAssign<f64> for Su3Adjoint
source§fn div_assign(&mut self, rhs: f64)
fn div_assign(&mut self, rhs: f64)
/=
operation. Read moresource§impl From<&Su3Adjoint> for Vector8<Real>
impl From<&Su3Adjoint> for Vector8<Real>
source§fn from(v: &Su3Adjoint) -> Self
fn from(v: &Su3Adjoint) -> Self
source§impl From<Matrix<f64, Const<8>, Const<1>, ArrayStorage<f64, 8, 1>>> for Su3Adjoint
impl From<Matrix<f64, Const<8>, Const<1>, ArrayStorage<f64, 8, 1>>> for Su3Adjoint
source§impl From<Su3Adjoint> for Vector8<Real>
impl From<Su3Adjoint> for Vector8<Real>
source§fn from(v: Su3Adjoint) -> Self
fn from(v: Su3Adjoint) -> Self
source§impl Index<usize> for Su3Adjoint
impl Index<usize> for Su3Adjoint
source§impl IndexMut<usize> for Su3Adjoint
impl IndexMut<usize> for Su3Adjoint
source§impl<'a> IntoIterator for &'a Su3Adjoint
impl<'a> IntoIterator for &'a Su3Adjoint
§type IntoIter = <&'a Matrix<f64, Const<8>, Const<1>, ArrayStorage<f64, 8, 1>> as IntoIterator>::IntoIter
type IntoIter = <&'a Matrix<f64, Const<8>, Const<1>, ArrayStorage<f64, 8, 1>> as IntoIterator>::IntoIter
source§impl<'a> IntoIterator for &'a mut Su3Adjoint
impl<'a> IntoIterator for &'a mut Su3Adjoint
§type IntoIter = <&'a mut Matrix<f64, Const<8>, Const<1>, ArrayStorage<f64, 8, 1>> as IntoIterator>::IntoIter
type IntoIter = <&'a mut Matrix<f64, Const<8>, Const<1>, ArrayStorage<f64, 8, 1>> as IntoIterator>::IntoIter
source§impl Mul<&Su3Adjoint> for &Real
impl Mul<&Su3Adjoint> for &Real
§type Output = Su3Adjoint
type Output = Su3Adjoint
*
operator.source§impl Mul<&Su3Adjoint> for Real
impl Mul<&Su3Adjoint> for Real
§type Output = Su3Adjoint
type Output = Su3Adjoint
*
operator.source§impl Mul<&f64> for &Su3Adjoint
impl Mul<&f64> for &Su3Adjoint
source§impl Mul<&f64> for Su3Adjoint
impl Mul<&f64> for Su3Adjoint
source§impl Mul<Su3Adjoint> for &Real
impl Mul<Su3Adjoint> for &Real
§type Output = Su3Adjoint
type Output = Su3Adjoint
*
operator.source§impl Mul<Su3Adjoint> for Real
impl Mul<Su3Adjoint> for Real
§type Output = Su3Adjoint
type Output = Su3Adjoint
*
operator.source§impl Mul<f64> for &Su3Adjoint
impl Mul<f64> for &Su3Adjoint
source§impl Mul<f64> for Su3Adjoint
impl Mul<f64> for Su3Adjoint
source§impl MulAssign<f64> for Su3Adjoint
impl MulAssign<f64> for Su3Adjoint
source§fn mul_assign(&mut self, rhs: f64)
fn mul_assign(&mut self, rhs: f64)
*=
operation. Read moresource§impl Neg for &Su3Adjoint
impl Neg for &Su3Adjoint
source§impl Neg for Su3Adjoint
impl Neg for Su3Adjoint
source§impl PartialEq<Su3Adjoint> for Su3Adjoint
impl PartialEq<Su3Adjoint> for Su3Adjoint
source§fn eq(&self, other: &Su3Adjoint) -> bool
fn eq(&self, other: &Su3Adjoint) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for Su3Adjoint
impl Serialize for Su3Adjoint
source§impl Sub<&Su3Adjoint> for &Su3Adjoint
impl Sub<&Su3Adjoint> for &Su3Adjoint
§type Output = Su3Adjoint
type Output = Su3Adjoint
-
operator.source§impl Sub<&Su3Adjoint> for Su3Adjoint
impl Sub<&Su3Adjoint> for Su3Adjoint
source§impl Sub<Su3Adjoint> for &Su3Adjoint
impl Sub<Su3Adjoint> for &Su3Adjoint
§type Output = Su3Adjoint
type Output = Su3Adjoint
-
operator.source§impl Sub<Su3Adjoint> for Su3Adjoint
impl Sub<Su3Adjoint> for Su3Adjoint
source§impl SubAssign<Su3Adjoint> for Su3Adjoint
impl SubAssign<Su3Adjoint> for Su3Adjoint
source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
-=
operation. Read moreimpl Copy for Su3Adjoint
impl StructuralPartialEq for Su3Adjoint
Auto Trait Implementations§
impl RefUnwindSafe for Su3Adjoint
impl Send for Su3Adjoint
impl Sync for Su3Adjoint
impl Unpin for Su3Adjoint
impl UnwindSafe for Su3Adjoint
Blanket Implementations§
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.