# shrinkage::experimental::BufferedDesign

Shrinkage for Rust · 0.3.0

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

```rust
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`](<https://docs.rs/lazymatrix/0.11.0/lazymatrix/matrix/struct.LazyMatrix.html>) 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. 

<a id="impl-a25d51879906432774b512987d85ec7bcc75fcf5d60e2b1ed19153456c49582b"></a>

## Inherent implementation

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

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

<a id="method-new-a25d51879906432774b512987d85ec7bcc75fcf5d60e2b1ed19153456c49582b"></a>

### `new`

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

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

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. 

<a id="method-new-a25d51879906432774b512987d85ec7bcc75fcf5d60e2b1ed19153456c49582b-documentation-panics"></a>

#### Panics

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

<a id="impl-c0b2f47774f46fece0280eb07db2896da6f31b9a5358c49e8ae87aad3ac0320a"></a>

## Implementation of ColumnStats

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

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

<a id="method-col_l1-c0b2f47774f46fece0280eb07db2896da6f31b9a5358c49e8ae87aad3ac0320a"></a>

### `col_l1`

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

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

<a id="method-col_l1_centered-c0b2f47774f46fece0280eb07db2896da6f31b9a5358c49e8ae87aad3ac0320a"></a>

### `col_l1_centered`

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

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

<a id="method-col_l2-c0b2f47774f46fece0280eb07db2896da6f31b9a5358c49e8ae87aad3ac0320a"></a>

### `col_l2`

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

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

<a id="method-col_l2_centered-c0b2f47774f46fece0280eb07db2896da6f31b9a5358c49e8ae87aad3ac0320a"></a>

### `col_l2_centered`

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

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

<a id="method-col_maxabs-c0b2f47774f46fece0280eb07db2896da6f31b9a5358c49e8ae87aad3ac0320a"></a>

### `col_maxabs`

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

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

<a id="method-col_maxabs_centered-c0b2f47774f46fece0280eb07db2896da6f31b9a5358c49e8ae87aad3ac0320a"></a>

### `col_maxabs_centered`

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

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

<a id="method-col_means-c0b2f47774f46fece0280eb07db2896da6f31b9a5358c49e8ae87aad3ac0320a"></a>

### `col_means`

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

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

<a id="method-col_medians-c0b2f47774f46fece0280eb07db2896da6f31b9a5358c49e8ae87aad3ac0320a"></a>

### `col_medians`

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

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

<a id="method-col_mins-c0b2f47774f46fece0280eb07db2896da6f31b9a5358c49e8ae87aad3ac0320a"></a>

### `col_mins`

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

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

<a id="method-col_quantile_ranges-c0b2f47774f46fece0280eb07db2896da6f31b9a5358c49e8ae87aad3ac0320a"></a>

### `col_quantile_ranges`

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

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

<a id="method-col_ranges-c0b2f47774f46fece0280eb07db2896da6f31b9a5358c49e8ae87aad3ac0320a"></a>

### `col_ranges`

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

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

<a id="method-col_sds-c0b2f47774f46fece0280eb07db2896da6f31b9a5358c49e8ae87aad3ac0320a"></a>

### `col_sds`

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

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

<a id="method-normalization_stats-c0b2f47774f46fece0280eb07db2896da6f31b9a5358c49e8ae87aad3ac0320a"></a>

### `normalization_stats`

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

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

<a id="impl-896835fdfd25a116621872ddc793d37a680ab25c2062c21b7132b32fce4f5605"></a>

## Implementation of MatTransposeVecInto

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

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

<a id="method-mat_transpose_vec_into-896835fdfd25a116621872ddc793d37a680ab25c2062c21b7132b32fce4f5605"></a>

### `mat_transpose_vec_into`

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

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

<a id="impl-a1fa498eb9edf6b918c66d0b1bff44409ccdbfde6a4cd758cb8cefad8f64e5df"></a>

## Implementation of MatVecInto

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

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

<a id="method-matvec_into-a1fa498eb9edf6b918c66d0b1bff44409ccdbfde6a4cd758cb8cefad8f64e5df"></a>

### `matvec_into`

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

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

<a id="impl-deec1a86f9747a75528c60102d6a597a432c83a4563f3d42bae37959996e0c38"></a>

## Implementation of MatrixErrorType

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

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

<a id="associated-type-Error-deec1a86f9747a75528c60102d6a597a432c83a4563f3d42bae37959996e0c38"></a>

### `Error`

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

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

<a id="impl-9139d63c103b898c9e3a869a1e3de376671f49ba5079e886c201118a746b2e3a"></a>

## Implementation of MatrixShape

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

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

<a id="method-ncols-9139d63c103b898c9e3a869a1e3de376671f49ba5079e886c201118a746b2e3a"></a>

### `ncols`

```rust
fn ncols(&self) -> usize
```

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

<a id="method-nrows-9139d63c103b898c9e3a869a1e3de376671f49ba5079e886c201118a746b2e3a"></a>

### `nrows`

```rust
fn nrows(&self) -> usize
```

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/experimental.rs>)

