Skip to content

Reference: Square Root Qubricks

Contents


Sqrt Class

psiqworkbench.qubricks.qbk_sqrt.Sqrt

Sqrt(**kwargs)

Bases: Qubrick

Qubrick for square root.

This is implemented starting from "T-count and Qubit Optimized Quantum Circuit Design of the Non-Restoring Square Root Algorithm" (arxiv:1712.08254 ⧉) but with multiple fixes and optimizations:

  • Qubit highwater and Toffoli count are significantly reduced from the original paper.
  • The original paper doesn't work when the high 2 input qubits are 1, but this one does.
  • The original paper requires n to be even and >= 6, this one has no restrictions (for tiny inputs it auto-pads them to 6).

compute

compute(input_qreg: Qubits | QUInt)

Compute square root.

Parameters:

Name Type Description Default
input_qreg Qubits or QUInt

Input register for square root operation

required
Note

For more details, see Built-in Qubricks tutorial.