pub struct SparseInput<S, F>{ /* private fields */ }Expand description
Sparse NMF input backed by a matched (CSR, CSC) pair.
Validates non-negativity and finiteness once at construction, then computes
and caches ||V||_F^2.
Implementations§
Source§impl<S, F> SparseInput<S, F>where
S: BixverseNumeric + BixverseSimd + Into<F> + Float + Clone,
F: BixverseFloat + BixverseSimd + Sum,
impl<S, F> SparseInput<S, F>where
S: BixverseNumeric + BixverseSimd + Into<F> + Float + Clone,
F: BixverseFloat + BixverseSimd + Sum,
Sourcepub fn from_primary<T, U>(
matrix: &CompressedSparseData2<T, U>,
) -> Result<Self, MethodsErrors>
pub fn from_primary<T, U>( matrix: &CompressedSparseData2<T, U>, ) -> Result<Self, MethodsErrors>
Construct a SparseInput from the primary data layer of matrix.
Casts and validates data, derives the transpose, and builds the
matched (CSR, CSC) pair.
§Params
matrix- Source sparse matrix whosedatafield is used.
§Returns
A SparseInput, or MethodsErrors::NmfNonFinite /
MethodsErrors::NmfNonNegativeViolated if validation fails.
Sourcepub fn from_secondary<T, U>(
matrix: &CompressedSparseData2<T, U>,
) -> Result<Self, MethodsErrors>
pub fn from_secondary<T, U>( matrix: &CompressedSparseData2<T, U>, ) -> Result<Self, MethodsErrors>
Construct a SparseInput from the secondary data layer of matrix.
Casts and validates data_2, derives the transpose, and builds the
matched (CSR, CSC) pair. Intended for the log1p-normalised layer in the
single-cell case.
§Params
matrix- Source sparse matrix whosedata_2field is used.
§Returns
A SparseInput, or CoreErrors::Data2NotAvailable if
data_2 is absent, or MethodsErrors::NmfNonFinite /
MethodsErrors::NmfNonNegativeViolated if validation fails.
Sourcepub fn csr(&self) -> &CompressedSparseData2<S>
pub fn csr(&self) -> &CompressedSparseData2<S>
The CSR layout of V, used for V H^T.
Exposed so a GPU backend can upload the already-validated matched pair rather than rebuilding and revalidating it.
§Returns
A reference to the CSR layer.
Sourcepub fn csc(&self) -> &CompressedSparseData2<S>
pub fn csc(&self) -> &CompressedSparseData2<S>
Trait Implementations§
Source§impl<S, F> Debug for SparseInput<S, F>
impl<S, F> Debug for SparseInput<S, F>
Source§impl<S, F> NmfInput<F> for SparseInput<S, F>where
S: BixverseNumeric + BixverseSimd + Into<F> + Float + Clone + Sync,
F: BixverseFloat + BixverseSimd + Send + Sync + Sum,
NmfInput trait implementation for SparseInput
impl<S, F> NmfInput<F> for SparseInput<S, F>where
S: BixverseNumeric + BixverseSimd + Into<F> + Float + Clone + Sync,
F: BixverseFloat + BixverseSimd + Send + Sync + Sum,
NmfInput trait implementation for SparseInput
Source§fn top_k_svd(&self, k: usize) -> Result<SvdResults<F>, MethodsErrors>
fn top_k_svd(&self, k: usize) -> Result<SvdResults<F>, MethodsErrors>
Auto Trait Implementations§
impl<S, F> Freeze for SparseInput<S, F>
impl<S, F> RefUnwindSafe for SparseInput<S, F>
impl<S, F> Send for SparseInput<S, F>where
CompressedSparseData2<S>: Send,
impl<S, F> Sync for SparseInput<S, F>where
CompressedSparseData2<S>: Sync,
impl<S, F> Unpin for SparseInput<S, F>
impl<S, F> UnsafeUnpin for SparseInput<S, F>
impl<S, F> UnwindSafe for SparseInput<S, F>
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
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> ⓘ
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> ⓘ
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>
self from the equivalent element of its
superset. Read moreSource§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).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.