Closed TonalidadeHidrica closed 1 year ago
i think implementing traits like multiplicative/additive identity can be useful in many generic functions like binary_exp
, (so the end user can implement a wrapper class for 2D vector and implement MulIdentity
trait and Mul
operator and use the same binary_exp for matrix exp), gcd
, ext_gcd
, etc.
and we can implement traits for primitive types using macros as
implement_mul_iden!(i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize);
Resolved by #44.
I will provide some default implementation for monoid, such as calculating sums, products, maximum or minimum values. I want to implement them for all types available, but currently there are no traits that ensure the existence of additive unit etc.. I suggest creating a new trait that returns such values. The names listed in the title are just examples.