Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/frankwswang/msqr.jl

Qubit-state Reconstruction algorithm based on MPS-SwapTest hybrid method.
https://github.com/frankwswang/msqr.jl

Last synced: 5 days ago
JSON representation

Qubit-state Reconstruction algorithm based on MPS-SwapTest hybrid method.

Awesome Lists containing this project

README

        

# MSQR.jl

[![Build Status](https://github.com/frankwswang/MSQR.jl/actions/workflows/CI-JS-latest.yml/badge.svg)](https://github.com/frankwswang/MSQR.jl/actions/workflows/CI-JS-latest.yml)
[![Coverage](https://codecov.io/gh/frankwswang/MSQR.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/frankwswang/MSQR.jl)

__MSQR__ is the short form for __MPS-SWAP-test__ hybrid structural __Quantum__ state __Reconstruction__ algorithm.

## Main functions

### MScircuit

Build the quantum circuit for MPS-Swap Test(`MStest`) and MSQR(`MSQRtrain!`).

### MStest

Use Swap Test algorithm to measure overlaps between a Target wave function(register) and a random MPS wave function generated by a qubit-reusable circuit.

### MSQRtrain!

Combining MPS-Swap Test method and Quantum Gradient Optimization, MSQR can train a MPS circuit with adjustable parameters to reconstruct a wave function that has similar entanglements with the target wave function.

## Setup Guide

### Julia Environment

* [__Julia 1.9__](https://julialang.org)

### Installation

__Please first install another unregistered package [QMPS](https://github.com/frankwswang/QMPS.jl).__
Type `]` in Julia REPL to enter [`Pkg` mode](https://julialang.github.io/Pkg.jl/v1.0/index.html), then type:

```julia
pkg> add https://github.com/frankwswang/QMPS.jl
```

__Then use the same procedure to install this project package:__

```julia
pkg> add https://github.com/frankwswang/MSQR.jl
```

## How to use

Please type `using QMPS` and `using MSQR` to use any functions of this package. __MSQR__ relies on a Julia Quantum Computation Simulation Framework package called [__Yao__](https://github.com/QuantumBFS/Yao.jl) to realize its full functionality and currently compatiple version is __Yao 0.6__. You need to type `using Yao` in order to interact with MSQR using Yao's functions.

For more introductions and tutorials about MSQR's functions please check the __examples__ directory in the repository as well as the function documentation using Julia's [__`Help` mode__](https://docs.julialang.org/en/v1/stdlib/REPL/#Help-mode-1).

### Recommended training configuration

Hyper-parameters | Values
-------- | --------
Measure Times | 5000
SGD(ADAM) | η = 0.01 β = (0.9,0.999)
Random Seed(Julia) | 1234

### CUDA GPU support

If your GPU supports __[CUDA](https://developer.nvidia.com/cuda-gpus)__, you may also install CUDA-supported version of Yao: __[CuYao](https://github.com/QuantumBFS/CuYao.jl)__ to gain significant calculation acceleration for MSQR. After properly installing __CuYao__ and typing `using CuYao`, you can gain GPU acceleration(saved time may vary due to different models of GPU) calling each following functions:

* __MSQRtrain!__
* __SWAPtrain!__
* __SWAPtest__
* __MSTtest__
* __MStest__

If you want to manually switch off any above function's CUDA support, just add the optional function argument `useCuYao = false` when calling the function.

## Examples

* __MSTest.jl:__ Showing the function of `MPSSwapTest`.
* __MSQRTest.jl:__ Showing a training example of `MSQR`.

## References

* Ekert, A. K., Alves, C. M., Oi, D. K., Horodecki, M., Horodecki, P., & Kwek, L. C. (2002). Direct estimations of linear and nonlinear functionals of a quantum state. Physical review letters, 88(21), 217901. ([DOI: 10.1103/PhysRevLett.88.217901](https://doi.org/10.1103/PhysRevLett.88.217901))

* Liu, J. G., Zhang, Y. H., Wan, Y., & Wang, L. (2019). Variational quantum eigensolver with fewer qubits. Physical Review Research, 1(2), 023025.([DOI: 10.1103/PhysRevResearch.1.023025](https://journals.aps.org/prresearch/abstract/10.1103/PhysRevResearch.1.023025))

## License

MSQR.jl is released under Apache License 2.0.