quantum_walk#
Functionality#
Quantum walks are the quantum analog of classical random walks, and have been widely studied in the context of quantum algorithms and quantum computing. They have applications in various areas such as search algorithms, graph traversal, and quantum simulation. The quantum_walk.py program implements a discrete-time quantum walk on a one-dimensional line, where the walker can move left or right based on the state of a coin qubit.
quantum_walk.py#
Callee: QuantumWalk
The evolution of a quantum walk in discrete time is specified by the product of two unitary operators: (1) a “coin flip” operator and (2) a conditional shift operator, which are applied repeatedly. The program defines the joint quantum state as
\(\ket{\text{coin}}_1 \otimes \ket{\text{node}}_{n-1}\), given the input argument \(n\) (\(n>1\)).
The coin state is determined by the coin_state_preparation argument, which is a quantum circuit acting on the coin qubit. If no circuit is provided, the coin qubit is initialized to the \(\ket{0}\) state. Physically, the coin degree of freedom can be interpreted as a two-level spin system, where \(\ket{1}\) corresponds to spin up and \(\ket{0}\) corresponds to spin down. Generally, the coin state can be denoted as
The node state is initialized to the \(\ket{0}^{\otimes (n-1)}\) state, and can be represented as
The conditional shift operator for the quantum walk on the line is defined as
i.e. the particle jumps right if it has spin up and left if it has spin down. Under the above convention, this corresponds exactly to the computational basis used in the code: the coin state \(\ket{1}\) (spin up) controls a shift to the right, while the coin state \(\ket{0}\) (spin down) controls a shift to the left. Explicitly, the conditional shift operator acts on product states according to
The argument depth specifies the number of steps the quantum walk takes. Each step consists of applying a Hadamard gate \(H\) to the coin qubit, followed by the conditional shift operator \(S\).
Test expectations:
Define the one-step evolution operator as
where \(I\) is the identity on the node register. After \(d\) steps, the final quantum state is
where the amplitudes \(\alpha_{c,x}\) are determined by repeated application of the coin flip and conditional shift.
Doc references: [43]
Execution example:
Two-step quantum walk (\(d=2\), \(n=3\)):
We consider a discrete-time quantum walk on a one-dimensional line. The system consists of one coin qubit and two position qubits.
The initial state is given by \(\ket{\psi_0}=\ket{0}_1 \otimes \ket{0}_2\), where the coin qubit is initialized in the spin-down state and the walker is localized at position \(x = 0\).
Each step of the quantum walk is governed by the unitary operator \(U = S \cdot (H \otimes I)\), where \(H\) is the Hadamard gate acting on the coin subspace and \(S\) is the conditional shift operator defined as
Step 1: Applying the Hadamard gate to the coin qubit yields
After applying the conditional shift operator \(S\), the state becomes
Step 2: Applying the Hadamard gate again to the coin qubit gives
Rearranging terms, we obtain
Applying the conditional shift operator \(S\) yields the final state
Final state after two steps
API#
qolumbina.programs.quantum_walk.quantum_walk#
Qwalk benchmark definition.
- class QuantumWalk(input_qubits, depth, coin_state_preparation=None, name=None)[source]#
Bases:
QuantumCircuitCreate a Quantum Walk circuit.
- Parameters:
input_qubits (int) – The total number of qubits in the circuit, including one coin qubit and input_qubits - 1 node qubits. Must be at least 2.
depth (int) – The number of steps (\(d\)) the quantum walk takes.
coin_state_preparation (QuantumCircuit | Statevector | None) – A quantum circuit or statevector to prepare the initial state of the coin qubit. If None, the coin qubit is initialized to the \(\ket{0}\) state.
name (str | None) – Optional name of the circuit.