algebra
algebra copied to clipboard
All operators should be parameterized for more general cases.
Current approach are not suitable for more general algebras:
-
Lattice consists of two semigroups, their operators have very similiar properties to each other and should not be assumed as additive-like nor multiplicative-like.
-
Tensor product of modules consists of several different product-like operators, so I think all operators should be parameterized rather than be concrete instances.
A better approach might be letting all operators be parameterized through generics. For example:
pub trait Ring<Additive:Op, Multiplicative:Op>
: RingApprox<Additive, Multiplicative>
+ GroupAbelian<Additive>
+ Monoid<Multiplicative>
instead of
pub trait Ring
: RingApprox
+ GroupAbelian<Additive>
+ Monoid<Multiplicative>
Hmm.. Yeah that makes sense. I am not actually sure how much this library will be developed as https://github.com/sebcrozet/alga has been developed more.
As you might have noticed development of both has been pretty slow...
For what it's worth,the approach proposed here is actually the one implemented on alga!