# cirq.quantum_shannon_decomposition

Decomposes n-qubit unitary into CX/YPow/ZPow/CNOT gates, preserving global phase.

The algorithm is described in Shende et al.: Synthesis of Quantum Logic Circuits. Tech. rep. 2006, https://arxiv.org/abs/quant-ph/0406176

`qubits` List of qubits in order of significance
`u` Numpy array for unitary matrix representing gate to be decomposed

(Base Case)

1. _single_qubit_decomposition OR (Recursive Case)
2. _msb_demuxer
3. _multiplexed_cossin
4. _msb_demuxer

A single 2-qubit or 1-qubit operations from OP TREE composed from the set { CNOT, rz, ry, ZPowGate }

`ValueError` If the u matrix is non-unitary
`ValueError` If the u matrix is not of shape (2^n,2^n)

[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }]
[{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }]