Skip to content

harshangrjn/QuantumCircuitOpt.jl

Repository files navigation


A Julia Package for Optimal Quantum Circuit Design

Status: CI codecov version

Dev version: Documentation

QuantumCircuitOpt is a Julia package which implements discrete optimization-based methods for provably optimal synthesis of an 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 quantum computation, as a target gate, and a set of elemental one- and two-qubit gates, this package provides a provably optimal, exact (up to global phase and machine precision) or an approximate decomposition with minimum number of elemental gates and CNOT gates. Now, this package also supports multi-qubit gates in the elementary gates set, such as the global rotation gate. Note that QuantumCircuitOpt currently supports only decompositions of circuits up to ten qubits.

Overall, QuantumCircuitOpt can be a useful tool for researchers and developers working on quantum algorithms or quantum computing applications, as it can help to reduce the resource requirements of quantum computations, making them more practical and efficient.

Installation

QuantumCircuitOpt 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 several important circuit decompositions.

Video Links

For more technical details about the package, check out these video links:

Sample Circuit Synthesis

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

import QuantumCircuitOpt as QCOpt
using JuMP
using Gurobi

# 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, 
"maximum_depth" => 4,    
"elementary_gates" => ["U3_1", "U3_2", "CNot_1_2", "Identity"],
"target_gate" => target_gate(),
"objective" => "minimize_depth",
"decomposition_type" => "exact_optimal",
       
"U3_θ_discretization" => -π/2:π,
"U3_ϕ_discretization" => -π/2:π,
"U3_λ_discretization" => -π/2:π,
)

qcm_optimizer = JuMP.optimizer_with_attributes(Gurobi.Optimizer, "presolve" => 1) 
QCOpt.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. The primary developer of this package is Harsha Nagarajan (@harshangrjn).

Citing QuantumCircuitOpt

If you find QuantumCircuitOpt useful in your work, we request you to cite the following paper (IEEE link, arXiv link):

@inproceedings{QCOpt_SC2021,
  title={{QuantumCircuitOpt}: An Open-source Framework for Provably Optimal Quantum Circuit Design},
  author={Nagarajan, Harsha and Lockwood, Owen and Coffrin, Carleton},
  booktitle={SC21: The International Conference for High Performance Computing, Networking, Storage, and Analysis},
  series={Second Workshop on Quantum Computing Software},
  pages={55--63},
  year={2021},
  doi={10.1109/QCS54837.2021.00010},
  organization={IEEE Computer Society}
}

Another publication which explores the potential of non-linear programming formulations in QuantumCircuitOpt is the following: IEEE link, arXiv link.