qcheff.operators.sparse_operator

Module Contents

Classes

SparseOperator

A sparse matrix operator.

API

class SparseOperator

Bases: qcheff.operators.operator_base.OperatorMatrix

A sparse matrix operator.

Attributes

op : SparseMatrix The underlying sparse matrix operator. backend_module : ModuleType The module providing the backend for the operator.

op: qcheff.operators.operator_base.SparseMatrix

None

backend_module: types.ModuleType

‘field(…)’

save(filename: str) None

Save the OperatorMatrix to disk.

Parameters

filename : str The filename to save to.

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.

to(backend: str) None

Convert the operator to a different backend. Note that CPU to GPU conversion incurs memory transfer and is slow.

Parameters

backend : str The backend to convert to.

diagonals() qcheff.operators.operator_base.SparseMatrix

Returns the diagonal elements of the operator.

Returns

SparseMatrix The diagonal elements of the operator.

couplings() qcheff.operators.operator_base.SparseMatrix

Returns the off-diagonal elements of the operator.

Returns

SparseMatrix The off-diagonal elements of the operator.