lazymatrix::ZarrMatrix
LazyMatrix for Rust · 0.8.1
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
impl<A, F> ZarrMatrix<A, F>as_inner
pub fn as_inner(&self) -> &ABorrow the original array without changing its metadata.
into_inner
pub fn into_inner(self) -> ARecover the original array without copying its data.
Inherent implementation
impl<A: ZarrArray<F>, F: Scalar> lazymatrix::ZarrMatrix<A, F>try_new
pub fn try_new(array: A) -> Result<Self, ZarrMatrixError>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
impl<A: ZarrArray<F>, F: Scalar> ColumnStats<F> for lazymatrix::ZarrMatrix<A, F>col_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 Debug
impl<A: core::fmt::Debug, F: core::fmt::Debug> Debug for ZarrMatrix<A, F>fmt
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::ResultImplementation of MatMatInto
impl<A: ZarrArray<F>, F: Scalar> MatMatInto<F> for ZarrMatrix<A, F>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> + lazymatrix::MatrixWrite<F> + ?SizedImplementation of MatTransposeMatInto
impl<A: ZarrArray<F>, F: Scalar> MatTransposeMatInto<F> for ZarrMatrix<A, F>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> + lazymatrix::MatrixWrite<F> + ?SizedImplementation of MatTransposeVec
impl<A: ZarrArray<F>, F: Scalar> MatTransposeVec<Vec<F>> for ZarrMatrix<A, F>mat_transpose_vec
fn mat_transpose_vec(
&self,
x: &Vec<F>
) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>Implementation of MatTransposeVecInto
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
fn mat_transpose_vec_into(
&self,
x: &X,
out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error>Implementation of MatTransposeVecScaledInto
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
fn mat_transpose_vec_scaled_into(
&self,
alpha: F,
x: &X,
beta: F,
out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error>Implementation of MatVec
impl<A: ZarrArray<F>, F: Scalar> MatVec<Vec<F>> for ZarrMatrix<A, F>matvec
fn matvec(&self, x: &Vec<F>) -> Result<Vec<F>, <Self as MatrixErrorType>::Error>Implementation of MatVecInto
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
fn matvec_into(
&self,
x: &X,
out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error>Implementation of MatVecScaledInto
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
fn matvec_scaled_into(
&self,
alpha: F,
x: &X,
beta: F,
out: &mut Y
) -> Result<(), <Self as MatrixErrorType>::Error>Implementation of MaterializeDense
impl<A, F> MaterializeDense<F> for ZarrMatrix<A, F> where A: ZarrArray<F>, F: Scalarmaterialize_normalized_into
fn materialize_normalized_into<O: lazymatrix::MatrixWrite<F> + ?Sized>(
&self,
centers: Option<&[F]>,
scales: Option<&[F]>,
out: &mut O
) -> Result<(), <Self as MatrixErrorType>::Error>Implementation of MatrixErrorType
impl<A, F> MatrixErrorType for ZarrMatrix<A, F>Error
type Error = ZarrMatrixError;Implementation of MatrixShape
impl<A, F> MatrixShape for ZarrMatrix<A, F>ncols
fn ncols(&self) -> usizenrows
fn nrows(&self) -> usizeImplementation of ReadBlock
impl<A, F> ReadBlock<F> for ZarrMatrix<A, F> where A: ZarrArray<F>, F: Scalarread_block
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>Implementation of Freeze
impl<A, F> Freeze for ZarrMatrix<A, F> where A: Freeze, PhantomData<F>: FreezeImplementation of RefUnwindSafe
impl<A, F> RefUnwindSafe for ZarrMatrix<A, F> where A: RefUnwindSafe, PhantomData<F>: RefUnwindSafeImplementation of Send
impl<A, F> Send for ZarrMatrix<A, F> where A: Send, PhantomData<F>: SendImplementation of Sync
impl<A, F> Sync for ZarrMatrix<A, F> where A: Sync, PhantomData<F>: SyncImplementation of Unpin
impl<A, F> Unpin for ZarrMatrix<A, F> where A: Unpin, PhantomData<F>: UnpinImplementation of UnsafeUnpin
impl<A, F> UnsafeUnpin for ZarrMatrix<A, F> where A: UnsafeUnpin, PhantomData<F>: UnsafeUnpinImplementation of UnwindSafe
impl<A, F> UnwindSafe for ZarrMatrix<A, F> where A: UnwindSafe, PhantomData<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 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 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>
