quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.24k stars 1.01k forks source link

Preserve global phase in analytical decompositions #6523

Open tanujkhattar opened 6 months ago

tanujkhattar commented 6 months ago

Is your feature request related to a use case or problem? Please describe. two_qubit_matrix_to_cz_operations and three_qubit_matrix_to_operations are used from within the decompose method of MatrixGate but they currently ignore global phase; because of which we don't support decomposing controlled versions of MatrixGate.

Describe the solution you'd like In general, it'd be nice to write a method which, given a target unitary a and actual unitary b returns a cirq.GlobalPhaseGate() which can be used to match b to a s.t. a = global_phase_gate.coefficient * b. This would require minor modification to match_global_phasewhich already exists and can be used from within multiple anlaytical decompositions to "preserve" global phase by simply returning a GlobalPhaseGate() with the right phase.

We should also try to update as many anlaytical_decomposition as possible to preserve global phase.

This can be used to solve issues like https://github.com/quantumlib/Cirq/issues/6517

github-actions[bot] commented 5 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days

github-actions[bot] commented 4 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days

github-actions[bot] commented 3 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days

github-actions[bot] commented 2 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days

github-actions[bot] commented 1 week ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days