---
title: SupportsLinearOperator (latest version)
description: API reference for qiskit_fermions.protocols.SupportsLinearOperator in the latest version of qiskit-fermions
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit-fermions/protocols-supports-linear-operator
---

# SupportsLinearOperator

*class* `SupportsLinearOperator(*args, **kwargs)`

Bases: [`Protocol`](https://docs.python.org/3/library/typing.html#typing.Protocol)

A mirror of the [`ffsim.SupportsLinearOperator`](https://qiskit-community.github.io/ffsim/api/stubs/ffsim.SupportsLinearOperator.html#ffsim.SupportsLinearOperator "(in ffsim)") protocol.

See [`linear_operator()`](/docs/api/qiskit-fermions/linalg-linear-operator "qiskit_fermions.linalg.linear_operator") for the type-agnostic helper function dispatching to the method below.

```pycon
>>> 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\_

`_linear_operator_(norb, nelec)`

Returns a [`scipy.sparse.linalg.LinearOperator`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.linalg.LinearOperator.html#scipy.sparse.linalg.LinearOperator "(in SciPy v1.18.0)") for this operator on the `(norb, nelec)` FCI sector.

**Parameters**

- **norb** ([*int*](https://docs.python.org/3/library/functions.html#int))
- **nelec** ([*int*](https://docs.python.org/3/library/functions.html#int)  *|*[*tuple*](https://docs.python.org/3/library/stdtypes.html#tuple)*\[*[*int*](https://docs.python.org/3/library/functions.html#int)*,* [*int*](https://docs.python.org/3/library/functions.html#int)*]*)

**Return type**

[*LinearOperator*](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.linalg.LinearOperator.html#scipy.sparse.linalg.LinearOperator "(in SciPy v1.18.0)")
