cirq.num_cnots_required

Returns the min number of CNOT/CZ gates required by a two-qubit unitary.

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

u A two-qubit unitary.
atol The absolute tolerance used to make this judgement.

The number of CNOT or CZ gates required to implement the unitary.

ValueError If the shape of u is not 4 by 4.