SupportsCommutators
class SupportsCommutators(*args, **kwargs)
Basen: Protocol
Ein Protokoll, das die Unterstützung für eine effiziente Kommutatorerzeugung angibt.
Zur Umsetzung dieses Protokolls sind die folgenden drei Methoden erforderlich. Siehe commutator(), anti_commutator(), und double_commutator() für die typunabhängigen Hilfsfunktionen, die an diese Methoden weiterleiten.
>>> from qiskit_fermions.operators import FermionOperator
>>> cre_0 = FermionOperator.from_dict({((True, 0),): 1.0})
>>> ann_0 = FermionOperator.from_dict({((False, 0),): 1.0})
>>> comm = FermionOperator._commutator_(cre_0, ann_0)
>>> print(format(comm.normal_ordered().simplify()))
-1.000000e0 +0.000000e0j * ()
2.000000e0 +0.000000e0j * (+0 -0)
Protokollmethoden
_anti_commutator_
static _anti_commutator_(op_a, op_b)
Berechnet den Antikommutator zweier Operatoreninstanzen.
Weitere Informationen finden anti_commutator() Sie hier.
Parameter
- op_a (T)
- op_b (T)
Rückgabetyp
T
_commutator_
static _commutator_(op_a, op_b)
Berechnet den Kommutator zweier Operatorinstanzen.
Weitere Informationen finden commutator() Sie hier.
Parameter
- op_a (T)
- op_b (T)
Rückgabetyp
T
_double_commutator_
static _double_commutator_(op_a, op_b, op_c, sign)
Berechnet den Doppelkommutator von drei Operatoren.
Weitere Informationen finden double_commutator() Sie hier.
Parameter
- op_a (T)
- op_b (T)
- op_c (T)
- sign (bool)
Rückgabetyp
T