Standard

Struct Standard 

Source
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., f64Standard<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: Scalar> Algebra for Standard<T>

Source§

type Scalar = T

The scalar element type for tensors under this algebra.
Source§

impl<T: Scalar + Zero + One> 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§

fn zero() -> T

Additive identity element.
Source§

fn one() -> T

Multiplicative identity element.
Source§

fn add(a: T, b: T) -> T

Semiring addition.
Source§

fn mul(a: T, b: T) -> T

Semiring multiplication.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.