QuantumStatePreparation
QuICT.qcda.synthesis.quantum_state_preparation.QuantumStatePreparation ¶
QuantumStatePreparation(method: str = 'unitary_decomposition', keep_phase: bool = False, ancilla: int = 0, opt: bool = True)
Bases: object
For a given quantum state \(|\psi\rangle\), create a CompositeGate \(C\) that \(|\psi\rangle = C |0\rangle\)
Choose the method between the references, designing circuit of quantum state preparation with uniformly gates, unitary decomposition and diagnal gates respectively
Reference
[1] Transformation of quantum states using uniformly controlled rotations
https://arxiv.org/abs/quant-ph/0407010
[2] Quantum-state preparation with universal gate decompositions
https://arxiv.org/abs/1003.5760
Examples:
>>> from QuICT.qcda.synthesis import QuantumStatePreparation
>>> QSP = QuantumStatePreparation('uniformly_gates')
>>> gates = QSP.execute(state_vector)
>>> from QuICT.qcda.synthesis import QuantumStatePreparation
>>> QSP = QuantumStatePreparation('unitary_decomposition')
>>> gates = QSP.execute(state_vector)
Parameters:
-
method(str, default:'unitary_decomposition') –chosen method in ['uniformly_gates', 'unitary_decomposition'], Please note that if you select method 'unary_transformation', then please pass in the state_vector with all real number coefficient when using execute(), otherwise the method will be invalid and automatically transferred to method 'unary_diagonal_joint'.
-
keep_phase(bool, default:False) –whether to keep the global phase as a GPhase gate in the output
-
ancilla(int, default:0) –the number of ancillary qubits m
-
opt(bool, default:True) –optimizer switch for 'diagonal_gates', enabled by default
Source code in QuICT/qcda/synthesis/quantum_state_preparation/quantum_state_preparation.py
execute ¶
Quantum state preparation with the chosen method
Parameters:
-
state_vector(ndarray) –the statevector to be prepared
Returns:
-
CompositeGate(CompositeGate) –the preparation CompositeGate