pub struct FuncScatterTensor {
pub in_scatter: Array2<f32>,
pub out_scatter: Array2<f32>,
}Expand description
Represents a 4-tensor which is expressible as
kron(out_scatter, in_scatter), where out_scatter
and in_scatter are both positive semi-definite.
This is typically used to express the precision
or covariance of a crate::normal_inverse_wishart::NormalInverseWishart model.
See also crate::func_schmear::FuncSchmear for an example of usage.
Fields§
§in_scatter: Array2<f32>§out_scatter: Array2<f32>Implementations§
Source§impl FuncScatterTensor
impl FuncScatterTensor
Sourcepub fn inverse(&self) -> FuncScatterTensor
pub fn inverse(&self) -> FuncScatterTensor
Inverts both in_scatter and out_scatter
of this FuncScatterTensor to yield
a new one. May be used to e.g: convert between
a function’s covariance 4-tensor and its precision 4-tensor.
Sourcepub fn flatten_and_multiply(&self, mat: ArrayView2<'_, f32>) -> Array2<f32>
pub fn flatten_and_multiply(&self, mat: ArrayView2<'_, f32>) -> Array2<f32>
Supposing that out_scatter and in_scatter are nxn and mxm, respectively,
and given a Lx(n*m) matrix mat, compute mat * kron(out_scatter, in_scatter).
This has better asymptotic efficiency than simply expanding out the definition
above. Delivers a result of size Lx(n*m).
Sourcepub fn compress(&self, mat: ArrayView2<'_, f32>) -> Array2<f32>
pub fn compress(&self, mat: ArrayView2<'_, f32>) -> Array2<f32>
Efficiently transforms this FuncScatterTensor, taken to represent a covariance tensor,
through the linear transformation given by mat.
Supposing that out_scatter and in_scatter are nxn and mxm, respectively,
and given a Lx(n*m) matrix mat, compute mat * kron(out_scatter, in_scatter) * mat.t().
This has better asymptotic efficiency than simply expanding out the definition above.
Delivers a result of size LxL.
Sourcepub fn flatten(&self) -> Array2<f32>
pub fn flatten(&self) -> Array2<f32>
Flattens this FuncScatterTensor to a 2d matrix using the kronecker product
kron(out_scatter, in_scatter).
Trait Implementations§
Source§impl Clone for FuncScatterTensor
impl Clone for FuncScatterTensor
Source§fn clone(&self) -> FuncScatterTensor
fn clone(&self) -> FuncScatterTensor
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more