Trait Act

Source
pub trait Act<M: Monoid> {
    type Monoid: Monoid<Element = Self::Element>;
    type Element;

    // Required methods
    fn monoid(&self) -> &Self::Monoid;
    fn act(
        &self,
        m: &M,
        val: M::Element,
        a: Self::Element,
        n: usize,
    ) -> M::Element;

    // Provided methods
    fn act_one(&self, m: &M, val: M::Element, a: Self::Element) -> M::Element { ... }
    fn op(&self, a: Self::Element, b: Self::Element) -> Self::Element { ... }
    fn id(&self) -> Self::Element { ... }
}
Expand description

モノイド作用

Required Associated Types§

Source

type Monoid: Monoid<Element = Self::Element>

作用させるモノイド

Source

type Element

モノイドの元

Required Methods§

Source

fn monoid(&self) -> &Self::Monoid

作用させるモノイドへの参照を返す。

Source

fn act(&self, m: &M, val: M::Element, a: Self::Element, n: usize) -> M::Element

$val$をn個の値からなる列をモノイド$(\circ, e)$で畳み込んだ値であるとしたとき、 列の各値に$a$を作用させて畳み込んだ値を求める。

畳み込んだ値が同一になるような、長さnのいかなる列に対しても、$a$を作用させて畳み込んだ値はすべて同一でなければならない。

Provided Methods§

Source

fn act_one(&self, m: &M, val: M::Element, a: Self::Element) -> M::Element

self.act(m, val, a, 1)

Source

fn op(&self, a: Self::Element, b: Self::Element) -> Self::Element

二項演算

Source

fn id(&self) -> Self::Element

単位元

Implementors§

Source§

impl<M, A> Act<M> for AddSum<A>
where M: Monoid + Additive, A: Monoid + Additive, M::Element: TryFrom<A::Element, Error: Debug>,

Source§

type Monoid = A

Source§

type Element = <A as Set>::Element

Source§

impl<S> Act<S> for MulProd<S>

Source§

type Monoid = S

Source§

type Element = <S as Set>::Element

Source§

impl<T> Act<Max<T>> for ChmaxMax<T>
where Max<T>: Monoid<Element = T>,

Source§

impl<T> Act<Min<T>> for ChminMin<T>
where Min<T>: Monoid<Element = T>,

Source§

impl<T, M> Act<M> for UpdateFold<T>
where M: Monoid<Element = T>, M::Element: Clone,

Source§

impl<T, M> Act<M> for UpdateSum<T>
where M: Monoid<Element = T> + Additive,

Source§

impl<T, M, S> Act<M> for MulSum<S>
where M: Monoid<Element = T> + Additive, S: Monoid<Element = T> + Multiplicative,

Source§

type Monoid = S

Source§

type Element = <S as Set>::Element

Source§

impl<T, S, M> Act<M> for AffineSum<S>
where M: Monoid<Element = T> + Additive, S: Semiring<Element = T>, Dual<Composition<S>>: Monoid<Element = Linear<T>>,

Source§

impl<T, U, A> Act<MinCount<T, U>> for AddMinCount<A>
where A: Monoid<Element = T> + Additive, MinCount<T, U>: Monoid<Element = (Option<T>, U)>,

Source§

type Monoid = A

Source§

type Element = <A as Set>::Element