SupportsLinearOperator¶
- class SupportsLinearOperator(*args, **kwargs)¶
Bases:
ProtocolA mirror of the
ffsim.SupportsLinearOperatorprotocol.See
linear_operator()for the type-agnostic helper function dispatching to the method below.>>> 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.