SupportsLinearOperator

class SupportsLinearOperator(*args, **kwargs)

Bases: Protocol

A mirror of the ffsim.SupportsLinearOperator protocol.

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.LinearOperator for this operator on the (norb, nelec) FCI sector.

Parameters:
Return type:

LinearOperator