SciPy

This is documentation for an old release of SciPy (version 1.0.0). Read this page in the documentation of the latest stable release (version 1.15.0).

scipy.sparse.linalg.aslinearoperator

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

Return A as a LinearOperator.

‘A’ may be any of the following types:
  • ndarray
  • matrix
  • sparse matrix (e.g. csr_matrix, lil_matrix, etc.)
  • LinearOperator
  • An object with .shape and .matvec attributes

See the LinearOperator documentation for additional information.

Examples

>>>
>>> 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>