Skip to content

The project codes associated with quantum Wasserstein GAN

License

Notifications You must be signed in to change notification settings

zohimchandani/qWGAN

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qWGAN

The repository contains codes for quantum Wasserstein GAN framework and its applications proposed in the following reference:

Shouvanik Chakrabarti, Yiming Huang, Tongyang Li, Soheil Feizi, and Xiaodi Wu, Quantum Wasserstein Generative Adversarial Networks, NeurIPS 2019.

Content

We listed 4 applications which using quantum Wasserstein GAN framework as follows

  1. Learning pure state Learn the pure state generated by applying parameterized Pauli gates on each qubit.
  2. Learning mixed state Learn the mixed state , in which each pure state is generated by the same method mentioned in 1. is a random number between 0 and 1, and .
  3. Learning pure state with noise Add gaussian noise to the gradient of each parameters. and the generator circuit is constructed by the same ansatz used in training hybrid algorithm on iron-trap quantum computer('Training of Quantum Circuits on a Hybrid Quantum Computer').
  4. Hamiltonian Simulation Learn the pure state generated by applying the unitary operations which restricted by the Hamiltonian dynamics on maximually entangled state. Here we focus on the Hamiltonian of one-dimensional nearest-neighbor Heisenberg model with a random magnetic field in the z direction.

Getting Started

Constructing quantum circuit

  1. Create an instance of Quantum Circuit Such as we construct a quantum circuit as the generator:
    from base_notation import *
    qcircuit = Quantum_Circuit(system_size, "generator") # create an instance of Quantum Circuit
  2. Adding quantum gates to quantum circuit, such as:
    qcircuit.add(Quantum_Gate("X", i, angle=0.5000 * np.pi)) # add parameterized X Rotation gate with 0.5*pi on ith wire

Create an instance of Generator

  1. Create an instance of Generator Such as creating the Generator of 2 qubits system
    system_size = 2
    gen = Generator(system_size) # create an instance of generator of 2 qubits system
  2. Create the quantum circuit and set it as the variational quantum circuit of the generator.
    qc = construct_qcircuit(qc,size) # create an instance of system
    gen.set_qcircuit(qc) # set qc as the circuit of generator

Create an instance of Discriminator

  1. Define the Pauli matrices set. As the discriminator is represented as linear combination of tensor products of simple Pauli matrices, we first define the Pauli matrices set
    herm = [I, X, Y, Z]
  2. Create an instance of Discriminator
    dis = Discriminator(herm, system size)

Update the parameters of generator and discriminator

Update the parameters of generator and discriminator alternativly until the fidelity between the generated states and target state approximate to 1.

dis.update_dis(gen,real_state) #update the parameters of the discriminator
gen.update_gen(dis,real_state) #update the parameters of the generator

Dependencies

All the codes have dependencies on following python library:

  1. numpy 1.14.5
  2. scipy 1.1.0
  3. matplotlib 3.0.2

Citation

If you use our code in your research or wish to refer to the baseline results, please use the following BibTeX entry.

@inproceedings{chakrabarti2019quantum,
  title={Quantum wasserstein generative adversarial networks},
  author={Chakrabarti, Shouvanik and Yiming, Huang and Li, Tongyang and Feizi, Soheil and Wu, Xiaodi},
  booktitle={Advances in Neural Information Processing Systems},
  pages={6778--6789},
  year={2019}
}

License

Distributed under the MIT License. See LICENSE for more information.

About

The project codes associated with quantum Wasserstein GAN

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%