aslinearoperator — SciPy v1.15.3 Manual (original) (raw)

scipy.sparse.linalg.

scipy.sparse.linalg.aslinearoperator(A)[source]#

Return A as a LinearOperator.

‘A’ may be any of the following types:

See the LinearOperator documentation for additional information.

Notes

If ‘A’ has no .dtype attribute, the data type is determined by callingLinearOperator.matvec - set the .dtype attribute to prevent this call upon the linear operator creation.

Examples

import numpy as np from scipy.sparse.linalg import aslinearoperator M = np.array([[1,2,3],[4,5,6]], dtype=np.int32) aslinearoperator(M) <2x3 MatrixLinearOperator with dtype=int32>