pub trait Algebra<F>:
PrimeCharacteristicRing<Output = Self, Output = Self, Output = Self>
+ From<F>
+ Add<F>
+ AddAssign<F>
+ Sub<F>
+ SubAssign<F>
+ Mul<F>
+ MulAssign<F> {
// Provided method
fn mixed_dot_product<const N: usize>(a: &[Self; N], f: &[F; N]) -> Self
where F: Clone { ... }
}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.
Provided Methods§
Sourcefn mixed_dot_product<const N: usize>(a: &[Self; N], f: &[F; N]) -> Selfwhere
F: Clone,
fn mixed_dot_product<const N: usize>(a: &[Self; N], f: &[F; N]) -> Selfwhere
F: Clone,
Dot product between algebra elements and base field scalars.
Given arrays a (algebra) and f (scalars), computes:
result = a[0]*f[0] + a[1]*f[1] + ... + a[N-1]*f[N-1]Uses a tree-structured summation to minimize dependency chains and maximize throughput on pipelined architectures.
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.
Implementations on Foreign Types§
impl<F> Algebra<SymbolicVariable<F>> for SymbolicExpr<BaseLeaf<F>>where
F: Field,
impl<F> Algebra<F> for SymbolicExpr<BaseLeaf<F>>where
F: Field,
impl<F, EF> Algebra<SymbolicExpr<BaseLeaf<F>>> for SymbolicExpr<ExtLeaf<F, EF>>where
F: Field,
EF: ExtensionField<F>,
impl<F, EF> Algebra<SymbolicVariable<F>> for SymbolicExpr<ExtLeaf<F, EF>>where
F: Field,
EF: ExtensionField<F>,
impl<F, EF> Algebra<SymbolicVariableExt<F, EF>> for SymbolicExpr<ExtLeaf<F, EF>>where
F: Field,
EF: ExtensionField<F>,
impl<F, EF> Algebra<F> for SymbolicExpr<ExtLeaf<F, EF>>where
F: Field,
EF: ExtensionField<F>,
impl<F, const D: usize> Algebra<BinomialExtensionField<F, D>> for SymbolicExpr<ExtLeaf<F, BinomialExtensionField<F, D>>>
Concrete Algebra for BinomialExtensionField — avoids overlap with Algebra<F> when EF = F.