Code Monkey home page Code Monkey logo

pastaq.jl's People

Contributors

emstoudenmire avatar github-actions[bot] avatar gtorlai avatar jlapeyre avatar mtfishman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pastaq.jl's Issues

Introduce appendlayer! function

There are many functions that do similar things, like:

  • hadamardlayer
  • hadamardlayer!
  • randomrotationlayer
  • randomrotationlayer!
  • twoqubitlayer
  • twoqubitlayer!

It seems like we could compress this into a unified interface, for example:

N = 10 # N sites
# Same as hadamardlayer
g = gatelayer("H", N)

and

# Same as hadamardlayer!
appendlayer!(gates, "H", N)

randomrotation could be implemented through the gate interface with a special GateName, for example gate("randrot", s). Then, randomrotation[!] could be replaced by:

gatelayer("randU", N)
appendlayer!(gates, "randU", N)

Also, the two-qubit layer could be determined automatically internally, or be specified with a keyword argument. I think a keyword argument may be best, such as:

appendlayer!(gates, "CX", N; nqubit = 2) # Every other site, starting at site 1 (on odd sites)
appendlayer!(gates, "CX", N; nqubit = 2, start = 2) # Every other site, starting at site 2 (so on even sites)

Also, we could probably just simplify:

  • randomquantumcircuit -> randomcircuit

Implement "randU" gate type

Implement an n-qubit "randU" gate that is a random unitary picked from a certain distribution. At first we can implement it with a positive QR decomposition of random matrices (where the elements are picked from a normal distribution).

Possible mistake in `randomcircuit` for 2D random circuit

In randomcircuit, there is a line:

cycle = twoqubit_bonds[(d-1)%2+1]

that chooses which layering of bonds to use (either odd or even) for the 2-qubit gates. However, in the 2D version, there are 4 unique layers of bonds (odd and even, layered in different directions). Perhaps the line should be something like:

cycle = twoqubit_bonds[(d-1)%length(twoqubit_bonds)+1]

Add measurement dictionary

Measurement dictionary containing eigenstates of the rotation gates, similar syntax of the quantumgate case

Variational quantum eigensolver

Implement the standard VQE:

  • RyRz + CX circuit structure
  • Optimization with simultaneous perturbation method
  • Test on LiH molecule

Rename generatedata to sample or samples?

I find the name generatedata a little opaque. Could we just call it sample, or something related like samples or getsamples? I think this is an appropriate name, since the data is always generated by sampling in some way.

Replace `fullfidelity(::MPO, ::MPO)` with `fidelity(::ITensor, ::ITensor)`

fullfidelity is not my favorite name. Instead, we could define fidelity(::ITensor, ::ITensor), and then tell people to use fidelity(prod(rho), prod(sigma)). We can also define fidelity(::MPO, ::MPO) and just make it throw an error, telling people to use fidelity(::ITensor, ::ITensor) instead.

Convert process tomography to work with un-split Choi states

The bond dimension of the Choi matrix, after splitting N tensors with physical dimension d=4 into 2N tensors with physical dimension d=2, grows too large.

First, we consider the case of a unitary circuit

Random.seed!(1234)
N = 4
gates = randomcircuit(N,4)

U = runcircuit(N,gates;process=true)
@show linkdims(U)
# linkdims(U) = [4,4,4]

Λ = choimatrix(N,gates)
@show linkdims(Λ)
# linkdims(Λ) = [2, 4, 4, 4, 8, 4, 2]

In the above example, the SVD introduced new bonds with dimensions [2,4,8,2], with a factor 2 increase with respect to the alternative representation.

The idea is to use the un-split version instead, both in the quantum circuit simulator and in quantum tomography

Version 0.0.1

Pre-release:

  • Extend noise channels
  • Return list of single-qubit noise gates (for a multi-qubit gate)
  • 2D quantum circuit / quantum circuit with random gates
  • Simplify gate/noise/projector design
  • Compute Choi matrix
  • Implement process tomography run function
  • Improve interface of runcircuit
  • Add data generation using Choi matrix & optimize data generation
  • Improve generation of circuits data structures (Matt)
  • Add normalization correction to the loss function in process tomography
  • Check priming in SGD for MPO updates
  • Add AdaDelta/AdaGrad/AdaM
  • Add multi-threading to gradnll for LPDO
  • Fidelity proxy for MPO
  • Add LPDO type
  • Fix over-writing h5 file bug
  • Update readme

Readout error

Add a readout error to each measurement, where an outcome 0 is flipped to 1 with probability p(1|0) and an outcome 1 is flipped to 0 with probability p(0|1).

Add LPDO type

Add an LPDO type, which represents an MPO of the form X*X^\dagger (and only stores the MPO X).

