Struct lattice_qcd_rs::lattice::LatticePoint
source · pub struct LatticePoint<const D: usize> { /* private fields */ }
Expand description
Represents point on a (any) lattice.
Implementations§
source§impl<const D: usize> LatticePoint<D>
impl<const D: usize> LatticePoint<D>
sourcepub const fn new(data: SVector<usize, D>) -> Self
pub const fn new(data: SVector<usize, D>) -> Self
Create a new lattice point.
It can be outside a lattice.
sourcepub fn from_fn<F>(f: F) -> Selfwhere
F: FnMut(usize) -> usize,
pub fn from_fn<F>(f: F) -> Selfwhere F: FnMut(usize) -> usize,
Create a point using the closure generate elements with the index as input.
sourcepub const fn len(&self) -> usize
pub const fn len(&self) -> usize
Number of elements in LatticePoint
. This is D
.
sourcepub const fn is_empty(&self) -> bool
pub const fn is_empty(&self) -> bool
Return if LatticePoint contain no data. True when the dimension is 0, false otherwise.
sourcepub fn iter(
&self
) -> impl Iterator<Item = &usize> + ExactSizeIterator + FusedIterator
pub fn iter( &self ) -> impl Iterator<Item = &usize> + ExactSizeIterator + FusedIterator
Get an iterator on the data.
sourcepub fn iter_mut(
&mut self
) -> impl Iterator<Item = &mut usize> + ExactSizeIterator + FusedIterator
pub fn iter_mut( &mut self ) -> impl Iterator<Item = &mut usize> + ExactSizeIterator + FusedIterator
Get an iterator on the data as mutable.
sourcepub const fn as_svector(&self) -> &SVector<usize, D>
pub const fn as_svector(&self) -> &SVector<usize, D>
Get the point as as nalgebra::SVector<usize, D>
Example
let max = point.as_svector().max();
let min = point.as_ref().min();
sourcepub fn as_svector_mut(&mut self) -> &mut SVector<usize, D>
pub fn as_svector_mut(&mut self) -> &mut SVector<usize, D>
Get the point as a mut ref to nalgebra::SVector<usize, D>
Example
point.as_svector_mut()[2] = 2;
point.as_mut()[0] = 1;
Trait Implementations§
source§impl<const D: usize> AsMut<Matrix<usize, Const<D>, Const<1>, ArrayStorage<usize, D, 1>>> for LatticePoint<D>
impl<const D: usize> AsMut<Matrix<usize, Const<D>, Const<1>, ArrayStorage<usize, D, 1>>> for LatticePoint<D>
source§impl<const D: usize> AsRef<Matrix<usize, Const<D>, Const<1>, ArrayStorage<usize, D, 1>>> for LatticePoint<D>
impl<const D: usize> AsRef<Matrix<usize, Const<D>, Const<1>, ArrayStorage<usize, D, 1>>> for LatticePoint<D>
source§impl<const D: usize> Clone for LatticePoint<D>
impl<const D: usize> Clone for LatticePoint<D>
source§fn clone(&self) -> LatticePoint<D>
fn clone(&self) -> LatticePoint<D>
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<const D: usize> Debug for LatticePoint<D>
impl<const D: usize> Debug for LatticePoint<D>
source§impl<const D: usize> Default for LatticePoint<D>
impl<const D: usize> Default for LatticePoint<D>
source§impl<'de, const D: usize> Deserialize<'de> for LatticePoint<D>
impl<'de, const D: usize> Deserialize<'de> for LatticePoint<D>
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<const D: usize> Display for LatticePoint<D>
impl<const D: usize> Display for LatticePoint<D>
source§impl<const D: usize> From<LatticePoint<D>> for [usize; D]where
SVector<usize, D>: Into<[usize; D]>,
impl<const D: usize> From<LatticePoint<D>> for [usize; D]where SVector<usize, D>: Into<[usize; D]>,
source§impl<const D: usize> Hash for LatticePoint<D>
impl<const D: usize> Hash for LatticePoint<D>
source§impl<'a, const D: usize> IntoIterator for &'a LatticePoint<D>
impl<'a, const D: usize> IntoIterator for &'a LatticePoint<D>
§type IntoIter = <&'a Matrix<usize, Const<D>, Const<1>, ArrayStorage<usize, D, 1>> as IntoIterator>::IntoIter
type IntoIter = <&'a Matrix<usize, Const<D>, Const<1>, ArrayStorage<usize, D, 1>> as IntoIterator>::IntoIter
Which kind of iterator are we turning this into?
source§impl<'a, const D: usize> IntoIterator for &'a mut LatticePoint<D>
impl<'a, const D: usize> IntoIterator for &'a mut LatticePoint<D>
§type IntoIter = <&'a mut Matrix<usize, Const<D>, Const<1>, ArrayStorage<usize, D, 1>> as IntoIterator>::IntoIter
type IntoIter = <&'a mut Matrix<usize, Const<D>, Const<1>, ArrayStorage<usize, D, 1>> as IntoIterator>::IntoIter
Which kind of iterator are we turning this into?
source§impl<const D: usize> LatticeElementToIndex<D> for LatticePoint<D>
impl<const D: usize> LatticeElementToIndex<D> for LatticePoint<D>
source§fn to_index(&self, l: &LatticeCyclic<D>) -> usize
fn to_index(&self, l: &LatticeCyclic<D>) -> usize
Given a lattice return an index from the element
source§impl<const D: usize> PartialEq<LatticePoint<D>> for LatticePoint<D>
impl<const D: usize> PartialEq<LatticePoint<D>> for LatticePoint<D>
source§fn eq(&self, other: &LatticePoint<D>) -> bool
fn eq(&self, other: &LatticePoint<D>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<const D: usize> PartialOrd<LatticePoint<D>> for LatticePoint<D>
impl<const D: usize> PartialOrd<LatticePoint<D>> for LatticePoint<D>
source§fn partial_cmp(&self, other: &LatticePoint<D>) -> Option<Ordering>
fn partial_cmp(&self, other: &LatticePoint<D>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<const D: usize> Serialize for LatticePoint<D>
impl<const D: usize> Serialize for LatticePoint<D>
impl<const D: usize> Copy for LatticePoint<D>
impl<const D: usize> Eq for LatticePoint<D>
impl<const D: usize> StructuralEq for LatticePoint<D>
impl<const D: usize> StructuralPartialEq for LatticePoint<D>
Auto Trait Implementations§
impl<const D: usize> RefUnwindSafe for LatticePoint<D>
impl<const D: usize> Send for LatticePoint<D>
impl<const D: usize> Sync for LatticePoint<D>
impl<const D: usize> Unpin for LatticePoint<D>
impl<const D: usize> UnwindSafe for LatticePoint<D>
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.