pub struct SparseAxis<T, U = T> {
pub indices: Vec<usize>,
pub data: Vec<T>,
pub data_2: Option<Vec<U>>,
pub cs_type: CompressedSparseFormat,
pub len: usize,
}Expand description
Generate structure to store sparse rows or columns
Fields§
§indices: Vec<usize>The indices of the values/non-zero positions
data: Vec<T>The values in the row/columns
data_2: Option<Vec<U>>An optional second data layer
cs_type: CompressedSparseFormatIs the data stored in Csr or Csc. Csr -> sparse row; Csc ->
sparse column
len: usizeTotal values in that dimension
Implementations§
Source§impl<T, U> SparseAxis<T, U>where
T: BixverseNumeric,
U: BixverseNumeric,
impl<T, U> SparseAxis<T, U>where
T: BixverseNumeric,
U: BixverseNumeric,
Sourcepub fn new_csc(
indices: Vec<usize>,
data: Vec<T>,
data_2: Option<Vec<U>>,
len: usize,
) -> SparseAxis<T, U>
pub fn new_csc( indices: Vec<usize>, data: Vec<T>, data_2: Option<Vec<U>>, len: usize, ) -> SparseAxis<T, U>
Generate a new SparseAxis in CSC format
§Params
indices- The indices of the values/non-zero positionsdata- The values in the row/columnsdata_2- An optional second data layerlen- Number of rows in this sparse column
Sourcepub fn get_indices_data_2(&self) -> Result<(&[usize], &[U]), CoreErrors>
pub fn get_indices_data_2(&self) -> Result<(&[usize], &[U]), CoreErrors>
Sourcepub fn from_vecs_to_csc(
indices: Vec<T>,
values: Vec<U>,
) -> Result<SparseAxis<T, U>, CoreErrors>
pub fn from_vecs_to_csc( indices: Vec<T>, values: Vec<U>, ) -> Result<SparseAxis<T, U>, CoreErrors>
Construct a SparseAxis in CSC format from index and value vectors.
Stores indices (converted to usize) in self.indices, leaves
data empty, and places values into data_2. Useful for building
single-target test fixtures and lightweight sparse columns where only
the float layer is needed.
§Params
indices- Non-zero positions (must be convertible tousize).values- Corresponding values, stored indata_2.
§Panics
Panics if indices and values differ in length.
Auto Trait Implementations§
impl<T, U> Freeze for SparseAxis<T, U>
impl<T, U> RefUnwindSafe for SparseAxis<T, U>
impl<T, U> Send for SparseAxis<T, U>
impl<T, U> Sync for SparseAxis<T, U>
impl<T, U> Unpin for SparseAxis<T, U>
impl<T, U> UnsafeUnpin for SparseAxis<T, U>
impl<T, U> UnwindSafe for SparseAxis<T, U>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§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 moreSource§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).Source§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.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.