mimiqcircuits.decomposition.rules.solovay_kitaev¶
Solovay-Kitaev algorithm for approximating arbitrary unitaries with Clifford+T.
The Solovay-Kitaev algorithm recursively refines an initial approximation using group commutators, achieving ε-approximation with O(log^c(1/ε)) gates where c ≈ 3.97.
References
Dawson & Nielsen, “The Solovay-Kitaev algorithm” (2005)
Kitaev, Shen, Vyalyi, “Classical and Quantum Computation” (2002)
Functions
|
Construct an SU(2) matrix from rotation axis and angle. |
|
Extract the rotation angle θ from an SU(2) matrix U = exp(iθ n·σ/2). |
|
Extract the rotation axis n from an SU(2) matrix U = exp(iθ n·σ/2). |
|
Find the gate sequence in the ε-net that best approximates U. |
|
Find two orthonormal vectors v, w perpendicular to n. |
|
Convert a gate to a numpy matrix. |
|
Decompose an SU(2) matrix Δ (close to identity) into V and W. |
|
Generate an ε-net over SU(2) using Breadth-First Search. |
|
Get the basic Clifford+T gates for the epsilon-net. |
|
Get or initialize the Solovay-Kitaev lookup tables. |
|
Return the inverse of a gate sequence: (g₁ g₂ . |
|
Map an SU(2) matrix to a point in R^4 (the 3-sphere S³). |
|
Compute the Frobenius norm distance ||U - V||_F. |
|
Compute the unitary matrix for a gate sequence. |
|
Simplify a gate sequence by canceling adjacent gates. |
|
Approximate an SU(2) matrix using the Solovay-Kitaev algorithm. |
|
Project a 2x2 unitary matrix to SU(2) by removing the global phase. |
Classes
|
Cache entry for Solovay-Kitaev lookup tables. |
|
Rewrite rule using the Solovay-Kitaev algorithm. |
- class mimiqcircuits.decomposition.rules.solovay_kitaev.SolovayKitaevRewrite(depth=3, simplify=True, net_max_depth=10, net_max_points=50000, net_min_dist=0.02)[source]¶
Bases:
RewriteRuleRewrite rule using the Solovay-Kitaev algorithm.
Approximates arbitrary single-qubit unitaries using a sequence of Clifford+T gates. The algorithm recursively refines an initial approximation using group commutators, achieving ε-approximation with O(log^c(1/ε)) gates.
- Parameters:
depth (int) – Recursion depth (default: 3). Higher = better precision, more gates.
simplify (bool) – Whether to simplify the resulting sequence (default: True).
net_max_depth (int) – Maximum depth for epsilon-net generation (default: 15).
net_max_points (int) – Maximum points in epsilon-net (default: 100,000).
net_min_dist (float) – Minimum distance between epsilon-net points (default: 0.01).
- Supported operations:
GateRZ(λ): Z-rotation by angle λ
GateRY(θ): Y-rotation by angle θ
GateRX(θ): X-rotation by angle θ
GateU(θ, φ, λ, γ): General single-qubit unitary
Symbolic parameters are NOT supported.
Example
>>> from mimiqcircuits import GateRZ >>> from mimiqcircuits.decomposition import SolovayKitaevRewrite >>> rule = SolovayKitaevRewrite(depth=0) >>> circ = rule.decompose_step(GateRZ(0.123), [0], [], [])
Note
The first call may be slow due to epsilon-net generation. Subsequent calls reuse the cached net.
- matches(op)[source]¶
Check if this rule can decompose the operation.
Matches single-qubit rotations with concrete (non-symbolic) angles.
- decompose_step(op, qubits, bits, zvars)[source]¶
Decompose the operation using Solovay-Kitaev.
- Parameters:
- Returns:
A Circuit containing the Clifford+T approximation.
- Raises:
DecompositionError – If the operation cannot be decomposed.
- Return type:
- __init__(depth=3, simplify=True, net_max_depth=10, net_max_points=50000, net_min_dist=0.02)¶