pub struct FeatureMatrix<T, const N_FEATURES: usize> { /* private fields */ }Expand description
Type-safe feature matrix with compile-time feature count validation
Implementations§
Source§impl<T, const N_FEATURES: usize> FeatureMatrix<T, N_FEATURES>
impl<T, const N_FEATURES: usize> FeatureMatrix<T, N_FEATURES>
Sourcepub fn new(data: Array2<T>) -> Result<Self>
pub fn new(data: Array2<T>) -> Result<Self>
Create a new feature matrix with compile-time feature count validation
Sourcepub unsafe fn new_unchecked(data: Array2<T>) -> Self
pub unsafe fn new_unchecked(data: Array2<T>) -> Self
Create a new feature matrix without validation (unsafe)
§Safety
The caller must ensure that data.ncols() == N_FEATURES
Sourcepub const fn n_features(&self) -> usize
pub const fn n_features(&self) -> usize
Get the number of features (always N_FEATURES)
Sourcepub fn view(&self) -> ArrayView2<'_, T>
pub fn view(&self) -> ArrayView2<'_, T>
Get a view of the underlying data
Sourcepub fn feature(&self, index: FeatureIndex<N_FEATURES>) -> ArrayView1<'_, T>
pub fn feature(&self, index: FeatureIndex<N_FEATURES>) -> ArrayView1<'_, T>
Get a feature column by type-safe index
Sourcepub fn select_features<const N_SELECTED: usize>(
&self,
mask: &FeatureMask<N_FEATURES>,
) -> Result<FeatureMatrix<T, N_SELECTED>>
pub fn select_features<const N_SELECTED: usize>( &self, mask: &FeatureMask<N_FEATURES>, ) -> Result<FeatureMatrix<T, N_SELECTED>>
Select features using a type-safe mask
Sourcepub fn to_dynamic(self) -> DynamicFeatureMatrix<T>
pub fn to_dynamic(self) -> DynamicFeatureMatrix<T>
Convert to a dynamic feature matrix
Trait Implementations§
Auto Trait Implementations§
impl<T, const N_FEATURES: usize> Freeze for FeatureMatrix<T, N_FEATURES>
impl<T, const N_FEATURES: usize> RefUnwindSafe for FeatureMatrix<T, N_FEATURES>where
ArrayBase<OwnedRepr<T>, Dim<[usize; 2]>>: RefUnwindSafe,
PhantomData<[T; N_FEATURES]>: RefUnwindSafe,
impl<T, const N_FEATURES: usize> Send for FeatureMatrix<T, N_FEATURES>
impl<T, const N_FEATURES: usize> Sync for FeatureMatrix<T, N_FEATURES>
impl<T, const N_FEATURES: usize> Unpin for FeatureMatrix<T, N_FEATURES>
impl<T, const N_FEATURES: usize> UnsafeUnpin for FeatureMatrix<T, N_FEATURES>where
ArrayBase<OwnedRepr<T>, Dim<[usize; 2]>>: UnsafeUnpin,
PhantomData<[T; N_FEATURES]>: UnsafeUnpin,
impl<T, const N_FEATURES: usize> UnwindSafe for FeatureMatrix<T, N_FEATURES>where
ArrayBase<OwnedRepr<T>, Dim<[usize; 2]>>: UnwindSafe,
PhantomData<[T; N_FEATURES]>: UnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.