Skip to content

lazymatrix::EagerMatrix ​

LazyMatrix for Rust · 0.8.1

Source

rust
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 ​

Source

rust
impl<M: MatrixShape, F: Scalar> EagerMatrix<M, F>

centers ​

rust
pub fn centers(&self) -> Option<&[F]>

Source

Original fitted centers, already applied to the data.

column ​

rust
pub fn column(
    &self,
    j: usize
) -> LazyColumn<<M as RawColumns>::Column<'_>, F> where M: RawColumns<F>

Source

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 ​

rust
pub fn data(&self) -> &M

Source

Borrow the already normalized backend data.

into_parts ​

rust
pub fn into_parts(self) -> (M, Option<Vec<F>>, Option<Vec<F>>)

Source

Recover normalized data and original fitted center and scale vectors.

ncols ​

rust
pub fn ncols(&self) -> usize

Source

Number of columns of the normalized matrix.

normalization ​

rust
pub fn normalization(&self) -> &NormalizationParams<F>

Source

Borrow the original fitted normalization, for example for prediction.

nrows ​

rust
pub fn nrows(&self) -> usize

Source

Number of rows of the normalized matrix.

scales ​

rust
pub fn scales(&self) -> Option<&[F]>

Source

Original fitted scales, already applied to the data.

Implementation of Clone ​

Source

rust
impl<M: core::clone::Clone, F: core::clone::Clone> Clone for EagerMatrix<M, F>

clone ​

rust
fn clone(&self) -> Self

Source

Implementation of ColumnStats ​

Source

rust
impl<M, F, T> ColumnStats<F> for EagerMatrix<M, T> where M: ColumnStats<F>, F: Scalar

col_l1 ​

rust
fn col_l1(&self) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>

Source

col_l1_centered ​

rust
fn col_l1_centered(
    &self,
    centers: &[F]
) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>

Source

col_l2 ​

rust
fn col_l2(&self) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>

Source

col_l2_centered ​

rust
fn col_l2_centered(
    &self,
    centers: &[F]
) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>

Source

col_maxabs ​

rust
fn col_maxabs(&self) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>

Source

col_maxabs_centered ​

rust
fn col_maxabs_centered(
    &self,
    centers: &[F]
) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>

Source

col_means ​

rust
fn col_means(&self) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>

Source

col_mins ​

rust
fn col_mins(&self) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>

Source

col_ranges ​

rust
fn col_ranges(&self) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>

Source

col_sds ​

rust
fn col_sds(&self) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>

Source

normalization_stats ​

rust
fn normalization_stats(
    &self,
    spec: Normalization
) -> Result<lazymatrix::NormalizationStats<F>, <Self as MatrixErrorType>::Error>

Source

Implementation of Columns ​

Source

rust
impl<M: RawColumns<F>, F: Scalar> Columns<F> for EagerMatrix<M, F>

Column ​

rust
type Column<'a> = LazyColumn<<M as RawColumns<F>>::Column<'a>, F> where Self: 'a;

Source

column ​

rust
fn column(&self, j: usize) -> <Self as Columns>::Column<'_>

Source

Implementation of Debug ​

Source

rust
impl<M: core::fmt::Debug, F: core::fmt::Debug> Debug for EagerMatrix<M, F>

fmt ​

rust
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result

Source

Implementation of MatMatInto ​

Source

rust
impl<M: lazymatrix::MatMatInto<F>, F: Scalar, T> MatMatInto<F> for EagerMatrix<M, T>

matmat_into ​

rust
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> + ?Sized

Source

matmat_normalized_into ​

rust
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> + ?Sized

Source

Implementation of MatTransposeMatInto ​

Source

rust
impl<M: lazymatrix::MatTransposeMatInto<F>, F: Scalar, T> MatTransposeMatInto<F> for EagerMatrix<M, T>

mat_transpose_mat_into ​

rust
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> + ?Sized

Source

mat_transpose_mat_normalized_into ​

rust
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> + ?Sized

Source

Implementation of MatTransposeVec ​

