QiskitCircuit

class QiskitCircuit

Qiskit-based quantum circuit implementation.

Wraps QuantumCircuit and SparsePauliOp to satisfy the circuit protocol interface required by QAOA circuit construction.

Methods

__init__

add_cnot_gate

Apply a CNOT gate with control qubit i and target qubit j.

add_h_gate

Apply a Hadamard gate to qubit i.

add_observable_rotation_gate

Apply a Hamiltonian evolution gate exp(-i * value * H).

add_rx_gate

Apply an Rx rotation gate to qubit i.

add_ry_gate

Apply an Ry rotation gate to qubit i.

add_x_gate

Apply a Pauli-X gate to qubit i.

construct_quantum_circuit

Create a new QuantumCircuit with num_qubits qubits.

get_observable_class

Return the observable implementation class used by this circuit.

Attributes

circuit

Underlying QuantumCircuit object.

num_qubits

Number of qubits in the circuit.

class ObservableImpl

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,
) 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).

パラメータ:
  • num_qubits (int) -- Total number of qubits in the operator.

  • bit_index (int | Iterable[int]) -- Qubit index or indices for the X operator.

  • value (float) -- Coefficient of the term.

戻り値:

This instance, for chaining.

戻り値の型:

Self

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).

パラメータ:
  • num_qubits (int) -- Total number of qubits in the operator.

  • bit_index (int | Iterable[int]) -- Qubit index or indices for the Z operator.

  • value (float) -- Coefficient of the term.

戻り値:

This instance, for chaining.

戻り値の型:

Self

static construct_observable(
num_qubits: int,
) SparsePauliOp

Return a zero-initialized SparsePauliOp.

パラメータ:

num_qubits (int) -- Number of qubits in the observable.

戻り値:

Zero operator over num_qubits qubits.

戻り値の型:

SparsePauliOp

get_raw() SparsePauliOp

Return the underlying SparsePauliOp.

T_circuit

QuantumCircuit の別名です。

T_obs

SparsePauliOp の別名です。

__init__(num_qubits: int) None
add_cnot_gate(i: int, j: int) Self

Apply a CNOT gate with control qubit i and target qubit j.

パラメータ:
  • i (int) -- Control qubit index.

  • j (int) -- Target qubit index.

戻り値:

This instance, for chaining.

戻り値の型:

Self

add_h_gate(i: int) Self

Apply a Hadamard gate to qubit i.

パラメータ:

i (int) -- Target qubit index.

戻り値:

This instance, for chaining.

戻り値の型:

Self

add_observable_rotation_gate(op_f: SupportsHam[QiskitCircuit.T_obs], value: float, num_qubits: int) Self

Apply a Hamiltonian evolution gate exp(-i * value * H).

Appends a PauliEvolutionGate generated from op_f to the circuit.

パラメータ:
  • op_f (SupportsHam[SparsePauliOp]) -- Observable whose raw SparsePauliOp is used as the Hamiltonian H.

  • value (float) -- Evolution time (rotation angle).

  • num_qubits (int) -- Number of qubits the gate acts on.

戻り値:

This instance, for chaining.

戻り値の型:

Self

add_rx_gate(i: int, value: float) Self

Apply an Rx rotation gate to qubit i.

パラメータ:
  • i (int) -- Target qubit index.

  • value (float) -- Rotation angle in radians.

戻り値:

This instance, for chaining.

戻り値の型:

Self

add_ry_gate(i: int, value: float) Self

Apply an Ry rotation gate to qubit i.

パラメータ:
  • i (int) -- Target qubit index.

  • value (float) -- Rotation angle in radians.

戻り値:

This instance, for chaining.

戻り値の型:

Self

add_x_gate(i: int) Self

Apply a Pauli-X gate to qubit i.

パラメータ:

i (int) -- Target qubit index.

戻り値:

This instance, for chaining.

戻り値の型:

Self

static construct_quantum_circuit(num_qubits: int) QuantumCircuit

Create a new QuantumCircuit with num_qubits qubits.

パラメータ:

num_qubits (int) -- Number of qubits.

戻り値:

An empty circuit with a single quantum register.

戻り値の型:

QuantumCircuit

classmethod get_observable_class() type[ObservableImpl]

Return the observable implementation class used by this circuit.

property circuit: QuantumCircuit

Underlying QuantumCircuit object.

property num_qubits: int

Number of qubits in the circuit.