liveBook · Manning

Quantum circuit

As explained in Quantum Programming in Depth

A quantum circuit is a representation of a quantum computation as an ordered sequence of quantum gates and measurements.

A quantum circuit represents a computation as an ordered sequence of gates and measurements applied to a fixed set of qubits. In Qiskit, QuantumCircuit records those operations and can include classical bits for measurement results. section 2.1.2

Constructing a useful circuit requires:

  • Declaring the required qubits and classical bits before appending operations. section 2.1.2
  • Adding gates by method shortcuts or append, while preserving qubit order and identifying each target explicitly. section 2.1.2 section 6.5.2
  • Preparing complete executable circuits when measurements, simulation, or state analysis are required. section 4.5.2
  • Testing behavior against classical calculations or expected basis-state results. section 4.5.2 section 6.4.2

Preparing and composing circuits

A single-qubit state can be prepared with an Ry rotation whose angle is derived from the target coefficients. Larger circuits compose reusable operations such as controlled-X, XOR, AND, and OR, assigning input, auxiliary, and output qubits in a documented order. section 2.1.2 section 6.5.2

Listing 2.1 Qiskit code to prepare a single-qubit state
from math import atan2
from qiskit import QuantumCircuit

alpha, beta = 0.6, 0.8

circ = QuantumCircuit(1)     #1
theta = 2 * atan2(beta, alpha)   #2
circ.ry(theta, 0)            #3

Inspect a minimal Qiskit circuit that derives a rotation angle and prepares a one-qubit state. section 2.1.2

How Quantum Programming in Depth covers it

How deep it goes
Explains construction, qubit ordering, simulation, composition, and testing, but does not detail hardware execution.
Examples
Uses single-qubit rotations, state reconstruction, Boolean gates, and conjunctive-normal-form expression evaluation.
What it assumes
Assumes basic Python and quantum-state notation while refreshing gate application, measurement, and qubit indexing through implementations.
What you can do after
Builds and tests executable circuits in Qiskit, then inspects measurements or simulated state information.
How it connects
Connects quantum gates, measurements, qubits, state preparation, simulation, Boolean operations, and auxiliary qubits.

Also explained in

Compare how 2 books explain quantum circuit →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Quantum Programming in Depth. The section links point to the parts of the book it draws on.