pub trait ChainCore<T>: Sized {
type Error: From<ChainCompressionError>;
// Required methods
fn view(&self) -> Result<ColMajorArrayRef<'_, T>, Self::Error>;
fn from_col_major(
shape: [usize; 3],
data: Vec<T>,
) -> Result<Self, Self::Error>;
}Expand description
Storage adapter that lets the chain sweeps read and rebuild rank-3 cores.
ColMajorArray implements it directly; other crates implement it for
their own core types so that compress_chain_lu_mut and
compress_chain_cores_mut can update them in place.
§Examples
use tensor4all_core::{ChainCore, ColMajorArray};
let core = <ColMajorArray<f64> as ChainCore<f64>>::from_col_major([1, 2, 1], vec![1.0, 2.0])?;
let view = ChainCore::<f64>::view(&core)?;
assert_eq!(view.shape(), &[1, 2, 1]);
assert_eq!(view.data(), &[1.0, 2.0]);Required Associated Types§
Sourcetype Error: From<ChainCompressionError>
type Error: From<ChainCompressionError>
Error returned when reading or rebuilding a core, and by the sweeps.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".