pub trait Algebra<R: Ring>:
Module<R>
+ Mul<Output = Self>
+ MulAssign
+ One
+ Distributive {
// Provided method
fn sqr(&self) -> Self { ... }
}Expand description
Represents a Unital Algebra over a Ring.
In abstract algebra, an algebra is a vector space—or, more generally, a module—equipped with a bilinear binary operation. This trait abstracts over this concept.
This trait defines a Unital Algebra because it requires the One trait,
which provides a multiplicative identity (1).
§Mathematical Definition
An algebra A over a commutative ring R is a module over R that is also
a ring itself, where the ring multiplication is R-bilinear. This implementation
is slightly more general, as R is only required to be a Ring, not necessarily
commutative.
An algebra is unital if it has a multiplicative identity element.
§Structure:
Selfis aModuleover a scalarRingR. This provides vector addition and scalar multiplication.Selfhas a binary operation*(multiplication) that is compatible with the module structure.Selfhas a multiplicative identity1(from theOnetrait).
§Note:
This trait does not require the algebra to be associative. For that, see
the AssociativeAlgebra trait.
An Algebra over a Ring R.
Mathematical Definition: A Vector Space (Module) equipped with a bilinear product.
Constraints:
- It is a Module (AddGroup + Scaling).
- It is Unital (Has One).
- It is Distributive (a(b+c) = ab + ac).
- It is NOT necessarily Associative (Octonions allowed).
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.