TensorResolveConjContextFor

Trait TensorResolveConjContextFor 

Source
pub trait TensorResolveConjContextFor<T: Scalar + Conjugate> {
    // Required method
    fn resolve_conj(ctx: &mut Self, src: &Tensor<T>) -> Tensor<T>;
}
Expand description

Bridge trait for backend-specific lazy-conjugation resolution.

High-level crates use this trait to stay generic over runtime context types while still materializing unresolved conjugation through the correct backend utility.

§Examples

use num_complex::Complex64;
use tenferro_prims::{CpuContext, TensorResolveConjContextFor};
use tenferro_tensor::{MemoryOrder, Tensor};

let mut ctx = CpuContext::new(1);
let base = Tensor::from_slice(
    &[Complex64::new(1.0, 2.0), Complex64::new(3.0, -4.0)],
    &[2],
    MemoryOrder::ColumnMajor,
)
.unwrap();
let lazy = base.conj();
let resolved = <CpuContext as TensorResolveConjContextFor<Complex64>>::resolve_conj(
    &mut ctx,
    &lazy,
);
assert!(!resolved.is_conjugated());

Required Methods§

Source

fn resolve_conj(ctx: &mut Self, src: &Tensor<T>) -> Tensor<T>

Materialize a lazily-conjugated tensor using the backend tied to Self.

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.

Implementors§