pub trait Algebra<F>:
PrimeCharacteristicRing
+ From<F>
+ Add<F, Output = Self>
+ AddAssign<F>
+ Sub<F, Output = Self>
+ SubAssign<F>
+ Mul<F, Output = Self>
+ MulAssign<F> { }
Expand description
A ring R
implements Algebra<F>
if there is an injective homomorphism
from F
into R
; in particular only F::ZERO
maps to R::ZERO
.
For the most part, we will usually expect F
to be a field but there
are a few cases where it is handy to allow it to just be a ring. In
particular, every ring naturally implements Algebra<Self>
.
§Mathematical Description
Let x
and y
denote arbitrary elements of F
. Then
we require that our map from
has the properties:
- Preserves Identity:
from(F::ONE) = R::ONE
- Commutes with Addition:
from(x + y) = from(x) + from(y)
- Commutes with Multiplication:
from(x * y) = from(x) * from(y)
Such maps are known as ring homomorphisms and are injective if the
only element which maps to R::ZERO
is F::ZERO
.
The existence of this map makes R
into an F
-module and hence an F
-algebra.
If, additionally, R
is a field, then this makes R
a field extension of F
.
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.