Trait accurate::traits::DotAccumulator [] [src]

pub trait DotAccumulator<F>: Add<(F, F), Output = Self> + From<F> + Clone {
    fn dot(self) -> F;

    fn zero() -> Self
    where
        F: Zero
, { ... }
fn absorb<I>(self, it: I) -> Self
    where
        I: IntoIterator<Item = (F, F)>
, { ... } }

Accumulates terms of a dot product

Required Methods

The dot product of all terms accumulated so far

Provided Methods

Initial value for an accumulator

Absorb the items of an iterator into the accumulator

Examples

use accurate::traits::*;
use accurate::dot::Dot2;

let x = vec![1.0, 2.0, 3.0];
let y = x.clone();

let d = Dot2::zero().absorb(x.into_iter().zip(y.into_iter()));
assert_eq!(14.0f64, d.dot())

Implementors