quantum_circuitThis class models a quantum circuit, providing gate operations, quantum states, probabilities, quantum phases, expectation values, measurements, etc.
class quantum_circuit
This class does not inherit to any class.
This class does not have attributes.
construct() — The constructor. Create an instance of class quantum_circuit apply_controlled_gate() — Apply controlled-Hermitian gate to the circuit apply_gate() — Apply Hermitian gate to the circuit barrier() — Add a barrier to the circuit bits() — Get total number of classical bits of the circuit ccx() — Apply \(CCX\) (also known as Toffoli) gate to the circuit classical_bits() — Get the measured classical bits cp() — Apply \(CP\) gate to the circuit cu() — Apply \(CU\) gate to the circuit cx() — Apply \(CX\) (\(CNOT\)) gate to the circuit cy() — Apply \(CY\) gate to the circuit cz() — Apply \(CZ\) gate to the circuit density_operator() — Get density operator of the circuit in little endian order draw() — Draw the circuit in ASCII art form expectation_value() — Get the expectation value by an observable Hermitian operator \(\hat{A}\) h() — Apply \(H\) gate to the circuit i() — Apply \(I\) gate to the circuit initialise() — Set amplitudes of the state iqft() — Apply \(N\)-qubit Inverse Quantum Fourier Transform (\(QFT^\dagger_N\)) to the circuit measure() — Measure specific qubit and store the result to classical bit p() — Apply \(P\) gate (single-qubit rotation of \(Z\)-axis) to the circuit phase() — Get the quantum phase in little endian order print_classical_bits() — Print the measured classical bits in a little-endian binary string format print_phase() — Print the quantum phase in little endian order print_probability() — Print the state probabilities in little endian order print_statevector() — Print the statevector \(\ket{\psi}\) of the circuit in little endian order probability() — Get the state probabilities in little endian order qft() — Apply \(N\)-qubit Quantum Fourier Transform (\(QFT_N\)) to the circuit qubits() — Get total number of qubits of the circuit rx() — Apply \(Rx\) gate to the circuit rxx() — Apply \(Rxx\) gate to the circuit ry() — Apply \(Ry\) gate to the circuit ryy() — Apply \(Ryy\) gate to the circuit rz() — Apply \(Rz\) gate to the circuit rzx() — Apply \(Rzx\) gate to the circuit rzz() — Apply \(Rzz\) gate to the circuit s() — Apply \(S\) gate to the circuit sdg() — Apply \(S^{\dagger}\) gate to the circuit set_psi() — Set the state \(\ket{\psi}\) sqrt_x() — Apply \(\sqrt{X}\) gate to the circuit sqrt_xdg() — Apply \(\sqrt{X}^{\dagger}\) gate to the circuit statevector() — Get the statevector \(\ket{\psi}\) of the circuit in little endian order swap() — Apply \(SWAP\) gate to the circuit t() — Apply \(T\) gate to the circuit tdg() — Apply \(T^{\dagger}\) gate to the circuit u() — Apply \(U\) gate (generic single-qubit rotation of \(ZYZ\) Euler angles) to the circuit x() — Apply \(X\) gate to the circuit y() — Apply \(Y\) gate to the circuit z() — Apply \(Z\) gate to the circuit