Operators in qCHeff

In the interest of minimal code duplication, \({\rm qCH_{\rm eff}}\) defines a convenience wrapper class around NumPy/SciPy(sparse)/CuPy arrays. This provides a uniform interface to access some commonly used operations on these matrices. For iterative SWT methods, it is necessary to separate the diagonal and off-diagonal values in a matrix since they correspond to energies and couplings respectively, so qcheff.operator provides a uniform interface to these operations that dispatch to the appropriate underlying array module. This wrapper is for convenience of the user only. The NPAD subroutines work directly with the underlying array.

We define an abstract base class

class OperatorMatrix

Bases: typing.Protocol

Interface for all operators used in qcheff.

Parameters

op : qcheff_array The underlying array of the operator. backend_module : ModuleType, optional The module providing the backend for the operator. Defaults to the module of the input operator.

op: qcheff.operators.operator_base.qcheff_array

None

backend_module: types.ModuleType

‘field(…)’

abstractmethod save(filename: str) None

Save the OperatorMatrix to disk.

Parameters

filename : str The filename to save to.

abstractmethod classmethod load(filename: str) qcheff.operators.operator_base.OperatorMatrix

Load an OperatorMatrix from disk.

Parameters

filename : str The filename to load from.

Returns

OperatorMatrix The loaded OperatorMatrix.

diagonals() qcheff.operators.operator_base.qcheff_array

Returns the diagonal elements of the operator.

Returns

qcheff_array The diagonal elements of the operator.

couplings() qcheff.operators.operator_base.qcheff_array

Returns the off-diagonal elements of the operator.

Returns

off_diagonals : qcheff_array The off-diagonal elements of the operator.

Basic Operators

We have defined some basic operators in qcheff.operators.operators. The set of operators is a subset of all the operators in QuTiP.