WeightedPauliOperator¶

class
WeightedPauliOperator
(paulis, basis=None, z2_symmetries=None, atol=1e12, name=None)[source]¶ Bases :
qiskit.aqua.operators.legacy.base_operator.LegacyBaseOperator
Weighted Pauli Operator
 Paramètres
paulis (
List
[List
[Union
[complex
,Pauli
]]]) – the list of weighted Paulis, where a weighted pauli is composed of a length2 list and the first item is the weight and the second item is the Pauli object.basis (
Optional
[List
[Tuple
[object
,List
[int
]]]]) – the grouping basis, each element is a tuple composed of the basis and the indices to paulis which belong to that group. e.g., if tpb basis is used, the object will be a pauli. By default, the group is equal to nongrouping, each pauli is its own basis.z2_symmetries (
Optional
[Z2Symmetries
]) – recording the z2 symmetries infoatol (
float
) – the threshold used in truncating paulisname (
Optional
[str
]) – the name of operator.
Methods
Perform self + other.
Anti commutes with
Eliminate the real and imagine part of weight in each pauli by threshold.
Commutes with
Construct the circuits for evaluation, which calculating the expectation <psiHpsi>.
Get a copy of self
This method can be only used with the circuits generated by the
construct_evaluation_circuit()
method with the same circuit_name_prefix name since the circuit names are tied to some meanings. param quantum_state
a quantum state.
 param statevector_mode
will it be run on statevector simulator or not
Carry out the eoh evolution for the operator under supplied specifications.
Carry out the eoh evolution for the operator under supplied specifications.
Load paulis from a dictionary to construct an Operator.
Load paulis in a file to construct an Operator.
Create a WeightedPauliOperator via a pair of list.
Check Operator is empty or not.
Perform self * other, and the phases are tracked.
Print out the operator in details.
Reorder the paulis based on the basis and return the reordered paulis.
Rounding the weight.
Merge the paulis whose bases are identical and the pauli with zero coefficient would be removed.
Perform self  other.
Save operator to a dict in pauli representation.
Save operator to a file in pauli representation.
to op flow
Attributes

atol
¶ get atol

basis
¶ returns basis

name
¶ returns name

num_qubits
¶ Number of qubits required for the operator.
 Renvoie
number of qubits
 Type renvoyé
int

paulis
¶ get paulis

z2_symmetries
¶ returns z2 symmetries