Trait nekolib::traits::binop::Recip

source ·
pub trait Recip: PartialRecip {
    // Provided method
    fn recip(&self, x: Self::Set) -> Self::Set { ... }
}
Expand description

逆元が常に存在する。

二項演算 $\circ: M \times M \to M$ が、常に逆元を持つことを示す。 $$ x \in M \implies {}^\exists a \in M: x \circ a = a \circ x = e. $$ この $a$ を $x^{-1}$ と書く。

Examples

use nekolib::traits::{Magma, Monoid, Recip};
use nekolib::utils::OpAdd;

let op_add = OpAdd::default();
let x = 3;
let y = op_add.recip(x);
assert_eq!(op_add.op(x, y), 0);

Provided Methods§

source

fn recip(&self, x: Self::Set) -> Self::Set

Implementors§

source§

impl<T> Recip for OpAdd<T>where T: Add<Output = T> + Eq + Sized + Neg<Output = T>,

source§

impl<T> Recip for OpMul<T>where T: Mul<Output = T> + Eq + Sized + MulRecip<Output = T>,