TPBGroupedWeightedPauliOperator.from_dict

classmethod TPBGroupedWeightedPauliOperator.from_dict(dictionary, before_04=False)

Load paulis from a dictionary to construct an Operator. The dictionary must comprise the key ‘paulis’ having a value which is an array of pauli dicts. Each dict in this array must be represented by label and coeff (real and imag) such as in the following example:

{'paulis':
    [
        {'label': 'IIII',
         'coeff': {'real': -0.33562957575267038, 'imag': 0.0}},
        {'label': 'ZIII',
         'coeff': {'real': 0.28220597164664896, 'imag': 0.0}},
         ...
    ]
 }
Parameters
  • dictionary (dict) – dictionary, which contains a list of Paulis and coefficients.

  • before_04 (bool) – support the format before Aqua 0.4.

Returns

the operator created from the input dictionary.

Return type

WeightedPauliOperator

Raises

AquaError – Invalid dictionary