mindquantum.algorithm.library.bitphaseflip_operator
- mindquantum.algorithm.library.bitphaseflip_operator(phase_inversion_index, n_qubits)[source]
Generate a circuit that can flip the sign of any calculation bases.
- Parameters
Examples
>>> from mindquantum.core.circuit import Circuit, UN >>> from mindquantum.core.gates import H, Z >>> from mindquantum.algorithm.library import bitphaseflip_operator >>> circuit = Circuit() >>> circuit += UN(H, 3) >>> circuit += bitphaseflip_operator([1, 3], 3) >>> print(circuit.get_qs(ket=True)) √2/4¦000⟩ -√2/4¦001⟩ √2/4¦010⟩ -√2/4¦011⟩ √2/4¦100⟩ √2/4¦101⟩ √2/4¦110⟩ √2/4¦111⟩
- Returns
Circuit, the bit phase flip circuit.