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.
QuantumCircuitOpt.jl is a registered package and can be installed by entering the following in the Julia REPL-mode:
import Pkg
Pkg.add("QuantumCircuitOpt")
- Clone the repository.
- Open a terminal in the repo folder and run
julia --project=.
. - Hit
]
to open the project environment and runtest
to run unit tests. If you see an error because of missing packages, runresolve
.
On how to use this package, check the Documentation's quick start guide and the "examples" folder for more such decompositions.
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.
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.
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).