Shrinkage

shrinkage::experimental::BufferedDesign

Shrinkage for Rust · rust · 0.3.0

pub struct BufferedDesign<'a, M: ?Sized>

A borrowed design with one caller-owned block buffer for sequential scans.

Raw products use packed blocks; lazymatrix::LazyMatrix applies training normalization. Statistics retain the backend's combined scan hook. The adapter does not provide borrowed columns or rows, cache chunks, or require a full-width row buffer. Product outputs may be partial after an error.

The buffer remains borrowed until this adapter is dropped. Internal mutable borrowing supports the shared-reference operator traits; this adapter is intended for synchronous use and is not Sync. The design must remain unchanged across validation, normalization, and fitting.

Inherent implementation

impl<'a, M: ReadBlock<f64> + ?Sized> BufferedDesign<'a, M>

new

pub fn new(
    matrix: &'a M,
    block_shape: [usize; 2],
    buffer: &'a mut [f64]
) -> Self

Borrow a design and initialized buffer for blocks of at most block_shape.

Storage chunk and codec workspace can exceed the caller's buffer size.

Panics

Panics for a zero block dimension, dimension overflow, or a buffer shorter than the product of the requested block dimensions.

Implementation of ColumnStats

impl<M: ColumnStats<f64> + ?Sized> ColumnStats<f64> for BufferedDesign<'_, M>

col_l1

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

col_l1_centered

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

col_l2

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

col_l2_centered

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

col_maxabs

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

col_maxabs_centered

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

col_means

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

col_medians

fn col_medians(&self) -> Result<Vec<f64>, <Self as >::Error>

col_mins

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

col_quantile_ranges

fn col_quantile_ranges(
    &self,
    range: QuantileRange
) -> Result<Vec<f64>, <Self as >::Error>

col_ranges

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

col_sds

fn col_sds(&self, df: usize) -> Result<Vec<f64>, <Self as >::Error>

normalization_stats

fn normalization_stats(
    &self,
    spec: lazymatrix::ColumnNormalization
) -> Result<ColumnNormalizationStats<f64>, <Self as >::Error>

Implementation of MatTransposeVecInto

impl<M: ReadBlock<f64> + ?Sized> MatTransposeVecInto<Vec<f64>> for BufferedDesign<'_, M>

mat_transpose_vec_into

fn mat_transpose_vec_into(
    &self,
    input: &Vec<f64>,
    output: &mut Vec<f64>
) -> Result<(), <Self as >::Error>

Implementation of MatVecInto

impl<M: ReadBlock<f64> + ?Sized> MatVecInto<Vec<f64>> for BufferedDesign<'_, M>

matvec_into

fn matvec_into(
    &self,
    input: &Vec<f64>,
    output: &mut Vec<f64>
) -> Result<(), <Self as >::Error>

Implementation of MatrixErrorType

impl<M: MatrixErrorType + ?Sized> MatrixErrorType for BufferedDesign<'_, M>

Error

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

Implementation of MatrixShape

impl<M: MatrixShape + ?Sized> MatrixShape for BufferedDesign<'_, M>

ncols

fn ncols(&self) -> usize

nrows

fn nrows(&self) -> usize

Implementation of Freeze

impl<'a, M> !Freeze for BufferedDesign<'a, M>

Implementation of RefUnwindSafe

impl<'a, M> !RefUnwindSafe for BufferedDesign<'a, M>

Implementation of Send

impl<'a, M> Send for BufferedDesign<'a, M> where &'a M: Send, M: ?Sized

Implementation of Sync

impl<'a, M> !Sync for BufferedDesign<'a, M>

Implementation of Unpin

impl<'a, M> Unpin for BufferedDesign<'a, M> where &'a M: Unpin, M: ?Sized

Implementation of UnsafeUnpin

impl<'a, M> UnsafeUnpin for BufferedDesign<'a, M> where &'a M: UnsafeUnpin, M: ?Sized

Implementation of UnwindSafe

impl<'a, M> !UnwindSafe for BufferedDesign<'a, M>

Implementation of Any

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

Implementation of Borrow

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

Implementation of BorrowMut

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

Implementation of ByRef

impl<T> ByRef<T> for T

Implementation of CastableFrom

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

Implementation of CastableFrom

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

Implementation of From

impl<T> From<T> for T

Implementation of Imply

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

Implementation of Into

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

Implementation of IntoEither

impl<T> IntoEither for T

Implementation of Pointable

impl<T> Pointable for T

Implementation of Read

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

Implementation of Same

impl<T> Same for T

Implementation of SupersetOf

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

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