EinsumScalar

Trait EinsumScalar 

Source
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§

Source

fn type_name() -> &'static str

Human-readable type name for error messages.

Source

fn wrap_data(data: StridedData<'_, Self>) -> EinsumOperand<'_>

Wrap typed StridedData into a type-erased EinsumOperand.

Source

fn wrap_array(arr: StridedArray<Self>) -> EinsumOperand<'static>

Wrap an owned StridedArray into a type-erased EinsumOperand.

Source

fn wrap_typed_tensor(arr: StridedArray<Self>) -> TypedTensor

Wrap an owned StridedArray into a TypedTensor.

Source

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.

Source

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.

Implementations on Foreign Types§

Source§

impl EinsumScalar for f64

Source§

impl EinsumScalar for Complex64

Implementors§