SupportsTrace¶
- class SupportsTrace(*args, **kwargs)¶
Bases:
ProtocolThe trace contract this package implements.
This is the same protocol that
ffsim.SupportsTracedescribes, soffsim.trace()dispatches to the method below on any object of this package. The trace of an operator on a fixed sector preconditionsexpm_multiply(), which factors outexp(traceA / n)– not a correctness input, but a sizeable win in speed and accuracy for an operator with a large trace, as a molecular Hamiltonian has.>>> from qiskit_fermions.operators import FermionOperator >>> num_op = FermionOperator.from_dict({((True, 0), (False, 0)): 1.0}) >>> num_op._trace_(norb=2, nelec=1) (1+0j)
Protocol Methods