mVQE is a Julia library designed to facilitate the implementation of the algorithms introduced in Learning Feedback Mechanisms for Measurement-Based Variational Quantum State Preparation. It leverages the ITensors.jl framework for tensor network computations and integrates seamlessly with Flux.jl for machine learning components.
- Efficient one-qubit gate application: A custom
runcircuitfunction enables fast forward and backward passes when applying one-qubit gates to a state (MPS). - Entropy & mutual information: Functions for computing various measures of entanglement (von Neumann entropy, mutual information, etc.) on both pure and mixed states.
- MPS construction: A suite of functions to initialize commonly used matrix product states.
- Circuit construction: Variational circuit components and layers, both standard and measurement-based (with mid-circuit measurements).
- Hamiltonian expectation: An efficient
expectfunction for computing expectation values w.r.t. a Hamiltonian, optimized for backpropagation. - Neural network feedback: An optional Flux-based approach for feedback and adaptive parameter updates in the mVQE algorithm.
- Girvin protocol: An implementation of the measurement-based protocol from Smith et al., PRX Quantum 4, 020315.
vmodels = [
mVQE.Circuits.VariationalCircuitRy(N, depth),
mVQE.Circuits.VariationalOneQubitM(
N_state; gate_type="U", sites=state_indices, nr_params=3
)
]
feedback_model = mVQE.FluxExtensions.TabularModel
model = VariationalMeasurementMCFeedback(vmodels, [feedback_model], ancilla_indices)
ψM = model(ψ)
The resulting model can be optimized in a variety of ways. To see full examples you can check the zenodo repository.
- File:
src/ITensorsExtension/apply.jl - Key Function:
runcircuit(psi, circuit; onequbit_gates=true)- Efficiently applies one-qubit unitary gates to an MPS state.
- Includes a faster backpropagation pathway than the default ITensors methods.
- Additional Utilities:
- Entropy and mutual information calculations for both pure and mixed states.
- File:
src/StateFactory.jl - Contains helper functions to create or initialize various matrix product states (e.g., product states, random states, GHZ states, etc.).
- File:
src/Gates.jl - Provides definitions of different quantum gates.
- These gate definitions can be used to build custom circuits with measurement-based or standard gate-based approaches.
- File:
src/Layers.jl - Includes definitions of “layers” for building deeper variational circuits easily.
- File:
src/GirvinProtocol.jl - Implements the measurement-based protocol described by Smith et al. (PRX Quantum 4, 020315).
- Folder:
src/FluxExtension/ - Implements Flux-based recurrent neural network that can be used in the feedback steps of the mVQE algorithm.
- Directly integrates with
Circuitsto enable gradient-based updates and advanced optimization routines.
- Folder:
src/Circuits/ - Houses the definitions of variational circuits used by the mVQE algorithm.
- MeasurementCircuits sub-module: Provides circuits with mid-circuit measurement and classical feedback, allowing measurement-based VQE protocols.
- File:
src/Optimization.jl - Contains the
expectfunction for Hamiltonian expectation value computations. - Optimized to replace ITensors’ standard
inner(psi', H, psi)call, offering better performance when backpropagating fot the calulcations of gradients.
- Folder:
src/ITensorsMeasurement/ - Implements projective measurements on both pure and mixed states.
- Handles backpropagation through measurement steps, keeping the workflow end-to-end differentiable.