Skip to content

lazymatrix::ZarrMatrix ​

LazyMatrix for Rust · 0.8.1

Source

rust
pub struct ZarrMatrix<A, F = f64>

A read-only, two-dimensional Zarr array presented as a matrix.

The array parameter A is the complete zarrs Array<S> type, rather than its storage type. Both supported releases can coexist in the same build.

Supports f32 and f64 elements from synchronous readable stores. Products and statistics read one chunk at a time in grid order, including fill values for missing chunks. Allocating products use Vec<F>; reusable-output products accept VectorView and VectorViewMut. No ndarray feature is required.

Working vectors and column statistics occupy O(nrows + ncols) memory. Chunk buffers and codec workspaces depend on the largest decoded storage chunk (the outer shard for a sharded array). Choose chunks that fit in RAM: this adapter does not impose a byte budget, cache chunks, or prefetch data. The parallel feature does not parallelize its scans.

The backing array must remain unchanged between normalization and products, and throughout each operation. The adapter provides no snapshot isolation. It deliberately provides no borrowed column or row capabilities, since data must be loaded and decoded before it can be borrowed. crate::ReadBlock instead loads caller-chosen rectangles into an explicit reusable buffer. Reads decode intersecting chunks serially; chunk and codec workspace is additional to the caller's buffer, including outer shards.

Inherent implementation ​

Source

rust
impl<A, F> ZarrMatrix<A, F>

as_inner ​

rust
pub fn as_inner(&self) -> &A

Source

Borrow the original array without changing its metadata.

into_inner ​

rust
pub fn into_inner(self) -> A

Source

Recover the original array without copying its data.

Inherent implementation ​

Source

rust
impl<A: ZarrArray<F>, F: Scalar> lazymatrix::ZarrMatrix<A, F>

try_new ​

rust
pub fn try_new(array: A) -> Result<Self, ZarrMatrixError>

Source

Wrap an opened array after checking its rank, shape, and scalar type.

This reads no chunks. Missing chunks retain the array's configured fill value, which need not be zero.

Errors ​

Returns an error for a rank other than two, dimensions that do not fit usize, or an element type different from F. Data is not converted.

Implementation of ColumnStats ​

Source

rust
impl<A: ZarrArray<F>, F: Scalar> ColumnStats<F> for lazymatrix::ZarrMatrix<A, F>

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

Source

rust
impl<A: core::fmt::Debug, F: core::fmt::Debug> Debug for ZarrMatrix<A, F>

fmt ​

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

Source

Implementation of MatMatInto ​

Source

rust
impl<A: ZarrArray<F>, F: Scalar> MatMatInto<F> for ZarrMatrix<A, F>

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> + lazymatrix::MatrixWrite<F> + ?Sized

Source

Implementation of MatTransposeMatInto ​

Source

rust
impl<A: ZarrArray<F>, F: Scalar> MatTransposeMatInto<F> for ZarrMatrix<A, F>

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> + lazymatrix::MatrixWrite<F> + ?Sized

Source

Implementation of MatTransposeVec ​

Source

rust
impl<A: ZarrArray<F>, F: Scalar> MatTransposeVec<Vec<F>> for ZarrMatrix<A, F>

mat_transpose_vec ​

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

Source

Implementation of MatTransposeVecInto ​

Source

rust
impl<A, F, X, Y> MatTransposeVecInto<X, Y> for ZarrMatrix<A, F> where A: ZarrArray<F>, F: Scalar, X: VectorView<F>, Y: VectorViewMut<F>

mat_transpose_vec_into ​

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

Source

Implementation of MatTransposeVecScaledInto ​

Source

rust
impl<A, F, X, Y> MatTransposeVecScaledInto<X, Y, F> for ZarrMatrix<A, F> where A: ZarrArray<F>, F: Scalar, X: VectorView<F>, Y: VectorViewMut<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

Implementation of MatVec ​

Source

rust
impl<A: ZarrArray<F>, F: Scalar> MatVec<Vec<F>> for ZarrMatrix<A, F>

matvec ​

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

Source

Implementation of MatVecInto ​

Source

rust
impl<A, F, X, Y> MatVecInto<X, Y> for ZarrMatrix<A, F> where A: ZarrArray<F>, F: Scalar, X: VectorView<F>, Y: VectorViewMut<F>

matvec_into ​

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

Source

Implementation of MatVecScaledInto ​

Source

rust
impl<A, F, X, Y> MatVecScaledInto<X, Y, F> for ZarrMatrix<A, F> where A: ZarrArray<F>, F: Scalar, X: VectorView<F>, Y: VectorViewMut<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

Implementation of MaterializeDense ​

Source

rust
impl<A, F> MaterializeDense<F> for ZarrMatrix<A, F> where A: ZarrArray<F>, F: Scalar

materialize_normalized_into ​

rust
fn materialize_normalized_into<O: lazymatrix::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<A, F> MatrixErrorType for ZarrMatrix<A, F>

Error ​

rust
type Error = ZarrMatrixError;

Source

Implementation of MatrixShape ​

Source

rust
impl<A, F> MatrixShape for ZarrMatrix<A, F>

ncols ​

rust
fn ncols(&self) -> usize

Source

nrows ​

rust
fn nrows(&self) -> usize

Source

Implementation of ReadBlock ​

Source

rust
impl<A, F> ReadBlock<F> for ZarrMatrix<A, F> where A: ZarrArray<F>, F: Scalar

read_block ​

rust
fn read_block<'buf>(
    &self,
    rows: std::ops::Range<usize>,
    columns: std::ops::Range<usize>,
    buffer: &'buf mut [F]
) -> Result<lazymatrix::DenseBlock<'buf, F>, <Self as MatrixErrorType>::Error>

Source

Implementation of Freeze ​

rust
impl<A, F> Freeze for ZarrMatrix<A, F> where A: Freeze, PhantomData<F>: Freeze

Implementation of RefUnwindSafe ​

rust
impl<A, F> RefUnwindSafe for ZarrMatrix<A, F> where A: RefUnwindSafe, PhantomData<F>: RefUnwindSafe

Implementation of Send ​

rust
impl<A, F> Send for ZarrMatrix<A, F> where A: Send, PhantomData<F>: Send

Implementation of Sync ​

rust
impl<A, F> Sync for ZarrMatrix<A, F> where A: Sync, PhantomData<F>: Sync

Implementation of Unpin ​

rust
impl<A, F> Unpin for ZarrMatrix<A, F> where A: Unpin, PhantomData<F>: Unpin

Implementation of UnsafeUnpin ​

rust
impl<A, F> UnsafeUnpin for ZarrMatrix<A, F> where A: UnsafeUnpin, PhantomData<F>: UnsafeUnpin

Implementation of UnwindSafe ​

rust
impl<A, F> UnwindSafe for ZarrMatrix<A, F> where A: UnwindSafe, PhantomData<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 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 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.