Skip to content

asd00012334/Quantum-Simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quantum-Simulation

Description

Simulating Quantum Algorithms including Shor's Algorithm and Deutsch-Jozsa's Algorithms.

Dependency

Use C++ Eigen Library

Guide

  • First, set up the dependency (C++ Eigen).
  • Put all files in the same directory, then include Quantum.hpp.
  • You might refer to the test.cpp for sample code.

Basic Usage

Namespace

Our interface is within namespace Quantum. You might want to use

using namespace Quantum;

Qreg

It represents a quantum register.

  • To instantiate a Qreg object, use
Qreg obj(initialValue, bitNumber);
  • To measure a Qreg from s'th bit to t'th bit, use
obj.measure(s,t);
  • To slice a Qreg, use
auto stateList = obj.slice(s,t);

It represents a sum of product form, and stored within a list of pairs, [(u1,v1),(u2,v2),...(un,vn)].

  • Use a*b to perform Kronecker product.

Gate

It represent unitary matrix acting on small number of bits.

  • Use gate(qubit) to take act on a quantum register and return its output.
  • Use gate1(gate2) to perform composite of gates.
  • Use gate1*gate2 to perform the Kronecker product of gates.

Deutsch-Jozsa Algorithm

  • Use DeutschJozsa(f, n) to perform Deutsch-Jozsa algorithm, where f is a function handler either constant or balanced and n is the total bit number

Shor's Algorithm

  • Use ShorFactor(N) to return a trivial divisor.
  • Use ShorPeriod(a,N) to return the order of a mod N while a, N are co-prime.

BibTeX

@misc{qsim,
  title={Quantum Simulation},
  author={Yu Hsuan Huang},
  year={2018},
  howpublished = {https://github.com/asd00012334/Quantum-Simulation}
}

About

Simulating Quantum Algorithms

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages