pub trait TensorConstructionLike: TensorContractionLike {
// Required methods
fn diagonal(
input_index: &<Self as TensorIndex>::Index,
output_index: &<Self as TensorIndex>::Index,
) -> Result<Self>;
fn scalar_one() -> Result<Self>;
fn ones(indices: &[<Self as TensorIndex>::Index]) -> Result<Self>;
fn onehot(
index_vals: &[(<Self as TensorIndex>::Index, usize)],
) -> Result<Self>;
// Provided methods
fn delta(
input_indices: &[<Self as TensorIndex>::Index],
output_indices: &[<Self as TensorIndex>::Index],
) -> Result<Self> { ... }
fn select_indices(
&self,
selected_indices: &[<Self as TensorIndex>::Index],
positions: &[usize],
) -> Result<Self> { ... }
}Expand description
Constructors and selection helpers for index-labelled tensors.
Required Methods§
Sourcefn diagonal(
input_index: &<Self as TensorIndex>::Index,
output_index: &<Self as TensorIndex>::Index,
) -> Result<Self>
fn diagonal( input_index: &<Self as TensorIndex>::Index, output_index: &<Self as TensorIndex>::Index, ) -> Result<Self>
Create a diagonal (Kronecker delta) tensor for a single index pair.
Sourcefn scalar_one() -> Result<Self>
fn scalar_one() -> Result<Self>
Create a scalar tensor with value 1.0.
Sourcefn ones(indices: &[<Self as TensorIndex>::Index]) -> Result<Self>
fn ones(indices: &[<Self as TensorIndex>::Index]) -> Result<Self>
Create a tensor filled with 1.0 for the given indices.
Provided Methods§
Sourcefn delta(
input_indices: &[<Self as TensorIndex>::Index],
output_indices: &[<Self as TensorIndex>::Index],
) -> Result<Self>
fn delta( input_indices: &[<Self as TensorIndex>::Index], output_indices: &[<Self as TensorIndex>::Index], ) -> Result<Self>
Create a delta (identity) tensor as outer product of diagonals.
Sourcefn select_indices(
&self,
selected_indices: &[<Self as TensorIndex>::Index],
positions: &[usize],
) -> Result<Self>
fn select_indices( &self, selected_indices: &[<Self as TensorIndex>::Index], positions: &[usize], ) -> Result<Self>
Select fixed coordinates for a subset of this tensor’s external indices.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.