pub trait SingletonViewer<A>: Debug {
// Required method
fn view_singleton<'a, 'b>(
&self,
tensor: &'b ArrayViewD<'a, A>,
) -> ArrayViewD<'b, A>
where A: Clone + LinalgScalar,
'a: 'b;
}Expand description
let new_view = obj.view_singleton(tensor_view);
This trait represents contractions that can be performed by returning a view of the original
tensor. The structs that currently implement this view are the ones that don’t perform
any summation over indices and hence return only a subset of the elements of the original tensor:
Identity, Permutation, and Diagonalization. Note that whether Diagonalization
can actually return a view is dependent on the memory layout of the input tensor; if the input
tensor is not contiguous, diag.view_singleton() will panic.