pub trait EinsumScalar:
Sealed
+ Scalar
+ Default
+ 'static {
// Required methods
fn type_name() -> &'static str;
fn wrap_data(data: StridedData<'_, Self>) -> EinsumOperand<'_>;
fn wrap_array(arr: StridedArray<Self>) -> EinsumOperand<'static>;
fn wrap_typed_tensor(arr: StridedArray<Self>) -> TypedTensor;
fn extract_data<'a>(op: EinsumOperand<'a>) -> Result<StridedData<'a, Self>>;
fn validate_operands(ops: &[Option<EinsumOperand<'_>>]) -> Result<()>;
}Expand description
Scalar types that can be used as the output element type for einsum_into.
Sealed trait: only implemented for f64 and Complex64.
Required Methods§
Sourcefn wrap_data(data: StridedData<'_, Self>) -> EinsumOperand<'_>
fn wrap_data(data: StridedData<'_, Self>) -> EinsumOperand<'_>
Wrap typed StridedData into a type-erased EinsumOperand.
Sourcefn wrap_array(arr: StridedArray<Self>) -> EinsumOperand<'static>
fn wrap_array(arr: StridedArray<Self>) -> EinsumOperand<'static>
Wrap an owned StridedArray into a type-erased EinsumOperand.
Sourcefn wrap_typed_tensor(arr: StridedArray<Self>) -> TypedTensor
fn wrap_typed_tensor(arr: StridedArray<Self>) -> TypedTensor
Wrap an owned StridedArray into a TypedTensor.
Sourcefn extract_data<'a>(op: EinsumOperand<'a>) -> Result<StridedData<'a, Self>>
fn extract_data<'a>(op: EinsumOperand<'a>) -> Result<StridedData<'a, Self>>
Extract typed data from a type-erased EinsumOperand, promoting if needed.
For f64: returns error if operand is C64.
For Complex64: promotes F64 operands to C64.
Sourcefn validate_operands(ops: &[Option<EinsumOperand<'_>>]) -> Result<()>
fn validate_operands(ops: &[Option<EinsumOperand<'_>>]) -> Result<()>
Check whether any operand requires this type or is incompatible.
Returns error early if T = f64 but any operand is C64.
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.