Batch Inverse
Reduction of the number of field inverse operations when computing batch operations.
What is Batch Inverse?
Batch Inverse is a technique used to efficiently compute the inverses of multiple values at once. Normally, calculating each inverse separately requires (inverse operations), but with Batch Inversion, you can compute all the inverses using just a single inverse operation.
As inverse operations are significantly more expensive than multiplications, this method is especially useful in performance-sensitive contexts—such as in ZK provers.
How Does It Work?
Let’s walk through an example of computing the inverses of four values:
1. Compute Prefix Products
Multiply the values one by one, keeping track of intermediate results:
So we get:
2. Compute Inverse of the Final Product
Compute the inverse of the final product:
This is the only inverse operation required.
3. Compute Each Inverse in Reverse
Now, traverse the values in reverse to compute individual inverses:
, then update
, then update
, then update
This phase involves only multiplication operations.
Computational Complexity
If the vector has length , the total computational cost is:
Prefix Product Computation:
One Inverse Operation:
Reverse Traversal:
Total:
Last updated