GTorlai / PastaQ.jl

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

Projective measurement gates #148

Open mtfishman opened 3 years ago

mtfishman commented 3 years ago

Here is an idea for making a "gate" that performs a projective measurement, like for the "hybrid circuit". The idea would be to define the gate with a measurement flag, and the basis you want the measurement done in:

gates = [("basisX", 1, (measure = true,))]

to measure in the X basis on site 1. Then, in the gate function, it could read the flag measure = true, and instead of making a regular ITensor, it makes a "measurement ITensor" defined as:

struct Measurement{ITensorT <: ITensor}
  T::ITensorT
end

Then within runcircuit(::MPS, ::Vector), it could determine if a Measurement gate is being applied, and if so it samples in that basis.