Trait Semiring

Source
pub trait Semiring:
    Debug
    + Clone
    + Eq {
    type Target: Debug + Clone + Eq;

    // Required methods
    fn zero() -> Self::Target;
    fn one() -> Self::Target;
    fn add_assign(a: &mut Self::Target, b: &Self::Target);
    fn mul(a: &Self::Target, b: &Self::Target) -> Self::Target;
}
Expand description

半環
加算は可換モノイド
乗算はモノイド
乗算は加法に対して分配法則を満たす a*(b+c) = ab + ac, (a+b)c = ac + bc
加算の単位元は乗算の零元 0
a=a*0=0

Required Associated Types§

Required Methods§

Source

fn zero() -> Self::Target

Source

fn one() -> Self::Target

Source

fn add_assign(a: &mut Self::Target, b: &Self::Target)

Source

fn mul(a: &Self::Target, b: &Self::Target) -> Self::Target

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§