Skip to main content

textbook_square

Function textbook_square 

Source
pub fn textbook_square(builder: &CircuitBuilder, a: &BigUint) -> BigUint
Expand description

Square an arbitrary-sized BigUint using textbook algorithm.

Computes a * a using an optimized algorithm that takes advantage of the symmetry in squaring (each cross-product appears twice). This is roughly twice more efficient than using textbook_mul, though still quadratic in the number of constraints.

§Arguments

  • builder - Circuit builder for constraint generation
  • a - The BigUint to be squared

§Returns

The square of a as a BigUint with 2 * a.limbs.len() limbs