template<typename
Curve>
class bb::BatchedAffineAddition< Curve >
Class for handling fast batched affine addition of large sets of EC points.
Useful for pre-reducing the SRS points via summation for commitments to polynomials with large ranges of constant coefficients.
- Template Parameters
-
Definition at line 23 of file batched_affine_addition.hpp.
template<typename
Curve >
Given a set of points and sequence counts, peform addition to reduce each sequence to a single point.
Reduce each sequence to a single point via repeated rounds of pairwise addition. (If the length of the sequence is odd in a given round, the unpaired point is simply carried over to the next round). The inverses needed in the addition formula are batch computed in a single go for all additions to be performed across all sequences in a given round.
- Note
- : Multithreading is achieved by evenly distributing the points across the optimal number of available threads. This can result in the bisecting of some sequences which is acounted for in the final result by further summing the reduced points that resulted from a sequence split across two or more threads. An example with two threads and three add sequences:
|------------------------| Points
|------------|-----------| Thread boundaries
|---|-----------|--------| Addition sequence boundaries
|---|--------|---|-------| New addition sequence boundaries
| 0 | 1 | 1 | 2 | Tags
Each thread recieves two add sequences and reduces them to two points. The resulting four points are further reduced to three by summing points that share a sequence tag.
- Parameters
-
points | Set of points to be reduced in place to num-sequences many points |
sequence_counts | lengths of the individual sequences to be summed (assumed continguous in points) |
- Returns
- std::vector<G1> the set of reduced points in contiguous memory
Definition at line 18 of file batched_affine_addition.cpp.
template<typename
Curve >
Add two affine elements with the inverse in the slope term \lambda provided as input.
The sum of two points (x1, y1), (x2, y2) is given by x3 = \lambda^2 - x1 - x2, y3 = \lambda*(x1 - x3) - y1, where \lambda = (y2 - y1)/(x2 - x1). When performing many additions at once, it is more efficient to batch compute the inverse component of \lambda for each pair of points. This gives rise to the need for a method like this one.
- Template Parameters
-
- Parameters
-
point_1 | (x1, y1) |
point_2 | (x2, y2) |
denominator | 1/(x2 - x1) |
- Returns
- Curve::AffineElement
Definition at line 116 of file batched_affine_addition.hpp.