lazymatrix::EagerMatrix
LazyMatrix for Rust · 0.8.1
pub struct EagerMatrix<M, F = f64>An eagerly normalized dense matrix with its original fitted parameters.
The underlying data already contains normalized values. Operations delegate directly to it without applying the retained parameters again. Materializing entries changes arithmetic order relative to lazy products, so results may differ through rounding and IEEE nonfinite arithmetic. Available capabilities and operational errors come from the selected dense backend, rather than the original input. Statistics describe the normalized data.
Inherent implementation
impl<M: MatrixShape, F: Scalar> EagerMatrix<M, F>centers
pub fn centers(&self) -> Option<&[F]>Original fitted centers, already applied to the data.
column
pub fn column(
&self,
j: usize
) -> LazyColumn<<M as RawColumns>::Column<'_>, F> where M: RawColumns<F>Borrow a logical column of the already normalized data.
Its center and scale are zero and one, respectively. The fitted parameters returned by the matrix accessors are metadata only.
data
pub fn data(&self) -> &MBorrow the already normalized backend data.
into_parts
pub fn into_parts(self) -> (M, Option<Vec<F>>, Option<Vec<F>>)Recover normalized data and original fitted center and scale vectors.
ncols
pub fn ncols(&self) -> usizeNumber of columns of the normalized matrix.
normalization
pub fn normalization(&self) -> &NormalizationParams<F>Borrow the original fitted normalization, for example for prediction.
nrows
pub fn nrows(&self) -> usizeNumber of rows of the normalized matrix.
scales
pub fn scales(&self) -> Option<&[F]>Original fitted scales, already applied to the data.
Implementation of Clone
impl<M: core::clone::Clone, F: core::clone::Clone> Clone for EagerMatrix<M, F>clone
fn clone(&self) -> SelfImplementation of ColumnStats
impl<M, F, T> ColumnStats<F> for EagerMatrix<M, T> where M: ColumnStats<F>, F: Scalarcol_l1
fn col_l1(&self) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>col_l1_centered
fn col_l1_centered(
&self,
centers: &[F]
) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>col_l2
fn col_l2(&self) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>col_l2_centered
fn col_l2_centered(
&self,
centers: &[F]
) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>col_maxabs
fn col_maxabs(&self) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>col_maxabs_centered
fn col_maxabs_centered(
&self,
centers: &[F]
) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>col_means
fn col_means(&self) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>col_mins
fn col_mins(&self) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>col_ranges
fn col_ranges(&self) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>col_sds
fn col_sds(&self) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>normalization_stats
fn normalization_stats(
&self,
spec: Normalization
) -> Result<lazymatrix::NormalizationStats<F>, <Self as MatrixErrorType>::Error>Implementation of Columns
impl<M: RawColumns<F>, F: Scalar> Columns<F> for EagerMatrix<M, F>Column
type Column<'a> = LazyColumn<<M as RawColumns<F>>::Column<'a>, F> where Self: 'a;column
fn column(&self, j: usize) -> <Self as Columns>::Column<'_>Implementation of Debug
impl<M: core::fmt::Debug, F: core::fmt::Debug> Debug for EagerMatrix<M, F>fmt
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::ResultImplementation of MatMatInto
impl<M: lazymatrix::MatMatInto<F>, F: Scalar, T> MatMatInto<F> for EagerMatrix<M, T>matmat_into
fn matmat_into<R, O>(
&self,
rhs: &R,
out: &mut O
) -> Result<(), <Self as MatrixErrorType>::Error> where R: lazymatrix::MatrixRead<F> + ?Sized, O: lazymatrix::MatrixRead<F> + MatrixWrite<F> + ?Sizedmatmat_normalized_into
fn matmat_normalized_into<R, O>(
&self,
rhs: &R,
centers: Option<&[F]>,
scales: Option<&[F]>,
out: &mut O
) -> Result<(), <Self as MatrixErrorType>::Error> where R: lazymatrix::MatrixRead<F> + ?Sized, O: lazymatrix::MatrixRead<F> + MatrixWrite<F> + ?SizedImplementation of MatTransposeMatInto
impl<M: lazymatrix::MatTransposeMatInto<F>, F: Scalar, T> MatTransposeMatInto<F> for EagerMatrix<M, T>mat_transpose_mat_into
fn mat_transpose_mat_into<R, O>(
&self,
rhs: &R,
out: &mut O
) -> Result<(), <Self as MatrixErrorType>::Error> where R: lazymatrix::MatrixRead<F> + ?Sized, O: lazymatrix::MatrixRead<F> + MatrixWrite<F> + ?Sizedmat_transpose_mat_normalized_into
fn mat_transpose_mat_normalized_into<R, O>(
&self,
rhs: &R,
centers: Option<&[F]>,
scales: Option<&[F]>,
out: &mut O
) -> Result<(), <Self as MatrixErrorType>::Error> where R: lazymatrix::MatrixRead<F> + ?Sized, O: lazymatrix::MatrixRead<F> + MatrixWrite<F> + ?SizedImplementation of MatTransposeVec
impl<M, V, T> MatTransposeVec<V> for EagerMatrix<M, T> where M: MatTransposeVec<V>mat_transpose_vec
fn mat_transpose_vec(
&self,
x: &V
) -> Result<V, <Self as MatrixErrorType>::Error>mat_transpose_vec_normalized
fn mat_transpose_vec_normalized<F: lazymatrix::Scalar>(
&self,
x: &V,
centers: Option<&[F]>,
scales: Option<&[F]>
) -> Result<V, <Self as MatrixErrorType>::Error> where V: lazymatrix::SumEntries<F> + lazymatrix::ScaledSubSlice<F> + lazymatrix::ElemDivAssign<F>Implementation of MatTransposeVecInto
impl<M, X, Y, T> MatTransposeVecInto<X, Y> for EagerMatrix<M, T> where M: MatTransposeVecInto<X, Y>mat_transpose_vec_into
fn mat_transpose_vec_into(
&self,
x: &X,
out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error>mat_transpose_vec_normalized_into
fn mat_transpose_vec_normalized_into<F: Scalar>(
&self,
x: &X,
centers: Option<&[F]>,
scales: Option<&[F]>,
out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error> where X: SumEntries<F>, Y: ScaledSubSlice<F> + ElemDivAssign<F>Implementation of MatTransposeVecScaledInto
impl<M, X, Y, F, T> MatTransposeVecScaledInto<X, Y, F> for EagerMatrix<M, T> where M: MatTransposeVecScaledInto<X, Y, F>mat_transpose_vec_scaled_into
fn mat_transpose_vec_scaled_into(
&self,
alpha: F,
x: &X,
beta: F,
out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error>try_mat_transpose_vec_scaled_normalized_into
fn try_mat_transpose_vec_scaled_normalized_into(
&self,
alpha: F,
x: &X,
beta: F,
centers: Option<&[F]>,
scales: Option<&[F]>,
out: &mut Y
) -> Option<Result<(), <Self as MatrixErrorType>::Error>> where F: lazymatrix::Scalar, X: lazymatrix::VectorView<F>, Y: lazymatrix::VectorViewMut<F>Implementation of MatVec
impl<M, V, T> MatVec<V> for EagerMatrix<M, T> where M: MatVec<V>matvec
fn matvec(&self, x: &V) -> Result<V, <Self as MatrixErrorType>::Error>matvec_normalized
fn matvec_normalized<F: lazymatrix::Scalar>(
&self,
x: &V,
centers: Option<&[F]>,
scales: Option<&[F]>
) -> Result<V, <Self as MatrixErrorType>::Error> where V: Clone + lazymatrix::ElemDivAssign<F> + lazymatrix::DotSlice<F> + lazymatrix::SubScalarAssign<F>Implementation of MatVecInto
impl<M, X, Y, T> MatVecInto<X, Y> for EagerMatrix<M, T> where M: MatVecInto<X, Y>matvec_into
fn matvec_into(
&self,
x: &X,
out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error>matvec_normalized_into
fn matvec_normalized_into<F: Scalar>(
&self,
x: &X,
centers: Option<&[F]>,
scales: Option<&[F]>,
out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error> where X: Clone + ElemDivAssign<F> + DotSlice<F>, Y: SubScalarAssign<F>Implementation of MatVecScaledInto
impl<M, X, Y, F, T> MatVecScaledInto<X, Y, F> for EagerMatrix<M, T> where M: MatVecScaledInto<X, Y, F>matvec_scaled_into
fn matvec_scaled_into(
&self,
alpha: F,
x: &X,
beta: F,
out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error>try_matvec_scaled_normalized_into
fn try_matvec_scaled_normalized_into(
&self,
alpha: F,
x: &X,
beta: F,
centers: Option<&[F]>,
scales: Option<&[F]>,
out: &mut Y
) -> Option<Result<(), <Self as MatrixErrorType>::Error>> where F: lazymatrix::Scalar, X: lazymatrix::VectorView<F>, Y: lazymatrix::VectorViewMut<F>Implementation of MaterializeDense
impl<M: MaterializeDense<F>, F: Scalar, T> MaterializeDense<F> for EagerMatrix<M, T>materialize_normalized_into
fn materialize_normalized_into<O: MatrixWrite<F> + ?Sized>(
&self,
centers: Option<&[F]>,
scales: Option<&[F]>,
out: &mut O
) -> Result<(), <Self as MatrixErrorType>::Error>Implementation of MatrixErrorType
impl<M: MatrixErrorType, T> MatrixErrorType for EagerMatrix<M, T>Error
type Error = <M as MatrixErrorType>::Error;Implementation of MatrixShape
impl<M: MatrixShape, T> MatrixShape for EagerMatrix<M, T>ncols
fn ncols(&self) -> usizenrows
fn nrows(&self) -> usizeImplementation of RawColumns
impl<M, F, T> RawColumns<F> for EagerMatrix<M, T> where M: RawColumns<F>, F: ScalarColumn
type Column<'a> = <M as RawColumns<F>>::Column<'a> where Self: 'a;raw_column
fn raw_column(&self, j: usize) -> <Self as RawColumns>::Column<'_>Implementation of WeightedColumnSumsInto
impl<M: WeightedColumnSumsInto<F>, F: Scalar, T> WeightedColumnSumsInto<F> for EagerMatrix<M, T>weighted_column_sums_into
fn weighted_column_sums_into<W, O>(
&self,
weights: &W,
out: &mut O
) -> Result<(), <Self as MatrixErrorType>::Error> where W: VectorView<F> + ?Sized, O: VectorViewMut<F> + ?SizedImplementation of WeightedColumnSumsKernel
impl<M: WeightedColumnSumsKernel<F>, F: Scalar, T> WeightedColumnSumsKernel<F> for EagerMatrix<M, T>weighted_column_sums_normalized_into
fn weighted_column_sums_normalized_into<W, O>(
&self,
weights: &W,
centers: Option<&[F]>,
scales: Option<&[F]>,
out: &mut O
) -> Result<(), <Self as MatrixErrorType>::Error> where W: VectorView<F> + ?Sized, O: VectorViewMut<F> + ?SizedImplementation of WeightedGramInto
impl<M, F, T> WeightedGramInto<F> for EagerMatrix<M, T> where M: WeightedGramInto<F>, F: Scalarweighted_gram_into
fn weighted_gram_into<W, O>(
&self,
weights: &W,
out: &mut O
) -> Result<(), <Self as MatrixErrorType>::Error> where W: VectorView<F> + ?Sized, O: MatrixWrite<F> + ?SizedImplementation of WeightedGramKernel
impl<M, F, T> WeightedGramKernel<F> for EagerMatrix<M, T> where M: WeightedGramKernel<F>, F: Scalarweighted_gram_normalized_into
fn weighted_gram_normalized_into<W, O>(
&self,
weights: &W,
centers: Option<&[F]>,
scales: Option<&[F]>,
out: &mut O
) -> Result<(), <Self as MatrixErrorType>::Error> where W: VectorView<F> + ?Sized, O: MatrixWrite<F> + ?SizedImplementation of Freeze
impl<M, F> Freeze for EagerMatrix<M, F> where M: Freeze, NormalizationParams<F>: FreezeImplementation of RefUnwindSafe
impl<M, F> RefUnwindSafe for EagerMatrix<M, F> where M: RefUnwindSafe, NormalizationParams<F>: RefUnwindSafeImplementation of Send
impl<M, F> Send for EagerMatrix<M, F> where M: Send, NormalizationParams<F>: SendImplementation of Sync
impl<M, F> Sync for EagerMatrix<M, F> where M: Sync, NormalizationParams<F>: SyncImplementation of Unpin
impl<M, F> Unpin for EagerMatrix<M, F> where M: Unpin, NormalizationParams<F>: UnpinImplementation of UnsafeUnpin
impl<M, F> UnsafeUnpin for EagerMatrix<M, F> where M: UnsafeUnpin, NormalizationParams<F>: UnsafeUnpinImplementation of UnwindSafe
impl<M, F> UnwindSafe for EagerMatrix<M, F> where M: UnwindSafe, NormalizationParams<F>: UnwindSafeImplementation of Any
impl<T> Any for T where T: 'static + ?SizedImplementation of Borrow
impl<T> Borrow<T> for T where T: ?SizedImplementation of BorrowMut
impl<T> BorrowMut<T> for T where T: ?SizedImplementation of ByRef
impl<T> ByRef<T> for TImplementation of CastableFrom
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT where ST: ?Sized, DT: ?SizedImplementation of CastableFrom
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT where ST: ?Sized, DT: ?SizedImplementation of CloneToUninit
impl<T> CloneToUninit for T where T: CloneImplementation of From
impl<T> From<T> for TImplementation of Imply
impl<T, U> Imply<T> for U where T: ?Sized, U: ?SizedImplementation of Into
impl<T, U> Into<U> for T where U: From<T>Implementation of IntoEither
impl<T> IntoEither for TImplementation of MatMat
impl<M, F> MatMat<F> for M where M: MatMatInto<F> + ?Sized, F: ScalarImplementation of MatTransposeMat
impl<M, F> MatTransposeMat<F> for M where M: MatTransposeMatInto<F> + ?Sized, F: ScalarImplementation of Pointable
impl<T> Pointable for TImplementation of Read
impl<T> Read<Exclusive, BecauseExclusive> for T where T: ?SizedImplementation of Same
impl<T> Same for TImplementation of SupersetOf
impl<SS, SP> SupersetOf<SS> for SP where SS: SubsetOf<SP>Implementation of ToOwned
impl<T> ToOwned for T where T: CloneImplementation of TryFrom
impl<T, U> TryFrom<U> for T where U: Into<T>Implementation of TryInto
impl<T, U> TryInto<U> for T where U: TryFrom<T>
