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.
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:
to measure in the X basis on site 1. Then, in the
gate
function, it could read the flagmeasure = true
, and instead of making a regular ITensor, it makes a "measurement ITensor" defined as:Then within
runcircuit(::MPS, ::Vector)
, it could determine if aMeasurement
gate is being applied, and if so it samples in that basis.