Skip to main content

Crate covstream

Crate covstream 

Source
Expand description

covstream is a fixed-dimension streaming covariance library with Lean-backed specifications.

The crate is built around two public entry points:

  • CovstreamState is the default user-facing API. It stores a chosen MatrixLayout and returns buffers in that layout.
  • CovstreamCore is the lower-level engine. It gives direct access to the underlying state and explicit extraction methods for each layout.

Safe ingest paths reject:

  • wrong sample dimensions
  • malformed flat batch buffers
  • non-finite inputs such as NaN and Inf

Covariance and shrinkage extraction require at least two observed samples. Until then the library returns CovstreamError::InsufficientSamples.

For higher-throughput pipelines that already validate inputs upstream, the trusted_finite ingest methods skip finite-value checks while preserving shape checks.

Security and safety notes:

  • The crate does not perform network I/O, file I/O, subprocess execution, or environment-based configuration in its library API.
  • The checked ingest paths validate dimensions and reject non-finite values.
  • The only unsafe code is isolated to optional AArch64 SIMD leaf kernels in src/kernels.rs.

Re-exports§

pub use shrinkage::diagonal_mean_row_major;
pub use shrinkage::scaled_identity_row_major;
pub use shrinkage::shrink_row_major;
pub use shrinkage::shrink_with_mode_row_major;
pub use shrinkage::ShrinkageMode;

Modules§

shrinkage

Structs§

CovstreamCore
Low-level fixed-dimension streaming covariance engine.
CovstreamState
User-facing wrapper around CovstreamCore that remembers an output layout.

Enums§

CovstreamError
Runtime errors returned by the checked Covstream APIs.
MatrixLayout
Output layout used when extracting covariance or shrinkage matrices.