QWGAN
The project codes associated with quantum Wasserstein GAN
Install / Use
/learn @yiminghwang/QWGANREADME
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
- Learning pure state
Learn the pure state
generated by applying parameterized Pauli gates on each qubit.
- 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
.
- 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').
- 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
- Create an instance of Quantum Circuit
Such as we construct a quantum circuit as the generator:
from qcircuit import * qc = Quantum_Circuit(system_size, "generator") # create an instance of Quantum Circuit - Adding quantum gates to quantum circuit, such as:
qc.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
- 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 - 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
- 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] - 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:
- numpy 1.14.5
- scipy 1.1.0
- 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.
Related Skills
node-connect
349.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
