pub struct Standard<T>(/* private fields */);Expand description
Typed standard arithmetic algebra (add = +, mul = *).
The type parameter T carries the scalar type, making the algebra
Alg::Scalar-centric. This is the canonical core model — HasAlgebra
provides UX sugar for automatic inference (e.g., f64 → Standard<f64>).
This is the default algebra for built-in numeric types (f32, f64,
Complex32, Complex64).
§Examples
use tenferro_algebra::{HasAlgebra, Standard};
// f64 maps to Standard<f64> algebra automatically
fn check_algebra<T: HasAlgebra<Algebra = Standard<T>>>() {}
check_algebra::<f64>();
check_algebra::<f32>();Trait Implementations§
Source§impl<T> Semiring for Standard<T>
Standard arithmetic implements Semiring with + and *.
impl<T> Semiring for Standard<T>
Standard arithmetic implements Semiring with + and *.
§Examples
use tenferro_algebra::{Semiring, Standard};
let z = <Standard<f64> as Semiring>::zero();
let o = <Standard<f64> as Semiring>::one();
assert_eq!(z, 0.0);
assert_eq!(o, 1.0);Source§impl<S> TensorAnalyticPrims<Standard<S>> for CpuBackendwhere
S: Scalar + 'static,
impl<S> TensorAnalyticPrims<Standard<S>> for CpuBackendwhere
S: Scalar + 'static,
type Plan = CpuAnalyticPlan
type Context = CpuContext
Source§fn plan(
_ctx: &mut <CpuBackend as TensorAnalyticPrims<Standard<S>>>::Context,
desc: &AnalyticPrimsDescriptor,
shapes: &[&[usize]],
) -> Result<<CpuBackend as TensorAnalyticPrims<Standard<S>>>::Plan, Error>
fn plan( _ctx: &mut <CpuBackend as TensorAnalyticPrims<Standard<S>>>::Context, desc: &AnalyticPrimsDescriptor, shapes: &[&[usize]], ) -> Result<<CpuBackend as TensorAnalyticPrims<Standard<S>>>::Plan, Error>
Plan an analytic-family operation for the given input/output shapes. Read more
Source§fn execute(
_ctx: &mut <CpuBackend as TensorAnalyticPrims<Standard<S>>>::Context,
plan: &<CpuBackend as TensorAnalyticPrims<Standard<S>>>::Plan,
alpha: S,
inputs: &[&Tensor<S>],
beta: S,
output: &mut Tensor<S>,
) -> Result<(), Error>
fn execute( _ctx: &mut <CpuBackend as TensorAnalyticPrims<Standard<S>>>::Context, plan: &<CpuBackend as TensorAnalyticPrims<Standard<S>>>::Plan, alpha: S, inputs: &[&Tensor<S>], beta: S, output: &mut Tensor<S>, ) -> Result<(), Error>
Execute a previously planned analytic-family operation. Read more
Source§fn has_analytic_support(desc: AnalyticPrimsDescriptor) -> bool
fn has_analytic_support(desc: AnalyticPrimsDescriptor) -> bool
Report whether the backend advertises support for the given descriptor. Read more
Source§impl<S> TensorIndexingPrims<Standard<S>> for CpuBackendwhere
S: Scalar + 'static,
impl<S> TensorIndexingPrims<Standard<S>> for CpuBackendwhere
S: Scalar + 'static,
Source§type Plan = CpuIndexingPlan
type Plan = CpuIndexingPlan
Backend-specific execution plan.
Source§type Context = CpuContext
type Context = CpuContext
Backend execution context.
Source§fn plan(
_ctx: &mut <CpuBackend as TensorIndexingPrims<Standard<S>>>::Context,
desc: &IndexingPrimsDescriptor,
shapes: &[&[usize]],
) -> Result<<CpuBackend as TensorIndexingPrims<Standard<S>>>::Plan, Error>
fn plan( _ctx: &mut <CpuBackend as TensorIndexingPrims<Standard<S>>>::Context, desc: &IndexingPrimsDescriptor, shapes: &[&[usize]], ) -> Result<<CpuBackend as TensorIndexingPrims<Standard<S>>>::Plan, Error>
Plan an indexing operation for the given input/index/output shapes. Read more
Source§fn execute(
_ctx: &mut <CpuBackend as TensorIndexingPrims<Standard<S>>>::Context,
plan: &<CpuBackend as TensorIndexingPrims<Standard<S>>>::Plan,
inputs: &[&Tensor<S>],
indices: &Tensor<i64>,
output: &mut Tensor<S>,
) -> Result<(), Error>
fn execute( _ctx: &mut <CpuBackend as TensorIndexingPrims<Standard<S>>>::Context, plan: &<CpuBackend as TensorIndexingPrims<Standard<S>>>::Plan, inputs: &[&Tensor<S>], indices: &Tensor<i64>, output: &mut Tensor<S>, ) -> Result<(), Error>
Execute a previously planned indexing operation. Read more
Source§fn has_indexing_support(_desc: IndexingPrimsDescriptor) -> bool
fn has_indexing_support(_desc: IndexingPrimsDescriptor) -> bool
Report whether the backend advertises support for the given descriptor.
Source§impl TensorRngPrims<Standard<f64>> for CpuBackend
impl TensorRngPrims<Standard<f64>> for CpuBackend
Source§type Context = CpuContext
type Context = CpuContext
Backend execution context.
Source§fn plan(
_ctx: &mut <CpuBackend as TensorRngPrims<Standard<f64>>>::Context,
desc: &RngPrimsDescriptor,
shapes: &[&[usize]],
) -> Result<<CpuBackend as TensorRngPrims<Standard<f64>>>::Plan, Error>
fn plan( _ctx: &mut <CpuBackend as TensorRngPrims<Standard<f64>>>::Context, desc: &RngPrimsDescriptor, shapes: &[&[usize]], ) -> Result<<CpuBackend as TensorRngPrims<Standard<f64>>>::Plan, Error>
Plan a tensor RNG operation for the given output shape.
Source§fn execute(
_ctx: &mut <CpuBackend as TensorRngPrims<Standard<f64>>>::Context,
plan: &<CpuBackend as TensorRngPrims<Standard<f64>>>::Plan,
generator: &mut Generator,
output: &mut Tensor<f64>,
) -> Result<(), Error>
fn execute( _ctx: &mut <CpuBackend as TensorRngPrims<Standard<f64>>>::Context, plan: &<CpuBackend as TensorRngPrims<Standard<f64>>>::Plan, generator: &mut Generator, output: &mut Tensor<f64>, ) -> Result<(), Error>
Execute a previously planned RNG operation.
Source§fn has_rng_support(desc: RngPrimsDescriptor) -> bool
fn has_rng_support(desc: RngPrimsDescriptor) -> bool
Report whether the backend advertises support for the given descriptor.
Source§impl TensorRngPrims<Standard<i32>> for CpuBackend
impl TensorRngPrims<Standard<i32>> for CpuBackend
Source§type Context = CpuContext
type Context = CpuContext
Backend execution context.
Source§fn plan(
_ctx: &mut <CpuBackend as TensorRngPrims<Standard<i32>>>::Context,
desc: &RngPrimsDescriptor,
shapes: &[&[usize]],
) -> Result<<CpuBackend as TensorRngPrims<Standard<i32>>>::Plan, Error>
fn plan( _ctx: &mut <CpuBackend as TensorRngPrims<Standard<i32>>>::Context, desc: &RngPrimsDescriptor, shapes: &[&[usize]], ) -> Result<<CpuBackend as TensorRngPrims<Standard<i32>>>::Plan, Error>
Plan a tensor RNG operation for the given output shape.
Source§fn execute(
_ctx: &mut <CpuBackend as TensorRngPrims<Standard<i32>>>::Context,
plan: &<CpuBackend as TensorRngPrims<Standard<i32>>>::Plan,
generator: &mut Generator,
output: &mut Tensor<i32>,
) -> Result<(), Error>
fn execute( _ctx: &mut <CpuBackend as TensorRngPrims<Standard<i32>>>::Context, plan: &<CpuBackend as TensorRngPrims<Standard<i32>>>::Plan, generator: &mut Generator, output: &mut Tensor<i32>, ) -> Result<(), Error>
Execute a previously planned RNG operation.
Source§fn has_rng_support(desc: RngPrimsDescriptor) -> bool
fn has_rng_support(desc: RngPrimsDescriptor) -> bool
Report whether the backend advertises support for the given descriptor.
Source§impl<S> TensorScalarPrims<Standard<S>> for CpuBackendwhere
S: Scalar + 'static,
impl<S> TensorScalarPrims<Standard<S>> for CpuBackendwhere
S: Scalar + 'static,
type Plan = CpuScalarPlan
type Context = CpuContext
Source§fn plan(
_ctx: &mut <CpuBackend as TensorScalarPrims<Standard<S>>>::Context,
desc: &ScalarPrimsDescriptor,
shapes: &[&[usize]],
) -> Result<<CpuBackend as TensorScalarPrims<Standard<S>>>::Plan, Error>
fn plan( _ctx: &mut <CpuBackend as TensorScalarPrims<Standard<S>>>::Context, desc: &ScalarPrimsDescriptor, shapes: &[&[usize]], ) -> Result<<CpuBackend as TensorScalarPrims<Standard<S>>>::Plan, Error>
Plan a scalar-family operation for the given input/output shapes. Read more
Source§fn execute(
_ctx: &mut <CpuBackend as TensorScalarPrims<Standard<S>>>::Context,
plan: &<CpuBackend as TensorScalarPrims<Standard<S>>>::Plan,
alpha: S,
inputs: &[&Tensor<S>],
beta: S,
output: &mut Tensor<S>,
) -> Result<(), Error>
fn execute( _ctx: &mut <CpuBackend as TensorScalarPrims<Standard<S>>>::Context, plan: &<CpuBackend as TensorScalarPrims<Standard<S>>>::Plan, alpha: S, inputs: &[&Tensor<S>], beta: S, output: &mut Tensor<S>, ) -> Result<(), Error>
Execute a previously planned scalar-family operation. Read more
Source§fn has_scalar_support(desc: ScalarPrimsDescriptor) -> bool
fn has_scalar_support(desc: ScalarPrimsDescriptor) -> bool
Report whether the backend advertises support for the given descriptor. Read more
Source§impl<S> TensorSemiringCore<Standard<S>> for CpuBackendwhere
S: Scalar,
impl<S> TensorSemiringCore<Standard<S>> for CpuBackendwhere
S: Scalar,
Source§type Context = CpuContext
type Context = CpuContext
Backend-specific execution context.
Source§fn plan(
ctx: &mut CpuContext,
desc: &SemiringCoreDescriptor,
shapes: &[&[usize]],
) -> Result<CpuPlan<S>, Error>
fn plan( ctx: &mut CpuContext, desc: &SemiringCoreDescriptor, shapes: &[&[usize]], ) -> Result<CpuPlan<S>, Error>
Plan a semiring-core operation.
Source§impl<S> TensorSemiringFastPath<Standard<S>> for CpuBackendwhere
S: Scalar,
impl<S> TensorSemiringFastPath<Standard<S>> for CpuBackendwhere
S: Scalar,
Source§type Context = CpuContext
type Context = CpuContext
Backend-specific execution context.
Source§fn plan(
ctx: &mut CpuContext,
desc: &SemiringFastPathDescriptor,
shapes: &[&[usize]],
) -> Result<CpuPlan<S>, Error>
fn plan( ctx: &mut CpuContext, desc: &SemiringFastPathDescriptor, shapes: &[&[usize]], ) -> Result<CpuPlan<S>, Error>
Plan an optional semiring fast path.
Source§fn execute(
ctx: &mut CpuContext,
plan: &CpuPlan<S>,
alpha: S,
inputs: &[&Tensor<S>],
beta: S,
output: &mut Tensor<S>,
) -> Result<(), Error>
fn execute( ctx: &mut CpuContext, plan: &CpuPlan<S>, alpha: S, inputs: &[&Tensor<S>], beta: S, output: &mut Tensor<S>, ) -> Result<(), Error>
Execute an optional semiring fast path.
Source§fn has_fast_path(desc: SemiringFastPathDescriptor) -> bool
fn has_fast_path(desc: SemiringFastPathDescriptor) -> bool
Query whether the optional path is available.
Source§impl<S> TensorSortPrims<Standard<S>> for CpuBackendwhere
S: Scalar + PartialOrd + 'static,
impl<S> TensorSortPrims<Standard<S>> for CpuBackendwhere
S: Scalar + PartialOrd + 'static,
Source§type Plan = CpuSortPlan
type Plan = CpuSortPlan
Backend-specific execution plan.
Source§type Context = CpuContext
type Context = CpuContext
Backend execution context.
Source§fn plan(
_ctx: &mut <CpuBackend as TensorSortPrims<Standard<S>>>::Context,
desc: &SortPrimsDescriptor,
shapes: &[&[usize]],
) -> Result<<CpuBackend as TensorSortPrims<Standard<S>>>::Plan, Error>
fn plan( _ctx: &mut <CpuBackend as TensorSortPrims<Standard<S>>>::Context, desc: &SortPrimsDescriptor, shapes: &[&[usize]], ) -> Result<<CpuBackend as TensorSortPrims<Standard<S>>>::Plan, Error>
Plan a sort operation for the given input shape. Read more
Source§fn execute(
_ctx: &mut <CpuBackend as TensorSortPrims<Standard<S>>>::Context,
plan: &<CpuBackend as TensorSortPrims<Standard<S>>>::Plan,
input: &Tensor<S>,
values_out: &mut Tensor<S>,
indices_out: &mut Tensor<i64>,
) -> Result<(), Error>
fn execute( _ctx: &mut <CpuBackend as TensorSortPrims<Standard<S>>>::Context, plan: &<CpuBackend as TensorSortPrims<Standard<S>>>::Plan, input: &Tensor<S>, values_out: &mut Tensor<S>, indices_out: &mut Tensor<i64>, ) -> Result<(), Error>
Execute a previously planned sort operation. Read more
Source§fn has_sort_support(_desc: &SortPrimsDescriptor) -> bool
fn has_sort_support(_desc: &SortPrimsDescriptor) -> bool
Report whether the backend advertises support for the given descriptor.
Auto Trait Implementations§
impl<T> Freeze for Standard<T>
impl<T> RefUnwindSafe for Standard<T>where
T: RefUnwindSafe,
impl<T> Send for Standard<T>where
T: Send,
impl<T> Sync for Standard<T>where
T: Sync,
impl<T> Unpin for Standard<T>where
T: Unpin,
impl<T> UnwindSafe for Standard<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more