Shared arithmetic power circuits #
Binary powering is a small but important reusable DAG primitive. Unlike a
tree expression for repeated multiplication, each recursively computed power
is shared by the squaring gate. For positive exponent e, the resulting
number of multiplication gates is at most 2 * Nat.log2 e.
Append one gate that multiplies a circuit's output by its original input. The original input remains available because programs retain their input-wire namespace.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Squaring appends exactly one gate.
Multiplication by the retained input appends exactly one gate.
Squaring has the expected semantics.
Multiplication by the retained input has the expected semantics.
Squaring adds exactly one multiplication to the circuit cost.
Multiplication by the retained input adds exactly one multiplication.
Squaring introduces no addition cost.
Multiplication by the retained input introduces no addition cost.
A shared binary-power circuit; its gate count is the bundled size.
Zero uses one free constant gate; one is the zero-gate identity; each further
binary digit contributes one squaring and, for a one bit, one multiplication
by the retained input.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Gate count of the binary-power circuit.
Equations
- Algebraic.Arithmetic.Power.binaryPowerGateCount exponent = (Algebraic.Arithmetic.Power.binaryCircuit exponent).size
Instances For
Binary powering under a name that is easy to mention at concrete
exponents; its gate count is binaryPowerGateCount.
Equations
Instances For
The named binary-power circuit has binaryPowerGateCount gates.
Exact number of multiplication gates used by binaryCircuit.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The multiplication cost of binary compilation is exactly the recursive binary count.
Multiplication cost of the named binary-power circuit.
Binary powering contains no addition gates.
The named binary-power circuit contains no addition gates.
Binary powering uses at most twice the base-two logarithm many multiplications for every positive exponent.