tf.linalg.LinearOperator

Base class defining a [batch of] linear operator[s].

Inherits From: Module

Subclasses of LinearOperator provide access to common methods on a (batch) matrix, without the need to materialize the matrix. This allows:

  • Matrix free computations
  • Operators that take advantage of special structure, while providing a consistent API to users.

Subclassing

To enable a public method, subclasses should implement the leading-underscore version of the method. The argument signature should be identical except for the omission of name="...". For example, to enable matmul(x, adjoint=False, name="matmul") a subclass should implement _matmul(x, adjoint=False).

Performance contract

Subclasses should only implement the assert methods (e.g. assert_non_singular) if they can be done in less than O(N^3) time.

Class docstrings should contain an explanation of computational complexity. Since this is a high-performance library, attention should be paid to detail, and explanations can include constants as well as Big-O notation.

Shape compatibility

LinearOperator subclasses should operate on a [batch] matrix with compatible shape. Class docstrings should define what is meant by compatible shape. Some subclasses may not support batching.

Examples:

x is a batch matrix with compatible shape for matmul if

operator.shape = [B1,...,Bb] + [M, N],  b >= 0,
x.shape =   [B1,...,Bb] + [N, R]

rhs is a batch matrix with compatible shape for solve if

operator