Update: This was added in #67. I'll leave this issue open to keep track of where it should be incorporated into the code. Here are functions where the LPDO should be used:

  • observer
  • lognormalize!(::LPDO) (but rename normalize!(::LPDO) with options about how the normalization will happen)
  • fullmatrix(::LPDO)
  • statetomography/processtomography
  • gradients
  • optimizers
  • initializetomography
  • gradlogZ
  • gradnll
  • nll
  • Replace getdensityoperator with MPO(::LPDO)
  • tr(::LPDO)
  • logtr(::LPDO)
  • fidelity(::LPDO, ::MPS) and related functions.
  • frobenius_distance(::LPDO, ::LPDO)

Update Choi matrix interface

  • Substitute circuit MPO for the rank-1 Choi MPS: adopt the standard convention that the object characterizing a quantum channel is the MPO (2-siteinds tensors) unitary quantum circuit and the MPO (4-siteinds tensors) Choi matrix for the case of unitary and noisy channels respectively.
  • Change choi flag to build_process in generatedata
  • Update initializetomography interface.
  • Modify splitchoi to take an unsplit Choi MPO / Unitary MPO as input
  • Add unsplit(Λ::{MPS,MPO}): take a 2N-sites Choi MPS/MPO, and returns the unsplit version with N tensors.
  • Remove Choi splitting from choimatrix and generatedata: create the Choi matrix as a MPO with N 4-siteinds tensors. In tomography, the Choi MPO needs to be split into an 2N-sites MPS at the beginning of the function. This will be changed at a later time. After the tomography, return the learned circuit MPO (compress back to N tensors).
  • Add limited run-time examples in the tests
  • Update optimizers to avoid model input
  • Test randomstates
  • Test hilbertspace,replacehilbertspace!
  • Test optimizers on LPDO
  • Test choimatrix
  • Test splitchoi, splitunitary,unsplitchoi,unsplitunitary

Custom preparation/measurements

Include the possibility to use customized preparation states and measurement bases. The user should provide the IDs and the corresponding quantum gates.

Replace initializetomography with more specific names

Proposal to replace initializetomography with more specific functions randomstate and randomprocess. The interface could be something like:

  • randomstate(MPS, N) # Make a random qubit wavefunction for pure state tomography
  • randomstate(LPDO, N) # Make a random mixed state as an LPDO
  • randomstate(MPO, N) # Make a random mixed state as an MPO
  • randomprocess(MPO, N) # Make a random unitary circuit as an MPO
  • randomprocess(Choi, N) # Make a random Choi matrix, defaults to Choi{LPDO}
  • randomprocess(Choi{MPO}, N) # Make a random Choi matrix in MPO form

Additionally, these options could be chosen with flags, like:

  • randomstate(N) = randomstate(MPS, N)
  • randomstate(N; mixed = true) = randomstate(LPDO, N)
  • randomstate(N; mixed = true, lpdo = false) = randomstate(MPO, N)
  • randomprocess(N) = randomprocess(MPO, N)
  • randomprocess(N; mixed = true) = randomprocess(Choi{LPDO}, N)
  • randomprocess(N; mixed = true, lpdo = false) = randomprocess(Choi{MPO}, N)

Here I'm assuming lpdo = true is the default, since it is probably most common, but could be chosen the other way.

applygate! failing incremental compilation

The new function (quantumcircuit.jj line 30)
function applygate!(M::MPS,gate::ITensor)
for 1-qubit gates conflicts with the one for 2q gates (quantumcircuit.jl line 74)
function applygate!(M::MPS, gate::ITensor; cutoff = 1e-10)

Quantumgate definition and measurement projectors

Change dictionary to return arrays given parameters, then quantumgate function build the actual ITensor

Switch the order of the indices when creating ITensor, and keep the traditional definition of the 2-qubit gates

Tomography initalization improvements

Here is a TODO list for improving initializetomography:

  • Use ITensor's randomMPS function for initializing state tomography.
  • Allow choosing the element type of the starting tomography state.
  • Explore creating random LPDO with local "thermal" states evolved by a random unitary circuit.
  • Initialize noiseless process tomography with a random unitary (maybe built from a random unitary circuit).
  • Implement randomstate(N; mixed = true, lpdo = false)
  • Implement randomprocess(N; mixed = true, lpdo = false)

Automatic generation of measurements/preparation gates

Ideally we would like to have an automated way to generate the various gates for preparation and measurement rotations.

  • Preparation gates
    Given a set of specified single-qubit states (ψ1,…ψK), we generate a set of gates (g1,…,gK) generating each state.

  • Measurement bases
    For each measurement basis (given as input as a hermitian 2x2 matrix), we generate the gate for the corresponding rotation.

Remove extraneous functions from export list

Before the release, we should go through exports.jl and remove anything that we don't want to be public functions, such as:

  • choi
  • choimatrix
  • readouterror!
  • projectchoi
  • convertdatapoint
  • gradlogZ
  • nll
  • gradnll
  • gradients
  • fullfidelity

It is best to keep this list as short as possible, especially at the beginning.

Optimize LPDO

Update the gradnll for LPDO ansatz with all optimizations done for the MPS case

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.