ac-library-rs icon indicating copy to clipboard operation
ac-library-rs copied to clipboard

Add something like "Zero", "One", "Max" and "Min" traits

Open TonalidadeHidrica opened this issue 5 years ago • 1 comments

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.

TonalidadeHidrica avatar Sep 11 '20 18:09 TonalidadeHidrica

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);

professor-flux avatar Apr 14 '21 02:04 professor-flux

Resolved by #44.

TonalidadeHidrica avatar Mar 26 '23 20:03 TonalidadeHidrica