Functions | |
| double | dot (const double *x, const double *y, std::size_t n) |
| Round-to-nearest-even value of the exact sum of x[i] * y[i]. | |
| double | orderedDot (const double *x, const double *y, std::size_t n) |
| A fixed summation tree: four lanes (term i goes to lane i mod 4, each lane a left-to-right sum of rounded products), then (l0 + l1) + (l2 + l3). | |
| double | sum (const double *x, std::size_t n) |
| Round-to-nearest-even value of the exact sum of x[i]. | |
| double | sumStrided (const double *x, std::size_t n, std::size_t stride) |
| Same sum for x[i * stride]. | |
| template<typename A, typename B> | |
| double | dot (const Eigen::MatrixBase< A > &x, const Eigen::MatrixBase< B > &y) |
| template<typename A, typename B> | |
| double | orderedDot (const Eigen::MatrixBase< A > &x, const Eigen::MatrixBase< B > &y) |
| template<typename A> | |
| double | squaredNorm (const Eigen::MatrixBase< A > &x) |
| template<typename A> | |
| double | norm (const Eigen::MatrixBase< A > &x) |
| sqrt of the correctly rounded squared norm; IEEE sqrt is itself correctly rounded, so this is reproducible as well. | |
| template<typename A> | |
| double | orderedNorm (const Eigen::MatrixBase< A > &x) |
| sqrt of orderedDot(x, x): reproducible, not correctly rounded. | |
| template<typename A> | |
| A::PlainObject | normalized (const Eigen::MatrixBase< A > &x, double min_norm=1e-300) |
| x / norm(x), or zero below min_norm (the safemath convention). | |
Variables | |
| constexpr std::size_t | kLanes = 4 |
|
nodiscard |
Round-to-nearest-even value of the exact sum of x[i] * y[i].
An exact zero returns +0. A non-finite input returns the plain IEEE sum, so NaN and infinity propagate as they would without this function.
Definition at line 451 of file ExactReduction.cpp.
|
nodiscard |
Definition at line 67 of file ExactReduction.h.
|
nodiscard |
sqrt of the correctly rounded squared norm; IEEE sqrt is itself correctly rounded, so this is reproducible as well.
Definition at line 92 of file ExactReduction.h.
|
nodiscard |
x / norm(x), or zero below min_norm (the safemath convention).
Definition at line 106 of file ExactReduction.h.
|
nodiscard |
A fixed summation tree: four lanes (term i goes to lane i mod 4, each lane a left-to-right sum of rounded products), then (l0 + l1) + (l2 + l3).
Not exact, but every operation is a single IEEE multiply or add in an order this translation unit fixes (it is compiled without contraction), so the bits match on every compiler, Eigen release and CPU. For bulk products that set a vector, not a branch.
Definition at line 483 of file ExactReduction.cpp.
|
nodiscard |
Definition at line 76 of file ExactReduction.h.
|
nodiscard |
sqrt of orderedDot(x, x): reproducible, not correctly rounded.
For the per-atom lengths of a step, where an exact sum per atom costs more than the step.
Definition at line 100 of file ExactReduction.h.
|
nodiscard |
Definition at line 85 of file ExactReduction.h.
|
nodiscard |
Round-to-nearest-even value of the exact sum of x[i].
Definition at line 514 of file ExactReduction.cpp.
|
nodiscard |
Same sum for x[i * stride].
A row-major atom matrix stores one column this way. stride 1 is sum().
Definition at line 516 of file ExactReduction.cpp.
|
constexpr |
Definition at line 278 of file ExactReduction.cpp.