Git Product home page Git Product logo

quantumcircuitopt.jl's Introduction

https://github.com/harshangrjn/QuantumCircuitOpt.jl/tree/master/docs/src/assets/docs_header_dark.png

Status: CI codecov

Dev version: Documentation

QuantumCircuitOpt.jl is a Julia package which implements discrete optimization-based methods for optimal synthesis of the architecture for Quantum circuits. While programming Quantum Computers, a primary goal is to build useful and less-noisy quantum circuits from the basic building blocks, also termed as elementary gates which arise due to hardware constraints. Thus, given a desired target quantum gate and a set of elemental one- and two-qubit gates, this package provides a provably optimal, exact (or, if preferable, an approximate) decomposition with minimum number of elemental gates and CNOT gates. Note that QuantumCircuitOpt currently supports only decompositions up to five qubit gates.

Installation

QuantumCircuitOpt.jl is a registered package and can be installed by entering the following in the Julia REPL-mode:

import Pkg
Pkg.add("QuantumCircuitOpt")

Usage

  • Clone the repository.
  • Open a terminal in the repo folder and run julia --project=..
  • Hit ] to open the project environment and run test to run unit tests. If you see an error because of missing packages, run resolve.

On how to use this package, check the Documentation's quick start guide and the "examples" folder for more such decompositions.

Sample Circuit Synthesis

Here is the a sample usage of QuantumCircuitOpt to optimally decompose a 2-qubit controlled-Z gate using the entangling CNOT gate the universal rotation gate with three discretized Euler angles, (θ,ϕ,λ) :

import QuantumCircuitOpt as QCO
using JuMP
using CPLEX

# Target: CZGate
function target_gate()
    return Array{Complex{Float64},2}([1 0 0 0; 0 1 0 0; 0 0 1 0; 0 0 0 -1]) 
end

params = Dict{String, Any}(
"num_qubits" => 2, 
"depth" => 3,    
"elementary_gates" => ["U3_1", "U3_2", "CNot_12", "Identity"], 
"target_gate" => target_gate(),
       
"U_θ_discretization" => collect(-π/2:π/2:π/2),
"U_ϕ_discretization" => collect(-π/2:π/2:π/2),
"U_λ_discretization" => collect(-π/2:π/2:π/2),    

"objective" => "minimize_depth", 
"decomposition_type" => "exact",
"optimizer" => "cplex"
)

qcm_optimizer = JuMP.optimizer_with_attributes(CPLEX.Optimizer) 
QCO.run_QCModel(params, qcm_optimizer)

If you prefer to decompose a target gate of your choice, update the target_gate() function and the set of elementary_gates accordingly in the above sample code.

Bug reports and Contributing

Please report any issues via the Github issue tracker. All types of issues are welcome and encouraged; this includes bug reports, documentation typos, feature requests, etc.

QuantumCircuitOpt is being actively developed and suggestions or other forms of contributions are encouraged.

Acknowledgement

This work was supported by Los Alamos National Laboratory's LDRD Early Career Research Award, "20190590ECR: Discrete Optimization Algorithms for Provable Optimal Quantum Circuit Design". The primary developer of this package is Harsha Nagarajan (@harshangrjn).

quantumcircuitopt.jl's People

Contributors

harshangrjn avatar lockwo avatar

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.