Returns the min number of CNOT/CZ gates required by a two-qubit unitary.
cirq.num_cnots_required(
u: np.ndarray, atol: float = 1e-08
) -> int
See Proposition III.1, III.2, III.3 in Shende et al. “Recognizing Small-
Circuit Structure in Two-Qubit Operators and Timing Hamiltonians to Compute
Controlled-Not Gates”. https://arxiv.org/abs/quant-ph/0308045
Args |
u
|
A two-qubit unitary.
|
atol
|
The absolute tolerance used to make this judgement.
|
Returns |
The number of CNOT or CZ gates required to implement the unitary.
|
Raises |
ValueError
|
If the shape of u is not 4 by 4.
|