Documentation
¶
Overview ¶
Package hhl implements the Harrow-Hassidim-Lloyd algorithm for solving linear systems of equations Ax = b on a quantum computer.
Given a Hermitian matrix A (expressed as a PauliSum Hamiltonian) and a state preparation circuit for |b⟩, HHL estimates x = A⁻¹b encoded in the amplitudes of the output quantum state.
The algorithm uses three registers:
- 1 ancilla qubit for eigenvalue inversion flagging
- NumPhaseBits phase qubits for quantum phase estimation
- NumQubits system qubits representing the vector space
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Matrix is the Hermitian matrix A expressed as a Pauli Hamiltonian.
Matrix pauli.PauliSum
// RHS is the state preparation circuit for |b⟩.
RHS *ir.Circuit
// NumPhaseBits is the number of ancilla qubits for phase estimation precision.
NumPhaseBits int
// NumQubits is the number of system qubits (dimension of A is 2^NumQubits).
NumQubits int
// Shots is the number of measurement shots. Default: 1024.
Shots int
}
Config specifies the HHL problem.
type Result ¶
type Result struct {
// Circuit is the full HHL circuit.
Circuit *ir.Circuit
// StateVector is the output state of the system register,
// post-selected on ancilla = |1⟩ and phase register = |0⟩.
StateVector []complex128
// Success is the probability of the post-selection succeeding
// (ancilla = |1⟩ and phase register = |0⟩).
Success float64
}
Result holds HHL output.
Click to show internal directories.
Click to hide internal directories.