Circuit Simulator

Initialization

PastaQ.qubitsFunction
qubits(N::Int; mixed::Bool=false)

qubits(sites::Vector{<:Index}; mixed::Bool=false)

Initialize qubits to:

  • An MPS wavefunction |ψ⟩ if mixed=false
  • An MPO density matrix ρ if mixed=true
source
qubits(M::Union{MPS,MPO,LPDO}; mixed::Bool=false)

Initialize qubits on the Hilbert space of a reference state, given as MPS, MPO or LPDO.

source
qubits(N::Int, states::Vector{String}; mixed::Bool=false)

qubits(sites::Vector{<:Index}, states::Vector{String};mixed::Bool = false)

Initialize the qubits to a given single-qubit product state.

source
PastaQ.resetqubits!Function
resetqubits!(M::Union{MPS,MPO})

Reset qubits to the initial state:

  • |ψ⟩=|0,0,…,0⟩ if M = MPS
  • ρ = |0,0,…,0⟩⟨0,0,…,0| if M = MPO
source

Gates and circuits

PastaQ.gateFunction
gate(M::Union{MPS,MPO}, gatename::String, site::Int; kwargs...)

Generate a gate tensor for a single-qubit gate identified by gatename acting on site site, with indices identical to a reference state M.

source
gate(M::Union{MPS,MPO},gatename::String, site::Tuple; kwargs...)

Generate a gate tensor for a two-qubit gate identified by gatename acting on sites (site[1],site[2]), with indices identical to a reference state M (MPS or MPO).

source
PastaQ.buildcircuitFunction
buildcircuit(M::Union{MPS,MPO}, gates::Vector{<:Tuple};
             noise = nothing)

Generates a vector of (gate) ITensor, from a vector of Tuple associated with a list of quantum gates. If noise is nontrivial, the corresponding Kraus operators are added to each gate as a tensor with an extra (Kraus) index.

source

Running a quantum circuit

PastaQ.runcircuitFunction
runcircuit(M::Union{MPS,MPO}, gate_tensors::Vector{<:ITensor};
           kwargs...)

Apply the circuit to a state (wavefunction/densitymatrix) from a list of tensors.

source
runcircuit(M::Union{MPS,MPO}, gates::Vector{<:Tuple};
           noise=nothing, apply_dag=nothing, 
           cutoff=1e-15, maxdim=10000,
           svd_alg = "divide_and_conquer")

Apply the circuit to a state (wavefunction or density matrix) from a list of gates.

If an MPS |ψ⟩ is input, there are three possible modes:

  1. By default (noise = nothing and apply_dag = nothing), the evolution U|ψ⟩ is performed.
  2. If noise is set to something nontrivial, the mixed evolution ε(|ψ⟩⟨ψ|) is performed. Example: noise = ("amplitude_damping", (γ = 0.1,)) (amplitude damping channel with decay rate γ = 0.1)
  3. If noise = nothing and apply_dag = true, the evolution U|ψ⟩⟨ψ|U† is performed.

If an MPO ρ is input, there are three possible modes:

  1. By default (noise = nothing and apply_dag = nothing), the evolution U ρ U† is performed.
  2. If noise is set to something nontrivial, the evolution ε(ρ) is performed.
  3. If noise = nothing and apply_dag = false, the evolution is performed.
source
runcircuit(N::Int, gates::Vector{<:Tuple};
           process = false,
           noise = nothing,
           cutoff = 1e-15,
           maxdim = 10000,
           svd_alg = "divide_and_conquer")

Run the circuit corresponding to a list of quantum gates on a system of N qubits. The starting state is generated automatically based on the flags process, noise, and apply_dag.

  1. By default (noise = nothing, apply_dag = nothing, and process = false), the evolution U|ψ⟩ is performed where the starting state is set to |ψ⟩ = |000...⟩. The MPS U|000...⟩ is returned.
  2. If noise is set to something nontrivial, the mixed evolution ε(|ψ⟩⟨ψ|) is performed, where the starting state is set to |ψ⟩ = |000...⟩. The MPO ε(|000...⟩⟨000...|) is returned.
  3. If process = true and noise = nothing, the evolution U 1̂ is performed, where the starting state 1̂ = (1⊗1⊗1⊗…⊗1). The MPO approximation for the unitary represented by the set of gates is returned.
  4. If process = true and noise is set to something nontrivial, the function returns the Choi matrix Λ = ε⊗1̂(|ξ⟩⟨ξ|), where |ξ⟩= ⨂ⱼ |00⟩ⱼ+|11⟩ⱼ, approximated by a MPO with 4 site indices, two for the input and two for the output Hilbert space of the quantum channel.
source
PastaQ.choimatrixFunction
choimatrix(N::Int, gates::Vector{<:Tuple};
           noise = nothing, apply_dag = false,
           cutoff = 1e-15, maxdim = 10000, kwargs...)

Compute the Choi matrix Λ = ε⊗1̂(|ξ⟩⟨ξ|), where |ξ⟩= ⨂ⱼ |00⟩ⱼ+|11⟩ⱼ, where ε is a quantum channel built out of a set of quantum gates and a local noise model. Returns a MPO with N tensor having 4 sites indices.

source

Standard quantum circuits

PastaQ.randomcircuitMethod
randomcircuit(N::Int,depth::Int,twoqubit_bonds::Array;
              twoqubitgate   = "CX",
              onequbitgates  = ["Rn"])

Build a random quantum circuit with N qubits and depth depth. Each layer in the circuit is built with a layer of two-qubit gates constructed according to a list of bonds contained in twoqubit_bonds, followed by a layer of single qubit gates. By default, the two-qubit gate is controlled-NOT, and the single-qubit gate is a rotation around a random axis.

source
PastaQ.qftFunction
qft(N::Int)

Generate a list of gates for the quantum fourier transform circuit on N sites.

source