SupportsLinearOperator¶
- class SupportsLinearOperator(*args, **kwargs)¶
Bases:
ProtocolThe linear-operator conversion contract this package implements.
This is the same protocol that
ffsim.SupportsLinearOperatordescribes, soffsim.linear_operator()dispatches to the method below on any object of this package.>>> import numpy as np >>> from qiskit_fermions.operators import FermionOperator >>> num_op = FermionOperator.from_dict({((True, 0), (False, 0)): 1.0}) >>> linop = num_op._linear_operator_(norb=2, nelec=1) >>> linop.shape (2, 2) >>> linop.matvec(np.array([1.0, 0.0], dtype=complex)) array([1.+0.j, 0.+0.j])
Protocol Methods
- _linear_operator_(norb, nelec)¶
Returns a
scipy.sparse.linalg.LinearOperatorfor this operator on the(norb, nelec)FCI sector.