Struct lattice_qcd_rs::statistics::distribution::CloseToUnit
source · pub struct CloseToUnit { /* private fields */ }
Expand description
used to generates matrix close the unit, for su2 close to +/-1, see su2::random_su2_close_to_unity
and for su(3) [su3::get_r] (+/- 1) * [su3::get_s] (+/- 1) * [su3::get_t] (+/- 1)
Example
use lattice_qcd_rs::error::ImplementationError;
use lattice_qcd_rs::statistics::CloseToUnit;
use nalgebra::{Complex, Matrix2, Matrix3};
use rand::{Rng, SeedableRng};
let mut rng = rand::rngs::StdRng::seed_from_u64(0);
let close_to_unit =
CloseToUnit::new(0.5_f64).ok_or(ImplementationError::OptionWithUnexpectedNone)?;
let r_matrix: Matrix2<Complex<f64>> = rng.sample(&close_to_unit);
let r_matrix: Matrix3<Complex<f64>> = rng.sample(&close_to_unit);
Implementations§
source§impl CloseToUnit
impl CloseToUnit
Trait Implementations§
source§impl Clone for CloseToUnit
impl Clone for CloseToUnit
source§fn clone(&self) -> CloseToUnit
fn clone(&self) -> CloseToUnit
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for CloseToUnit
impl Debug for CloseToUnit
source§impl<'de> Deserialize<'de> for CloseToUnit
impl<'de> Deserialize<'de> for CloseToUnit
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for CloseToUnit
impl Display for CloseToUnit
source§impl Distribution<Matrix<Complex<f64>, Const<2>, Const<2>, ArrayStorage<Complex<f64>, 2, 2>>> for CloseToUnit
impl Distribution<Matrix<Complex<f64>, Const<2>, Const<2>, ArrayStorage<Complex<f64>, 2, 2>>> for CloseToUnit
source§fn sample<R>(&self, rng: &mut R) -> CMatrix2where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> CMatrix2where R: Rng + ?Sized,
Generate a random value of
T
, using rng
as the source of randomness.source§impl Distribution<Matrix<Complex<f64>, Const<3>, Const<3>, ArrayStorage<Complex<f64>, 3, 3>>> for CloseToUnit
impl Distribution<Matrix<Complex<f64>, Const<3>, Const<3>, ArrayStorage<Complex<f64>, 3, 3>>> for CloseToUnit
source§fn sample<R>(&self, rng: &mut R) -> CMatrix3where
R: Rng + ?Sized,
fn sample<R>(&self, rng: &mut R) -> CMatrix3where R: Rng + ?Sized,
Generate a random value of
T
, using rng
as the source of randomness.source§impl PartialEq<CloseToUnit> for CloseToUnit
impl PartialEq<CloseToUnit> for CloseToUnit
source§fn eq(&self, other: &CloseToUnit) -> bool
fn eq(&self, other: &CloseToUnit) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for CloseToUnit
impl Serialize for CloseToUnit
impl Copy for CloseToUnit
impl StructuralPartialEq for CloseToUnit
Auto Trait Implementations§
impl RefUnwindSafe for CloseToUnit
impl Send for CloseToUnit
impl Sync for CloseToUnit
impl Unpin for CloseToUnit
impl UnwindSafe for CloseToUnit
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>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.