unitaryfund / mitiq

Mitiq is an open source toolkit for implementing error mitigation techniques on most current intermediate-scale quantum computers.
https://mitiq.readthedocs.io
GNU General Public License v3.0
344 stars 145 forks source link

Make LRE compatible with non-cirq circuits #2416

Open purva-thakre opened 1 week ago

purva-thakre commented 1 week ago

As discussed in another PR: https://github.com/unitaryfund/mitiq/pull/2347#issuecomment-2182074934

Two different ways to implement the optional args led to errors. Either the one_to_many argument was ignored (first code block) or _pop_measurement was used on a Qiskit circuit instead of converting the circuit to a cirq circuit first (second code block).

@accept_qprogram_and_validate
def multivariate_layer_scaling( input_circuit, degree, ............, one_to_many = True)

Similar to how the optional arg is used in PEC, I also tried changing multivariate_layer_scaling to _cirq_multivariate_layer_scaling such that the new multivariate_layer_scaling only accepted a QPROGRAM as input.

 noise_scaling_func = accept_qprogram_and_validate(
      _cirq_multivariate_layer_scaling,
      one_to_many=True,
  )
  scaled_circuits = noise_scaling_func(
      input_circuit, degree, fold_multiplier, num_chunks, folding_method
  )
 return scaled_circuits