pub trait ComputeInnerProduct: RingBase {
// Required methods
fn inner_product_ref<'a, I: Iterator<Item = (&'a Self::Element, &'a Self::Element)>>(
&self,
els: I,
) -> Self::Element
where Self::Element: 'a,
Self: 'a;
fn inner_product_ref_fst<'a, I: Iterator<Item = (&'a Self::Element, Self::Element)>>(
&self,
els: I,
) -> Self::Element
where Self::Element: 'a,
Self: 'a;
fn inner_product<I: Iterator<Item = (Self::Element, Self::Element)>>(
&self,
els: I,
) -> Self::Element;
}
Available on crate feature
unstable-enable
only.Expand description
Trait to allow rings to provide specialized implementations for inner products, i.e.
the sums sum_i a[i] * b[i]
.
§Availability
This API is marked as unstable and is only available when the unstable-enable
crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.
Required Methods§
Sourcefn inner_product_ref<'a, I: Iterator<Item = (&'a Self::Element, &'a Self::Element)>>(
&self,
els: I,
) -> Self::Elementwhere
Self::Element: 'a,
Self: 'a,
fn inner_product_ref<'a, I: Iterator<Item = (&'a Self::Element, &'a Self::Element)>>(
&self,
els: I,
) -> Self::Elementwhere
Self::Element: 'a,
Self: 'a,
Computes the inner product sum_i lhs[i] * rhs[i]
.
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.