|
| template<typename B , typename Fq_ , typename Fr_ , typename Params > |
| void | read (B &it, group_elements::affine_element< Fq_, Fr_, Params > &element) |
| |
| template<typename B , typename Fq_ , typename Fr_ , typename Params > |
| void | write (B &it, group_elements::affine_element< Fq_, Fr_, Params > const &element) |
| |
| template<class Fq , class Fr , class Params > |
| std::ostream & | operator<< (std::ostream &os, element< Fq, Fr, Params > const &e) |
| |
| template<typename AffineElement , typename Fq > |
| | __attribute__ ((always_inline)) inline void batch_affine_add_impl(const AffineElement *lhs |
| | Batch affine addition for parallel arrays: (lhs[i], rhs[i]) → rhs[i].
|
| |
| | for (size_t i=0;i< num_pairs;++i) |
| |
| | if (batch_inversion_accumulator==Fq::zero()) |
| |
| template<typename AffineElement , typename Fq , typename T > |
| | __attribute__ ((always_inline)) inline void batch_affine_double_impl(AffineElement *points |
| | Batch affine point doubling using Montgomery's trick.
|
| |
| | for (size_t i_plus_1=num_points;i_plus_1 > 0;--i_plus_1) |
| |
template<typename AffineElement , typename
Fq >
| bb::group_elements::__attribute__ |
( |
(always_inline) |
| ) |
const |
Batch affine addition for parallel arrays: (lhs[i], rhs[i]) → rhs[i].
Batch affine addition for interleaved arrays: pairs (points[2i], points[2i+1]) → points[num_points/2 + i].
Uses Montgomery's batch inversion trick. lhs and rhs are separate arrays so no aliasing issues.
- Parameters
-
| lhs | Input array of first summands (read-only) |
| rhs | Input array of second summands; results are written here (rhs[i] = lhs[i] + rhs[i]) |
| num_pairs | Number of point pairs to add |
| scratch_space | Temporary storage for batch inversion, size >= num_pairs |
- Warning
- ASSUMES NO EDGE CASES:
- All points must be valid (not point at infinity)
- lhs[i] != rhs[i] for all i (no point doubling cases)
- lhs[i] != -rhs[i] for all i (no point at infinity results)
Optimized for the pippenger interleaved memory layout where lhs and rhs live in the same contiguous array. Uses direct address arithmetic and hardcoded prefetch to avoid aliasing penalties that arise when the generic batch_affine_add_impl is called with lhs_base == rhs_base (the compiler cannot prove that writes to output don't alias reads from lhs, forcing unnecessary reloads).
- Parameters
-
| points | Interleaved array: [lhs0, rhs0, lhs1, rhs1, ...]. Results written to top half. |
| num_points | Total number of points (must be even). Number of pairs = num_points / 2. |
| scratch_space | Temporary storage for batch inversion, size >= num_points / 2. |