QiskitCircuit¶
- class QiskitCircuit¶
Qiskit-based quantum circuit implementation.
Wraps
QuantumCircuitandSparsePauliOpto satisfy the circuit protocol interface required by QAOA circuit construction.Methods
Apply a CNOT gate with control qubit i and target qubit j.
Apply a controlled-Z gate between qubit i and qubit j.
Apply a Hadamard gate to qubit i.
Apply a Hamiltonian evolution gate
exp(-i * value * H).Apply a phase gate to qubit i.
Apply an Rx rotation gate to qubit i.
Apply an Ry rotation gate to qubit i.
Apply an Rz rotation gate to qubit i.
Apply an S gate to qubit i, inducing a pi/2 phase on the |1> state.
Apply the adjoint of the S gate to qubit i, inducing a -pi/2 phase on the |1> state.
Apply a SWAP gate between qubit i and qubit j.
Apply a sqrt(X) gate to qubit i.
Apply the adjoint of the sqrt(X) gate to qubit i.
Apply a T gate to qubit i, inducing a pi/4 phase on the |1> state.
Apply the adjoint of the T gate to qubit i, inducing a -pi/4 phase on the |1> state.
Apply a general single-qubit unitary gate to qubit i.
Apply a Pauli-X gate to qubit i.
Apply a Pauli-Y gate to qubit i.
Apply a Pauli-Z gate to qubit i.
Return the observable implementation class used by this circuit.
Attributes
Number of qubits in the circuit.
Underlying
QuantumCircuitobject.- class QiskitObservable¶
Observable builder backed by
SparsePauliOp.Accumulates Pauli-X and Pauli-Z terms to construct a Hamiltonian used as the generator of a unitary rotation gate.
- __init__(
- num_qubits: int,
- _obs: SparsePauliOp | None = None,
- add_pauli_x(num_qubits: int, bit_index: int, value: float) Self¶
- add_pauli_x(num_qubits: int, bit_index: Iterable[int], value: float) Self
Add a weighted Pauli-X term acting on the specified qubit(s).
- add_pauli_y(num_qubits: int, bit_index: int, value: float) Self¶
- add_pauli_y(num_qubits: int, bit_index: Iterable[int], value: float) Self
Add a weighted Pauli-Y term acting on the specified qubit(s).
- add_pauli_z(num_qubits: int, bit_index: int, value: float) Self¶
- add_pauli_z(num_qubits: int, bit_index: Iterable[int], value: float) Self
Add a weighted Pauli-Z term acting on the specified qubit(s).
- property raw: SparsePauliOp¶
Return the underlying
SparsePauliOp.
- T_circuit¶
alias of
QuantumCircuit
- T_obs¶
alias of
SparsePauliOp
- classmethod get_observable_class() type[QiskitObservable]¶
Return the observable implementation class used by this circuit.
- add_h_gate(i: int) Self¶
Apply a Hadamard gate to qubit i.
- Parameters:
i (int) – Target qubit index.
- Returns:
This instance, for chaining.
- Return type:
Self
- add_observable_rotation_gate( ) Self¶
Apply a Hamiltonian evolution gate
exp(-i * value * H).Appends a
PauliEvolutionGategenerated from op_f to the circuit.
- add_s_gate(i: int) Self¶
Apply an S gate to qubit i, inducing a pi/2 phase on the |1> state.
- Parameters:
i (int) – Target qubit index.
- Returns:
This instance, for chaining.
- Return type:
Self
- add_sdg_gate(i: int) Self¶
Apply the adjoint of the S gate to qubit i, inducing a -pi/2 phase on the |1> state.
- Parameters:
i (int) – Target qubit index.
- Returns:
This instance, for chaining.
- Return type:
Self
- add_sx_gate(i: int) Self¶
Apply a sqrt(X) gate to qubit i.
- Parameters:
i (int) – Target qubit index.
- Returns:
This instance, for chaining.
- Return type:
Self
- add_sxdg_gate(i: int) Self¶
Apply the adjoint of the sqrt(X) gate to qubit i.
- Parameters:
i (int) – Target qubit index.
- Returns:
This instance, for chaining.
- Return type:
Self
- add_t_gate(i: int) Self¶
Apply a T gate to qubit i, inducing a pi/4 phase on the |1> state.
- Parameters:
i (int) – Target qubit index.
- Returns:
This instance, for chaining.
- Return type:
Self
- add_tdg_gate(i: int) Self¶
Apply the adjoint of the T gate to qubit i, inducing a -pi/4 phase on the |1> state.
- Parameters:
i (int) – Target qubit index.
- Returns:
This instance, for chaining.
- Return type:
Self
- add_u_gate(i: int, theta: float, phi: float, lam: float) Self¶
Apply a general single-qubit unitary gate to qubit i.
- add_x_gate(i: int) Self¶
Apply a Pauli-X gate to qubit i.
- Parameters:
i (int) – Target qubit index.
- Returns:
This instance, for chaining.
- Return type:
Self
- add_y_gate(i: int) Self¶
Apply a Pauli-Y gate to qubit i.
- Parameters:
i (int) – Target qubit index.
- Returns:
This instance, for chaining.
- Return type:
Self
- add_z_gate(i: int) Self¶
Apply a Pauli-Z gate to qubit i.
- Parameters:
i (int) – Target qubit index.
- Returns:
This instance, for chaining.
- Return type:
Self
- property raw: QuantumCircuit¶
Underlying
QuantumCircuitobject.