aslinop

probnum.linops.aslinop(A)

Return A as a LinearOperator.

Parameters

A (array-like or LinearOperator or RandomVariable or object) – Argument to be represented as a linear operator. When A is an object it needs to have the attributes .shape and .matvec.

See also

LinearOperator

Class representing linear operators.

Notes

If A has no .dtype attribute, the data type is determined by calling LinearOperator.matvec() - set the .dtype attribute to prevent this call upon the linear operator creation.

Examples

>>> import numpy as np
>>> from probnum.linops import aslinop
>>> M = np.array([[1,2,3],[4,5,6]], dtype=np.int32)
>>> aslinop(M)
<Matrix with shape=(2, 3) and dtype=int32>
Return type

LinearOperator