Attach a diagonal gate to a circuit.
The decomposition is based on Theorem 7 given in « Synthesis of Quantum Logic Circuits » by Shende et al. (https://arxiv.org/pdf/quant-ph/0406176.pdf).
diag (list) – list of the 2^k diagonal entries (for a diagonal gate on k qubits). Must contain at least two entries
qubit (QuantumRegister|list) – list of k qubits the diagonal is acting on (the order of the qubits specifies the computational basis in which the diagonal gate is provided: the first element in diag acts on the state where all the qubits in q are in the state 0, the second entry acts on the state where all the qubits q,…,q[k-1] are in the state zero and q is in the state 1, and so on)
the diagonal gate which was attached to the circuit.
- Type renvoyé
QiskitError – if the list of the diagonal entries or the qubit list is in bad format; if the number of diagonal entries is not 2^k, where k denotes the number of qubits