pub trait TensorComplexScalePrims<Input: ComplexFloat + Scalar>{
type Plan;
type Context;
// Required methods
fn plan(
ctx: &mut Self::Context,
desc: &ComplexScalePrimsDescriptor,
shapes: &[&[usize]],
) -> Result<Self::Plan>;
fn execute(
ctx: &mut Self::Context,
plan: &Self::Plan,
alpha: Input,
lhs: &Tensor<Input>,
rhs: &Tensor<Input::Real>,
beta: Input,
output: &mut Tensor<Input>,
) -> Result<()>;
fn has_complex_scale_support(desc: ComplexScalePrimsDescriptor) -> bool;
}Expand description
Cross-dtype complex-by-real pointwise family.
The left-hand side and output are complex-valued, while the right-hand side
is real-valued. The execution contract matches the rest of tenferro prims:
output <- alpha * (lhs * rhs) + beta * output.
§Examples
ⓘ
use num_complex::Complex64;
use tenferro_prims::{
ComplexScalePrimsDescriptor, CpuBackend, CpuContext, TensorComplexScalePrims,
};
let mut ctx = CpuContext::new(1);
let desc = ComplexScalePrimsDescriptor::PointwiseMul;
let _plan = <CpuBackend as TensorComplexScalePrims<Complex64>>::plan(
&mut ctx,
&desc,
&[&[2, 2], &[2, 2], &[2, 2]],
)
.unwrap();Required Associated Types§
Required Methods§
Sourcefn plan(
ctx: &mut Self::Context,
desc: &ComplexScalePrimsDescriptor,
shapes: &[&[usize]],
) -> Result<Self::Plan>
fn plan( ctx: &mut Self::Context, desc: &ComplexScalePrimsDescriptor, shapes: &[&[usize]], ) -> Result<Self::Plan>
Plan a complex-by-real pointwise operation for the given shapes.
Sourcefn execute(
ctx: &mut Self::Context,
plan: &Self::Plan,
alpha: Input,
lhs: &Tensor<Input>,
rhs: &Tensor<Input::Real>,
beta: Input,
output: &mut Tensor<Input>,
) -> Result<()>
fn execute( ctx: &mut Self::Context, plan: &Self::Plan, alpha: Input, lhs: &Tensor<Input>, rhs: &Tensor<Input::Real>, beta: Input, output: &mut Tensor<Input>, ) -> Result<()>
Execute a previously planned complex-by-real pointwise operation.
Sourcefn has_complex_scale_support(desc: ComplexScalePrimsDescriptor) -> bool
fn has_complex_scale_support(desc: ComplexScalePrimsDescriptor) -> bool
Report whether the backend advertises support for the given descriptor.
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§
Source§impl<Input> TensorComplexScalePrims<Input> for CpuBackend
impl<Input> TensorComplexScalePrims<Input> for CpuBackend
Source§impl<Input> TensorComplexScalePrims<Input> for CudaBackend
Available on non-crate feature cuda only.
impl<Input> TensorComplexScalePrims<Input> for CudaBackend
Available on non-crate feature
cuda only.