TPBGroupedWeightedPauliOperator.construct_evaluation_circuit

TPBGroupedWeightedPauliOperator.construct_evaluation_circuit(wave_function, statevector_mode, qr=None, cr=None, use_simulator_snapshot_mode=False, circuit_name_prefix='')

Construct the circuits for evaluation, which calculating the expectation <psi|H|psi>.

At statevector mode: to simplify the computation, we do not build the whole circuit for <psi|H|psi>, instead of that we construct an individual circuit <psi|, and a bundle circuit for H|psi>

Parameters
  • wave_function (QuantumCircuit) – the quantum circuit.

  • statevector_mode (bool) – indicate which type of simulator are going to use.

  • qr (QuantumRegister, optional) – the quantum register associated with the input_circuit

  • cr (ClassicalRegister, optional) – the classical register associated with the input_circuit

  • use_simulator_snapshot_mode (bool, optional) – if aer_provider is used, we can do faster evaluation for pauli mode on statevector simulation

  • circuit_name_prefix (str, optional) – a prefix of circuit name

Returns

a list of quantum circuits and each circuit with a unique name:

circuit_name_prefix + Pauli string

Return type

list[QuantumCircuit]

Raises
  • AquaError – if Operator is empty

  • AquaError – if quantum register is not provided explicitly and cannot find quantum register with q as the name

  • AquaError – The provided qr is not in the wave_function