haar_lib/algebra/act/
mod.rs1pub mod add_min_count;
3pub mod add_sum;
4pub mod affine_sum;
5pub mod chmax_max;
6pub mod chmin_min;
7pub mod mul_prod;
8pub mod mul_sum;
9pub mod update_fold;
10pub mod update_sum;
11
12pub use crate::algebra::traits::*;
13
14pub trait Act<M: Monoid> {
16 type Monoid: Monoid<Element = Self::Element>;
18 type Element;
20
21 fn monoid(&self) -> &Self::Monoid;
23
24 fn act(&self, m: &M, val: M::Element, a: Self::Element, n: usize) -> M::Element;
29
30 fn act_one(&self, m: &M, val: M::Element, a: Self::Element) -> M::Element {
32 self.act(m, val, a, 1)
33 }
34
35 fn op(&self, a: Self::Element, b: Self::Element) -> Self::Element {
37 self.monoid().op(a, b)
38 }
39 fn id(&self) -> Self::Element {
41 self.monoid().id()
42 }
43}