liveBook · Manning

State vector

As explained in Building Quantum Software with Python

A state vector is an ordered list of complex amplitudes representing a quantum state in a chosen basis.

A state vector is a Python list of complex amplitudes representing a quantum state in a chosen computational basis. Each list index identifies an outcome, while the squared magnitude of its amplitude gives that outcome’s probability. section 3.0 section 4.2.1

For one qubit, the list has two amplitudes; for two qubits, it has four, corresponding to 00, 01, 10, and 11. A valid two-qubit vector has squared magnitudes that sum to 1. section 3.0 section 4.2.1

Encoding and composing states

A two-qubit state can be generated from probabilities and phases: state = [sqrt(p) * (cos(theta) + 1j*sin(theta)) for (p, theta) in zip(probs, angles)]. Independent single-qubit states combine by multiplying their amplitudes pairwise, producing a four-entry product state. section 4.2.1

Bell-state vectors

The vectors [sqrt(0.5), 0.0, 0.0, sqrt(0.5)] and [sqrt(0.5), 0.0, 0.0, -sqrt(0.5)] provide two concrete two-qubit state representations with different amplitude signs. section 4.2.1

Figure 3.1 A dependency diagram of concepts introduced in this chapter
figure

Use the dependency diagram to navigate how state vectors connect single-qubit states, gates, circuits, and simulation. section 3.0

How Building Quantum Software with Python covers it

How deep it goes
Explains list structure, outcome indexing, normalization, phase construction, and product-state composition, but stops short of gate operations.
Examples
Uses Python lists for one- and two-qubit states, randomized probabilities and phases, product-state multiplication, and four Bell-state vectors.
What you can do after
Build it from scratch as normalized complex-amplitude lists and compose independent single-qubit states into two-qubit vectors.
How it connects
Connects quantum states with computational outcomes, state tables, product states, Bell states, quantum gates, and quantum circuits.

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.