estimate_errors

GateCompiler.estimate_errors(target, compiled, initial_state=None)

Estimate how far a compiled circuit sits from its target on hardware.

The compilation error is computed exactly: the average gate infidelity against a unitary target, or the state infidelity against a state. The physical error follows from the error the gate set gives each gate of compiled. The overall error combines the two. The estimate treats the errors as independent. It underestimates the same coherent error repeated with no gate between, which accumulates faster.

Note

Like compilation_error(), this builds dense \(2^n \times 2^n\) unitaries, so it is practical for small registers only.

Parameters:
  • target (Any) – The source circuit, for a unitary target, or the state the circuit should prepare, in the form compile_state() takes.

  • compiled (QuantumCircuit) – The compiled circuit, in this compiler’s native gates. Its .layout is applied.

  • initial_state (Any) – For a state target, the state the circuit runs from, in the form compile_state() takes. None means the all-zero state.

Return type:

ErrorEstimate

Returns:

The compilation, physical and overall errors.

Raises:
  • ConfigError – If a native gate that needs an error has none on the gate set.

  • ValidationError – If initial_state is given for a unitary target, a state’s norm is not 1, or a circuit holds a Pauli readout, a reset or a measurement.