Source

rust
impl<M, V, T> MatTransposeVec<V> for EagerMatrix<M, T> where M: MatTransposeVec<V>

mat_transpose_vec ​

rust
fn mat_transpose_vec(
    &self,
    x: &V
) -> Result<V, <Self as MatrixErrorType>::Error>

Source

mat_transpose_vec_normalized ​

rust
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>

Source

Implementation of MatTransposeVecInto ​

Source

rust
impl<M, X, Y, T> MatTransposeVecInto<X, Y> for EagerMatrix<M, T> where M: MatTransposeVecInto<X, Y>

mat_transpose_vec_into ​

rust
fn mat_transpose_vec_into(
    &self,
    x: &X,
    out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error>

Source

mat_transpose_vec_normalized_into ​

rust
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>

Source

Implementation of MatTransposeVecScaledInto ​

Source

rust
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 ​

rust
fn mat_transpose_vec_scaled_into(
    &self,
    alpha: F,
    x: &X,
    beta: F,
    out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error>

Source

try_mat_transpose_vec_scaled_normalized_into ​

rust
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>

Source

Implementation of MatVec ​

Source

rust
impl<M, V, T> MatVec<V> for EagerMatrix<M, T> where M: MatVec<V>

matvec ​

rust
fn matvec(&self, x: &V) -> Result<V, <Self as MatrixErrorType>::Error>

Source

matvec_normalized ​

rust
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>

Source

Implementation of MatVecInto ​

Source

rust
impl<M, X, Y, T> MatVecInto<X, Y> for EagerMatrix<M, T> where M: MatVecInto<X, Y>

matvec_into ​

rust
fn matvec_into(
    &self,
    x: &X,
    out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error>

Source

matvec_normalized_into ​

rust
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>

Source

Implementation of MatVecScaledInto ​

Source

rust
impl<M, X, Y, F, T> MatVecScaledInto<X, Y, F> for EagerMatrix<M, T> where M: MatVecScaledInto<X, Y, F>

matvec_scaled_into ​

rust
fn matvec_scaled_into(
    &self,
    alpha: F,
    x: &X,
    beta: F,
    out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error>

Source

try_matvec_scaled_normalized_into ​

rust
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>

Source

Implementation of MaterializeDense ​

Source

rust
impl<M: MaterializeDense<F>, F: Scalar, T> MaterializeDense<F> for EagerMatrix<M, T>

materialize_normalized_into ​

rust
fn materialize_normalized_into<O: MatrixWrite<F> + ?Sized>(
    &self,
    centers: Option<&[F]>,
    scales: Option<&[F]>,
    out: &mut O
) -> Result<(), <Self as MatrixErrorType>::Error>

Source

Implementation of MatrixErrorType ​

Source

rust
impl<M: MatrixErrorType, T> MatrixErrorType for EagerMatrix<M, T>

Error ​

rust
type Error = <M as MatrixErrorType>::Error;

Source

Implementation of MatrixShape ​

Source

rust
impl<M: MatrixShape, T> MatrixShape for EagerMatrix<M, T>

ncols ​

rust
fn ncols(&self) -> usize

Source

nrows ​

rust
fn nrows(&self) -> usize

Source

Implementation of RawColumns ​

Source

rust
impl<M, F, T> RawColumns<F> for EagerMatrix<M, T> where M: RawColumns<F>, F: Scalar

Column ​

rust
type Column<'a> = <M as RawColumns<F>>::Column<'a> where Self: 'a;

Source

raw_column ​

rust
fn raw_column(&self, j: usize) -> <Self as RawColumns>::Column<'_>

Source

Implementation of WeightedColumnSumsInto ​

Source

rust
impl<M: WeightedColumnSumsInto<F>, F: Scalar, T> WeightedColumnSumsInto<F> for EagerMatrix<M, T>

weighted_column_sums_into ​

rust
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> + ?Sized

Source

Implementation of WeightedColumnSumsKernel ​

Source

rust
impl<M: WeightedColumnSumsKernel<F>, F: Scalar, T> WeightedColumnSumsKernel<F> for EagerMatrix<M, T>

weighted_column_sums_normalized_into ​

rust
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> + ?Sized

Source

Implementation of WeightedGramInto ​

Source

rust
impl<M, F, T> WeightedGramInto<F> for EagerMatrix<M, T> where M: WeightedGramInto<F>, F: Scalar

weighted_gram_into ​

rust
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> + ?Sized

Source

Implementation of WeightedGramKernel ​

Source

rust
impl<M, F, T> WeightedGramKernel<F> for EagerMatrix<M, T> where M: WeightedGramKernel<F>, F: Scalar

weighted_gram_normalized_into ​

rust
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> + ?Sized

Source

Implementation of Freeze ​

rust
impl<M, F> Freeze for EagerMatrix<M, F> where M: Freeze, NormalizationParams<F>: Freeze

Implementation of RefUnwindSafe ​

rust
impl<M, F> RefUnwindSafe for EagerMatrix<M, F> where M: RefUnwindSafe, NormalizationParams<F>: RefUnwindSafe

Implementation of Send ​

rust
impl<M, F> Send for EagerMatrix<M, F> where M: Send, NormalizationParams<F>: Send

Implementation of Sync ​

rust
impl<M, F> Sync for EagerMatrix<M, F> where M: Sync, NormalizationParams<F>: Sync

Implementation of Unpin ​

rust
impl<M, F> Unpin for EagerMatrix<M, F> where M: Unpin, NormalizationParams<F>: Unpin

Implementation of UnsafeUnpin ​

rust
impl<M, F> UnsafeUnpin for EagerMatrix<M, F> where M: UnsafeUnpin, NormalizationParams<F>: UnsafeUnpin

Implementation of UnwindSafe ​

rust
impl<M, F> UnwindSafe for EagerMatrix<M, F> where M: UnwindSafe, NormalizationParams<F>: UnwindSafe

Implementation of Any ​

rust
impl<T> Any for T where T: 'static + ?Sized

Implementation of Borrow ​

rust
impl<T> Borrow<T> for T where T: ?Sized

Implementation of BorrowMut ​

rust
impl<T> BorrowMut<T> for T where T: ?Sized

Implementation of ByRef ​

rust
impl<T> ByRef<T> for T

Implementation of CastableFrom ​

rust
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT where ST: ?Sized, DT: ?Sized

Implementation of CastableFrom ​

rust
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT where ST: ?Sized, DT: ?Sized

Implementation of CloneToUninit ​

rust
impl<T> CloneToUninit for T where T: Clone

Implementation of From ​

rust
impl<T> From<T> for T

Implementation of Imply ​

rust
impl<T, U> Imply<T> for U where T: ?Sized, U: ?Sized

Implementation of Into ​

rust
impl<T, U> Into<U> for T where U: From<T>

Implementation of IntoEither ​

rust
impl<T> IntoEither for T

Implementation of MatMat ​

Source

rust
impl<M, F> MatMat<F> for M where M: MatMatInto<F> + ?Sized, F: Scalar

Implementation of MatTransposeMat ​

Source

rust
impl<M, F> MatTransposeMat<F> for M where M: MatTransposeMatInto<F> + ?Sized, F: Scalar

Implementation of Pointable ​

rust
impl<T> Pointable for T

Implementation of Read ​

rust
impl<T> Read<Exclusive, BecauseExclusive> for T where T: ?Sized

Implementation of Same ​

rust
impl<T> Same for T

Implementation of SupersetOf ​

rust
impl<SS, SP> SupersetOf<SS> for SP where SS: SubsetOf<SP>

Implementation of ToOwned ​

rust
impl<T> ToOwned for T where T: Clone

Implementation of TryFrom ​

rust
impl<T, U> TryFrom<U> for T where U: Into<T>

Implementation of TryInto ​

rust
impl<T, U> TryInto<U> for T where U: TryFrom<T>

Released under the MIT and Apache 2.0 licenses.