GTorlai / PastaQ.jl

Package for Simulation, Tomography and Analysis of Quantum Computers
Apache License 2.0
142 stars 23 forks source link

Introduce `invcircuit` and `dagcircuit` functions #139

Closed mtfishman closed 2 years ago

mtfishman commented 3 years ago

Introduce the dagcircuit function, which does the following:

gates = [("Rx", 1, (θ = π/4,)),
         ("Ry", 2, (θ = π/4,))]

dagcircuit(gates)

returns the gate list:

 ("Ry", 2, (θ = 0.7853981633974483, dag = true))
 ("Rx", 1, (θ = 0.7853981633974483, dag = true))

i.e. it reverses the gate list ordering and adds the dag = true keyword argument. Then, the gate function can be generalized to recognize the dag flag, and perform the conjugate transpose of the gate when the ITensor is made.

Similarly, an invcircuit function could be defined which instead adds the flag inv = true, which could work for nonunitary gates.

GTorlai commented 2 years ago

The dag part has been done, I'm closing this for now and re-open in the future if we actually need the inv