liveBook · Manning

Quantum circuit

As explained in Building Quantum Software with Python

A quantum circuit is an ordered representation of quantum gates, measurements, and related operations applied to qubits.

A quantum circuit is an ordered program for transforming qubits. It combines quantum gates and related operations, then represents their execution visually as gates placed from left to right on qubit wires. section 3.0 section 3.3.3

For one qubit, a circuit is a sequence of gates such as RY, X, phase, and H. The same sequence can be written in Python and inspected through a resulting state table. section 3.3.3

A single-qubit circuit

Initialize a state, apply RY(2π/3), X, phase(π/3), and H, then print the transformed amplitudes and probabilities. The circuit diagram shows the operations in application order, while the algebraic expression lists them in reverse order. section 3.3.3

With multiple qubits, circuits act on registers and evolve multi-qubit state vectors. Controlled gates use control qubits, while multi-qubit unitary transformations recombine groups of amplitudes. section 4.6 section 5.2.1

Building reusable circuits

A uniform-distribution circuit applies H to every qubit in a register. Reusable circuits can then be appended to another circuit, or appended with additional control qubits. section 4.5.3 section 5.2.1

Circuits support reusable algorithmic patterns: preparing distributions, encoding register data, amplifying marked-state amplitudes, and constructing search or optimization procedures. Measurement is needed to extract an advantage from amplitude changes in search. section 6.2 section 11.3.1

Figure 3.33 A circuit diagram representation of the gate sequence HP(π/3}) XRY(2π/3)
figure

Use the circuit diagram to trace gate order visually across a qubit wire. section 3.3.3

How Building Quantum Software with Python covers it

How deep it goes
Explains visual diagrams, Python construction, registers, controlled operations, composition, and unitary amplitude transformations.
Examples
Demonstrates single-qubit gate sequences, uniform distributions, reusable circuit composition, amplitude amplification, and knapsack register encoding.
What it assumes
Assumes basic qubit states and gates, then generalizes single-qubit sequences to multi-qubit registers and controlled transformations.
What you can do after
Builds circuits in Python, visualizes their gate order, composes reusable blocks, simulates states, and prepares algorithmic inputs.
How it connects
Connects quantum gates, state vectors, registers, controlled operations, unitary transformations, quantum measurement, and quantum algorithms.

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 Building Quantum Software with Python. The section links point to the parts of the book it draws on.