<a id="impl-1923e9d61d634a2336313849ff51f90fce8410922d4543cad9712cf5330f0a6c"></a>

## Implementation of Freeze

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

<a id="impl-cacbcfaa886c4bdb631e6e886424cae171d5cf21f0f5c047c50248d0563ed505"></a>

## Implementation of RefUnwindSafe

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

<a id="impl-3055284a2abbc7358738afc68e6c0259f6880effe970e6c15b7a232faf357b30"></a>

## Implementation of Send

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

<a id="impl-7c0cf00a42532f4f18dc177892459a7ff205c7efb772a40d2b5def7df53374e1"></a>

## Implementation of Sync

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

<a id="impl-54b7f5991561c2b16e4c28c4e43794e0c51f65e59cdd4d03f6c1af34fc281aaf"></a>

## Implementation of Unpin

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

<a id="impl-dcb0685cbf2dde01bcc703d830b241c4803a90faa63de259fed35af5f3d263c2"></a>

## Implementation of UnsafeUnpin

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

<a id="impl-5a24dd11904c78f7f86f7eb24cdfed3901b4f5f463ed4f8f40955ff3ae8a2224"></a>

## Implementation of UnwindSafe

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

<a id="impl-1e5682dc18e03c648aa9b125290c107c1e8d96ce8a179a8532e4057da4daf0cd"></a>

## Implementation of Any

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

<a id="impl-6c0b25c2c92cdb117802d9c0a4c70afc9a8bfb0da875bc6e66191e2349fcdf3f"></a>

## Implementation of Borrow

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

<a id="impl-796e80d926348273a22b04d8e84f510693b11c06ec57c3c3e2e8c1524094a85c"></a>

## Implementation of BorrowMut

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

<a id="impl-8360e4092e7ec4a05a26dd304cd739398f0cacc50c8d08dd5be0223d1a08d02e"></a>

## Implementation of ByRef

```rust
impl<T> ByRef<T> for T
```

<a id="impl-dbb1293b7b5dd80c4d9a98cfdd6843dc7470224c0b1387731cd418da07046d7b"></a>

## Implementation of CastableFrom

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

<a id="impl-97b65e7dfc44b5ecaa495a3a19fe737914a1e9f8532200cf8f46191314e7d777"></a>

## Implementation of CastableFrom

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

<a id="impl-c22bdd3b1b677b66eb32d1c182cc1410c7f0c46491dd74e6a659647c238d19ec"></a>

## Implementation of From

```rust
impl<T> From<T> for T
```

<a id="impl-5adf6ca1830f30fbbac655ab8ff394d254954df7ededc7cc833c72fdc87d6f00"></a>

## Implementation of Imply

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

<a id="impl-85eec431edd188129f88290bbcb748e4d2fdc97f7efef3c162b8c252286ffec0"></a>

## Implementation of Into

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

<a id="impl-c40268dd59dd3329202d3c0544c62372e98ff3baa8ec442ec00752e024ec1d06"></a>

## Implementation of IntoEither

```rust
impl<T> IntoEither for T
```

<a id="impl-5655b1ef858b34a584cb80104f040c8a4063ced0d281311a0833ed12aefde86e"></a>

## Implementation of Pointable

```rust
impl<T> Pointable for T
```

<a id="impl-8cc2aa01198fc9fa44f08b889f62988d70d2a7f4f0f11f4666d4c08bdaddb22a"></a>

## Implementation of Read

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

<a id="impl-5ea09131039c62dd92b119d480a35c7e2b33d2b81dccf0b849f6b1f19f4bda24"></a>

## Implementation of Same

```rust
impl<T> Same for T
```

<a id="impl-7ee6ff38d6674f5edfe4734359062c2a67a572cff5899a89704764822b931c7f"></a>

## Implementation of SupersetOf

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

<a id="impl-83960135d00d98080c95a08867729696e36811280c2dd9cf34c1b4fe21c81e18"></a>

## Implementation of TryFrom

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

<a id="impl-1cc495bcaa5112ffb304e7f0de674feca391fd97f47bec86033a9225b72ac05c"></a>

## Implementation of TryInto

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