Struct pineappl::sparse_array3::SparseArray3
source · [−]pub struct SparseArray3<T> { /* private fields */ }
Expand description
Struct for a sparse three-dimensional array, which is optimized for the sparsity of interpolation grids.
Implementations
sourceimpl<T: Clone + Default + PartialEq> SparseArray3<T>
impl<T: Clone + Default + PartialEq> SparseArray3<T>
sourcepub fn new(nx: usize, ny: usize, nz: usize) -> Self
pub fn new(nx: usize, ny: usize, nz: usize) -> Self
Constructs a new and empty SparseArray3
with the specified dimensions nx
, ny
and
nz
.
sourcepub fn from_ndarray(array: &Array3<T>, xstart: usize, xsize: usize) -> Self
pub fn from_ndarray(array: &Array3<T>, xstart: usize, xsize: usize) -> Self
Converts array
into a SparseArray3
.
sourcepub fn dimensions(&self) -> (usize, usize, usize)
pub fn dimensions(&self) -> (usize, usize, usize)
Returns the dimensions of this array.
sourcepub fn overhead(&self) -> usize
pub fn overhead(&self) -> usize
Returns the overhead for storing the explicitly zero and non-zero elements.
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of non-default (non-zero) elements in this array.
sourcepub fn indexed_iter(&self) -> IndexedIter<'_, T>ⓘNotable traits for IndexedIter<'a, T>impl<'a, T: Default + PartialEq> Iterator for IndexedIter<'a, T> type Item = ((usize, usize, usize), &'a T);
pub fn indexed_iter(&self) -> IndexedIter<'_, T>ⓘNotable traits for IndexedIter<'a, T>impl<'a, T: Default + PartialEq> Iterator for IndexedIter<'a, T> type Item = ((usize, usize, usize), &'a T);
Return an indexed Iterator
over the non-zero elements of this array. The iterator element
type is ((usize, usize, usize), &T)
.
sourcepub fn iter_mut(&mut self) -> IterMut<'_, T>
pub fn iter_mut(&mut self) -> IterMut<'_, T>
Return an iterator over the elements, including zero elements.
sourcepub fn x_range(&self) -> Range<usize>
pub fn x_range(&self) -> Range<usize>
Return a half-open interval of indices that are filled for the first dimension.
sourcepub fn increase_x_at(&mut self, x: usize)
pub fn increase_x_at(&mut self, x: usize)
Increase the number of entries of the x-axis by one by inserting zeros at x
.
Trait Implementations
sourceimpl<T: Clone> Clone for SparseArray3<T>
impl<T: Clone> Clone for SparseArray3<T>
sourcefn clone(&self) -> SparseArray3<T>
fn clone(&self) -> SparseArray3<T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<'de, T> Deserialize<'de> for SparseArray3<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for SparseArray3<T>where
T: Deserialize<'de>,
sourcefn 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
sourceimpl<T> Index<[usize; 3]> for SparseArray3<T>
impl<T> Index<[usize; 3]> for SparseArray3<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for SparseArray3<T>where
T: RefUnwindSafe,
impl<T> Send for SparseArray3<T>where
T: Send,
impl<T> Sync for SparseArray3<T>where
T: Sync,
impl<T> Unpin for SparseArray3<T>where
T: Unpin,
impl<T> UnwindSafe for SparseArray3<T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more