tf.linalg.diag     View source on GitHub    Returns a batched diagonal tensor with given batched diagonal values.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.linalg.diag, tf.compat.v1.matrix_diag
tf.linalg.diag(
    diagonal, name='diag', k=0, num_rows=-1, num_cols=-1, padding_value=0,
    align='RIGHT_LEFT'
)
 Returns a tensor with the contents in diagonal as k[0]-th to k[1]-th diagonals of a matrix, with everything else padded with padding. num_rows and num_cols specify the dimension of the innermost matrix of the output. If both are not specified, the op assumes the innermost matrix is square and infers its size from k and the innermost dimension of diagonal. If only one of them is specified, the op assumes the unspecified value is the smallest possible based on other criteria. Let diagonal have r dimensions [I, J, ..., L, M, N]. The output tensor has rank r+1 with shape [I, J, ..., L, M, num_rows, num_cols] when only one diagonal is given (k is an integer or k[0] == k[1]). Otherwise, it has rank r with shape [I, J, ..., L, num_rows, num_cols]. The second innermost dimension of diagonal has double meaning. When k is scalar or k[0] == k[1], M is part of the batch size [I, J, ..., M], and the output tensor is: output[i, j, ..., l, m, n]
  = diagonal[i, j, ..., l, n-max(d_upper, 0)] ; if n - m == d_upper
    padding_value                             ; otherwise
 Otherwise, M is treated as the number of diagonals for the matrix in the same batch (M = k[1]-k[0]+1), and the output tensor is: output[i, j, ..., l, m, n]
  = diagonal[i, j, ..., l, diag_index, index_in_diag] ; if k[0] <= d <= k[1]
    padding_value                                     ; otherwise
 where d = n - m, diag_index = k[1] - d, and index_in_diag = n - max(d, 0) + offset. offset is zero except when the alignment of the diagonal is to the right. offset = max_diag_len - diag_len(d) ; if (`align` in {RIGHT_LEFT, RIGHT_RIGHT}
                                           and `d >= 0`) or
                                         (`align` in {LEFT_RIGHT, RIGHT_RIGHT}
                                           and `d <= 0`)
         0                          ; otherwise
 where diag_len(d) = min(cols - max(d, 0), rows + min(d, 0)). For example: # The main diagonal.
diagonal = np.array([[1, 2, 3, 4],            # Input shape: (2, 4)
                     [5, 6, 7, 8]])
tf.matrix_diag(diagonal) ==> [[[1, 0, 0, 0],  # Output shape: (2, 4, 4)
                               [0, 2, 0, 0],
                               [0, 0, 3, 0],
                               [0, 0, 0, 4]],
                              [[5, 0, 0, 0],
                               [0, 6, 0, 0],
                               [0, 0, 7, 0],
                               [0, 0, 0, 8]]]

# A superdiagonal (per batch).
diagonal = np.array([[1, 2, 3],  # Input shape: (2, 3)
                     [4, 5, 6]])
tf.matrix_diag(diagonal, k = 1)
  ==> [[[0, 1, 0, 0],  # Output shape: (2, 4, 4)
        [0, 0, 2, 0],
        [0, 0, 0, 3],
        [0, 0, 0, 0]],
       [[0, 4, 0, 0],
        [0, 0, 5, 0],
        [0, 0, 0, 6],
        [0, 0, 0, 0]]]

# A tridiagonal band (per batch).
diagonals = np.array([[[8, 9, 0],  # Input shape: (2, 2, 3)
                       [1, 2, 3],
                       [0, 4, 5]],
                      [[2, 3, 0],
                       [6, 7, 9],
                       [0, 9, 1]]])
tf.matrix_diag(diagonals, k = (-1, 1))
  ==> [[[1, 8, 0],  # Output shape: (2, 3, 3)
        [4, 2, 9],
        [0, 5, 3]],
       [[6, 2, 0],
        [9, 7, 3],
        [0, 1, 9]]]

# RIGHT_LEFT alignment.
diagonals = np.array([[[0, 8, 9],  # Input shape: (2, 2, 3)
                       [1, 2, 3],
                       [4, 5, 0]],
                      [[0, 2, 3],
                       [6, 7, 9],
                       [9, 1, 0]]])
tf.matrix_diag(diagonals, k = (-1, 1), align="RIGHT_LEFT")
  ==> [[[1, 8, 0],  # Output shape: (2, 3, 3)
        [4, 2, 9],
        [0, 5, 3]],
       [[6, 2, 0],
        [9, 7, 3],
        [0, 1, 9]]]

# Rectangular matrix.
diagonal = np.array([1, 2])  # Input shape: (2)
tf.matrix_diag(diagonal, k = -1, num_rows = 3, num_cols = 4)
  ==> [[0, 0, 0, 0],  # Output shape: (3, 4)
       [1, 0, 0, 0],
       [0, 2, 0, 0]]

# Rectangular matrix with inferred num_cols and padding_value = 9.
tf.matrix_diag(diagonal, k = -1, num_rows = 3, padding_value = 9)
  ==> [[9, 9],  # Output shape: (3, 2)
       [1, 9],
       [9, 2]]

 Args
  diagonal   A Tensor with rank k >= 1.
  name   A name for the operation (optional).
  k   Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main diagonal, and negative value means subdiagonals. k can be a single integer (for a single diagonal) or a pair of integers specifying the low and high ends of a matrix band. k[0] must not be larger than k[1].
  num_rows   The number of rows of the output matrix. If it is not provided, the op assumes the output matrix is a square matrix and infers the matrix size from d_lower, d_upper, and the innermost dimension of diagonal.
  num_cols   The number of columns of the output matrix. If it is not provided, the op assumes the output matrix is a square matrix and infers the matrix size from d_lower, d_upper, and the innermost dimension of diagonal.
  padding_value   The value to fill the area outside the specified diagonal band with. Default is 0.
  align   Some diagonals are shorter than max_diag_len and need to be padded. align is a string specifying how superdiagonals and subdiagonals should be aligned, respectively. There are four possible alignments: "RIGHT_LEFT" (default), "LEFT_RIGHT", "LEFT_LEFT", and "RIGHT_RIGHT". "RIGHT_LEFT" aligns superdiagonals to the right (left-pads the row) and subdiagonals to the left (right-pads the row). It is the packing format LAPACK uses. cuSPARSE uses "LEFT_RIGHT", which is the opposite alignment.

 Returns   A Tensor. Has the same type as diagonal.


tf.linalg.diag_part     View source on GitHub    Returns the batched diagonal part of a batched tensor.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.linalg.diag_part, tf.compat.v1.matrix_diag_part
tf.linalg.diag_part(
    input, name='diag_part', k=0, padding_value=0,
    align='RIGHT_LEFT'
)
 Returns a tensor with the k[0]-th to k[1]-th diagonals of the batched input. Assume input has r dimensions [I, J, ..., L, M, N]. Let max_diag_len be the maximum length among all diagonals to be extracted, max_diag_len = min(M + min(k[1], 0), N + min(-k[0], 0)) Let num_diags be the number of diagonals to extract, num_diags = k[1] - k[0] + 1. If num_diags == 1, the output tensor is of rank r - 1 with shape [I, J, ..., L, max_diag_len] and values: diagonal[i, j, ..., l, n]
  = input[i, j, ..., l, n+y, n+x] ; if 0 <= n+y < M and 0 <= n+x < N,
    padding_value                 ; otherwise.
 where y = max(-k[1], 0), x = max(k[1], 0). Otherwise, the output tensor has rank r with dimensions [I, J, ..., L, num_diags, max_diag_len] with values: diagonal[i, j, ..., l, m, n]
  = input[i, j, ..., l, n+y, n+x] ; if 0 <= n+y < M and 0 <= n+x < N,
    padding_value                 ; otherwise.
 where d = k[1] - m, y = max(-d, 0) - offset, and x = max(d, 0) - offset. offset is zero except when the alignment of the diagonal is to the right. offset = max_diag_len - diag_len(d) ; if (`align` in {RIGHT_LEFT, RIGHT_RIGHT}
                                           and `d >= 0`) or
                                         (`align` in {LEFT_RIGHT, RIGHT_RIGHT}
                                           and `d <= 0`)
         0                          ; otherwise
 where diag_len(d) = min(cols - max(d, 0), rows + min(d, 0)). The input must be at least a matrix. For example: input = np.array([[[1, 2, 3, 4],  # Input shape: (2, 3, 4)
                   [5, 6, 7, 8],
                   [9, 8, 7, 6]],
                  [[5, 4, 3, 2],
                   [1, 2, 3, 4],
                   [5, 6, 7, 8]]])

# A main diagonal from each batch.
tf.linalg.diag_part(input) ==> [[1, 6, 7],  # Output shape: (2, 3)
                                [5, 2, 7]]

# A superdiagonal from each batch.
tf.linalg.diag_part(input, k = 1)
  ==> [[2, 7, 6],  # Output shape: (2, 3)
       [4, 3, 8]]

# A band from each batch.
tf.linalg.diag_part(input, k = (-1, 2))
  ==> [[[3, 8, 0],  # Output shape: (2, 4, 3)
        [2, 7, 6],
        [1, 6, 7],
        [0, 5, 8]],
       [[3, 4, 0],
        [4, 3, 8],
        [5, 2, 7],
        [0, 1, 6]]]

# RIGHT_LEFT alignment.
tf.linalg.diag_part(input, k = (-1, 2), align="RIGHT_LEFT")
  ==> [[[0, 3, 8],  # Output shape: (2, 4, 3)
        [2, 7, 6],
        [1, 6, 7],
        [5, 8, 0]],
       [[0, 3, 4],
        [4, 3, 8],
        [5, 2, 7],
        [1, 6, 0]]]

# max_diag_len can be shorter than the main diagonal.
tf.linalg.diag_part(input, k = (-2, -1))
  ==> [[[5, 8],
        [0, 9]],
       [[1, 6],
        [0, 5]]]

# padding_value = 9
tf.linalg.diag_part(input, k = (1, 3), padding_value = 9)
  ==> [[[4, 9, 9],  # Output shape: (2, 3, 3)
        [3, 8, 9],
        [2, 7, 6]],
       [[2, 9, 9],
        [3, 4, 9],
        [4, 3, 8]]]

 Args
  input   A Tensor with rank k >= 2.
  name   A name for the operation (optional).
  k   Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main diagonal, and negative value means subdiagonals. k can be a single integer (for a single diagonal) or a pair of integers specifying the low and high ends of a matrix band. k[0] must not be larger than k[1].
  padding_value   The value to fill the area outside the specified diagonal band with. Default is 0.
  align   Some diagonals are shorter than max_diag_len and need to be padded. align is a string specifying how superdiagonals and subdiagonals should be aligned, respectively. There are four possible alignments: "RIGHT_LEFT" (default), "LEFT_RIGHT", "LEFT_LEFT", and "RIGHT_RIGHT". "RIGHT_LEFT" aligns superdiagonals to the right (left-pads the row) and subdiagonals to the left (right-pads the row). It is the packing format LAPACK uses. cuSPARSE uses "LEFT_RIGHT", which is the opposite alignment.

 Returns   A Tensor containing diagonals of input. Has the same type as input.


tf.linalg.eig Computes the eigen decomposition of a batch of matrices.  View aliases  Main aliases
tf.eig
tf.linalg.eig(
    tensor, name=None
)
 The eigenvalues and eigenvectors for a non-Hermitian matrix in general are complex. The eigenvectors are not guaranteed to be linearly independent. Computes the eigenvalues and right eigenvectors of the innermost N-by-N matrices in tensor such that tensor[...,:,:] * v[..., :,i] = e[..., i] * v[...,:,i], for i=0...N-1.

 Args
  tensor   Tensor of shape [..., N, N]. Only the lower triangular part of each inner inner matrix is referenced.
  name   string, optional name of the operation.

 Returns
  e   Eigenvalues. Shape is [..., N]. Sorted in non-decreasing order.
  v   Eigenvectors. Shape is [..., N, N]. The columns of the inner most matrices contain eigenvectors of the corresponding matrices in tensor


tf.linalg.eigh     View source on GitHub    Computes the eigen decomposition of a batch of self-adjoint matrices.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.linalg.eigh, tf.compat.v1.self_adjoint_eig
tf.linalg.eigh(
    tensor, name=None
)
 Computes the eigenvalues and eigenvectors of the innermost N-by-N matrices in tensor such that tensor[...,:,:] * v[..., :,i] = e[..., i] * v[...,:,i], for i=0...N-1.

 Args
  tensor   Tensor of shape [..., N, N]. Only the lower triangular part of each inner inner matrix is referenced.
  name   string, optional name of the operation.

 Returns
  e   Eigenvalues. Shape is [..., N]. Sorted in non-decreasing order.
  v   Eigenvectors. Shape is [..., N, N]. The columns of the inner most matrices contain eigenvectors of the corresponding matrices in tensor


tf.linalg.eigvals Computes the eigenvalues of one or more matrices.  View aliases  Main aliases
tf.eigvals
tf.linalg.eigvals(
    tensor, name=None
)

Note: If your program backpropagates through this function, you should replace it with a call to tf.linalg.eig (possibly ignoring the second output) to avoid computing the eigen decomposition twice. This is because the eigenvectors are used to compute the gradient w.r.t. the eigenvalues. See _SelfAdjointEigV2Grad in linalg_grad.py.

 Args
  tensor   Tensor of shape [..., N, N].
  name   string, optional name of the operation.

 Returns
  e   Eigenvalues. Shape is [..., N]. The vector e[..., :] contains the N eigenvalues of tensor[..., :, :].


tf.linalg.eigvalsh     View source on GitHub    Computes the eigenvalues of one or more self-adjoint matrices.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.linalg.eigvalsh, tf.compat.v1.self_adjoint_eigvals
tf.linalg.eigvalsh(
    tensor, name=None
)

Note: If your program backpropagates through this function, you should replace it with a call to tf.linalg.eigh (possibly ignoring the second output) to avoid computing the eigen decomposition twice. This is because the eigenvectors are used to compute the gradient w.r.t. the eigenvalues. See _SelfAdjointEigV2Grad in linalg_grad.py.

 Args
  tensor   Tensor of shape [..., N, N].
  name   string, optional name of the operation.

 Returns
  e   Eigenvalues. Shape is [..., N]. The vector e[..., :] contains the N eigenvalues of tensor[..., :, :].


Module: tf.linalg.experimental Public API for tf.linalg.experimental namespace. Functions conjugate_gradient(...): Conjugate gradient solver.


tf.linalg.experimental.conjugate_gradient   Conjugate gradient solver.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.linalg.experimental.conjugate_gradient
tf.linalg.experimental.conjugate_gradient(
    operator, rhs, preconditioner=None, x=None, tol=1e-05, max_iter=20,
    name='conjugate_gradient'
)
 Solves a linear system of equations A*x = rhs for self-adjoint, positive definite matrix A and right-hand side vector rhs, using an iterative, matrix-free algorithm where the action of the matrix A is represented by operator. The iteration terminates when either the number of iterations exceeds max_iter or when the residual norm has been reduced to tol times its initial value, i.e. \(||rhs - A x_k|| <= tol ||rhs||\).

 Args
  operator   A LinearOperator that is self-adjoint and positive definite.
  rhs   A possibly batched vector of shape [..., N] containing the right-hand size vector.
  preconditioner   A LinearOperator that approximates the inverse of A. An efficient preconditioner could dramatically improve the rate of convergence. If preconditioner represents matrix M(M approximates A^{-1}), the algorithm uses preconditioner.apply(x) to estimate A^{-1}x. For this to be useful, the cost of applying M should be much lower than computing A^{-1} directly.
  x   A possibly batched vector of shape [..., N] containing the initial guess for the solution.
  tol   A float scalar convergence tolerance.
  max_iter   An integer giving the maximum number of iterations.
  name   A name scope for the operation.

 Returns
  output   A namedtuple representing the final state with fields:  i: A scalar int32 Tensor. Number of iterations executed. x: A rank-1 Tensor of shape [..., N] containing the computed solution. r: A rank-1 Tensor of shape [.., M] containing the residual vector. p: A rank-1 Tensor of shape [..., N]. A-conjugate basis vector. gamma: \(r \dot M \dot r\), equivalent to \(||r||_2^2\) when preconditioner=None.


tf.linalg.expm       View source on GitHub    Computes the matrix exponential of one or more square matrices.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.linalg.expm
tf.linalg.expm(
    input, name=None
)
  $$exp(A) = \sum_{n=0}^\infty A^n/n!$$  The exponential is computed using a combination of the scaling and squaring method and the Pade approximation. Details can be found in: Nicholas J. Higham, "The scaling and squaring method for the matrix exponential revisited," SIAM J. Matrix Anal. Applic., 26:1179-1193, 2005. The input is a tensor of shape [..., M, M] whose inner-most 2 dimensions form square matrices. The output is a tensor of the same shape as the input containing the exponential for all input submatrices [..., :, :].

 Args
  input   A Tensor. Must be float16, float32, float64, complex64, or complex128 with shape [..., M, M].
  name   A name to give this Op (optional).

 Returns   the matrix exponential of the input.

 Raises
  ValueError   An unsupported type is provided as input.    Scipy Compatibility Equivalent to scipy.linalg.expm


tf.linalg.global_norm     View source on GitHub    Computes the global norm of multiple tensors.  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.global_norm, tf.compat.v1.linalg.global_norm
tf.linalg.global_norm(
    t_list, name=None
)
 Given a tuple or list of tensors t_list, this operation returns the global norm of the elements in all tensors in t_list. The global norm is computed as: global_norm = sqrt(sum([l2norm(t)**2 for t in t_list])) Any entries in t_list that are of type None are ignored.

 Args
  t_list   A tuple or list of mixed Tensors, IndexedSlices, or None.
  name   A name for the operation (optional).

 Returns   A 0-D (scalar) Tensor of type float.

 Raises
  TypeError   If t_list is not a sequence.


tf.linalg.inv Computes the inverse of one or more square invertible matrices or their adjoints (conjugate transposes).  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.linalg.inv, tf.compat.v1.matrix_inverse
tf.linalg.inv(
    input, adjoint=False, name=None
)
 The input is a tensor of shape [..., M, M] whose inner-most 2 dimensions form square matrices. The output is a tensor of the same shape as the input containing the inverse for all input submatrices [..., :, :]. The op uses LU decomposition with partial pivoting to compute the inverses. If a matrix is not invertible there is no guarantee what the op does. It may detect the condition and raise an exception or it may simply return a garbage result.

 Args
  input   A Tensor. Must be one of the following types: float64, float32, half, complex64, complex128. Shape is [..., M, M].
  adjoint   An optional bool. Defaults to False.
  name   A name for the operation (optional).

 Returns   A Tensor. Has the same type as input.


tf.linalg.LinearOperator     View source on GitHub    Base class defining a [batch of] linear operator[s]. Inherits From: Module  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.linalg.LinearOperator
tf.linalg.LinearOperator(
    dtype, graph_parents=None, is_non_singular=None, is_self_adjoint=None,
    is_positive_definite=None, is_square=None, name=None, parameters=None
)
 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.shape = [B1,...,Bb] + [M, N],  b >= 0,
rhs.shape =   [B1,...,Bb] + [M, R]
 Example docstring for subclasses. This operator acts like a (batch) matrix A with shape [B1,...,Bb, M, N] for some b >= 0. The first b indices index a batch member. For every batch index (i1,...,ib), A[i1,...,ib, : :] is an m x n matrix. Again, this matrix A may not be materialized, but for purposes of identifying and working with compatible arguments the shape is relevant. Examples: some_tensor = ... shape = ????
operator = MyLinOp(some_tensor)

operator.shape()
==> [2, 4, 4]

operator.log_abs_determinant()
==> Shape [2] Tensor

x = ... Shape [2, 4, 5] Tensor

operator.matmul(x)
==> Shape [2, 4, 5] Tensor
 Shape compatibility This operator acts on batch matrices with compatible shape. FILL IN WHAT IS MEANT BY COMPATIBLE SHAPE Performance FILL THIS IN Matrix property hints This LinearOperator is initialized with boolean flags of the form is_X, for X = non_singular, self_adjoint, positive_definite, square. These have the following meaning:  If is_X == True, callers should expect the operator to have the property X. This is a promise that should be fulfilled, but is not a runtime assert. For example, finite floating point precision may result in these promises being violated. If is_X == False, callers should expect the operator to not have X. If is_X == None (the default), callers should have no expectation either way.  Initialization parameters All subclasses of LinearOperator are expected to pass a parameters argument to super().__init__(). This should be a dict containing the unadulterated arguments passed to the subclass __init__. For example, MyLinearOperator with an initializer should look like: def __init__(self, operator, is_square=False, name=None):
   parameters = dict(
       operator=operator,
       is_square=is_square,
       name=name
   )
   ...
   super().__init__(..., parameters=parameters)
 ```

 Users can then access `my_linear_operator.parameters` to see all arguments
 passed to its initializer.

<!-- Tabular view -->
 <table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Args</h2></th></tr>

<tr>
<td>
`dtype`
</td>
<td>
The type of the this `LinearOperator`.  Arguments to `matmul` and
`solve` will have to be this type.
</td>
</tr><tr>
<td>
`graph_parents`
</td>
<td>
(Deprecated) Python list of graph prerequisites of this
`LinearOperator` Typically tensors that are passed during initialization
</td>
</tr><tr>
<td>
`is_non_singular`
</td>
<td>
Expect that this operator is non-singular.
</td>
</tr><tr>
<td>
`is_self_adjoint`
</td>
<td>
Expect that this operator is equal to its hermitian
transpose.  If `dtype` is real, this is equivalent to being symmetric.
</td>
</tr><tr>
<td>
`is_positive_definite`
</td>
<td>
Expect that this operator is positive definite,
meaning the quadratic form `x^H A x` has positive real part for all
nonzero `x`.  Note that we do not require the operator to be
self-adjoint to be positive-definite.  See:
<a href="https://en.wikipedia.org/wiki/Positive-definite_matrix#Extension_for_non-symmetric_matrices">https://en.wikipedia.org/wiki/Positive-definite_matrix#Extension_for_non-symmetric_matrices</a>
</td>
</tr><tr>
<td>
`is_square`
</td>
<td>
Expect that this operator acts like square [batch] matrices.
</td>
</tr><tr>
<td>
`name`
</td>
<td>
A name for this `LinearOperator`.
</td>
</tr><tr>
<td>
`parameters`
</td>
<td>
Python `dict` of parameters used to instantiate this
`LinearOperator`.
</td>
</tr>
</table>

<!-- Tabular view -->
 <table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Raises</h2></th></tr>

<tr>
<td>
`ValueError`
</td>
<td>
If any member of graph_parents is `None` or not a `Tensor`.
</td>
</tr><tr>
<td>
`ValueError`
</td>
<td>
If hints are set incorrectly.
</td>
</tr>
</table>

<!-- Tabular view -->
 <table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Attributes</h2></th></tr>

<tr>
<td>
`H`
</td>
<td>
Returns the adjoint of the current `LinearOperator`.

Given `A` representing this `LinearOperator`, return `A*`.
Note that calling `self.adjoint()` and `self.H` are equivalent.
</td>
</tr><tr>
<td>
`batch_shape`
</td>
<td>
`TensorShape` of batch dimensions of this `LinearOperator`.

If this operator acts like the batch matrix `A` with
`A.shape = [B1,...,Bb, M, N]`, then this returns
`TensorShape([B1,...,Bb])`, equivalent to `A.shape[:-2]`
</td>
</tr><tr>
<td>
`domain_dimension`
</td>
<td>
Dimension (in the sense of vector spaces) of the domain of this operator.

If this operator acts like the batch matrix `A` with
`A.shape = [B1,...,Bb, M, N]`, then this returns `N`.
</td>
</tr><tr>
<td>
`dtype`
</td>
<td>
The `DType` of `Tensor`s handled by this `LinearOperator`.
</td>
</tr><tr>
<td>
`graph_parents`
</td>
<td>
List of graph dependencies of this `LinearOperator`. (deprecated)

Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version.
Instructions for updating:
Do not call `graph_parents`.
</td>
</tr><tr>
<td>
`is_non_singular`
</td>
<td>

</td>
</tr><tr>
<td>
`is_positive_definite`
</td>
<td>

</td>
</tr><tr>
<td>
`is_self_adjoint`
</td>
<td>

</td>
</tr><tr>
<td>
`is_square`
</td>
<td>
Return `True/False` depending on if this operator is square.
</td>
</tr><tr>
<td>
`parameters`
</td>
<td>
Dictionary of parameters used to instantiate this `LinearOperator`.
</td>
</tr><tr>
<td>
`range_dimension`
</td>
<td>
Dimension (in the sense of vector spaces) of the range of this operator.

If this operator acts like the batch matrix `A` with
`A.shape = [B1,...,Bb, M, N]`, then this returns `M`.
</td>
</tr><tr>
<td>
`shape`
</td>
<td>
`TensorShape` of this `LinearOperator`.

If this operator acts like the batch matrix `A` with
`A.shape = [B1,...,Bb, M, N]`, then this returns
`TensorShape([B1,...,Bb, M, N])`, equivalent to `A.shape`.
</td>
</tr><tr>
<td>
`tensor_rank`
</td>
<td>
Rank (in the sense of tensors) of matrix corresponding to this operator.

If this operator acts like the batch matrix `A` with
`A.shape = [B1,...,Bb, M, N]`, then this returns `b + 2`.
</td>
</tr>
</table>

## Methods

<h3 id="add_to_tensor"><code>add_to_tensor</code></h3>

<a target="_blank" href="https://github.com/tensorflow/tensorflow/blob/v2.4.0/tensorflow/python/ops/linalg/linear_operator.py#L1077-L1090">View source</a>

<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>add_to_tensor(
    x, name='add_to_tensor'
)
</code></pre>

Add matrix represented by this operator to `x`.  Equivalent to `A + x`.

<!-- Tabular view -->
 <table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>

<tr>
<td>
`x`
</td>
<td>
`Tensor` with same `dtype` and shape broadcastable to `self.shape`.
</td>
</tr><tr>
<td>
`name`
</td>
<td>
A name to give this `Op`.
</td>
</tr>
</table>

<!-- Tabular view -->
 <table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
A `Tensor` with broadcast shape and same `dtype` as `self`.
</td>
</tr>

</table>

<h3 id="adjoint"><code>adjoint</code></h3>

<a target="_blank" href="https://github.com/tensorflow/tensorflow/blob/v2.4.0/tensorflow/python/ops/linalg/linear_operator.py#L933-L948">View source</a>

<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>adjoint(
    name='adjoint'
)
</code></pre>

Returns the adjoint of the current `LinearOperator`.

Given `A` representing this `LinearOperator`, return `A*`.
Note that calling `self.adjoint()` and `self.H` are equivalent.

<!-- Tabular view -->
 <table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>

<tr>
<td>
`name`
</td>
<td>
A name for this `Op`.
</td>
</tr>
</table>

<!-- Tabular view -->
 <table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
<tr class="alt">
<td colspan="2">
`LinearOperator` which represents the adjoint of this `LinearOperator`.
</td>
</tr>

</table>

<h3 id="assert_non_singular"><code>assert_non_singular</code></h3>

<a target="_blank" href="https://github.com/tensorflow/tensorflow/blob/v2.4.0/tensorflow/python/ops/linalg/linear_operator.py#L541-L559">View source</a>

<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>assert_non_singular(
    name='assert_non_singular'
)
</code></pre>

Returns an `Op` that asserts this operator is non singular.

This operator is considered non-singular if

 ConditionNumber < max{100, range_dimension, domain_dimension} * eps, eps := np.finfo(self.dtype.as_numpy_dtype).eps ```

 Args
  name   A string name to prepend to created ops.

 Returns   An Assert Op, that, when run, will raise an InvalidArgumentError if the operator is singular.
 assert_positive_definite View source
assert_positive_definite(
    name='assert_positive_definite'
)
 Returns an Op that asserts this operator is positive definite. Here, positive definite means that the quadratic form x^H A x has positive real part for all nonzero x. Note that we do not require the operator to be self-adjoint to be positive definite.

 Args
  name   A name to give this Op.

 Returns   An Assert Op, that, when run, will raise an InvalidArgumentError if the operator is not positive definite.
 assert_self_adjoint View source
assert_self_adjoint(
    name='assert_self_adjoint'
)
 Returns an Op that asserts this operator is self-adjoint. Here we check that this operator is exactly equal to its hermitian transpose.

 Args
  name   A string name to prepend to created ops.

 Returns   An Assert Op, that, when run, will raise an InvalidArgumentError if the operator is not self-adjoint.
 batch_shape_tensor View source
batch_shape_tensor(
    name='batch_shape_tensor'
)
 Shape of batch dimensions of this operator, determined at runtime. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns a Tensor holding [B1,...,Bb].

 Args
  name   A name for this Op.

 Returns   int32 Tensor
 cholesky View source
cholesky(
    name='cholesky'
)
 Returns a Cholesky factor as a LinearOperator. Given A representing this LinearOperator, if A is positive definite self-adjoint, return L, where A = L L^T, i.e. the cholesky decomposition.

 Args
  name   A name for this Op.

 Returns   LinearOperator which represents the lower triangular matrix in the Cholesky decomposition.

 Raises
  ValueError   When the LinearOperator is not hinted to be positive definite and self adjoint.    cond View source
cond(
    name='cond'
)
 Returns the condition number of this linear operator.

 Args
  name   A name for this Op.

 Returns   Shape [B1,...,Bb] Tensor of same dtype as self.
 determinant View source
determinant(
    name='det'
)
 Determinant for every batch member.

 Args
  name   A name for this Op.

 Returns   Tensor with shape self.batch_shape and same dtype as self.

 Raises
  NotImplementedError   If self.is_square is False.    diag_part View source
diag_part(
    name='diag_part'
)
 Efficiently get the [batch] diagonal part of this operator. If this operator has shape [B1,...,Bb, M, N], this returns a Tensor diagonal, of shape [B1,...,Bb, min(M, N)], where diagonal[b1,...,bb, i] = self.to_dense()[b1,...,bb, i, i]. my_operator = LinearOperatorDiag([1., 2.])

# Efficiently get the diagonal
my_operator.diag_part()
==> [1., 2.]

# Equivalent, but inefficient method
tf.linalg.diag_part(my_operator.to_dense())
==> [1., 2.]

 Args
  name   A name for this Op.

 Returns
  diag_part   A Tensor of same dtype as self.    domain_dimension_tensor View source
domain_dimension_tensor(
    name='domain_dimension_tensor'
)
 Dimension (in the sense of vector spaces) of the domain of this operator. Determined at runtime. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns N.

 Args
  name   A name for this Op.

 Returns   int32 Tensor
 eigvals View source
eigvals(
    name='eigvals'
)
 Returns the eigenvalues of this linear operator. If the operator is marked as self-adjoint (via is_self_adjoint) this computation can be more efficient.
Note: This currently only supports self-adjoint operators.

 Args
  name   A name for this Op.

 Returns   Shape [B1,...,Bb, N] Tensor of same dtype as self.
 inverse View source
inverse(
    name='inverse'
)
 Returns the Inverse of this LinearOperator. Given A representing this LinearOperator, return a LinearOperator representing A^-1.

 Args
  name   A name scope to use for ops added by this method.

 Returns   LinearOperator representing inverse of this matrix.

 Raises
  ValueError   When the LinearOperator is not hinted to be non_singular.    log_abs_determinant View source
log_abs_determinant(
    name='log_abs_det'
)
 Log absolute value of determinant for every batch member.

 Args
  name   A name for this Op.

 Returns   Tensor with shape self.batch_shape and same dtype as self.

 Raises
  NotImplementedError   If self.is_square is False.    matmul View source
matmul(
    x, adjoint=False, adjoint_arg=False, name='matmul'
)
 Transform [batch] matrix x with left multiplication: x --> Ax. # Make an operator acting like batch matrix A.  Assume A.shape = [..., M, N]
operator = LinearOperator(...)
operator.shape = [..., M, N]

X = ... # shape [..., N, R], batch matrix, R > 0.

Y = operator.matmul(X)
Y.shape
==> [..., M, R]

Y[..., :, r] = sum_j A[..., :, j] X[j, r]

 Args
  x   LinearOperator or Tensor with compatible shape and same dtype as self. See class docstring for definition of compatibility.
  adjoint   Python bool. If True, left multiply by the adjoint: A^H x.
  adjoint_arg   Python bool. If True, compute A x^H where x^H is the hermitian transpose (transposition and complex conjugation).
  name   A name for this Op.

 Returns   A LinearOperator or Tensor with shape [..., M, R] and same dtype as self.
 matvec View source
matvec(
    x, adjoint=False, name='matvec'
)
 Transform [batch] vector x with left multiplication: x --> Ax. # Make an operator acting like batch matrix A.  Assume A.shape = [..., M, N]
operator = LinearOperator(...)

X = ... # shape [..., N], batch vector

Y = operator.matvec(X)
Y.shape
==> [..., M]

Y[..., :] = sum_j A[..., :, j] X[..., j]

 Args
  x   Tensor with compatible shape and same dtype as self. x is treated as a [batch] vector meaning for every set of leading dimensions, the last dimension defines a vector. See class docstring for definition of compatibility.
  adjoint   Python bool. If True, left multiply by the adjoint: A^H x.
  name   A name for this Op.

 Returns   A Tensor with shape [..., M] and same dtype as self.
 range_dimension_tensor View source
range_dimension_tensor(
    name='range_dimension_tensor'
)
 Dimension (in the sense of vector spaces) of the range of this operator. Determined at runtime. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns M.

 Args
  name   A name for this Op.

 Returns   int32 Tensor
 shape_tensor View source
shape_tensor(
    name='shape_tensor'
)
 Shape of this LinearOperator, determined at runtime. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns a Tensor holding [B1,...,Bb, M, N], equivalent to tf.shape(A).

 Args
  name   A name for this Op.

 Returns   int32 Tensor
 solve View source
solve(
    rhs, adjoint=False, adjoint_arg=False, name='solve'
)
 Solve (exact or approx) R (batch) systems of equations: A X = rhs. The returned Tensor will be close to an exact solution if A is well conditioned. Otherwise closeness will vary. See class docstring for details. Examples: # Make an operator acting like batch matrix A.  Assume A.shape = [..., M, N]
operator = LinearOperator(...)
operator.shape = [..., M, N]

# Solve R > 0 linear systems for every member of the batch.
RHS = ... # shape [..., M, R]

X = operator.solve(RHS)
# X[..., :, r] is the solution to the r'th linear system
# sum_j A[..., :, j] X[..., j, r] = RHS[..., :, r]

operator.matmul(X)
==> RHS

 Args
  rhs   Tensor with same dtype as this operator and compatible shape. rhs is treated like a [batch] matrix meaning for every set of leading dimensions, the last two dimensions defines a matrix. See class docstring for definition of compatibility.
  adjoint   Python bool. If True, solve the system involving the adjoint of this LinearOperator: A^H X = rhs.
  adjoint_arg   Python bool. If True, solve A X = rhs^H where rhs^H is the hermitian transpose (transposition and complex conjugation).
  name   A name scope to use for ops added by this method.

 Returns   Tensor with shape [...,N, R] and same dtype as rhs.

 Raises
  NotImplementedError   If self.is_non_singular or is_square is False.    solvevec View source
solvevec(
    rhs, adjoint=False, name='solve'
)
 Solve single equation with best effort: A X = rhs. The returned Tensor will be close to an exact solution if A is well conditioned. Otherwise closeness will vary. See class docstring for details. Examples: # Make an operator acting like batch matrix A.  Assume A.shape = [..., M, N]
operator = LinearOperator(...)
operator.shape = [..., M, N]

# Solve one linear system for every member of the batch.
RHS = ... # shape [..., M]

X = operator.solvevec(RHS)
# X is the solution to the linear system
# sum_j A[..., :, j] X[..., j] = RHS[..., :]

operator.matvec(X)
==> RHS

 Args
  rhs   Tensor with same dtype as this operator. rhs is treated like a [batch] vector meaning for every set of leading dimensions, the last dimension defines a vector. See class docstring for definition of compatibility regarding batch dimensions.
  adjoint   Python bool. If True, solve the system involving the adjoint of this LinearOperator: A^H X = rhs.
  name   A name scope to use for ops added by this method.

 Returns   Tensor with shape [...,N] and same dtype as rhs.

 Raises
  NotImplementedError   If self.is_non_singular or is_square is False.    tensor_rank_tensor View source
tensor_rank_tensor(
    name='tensor_rank_tensor'
)
 Rank (in the sense of tensors) of matrix corresponding to this operator. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns b + 2.

 Args
  name   A name for this Op.

 Returns   int32 Tensor, determined at runtime.
 to_dense View source
to_dense(
    name='to_dense'
)
 Return a dense (batch) matrix representing this operator. trace View source
trace(
    name='trace'
)
 Trace of the linear operator, equal to sum of self.diag_part(). If the operator is square, this is also the sum of the eigenvalues.

 Args
  name   A name for this Op.

 Returns   Shape [B1,...,Bb] Tensor of same dtype as self.
 __matmul__ View source
__matmul__(
    other
)


tf.linalg.LinearOperatorAdjoint     View source on GitHub    LinearOperator representing the adjoint of another operator. Inherits From: LinearOperator, Module  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.linalg.LinearOperatorAdjoint
tf.linalg.LinearOperatorAdjoint(
    operator, is_non_singular=None, is_self_adjoint=None, is_positive_definite=None,
    is_square=None, name=None
)
 This operator represents the adjoint of another operator. # Create a 2 x 2 linear operator.
operator = LinearOperatorFullMatrix([[1 - i., 3.], [0., 1. + i]])
operator_adjoint = LinearOperatorAdjoint(operator)

operator_adjoint.to_dense()
==> [[1. + i, 0.]
     [3., 1 - i]]

operator_adjoint.shape
==> [2, 2]

operator_adjoint.log_abs_determinant()
==> - log(2)

x = ... Shape [2, 4] Tensor
operator_adjoint.matmul(x)
==> Shape [2, 4] Tensor, equal to operator.matmul(x, adjoint=True)
 Performance The performance of LinearOperatorAdjoint depends on the underlying operators performance. Matrix property hints This LinearOperator is initialized with boolean flags of the form is_X, for X = non_singular, self_adjoint, positive_definite, square. These have the following meaning:  If is_X == True, callers should expect the operator to have the property X. This is a promise that should be fulfilled, but is not a runtime assert. For example, finite floating point precision may result in these promises being violated. If is_X == False, callers should expect the operator to not have X. If is_X == None (the default), callers should have no expectation either way.

 Args
  operator   LinearOperator object.
  is_non_singular   Expect that this operator is non-singular.
  is_self_adjoint   Expect that this operator is equal to its hermitian transpose.
  is_positive_definite   Expect that this operator is positive definite, meaning the quadratic form x^H A x has positive real part for all nonzero x. Note that we do not require the operator to be self-adjoint to be positive-definite. See: https://en.wikipedia.org/wiki/Positive-definite_matrix#Extension_for_non-symmetric_matrices
  is_square   Expect that this operator acts like square [batch] matrices.
  name   A name for this LinearOperator. Default is operator.name + "_adjoint".

 Raises
  ValueError   If operator.is_non_singular is False.

 Attributes
  H   Returns the adjoint of the current LinearOperator. Given A representing this LinearOperator, return A*. Note that calling self.adjoint() and self.H are equivalent.

  batch_shape   TensorShape of batch dimensions of this LinearOperator. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns TensorShape([B1,...,Bb]), equivalent to A.shape[:-2]

  domain_dimension   Dimension (in the sense of vector spaces) of the domain of this operator. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns N.

  dtype   The DType of Tensors handled by this LinearOperator.
  graph_parents   List of graph dependencies of this LinearOperator. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Do not call graph_parents.

  is_non_singular

  is_positive_definite

  is_self_adjoint

  is_square   Return True/False depending on if this operator is square.
  operator   The operator before taking the adjoint.
  parameters   Dictionary of parameters used to instantiate this LinearOperator.
  range_dimension   Dimension (in the sense of vector spaces) of the range of this operator. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns M.

  shape   TensorShape of this LinearOperator. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns TensorShape([B1,...,Bb, M, N]), equivalent to A.shape.

  tensor_rank   Rank (in the sense of tensors) of matrix corresponding to this operator. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns b + 2.
   Methods add_to_tensor View source
add_to_tensor(
    x, name='add_to_tensor'
)
 Add matrix represented by this operator to x. Equivalent to A + x.

 Args
  x   Tensor with same dtype and shape broadcastable to self.shape.
  name   A name to give this Op.

 Returns   A Tensor with broadcast shape and same dtype as self.
 adjoint View source
adjoint(
    name='adjoint'
)
 Returns the adjoint of the current LinearOperator. Given A representing this LinearOperator, return A*. Note that calling self.adjoint() and self.H are equivalent.

 Args
  name   A name for this Op.

 Returns   LinearOperator which represents the adjoint of this LinearOperator.
 assert_non_singular View source
assert_non_singular(
    name='assert_non_singular'
)
 Returns an Op that asserts this operator is non singular. This operator is considered non-singular if ConditionNumber < max{100, range_dimension, domain_dimension} * eps,
eps := np.finfo(self.dtype.as_numpy_dtype).eps

 Args
  name   A string name to prepend to created ops.

 Returns   An Assert Op, that, when run, will raise an InvalidArgumentError if the operator is singular.
 assert_positive_definite View source
assert_positive_definite(
    name='assert_positive_definite'
)
 Returns an Op that asserts this operator is positive definite. Here, positive definite means that the quadratic form x^H A x has positive real part for all nonzero x. Note that we do not require the operator to be self-adjoint to be positive definite.

 Args
  name   A name to give this Op.

 Returns   An Assert Op, that, when run, will raise an InvalidArgumentError if the operator is not positive definite.
 assert_self_adjoint View source
assert_self_adjoint(
    name='assert_self_adjoint'
)
 Returns an Op that asserts this operator is self-adjoint. Here we check that this operator is exactly equal to its hermitian transpose.

 Args
  name   A string name to prepend to created ops.

 Returns   An Assert Op, that, when run, will raise an InvalidArgumentError if the operator is not self-adjoint.
 batch_shape_tensor View source
batch_shape_tensor(
    name='batch_shape_tensor'
)
 Shape of batch dimensions of this operator, determined at runtime. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns a Tensor holding [B1,...,Bb].

 Args
  name   A name for this Op.

 Returns   int32 Tensor
 cholesky View source
cholesky(
    name='cholesky'
)
 Returns a Cholesky factor as a LinearOperator. Given A representing this LinearOperator, if A is positive definite self-adjoint, return L, where A = L L^T, i.e. the cholesky decomposition.

 Args
  name   A name for this Op.

 Returns   LinearOperator which represents the lower triangular matrix in the Cholesky decomposition.

 Raises
  ValueError   When the LinearOperator is not hinted to be positive definite and self adjoint.    cond View source
cond(
    name='cond'
)
 Returns the condition number of this linear operator.

 Args
  name   A name for this Op.

 Returns   Shape [B1,...,Bb] Tensor of same dtype as self.
 determinant View source
determinant(
    name='det'
)
 Determinant for every batch member.

 Args
  name   A name for this Op.

 Returns   Tensor with shape self.batch_shape and same dtype as self.

 Raises
  NotImplementedError   If self.is_square is False.    diag_part View source
diag_part(
    name='diag_part'
)
 Efficiently get the [batch] diagonal part of this operator. If this operator has shape [B1,...,Bb, M, N], this returns a Tensor diagonal, of shape [B1,...,Bb, min(M, N)], where diagonal[b1,...,bb, i] = self.to_dense()[b1,...,bb, i, i]. my_operator = LinearOperatorDiag([1., 2.])

# Efficiently get the diagonal
my_operator.diag_part()
==> [1., 2.]

# Equivalent, but inefficient method
tf.linalg.diag_part(my_operator.to_dense())
==> [1., 2.]

 Args
  name   A name for this Op.

 Returns
  diag_part   A Tensor of same dtype as self.    domain_dimension_tensor View source
domain_dimension_tensor(
    name='domain_dimension_tensor'
)
 Dimension (in the sense of vector spaces) of the domain of this operator. Determined at runtime. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns N.

 Args
  name   A name for this Op.

 Returns   int32 Tensor
 eigvals View source
eigvals(
    name='eigvals'
)
 Returns the eigenvalues of this linear operator. If the operator is marked as self-adjoint (via is_self_adjoint) this computation can be more efficient.
Note: This currently only supports self-adjoint operators.

 Args
  name   A name for this Op.

 Returns   Shape [B1,...,Bb, N] Tensor of same dtype as self.
 inverse View source
inverse(
    name='inverse'
)
 Returns the Inverse of this LinearOperator. Given A representing this LinearOperator, return a LinearOperator representing A^-1.

 Args
  name   A name scope to use for ops added by this method.

 Returns   LinearOperator representing inverse of this matrix.

 Raises
  ValueError   When the LinearOperator is not hinted to be non_singular.    log_abs_determinant View source
log_abs_determinant(
    name='log_abs_det'
)
 Log absolute value of determinant for every batch member.

 Args
  name   A name for this Op.

 Returns   Tensor with shape self.batch_shape and same dtype as self.

 Raises
  NotImplementedError   If self.is_square is False.    matmul View source
matmul(
    x, adjoint=False, adjoint_arg=False, name='matmul'
)
 Transform [batch] matrix x with left multiplication: x --> Ax. # Make an operator acting like batch matrix A.  Assume A.shape = [..., M, N]
operator = LinearOperator(...)
operator.shape = [..., M, N]

X = ... # shape [..., N, R], batch matrix, R > 0.

Y = operator.matmul(X)
Y.shape
==> [..., M, R]

Y[..., :, r] = sum_j A[..., :, j] X[j, r]

 Args
  x   LinearOperator or Tensor with compatible shape and same dtype as self. See class docstring for definition of compatibility.
  adjoint   Python bool. If True, left multiply by the adjoint: A^H x.
  adjoint_arg   Python bool. If True, compute A x^H where x^H is the hermitian transpose (transposition and complex conjugation).
  name   A name for this Op.

 Returns   A LinearOperator or Tensor with shape [..., M, R] and same dtype as self.
 matvec View source
matvec(
    x, adjoint=False, name='matvec'
)
 Transform [batch] vector x with left multiplication: x --> Ax. # Make an operator acting like batch matrix A.  Assume A.shape = [..., M, N]
operator = LinearOperator(...)

X = ... # shape [..., N], batch vector

Y = operator.matvec(X)
Y.shape
==> [..., M]

Y[..., :] = sum_j A[..., :, j] X[..., j]

 Args
  x   Tensor with compatible shape and same dtype as self. x is treated as a [batch] vector meaning for every set of leading dimensions, the last dimension defines a vector. See class docstring for definition of compatibility.
  adjoint   Python bool. If True, left multiply by the adjoint: A^H x.
  name   A name for this Op.

 Returns   A Tensor with shape [..., M] and same dtype as self.
 range_dimension_tensor View source
range_dimension_tensor(
    name='range_dimension_tensor'
)
 Dimension (in the sense of vector spaces) of the range of this operator. Determined at runtime. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns M.

 Args
  name   A name for this Op.

 Returns   int32 Tensor
 shape_tensor View source
shape_tensor(
    name='shape_tensor'
)
 Shape of this LinearOperator, determined at runtime. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns a Tensor holding [B1,...,Bb, M, N], equivalent to tf.shape(A).

 Args
  name   A name for this Op.

 Returns   int32 Tensor
 solve View source
solve(
    rhs, adjoint=False, adjoint_arg=False, name='solve'
)
 Solve (exact or approx) R (batch) systems of equations: A X = rhs. The returned Tensor will be close to an exact solution if A is well conditioned. Otherwise closeness will vary. See class docstring for details. Examples: # Make an operator acting like batch matrix A.  Assume A.shape = [..., M, N]
operator = LinearOperator(...)
operator.shape = [..., M, N]

# Solve R > 0 linear systems for every member of the batch.
RHS = ... # shape [..., M, R]

X = operator.solve(RHS)
# X[..., :, r] is the solution to the r'th linear system
# sum_j A[..., :, j] X[..., j, r] = RHS[..., :, r]

operator.matmul(X)
==> RHS

 Args
  rhs   Tensor with same dtype as this operator and compatible shape. rhs is treated like a [batch] matrix meaning for every set of leading dimensions, the last two dimensions defines a matrix. See class docstring for definition of compatibility.
  adjoint   Python bool. If True, solve the system involving the adjoint of this LinearOperator: A^H X = rhs.
  adjoint_arg   Python bool. If True, solve A X = rhs^H where rhs^H is the hermitian transpose (transposition and complex conjugation).
  name   A name scope to use for ops added by this method.

 Returns   Tensor with shape [...,N, R] and same dtype as rhs.

 Raises
  NotImplementedError   If self.is_non_singular or is_square is False.    solvevec View source
solvevec(
    rhs, adjoint=False, name='solve'
)
 Solve single equation with best effort: A X = rhs. The returned Tensor will be close to an exact solution if A is well conditioned. Otherwise closeness will vary. See class docstring for details. Examples: # Make an operator acting like batch matrix A.  Assume A.shape = [..., M, N]
operator = LinearOperator(...)
operator.shape = [..., M, N]

# Solve one linear system for every member of the batch.
RHS = ... # shape [..., M]

X = operator.solvevec(RHS)
# X is the solution to the linear system
# sum_j A[..., :, j] X[..., j] = RHS[..., :]

operator.matvec(X)
==> RHS

 Args
  rhs   Tensor with same dtype as this operator. rhs is treated like a [batch] vector meaning for every set of leading dimensions, the last dimension defines a vector. See class docstring for definition of compatibility regarding batch dimensions.
  adjoint   Python bool. If True, solve the system involving the adjoint of this LinearOperator: A^H X = rhs.
  name   A name scope to use for ops added by this method.

 Returns   Tensor with shape [...,N] and same dtype as rhs.

 Raises
  NotImplementedError   If self.is_non_singular or is_square is False.    tensor_rank_tensor View source
tensor_rank_tensor(
    name='tensor_rank_tensor'
)
 Rank (in the sense of tensors) of matrix corresponding to this operator. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns b + 2.

 Args
  name   A name for this Op.

 Returns   int32 Tensor, determined at runtime.
 to_dense View source
to_dense(
    name='to_dense'
)
 Return a dense (batch) matrix representing this operator. trace View source
trace(
    name='trace'
)
 Trace of the linear operator, equal to sum of self.diag_part(). If the operator is square, this is also the sum of the eigenvalues.

 Args
  name   A name for this Op.

 Returns   Shape [B1,...,Bb] Tensor of same dtype as self.
 __matmul__ View source
__matmul__(
    other
)


tf.linalg.LinearOperatorBlockDiag     View source on GitHub    Combines one or more LinearOperators in to a Block Diagonal matrix. Inherits From: LinearOperator, Module  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.linalg.LinearOperatorBlockDiag
tf.linalg.LinearOperatorBlockDiag(
    operators, is_non_singular=None, is_self_adjoint=None,
    is_positive_definite=None, is_square=True, name=None
)
 This operator combines one or more linear operators [op1,...,opJ], building a new LinearOperator, whose underlying matrix representation is square and has each operator opi on the main diagonal, and zero's elsewhere. Shape compatibility If opj acts like a [batch] square matrix Aj, then op_combined acts like the [batch] square matrix formed by having each matrix Aj on the main diagonal. Each opj is required to represent a square matrix, and hence will have shape batch_shape_j + [M_j, M_j]. If opj has shape batch_shape_j + [M_j, M_j], then the combined operator has shape broadcast_batch_shape + [sum M_j, sum M_j], where broadcast_batch_shape is the mutual broadcast of batch_shape_j, j = 1,...,J, assuming the intermediate batch shapes broadcast. Even if the combined shape is well defined, the combined operator's methods may fail due to lack of broadcasting ability in the defining operators' methods. Arguments to matmul, matvec, solve, and solvevec may either be single Tensors or lists of Tensors that are interpreted as blocks. The jth element of a blockwise list of Tensors must have dimensions that match opj for the given method. If a list of blocks is input, then a list of blocks is returned as well. # Create a 4 x 4 linear operator combined of two 2 x 2 operators.
operator_1 = LinearOperatorFullMatrix([[1., 2.], [3., 4.]])
operator_2 = LinearOperatorFullMatrix([[1., 0.], [0., 1.]])
operator = LinearOperatorBlockDiag([operator_1, operator_2])

operator.to_dense()
==> [[1., 2., 0., 0.],
     [3., 4., 0., 0.],
     [0., 0., 1., 0.],
     [0., 0., 0., 1.]]

operator.shape
==> [4, 4]

operator.log_abs_determinant()
==> scalar Tensor

x1 = ... # Shape [2, 2] Tensor
x2 = ... # Shape [2, 2] Tensor
x = tf.concat([x1, x2], 0)  # Shape [2, 4] Tensor
operator.matmul(x)
==> tf.concat([operator_1.matmul(x1), operator_2.matmul(x2)])

# Create a [2, 3] batch of 4 x 4 linear operators.
matrix_44 = tf.random.normal(shape=[2, 3, 4, 4])
operator_44 = LinearOperatorFullMatrix(matrix)

# Create a [1, 3] batch of 5 x 5 linear operators.
matrix_55 = tf.random.normal(shape=[1, 3, 5, 5])
operator_55 = LinearOperatorFullMatrix(matrix_55)

# Combine to create a [2, 3] batch of 9 x 9 operators.
operator_99 = LinearOperatorBlockDiag([operator_44, operator_55])

# Create a shape [2, 3, 9] vector.
x = tf.random.normal(shape=[2, 3, 9])
operator_99.matmul(x)
==> Shape [2, 3, 9] Tensor

# Create a blockwise list of vectors.
x = [tf.random.normal(shape=[2, 3, 4]), tf.random.normal(shape=[2, 3, 5])]
operator_99.matmul(x)
==> [Shape [2, 3, 4] Tensor, Shape [2, 3, 5] Tensor]
 Performance The performance of LinearOperatorBlockDiag on any operation is equal to the sum of the individual operators' operations. Matrix property hints This LinearOperator is initialized with boolean flags of the form is_X, for X = non_singular, self_adjoint, positive_definite, square. These have the following meaning:  If is_X == True, callers should expect the operator to have the property X. This is a promise that should be fulfilled, but is not a runtime assert. For example, finite floating point precision may result in these promises being violated. If is_X == False, callers should expect the operator to not have X. If is_X == None (the default), callers should have no expectation either way.

 Args
  operators   Iterable of LinearOperator objects, each with the same dtype and composable shape.
  is_non_singular   Expect that this operator is non-singular.
  is_self_adjoint   Expect that this operator is equal to its hermitian transpose.
  is_positive_definite   Expect that this operator is positive definite, meaning the quadratic form x^H A x has positive real part for all nonzero x. Note that we do not require the operator to be self-adjoint to be positive-definite. See: https://en.wikipedia.org/wiki/Positive-definite_matrix#Extension_for_non-symmetric_matrices
  is_square   Expect that this operator acts like square [batch] matrices. This is true by default, and will raise a ValueError otherwise.
  name   A name for this LinearOperator. Default is the individual operators names joined with _o_.

 Raises
  TypeError   If all operators do not have the same dtype.
  ValueError   If operators is empty or are non-square.

 Attributes
  H   Returns the adjoint of the current LinearOperator. Given A representing this LinearOperator, return A*. Note that calling self.adjoint() and self.H are equivalent.

  batch_shape   TensorShape of batch dimensions of this LinearOperator. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns TensorShape([B1,...,Bb]), equivalent to A.shape[:-2]

  domain_dimension   Dimension (in the sense of vector spaces) of the domain of this operator. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns N.

  dtype   The DType of Tensors handled by this LinearOperator.
  graph_parents   List of graph dependencies of this LinearOperator. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Do not call graph_parents.

  is_non_singular

  is_positive_definite

  is_self_adjoint

  is_square   Return True/False depending on if this operator is square.
  operators

  parameters   Dictionary of parameters used to instantiate this LinearOperator.
  range_dimension   Dimension (in the sense of vector spaces) of the range of this operator. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns M.

  shape   TensorShape of this LinearOperator. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns TensorShape([B1,...,Bb, M, N]), equivalent to A.shape.

  tensor_rank   Rank (in the sense of tensors) of matrix corresponding to this operator. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns b + 2.
   Methods add_to_tensor View source
add_to_tensor(
    x, name='add_to_tensor'
)
 Add matrix represented by this operator to x. Equivalent to A + x.

 Args
  x   Tensor with same dtype and shape broadcastable to self.shape.
  name   A name to give this Op.

 Returns   A Tensor with broadcast shape and same dtype as self.
 adjoint View source
adjoint(
    name='adjoint'
)
 Returns the adjoint of the current LinearOperator. Given A representing this LinearOperator, return A*. Note that calling self.adjoint() and self.H are equivalent.

 Args
  name   A name for this Op.

 Returns   LinearOperator which represents the adjoint of this LinearOperator.
 assert_non_singular View source
assert_non_singular(
    name='assert_non_singular'
)
 Returns an Op that asserts this operator is non singular. This operator is considered non-singular if ConditionNumber < max{100, range_dimension, domain_dimension} * eps,
eps := np.finfo(self.dtype.as_numpy_dtype).eps

 Args
  name   A string name to prepend to created ops.

 Returns   An Assert Op, that, when run, will raise an InvalidArgumentError if the operator is singular.
 assert_positive_definite View source
assert_positive_definite(
    name='assert_positive_definite'
)
 Returns an Op that asserts this operator is positive definite. Here, positive definite means that the quadratic form x^H A x has positive real part for all nonzero x. Note that we do not require the operator to be self-adjoint to be positive definite.

 Args
  name   A name to give this Op.

 Returns   An Assert Op, that, when run, will raise an InvalidArgumentError if the operator is not positive definite.
 assert_self_adjoint View source
assert_self_adjoint(
    name='assert_self_adjoint'
)
 Returns an Op that asserts this operator is self-adjoint. Here we check that this operator is exactly equal to its hermitian transpose.

 Args
  name   A string name to prepend to created ops.

 Returns   An Assert Op, that, when run, will raise an InvalidArgumentError if the operator is not self-adjoint.
 batch_shape_tensor View source
batch_shape_tensor(
    name='batch_shape_tensor'
)
 Shape of batch dimensions of this operator, determined at runtime. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns a Tensor holding [B1,...,Bb].

 Args
  name   A name for this Op.

 Returns   int32 Tensor
 cholesky View source
cholesky(
    name='cholesky'
)
 Returns a Cholesky factor as a LinearOperator. Given A representing this LinearOperator, if A is positive definite self-adjoint, return L, where A = L L^T, i.e. the cholesky decomposition.

 Args
  name   A name for this Op.

 Returns   LinearOperator which represents the lower triangular matrix in the Cholesky decomposition.

 Raises
  ValueError   When the LinearOperator is not hinted to be positive definite and self adjoint.    cond View source
cond(
    name='cond'
)
 Returns the condition number of this linear operator.

 Args
  name   A name for this Op.

 Returns   Shape [B1,...,Bb] Tensor of same dtype as self.
 determinant View source
determinant(
    name='det'
)
 Determinant for every batch member.

 Args
  name   A name for this Op.

 Returns   Tensor with shape self.batch_shape and same dtype as self.

 Raises
  NotImplementedError   If self.is_square is False.    diag_part View source
diag_part(
    name='diag_part'
)
 Efficiently get the [batch] diagonal part of this operator. If this operator has shape [B1,...,Bb, M, N], this returns a Tensor diagonal, of shape [B1,...,Bb, min(M, N)], where diagonal[b1,...,bb, i] = self.to_dense()[b1,...,bb, i, i]. my_operator = LinearOperatorDiag([1., 2.])

# Efficiently get the diagonal
my_operator.diag_part()
==> [1., 2.]

# Equivalent, but inefficient method
tf.linalg.diag_part(my_operator.to_dense())
==> [1., 2.]

 Args
  name   A name for this Op.

 Returns
  diag_part   A Tensor of same dtype as self.    domain_dimension_tensor View source
domain_dimension_tensor(
    name='domain_dimension_tensor'
)
 Dimension (in the sense of vector spaces) of the domain of this operator. Determined at runtime. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns N.

 Args
  name   A name for this Op.

 Returns   int32 Tensor
 eigvals View source
eigvals(
    name='eigvals'
)
 Returns the eigenvalues of this linear operator. If the operator is marked as self-adjoint (via is_self_adjoint) this computation can be more efficient.
Note: This currently only supports self-adjoint operators.

 Args
  name   A name for this Op.

 Returns   Shape [B1,...,Bb, N] Tensor of same dtype as self.
 inverse View source
inverse(
    name='inverse'
)
 Returns the Inverse of this LinearOperator. Given A representing this LinearOperator, return a LinearOperator representing A^-1.

 Args
  name   A name scope to use for ops added by this method.

 Returns   LinearOperator representing inverse of this matrix.

 Raises
  ValueError   When the LinearOperator is not hinted to be non_singular.    log_abs_determinant View source
log_abs_determinant(
    name='log_abs_det'
)
 Log absolute value of determinant for every batch member.

 Args
  name   A name for this Op.

 Returns   Tensor with shape self.batch_shape and same dtype as self.

 Raises
  NotImplementedError   If self.is_square is False.    matmul View source
matmul(
    x, adjoint=False, adjoint_arg=False, name='matmul'
)
 Transform [batch] matrix x with left multiplication: x --> Ax. # Make an operator acting like batch matrix A.  Assume A.shape = [..., M, N]
operator = LinearOperator(...)
operator.shape = [..., M, N]

X = ... # shape [..., N, R], batch matrix, R > 0.

Y = operator.matmul(X)
Y.shape
==> [..., M, R]

Y[..., :, r] = sum_j A[..., :, j] X[j, r]

 Args
  x   LinearOperator, Tensor with compatible shape and same dtype as self, or a blockwise iterable of LinearOperators or Tensors. See class docstring for definition of shape compatibility.
  adjoint   Python bool. If True, left multiply by the adjoint: A^H x.
  adjoint_arg   Python bool. If True, compute A x^H where x^H is the hermitian transpose (transposition and complex conjugation).
  name   A name for this Op.

 Returns   A LinearOperator or Tensor with shape [..., M, R] and same dtype as self, or if x is blockwise, a list of Tensors with shapes that concatenate to [..., M, R].
 matvec View source
matvec(
    x, adjoint=False, name='matvec'
)
 Transform [batch] vector x with left multiplication: x --> Ax. # Make an operator acting like batch matric A.  Assume A.shape = [..., M, N]
operator = LinearOperator(...)

X = ... # shape [..., N], batch vector

Y = operator.matvec(X)
Y.shape
==> [..., M]

Y[..., :] = sum_j A[..., :, j] X[..., j]

 Args
  x   Tensor with compatible shape and same dtype as self, or an iterable of Tensors (for blockwise operators). Tensors are treated a [batch] vectors, meaning for every set of leading dimensions, the last dimension defines a vector. See class docstring for definition of compatibility.
  adjoint   Python bool. If True, left multiply by the adjoint: A^H x.
  name   A name for this Op.

 Returns   A Tensor with shape [..., M] and same dtype as self.
 range_dimension_tensor View source
range_dimension_tensor(
    name='range_dimension_tensor'
)
 Dimension (in the sense of vector spaces) of the range of this operator. Determined at runtime. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns M.

 Args
  name   A name for this Op.

 Returns   int32 Tensor
 shape_tensor View source
shape_tensor(
    name='shape_tensor'
)
 Shape of this LinearOperator, determined at runtime. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns a Tensor holding [B1,...,Bb, M, N], equivalent to tf.shape(A).

 Args
  name   A name for this Op.

 Returns   int32 Tensor
 solve View source
solve(
    rhs, adjoint=False, adjoint_arg=False, name='solve'
)
 Solve (exact or approx) R (batch) systems of equations: A X = rhs. The returned Tensor will be close to an exact solution if A is well conditioned. Otherwise closeness will vary. See class docstring for details. Examples: # Make an operator acting like batch matrix A.  Assume A.shape = [..., M, N]
operator = LinearOperator(...)
operator.shape = [..., M, N]

# Solve R > 0 linear systems for every member of the batch.
RHS = ... # shape [..., M, R]

X = operator.solve(RHS)
# X[..., :, r] is the solution to the r'th linear system
# sum_j A[..., :, j] X[..., j, r] = RHS[..., :, r]

operator.matmul(X)
==> RHS

 Args
  rhs   Tensor with same dtype as this operator and compatible shape, or a list of Tensors (for blockwise operators). Tensors are treated like a [batch] matrices meaning for every set of leading dimensions, the last two dimensions defines a matrix. See class docstring for definition of compatibility.
  adjoint   Python bool. If True, solve the system involving the adjoint of this LinearOperator: A^H X = rhs.
  adjoint_arg   Python bool. If True, solve A X = rhs^H where rhs^H is the hermitian transpose (transposition and complex conjugation).
  name   A name scope to use for ops added by this method.

 Returns   Tensor with shape [...,N, R] and same dtype as rhs.

 Raises
  NotImplementedError   If self.is_non_singular or is_square is False.    solvevec View source
solvevec(
    rhs, adjoint=False, name='solve'
)
 Solve single equation with best effort: A X = rhs. The returned Tensor will be close to an exact solution if A is well conditioned. Otherwise closeness will vary. See class docstring for details. Examples: # Make an operator acting like batch matrix A.  Assume A.shape = [..., M, N]
operator = LinearOperator(...)
operator.shape = [..., M, N]

# Solve one linear system for every member of the batch.
RHS = ... # shape [..., M]

X = operator.solvevec(RHS)
# X is the solution to the linear system
# sum_j A[..., :, j] X[..., j] = RHS[..., :]

operator.matvec(X)
==> RHS

 Args
  rhs   Tensor with same dtype as this operator, or list of Tensors (for blockwise operators). Tensors are treated as [batch] vectors, meaning for every set of leading dimensions, the last dimension defines a vector. See class docstring for definition of compatibility regarding batch dimensions.
  adjoint   Python bool. If True, solve the system involving the adjoint of this LinearOperator: A^H X = rhs.
  name   A name scope to use for ops added by this method.

 Returns   Tensor with shape [...,N] and same dtype as rhs.

 Raises
  NotImplementedError   If self.is_non_singular or is_square is False.    tensor_rank_tensor View source
tensor_rank_tensor(
    name='tensor_rank_tensor'
)
 Rank (in the sense of tensors) of matrix corresponding to this operator. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns b + 2.

 Args
  name   A name for this Op.

 Returns   int32 Tensor, determined at runtime.
 to_dense View source
to_dense(
    name='to_dense'
)
 Return a dense (batch) matrix representing this operator. trace View source
trace(
    name='trace'
)
 Trace of the linear operator, equal to sum of self.diag_part(). If the operator is square, this is also the sum of the eigenvalues.

 Args
  name   A name for this Op.

 Returns   Shape [B1,...,Bb] Tensor of same dtype as self.
 __matmul__ View source
__matmul__(
    other
)


tf.linalg.LinearOperatorBlockLowerTriangular Combines LinearOperators into a blockwise lower-triangular matrix. Inherits From: LinearOperator, Module  View aliases  Compat aliases for migration
See Migration guide for more details. tf.compat.v1.linalg.LinearOperatorBlockLowerTriangular
tf.linalg.LinearOperatorBlockLowerTriangular(
    operators, is_non_singular=None, is_self_adjoint=None,
    is_positive_definite=None, is_square=None,
    name='LinearOperatorBlockLowerTriangular'
)
 This operator is initialized with a nested list of linear operators, which are combined into a new LinearOperator whose underlying matrix representation is square and has each operator on or below the main diagonal, and zero's elsewhere. Each element of the outer list is a list of LinearOperators corresponding to a row-partition of the blockwise structure. The number of LinearOperators in row-partion i must be equal to i. For example, a blockwise 3 x 3 LinearOperatorBlockLowerTriangular is initialized with the list [[op_00], [op_10, op_11], [op_20, op_21, op_22]], where the op_ij, i < 3, j <= i, are LinearOperator instances. The LinearOperatorBlockLowerTriangular behaves as the following blockwise matrix, where 0 represents appropriately-sized [batch] matrices of zeros: [[op_00,     0,     0],
 [op_10, op_11,     0],
 [op_20, op_21, op_22]]
 Each op_jj on the diagonal is required to represent a square matrix, and hence will have shape batch_shape_j + [M_j, M_j]. LinearOperators in row j of the blockwise structure must have range_dimension equal to that of op_jj, and LinearOperators in column j must have domain_dimension equal to that of op_jj. If each op_jj on the diagonal has shape batch_shape_j + [M_j, M_j], then the combined operator has shape broadcast_batch_shape + [sum M_j, sum M_j], where broadcast_batch_shape is the mutual broadcast of batch_shape_j, j = 0, 1, ..., J, assuming the intermediate batch shapes broadcast. Even if the combined shape is well defined, the combined operator's methods may fail due to lack of broadcasting ability in the defining operators' methods. For example, to create a 4 x 4 linear operator combined of three 2 x 2 operators: >>> operator_0 = tf.linalg.LinearOperatorFullMatrix([[1., 2.], [3., 4.]])
>>> operator_1 = tf.linalg.LinearOperatorFullMatrix([[1., 0.], [0., 1.]])
>>> operator_2 = tf.linalg.LinearOperatorLowerTriangular([[5., 6.], [7., 8]])
>>> operator = LinearOperatorBlockLowerTriangular(
...   [[operator_0], [operator_1, operator_2]])

operator.to_dense()
<tf.Tensor: shape=(4, 4), dtype=float32, numpy=
array([[1., 2., 0., 0.],
       [3., 4., 0., 0.],
       [1., 0., 5., 0.],
       [0., 1., 7., 8.]], dtype=float32)>

operator.shape
TensorShape([4, 4])

operator.log_abs_determinant()
<tf.Tensor: shape=(), dtype=float32, numpy=4.3820267>

x0 = [[1., 6.], [-3., 4.]]
x1 = [[0., 2.], [4., 0.]]
x = tf.concat([x0, x1], 0)  # Shape [2, 4] Tensor
operator.matmul(x)
<tf.Tensor: shape=(4, 2), dtype=float32, numpy=
array([[-5., 14.],
       [-9., 34.],
       [ 1., 16.],
       [29., 18.]], dtype=float32)>
 The above matmul is equivalent to: >>> tf.concat([operator_0.matmul(x0),
...   operator_1.matmul(x0) + operator_2.matmul(x1)], axis=0)
<tf.Tensor: shape=(4, 2), dtype=float32, numpy=
array([[-5., 14.],
       [-9., 34.],
       [ 1., 16.],
       [29., 18.]], dtype=float32)>
 Shape compatibility This operator acts on [batch] matrix with compatible shape. x is a batch matrix with compatible shape for matmul and solve if operator.shape = [B1,...,Bb] + [M, N],  with b >= 0
x.shape =        [B1,...,Bb] + [N, R],  with R >= 0.
 For example: Create a [2, 3] batch of 4 x 4 linear operators: >>> matrix_44 = tf.random.normal(shape=[2, 3, 4, 4])
>>> operator_44 = tf.linalg.LinearOperatorFullMatrix(matrix_44)
 Create a [1, 3] batch of 5 x 4 linear operators: >>> matrix_54 = tf.random.normal(shape=[1, 3, 5, 4])
>>> operator_54 = tf.linalg.LinearOperatorFullMatrix(matrix_54)
 Create a [1, 3] batch of 5 x 5 linear operators: >>> matrix_55 = tf.random.normal(shape=[1, 3, 5, 5])
>>> operator_55 = tf.linalg.LinearOperatorFullMatrix(matrix_55)
 Combine to create a [2, 3] batch of 9 x 9 operators: >>> operator_99 = LinearOperatorBlockLowerTriangular(
...   [[operator_44], [operator_54, operator_55]])
>>> operator_99.shape
TensorShape([2, 3, 9, 9])
 Create a shape [2, 1, 9] batch of vectors and apply the operator to it. >>> x = tf.random.normal(shape=[2, 1, 9])
>>> y = operator_99.matvec(x)
>>> y.shape
TensorShape([2, 3, 9])
 Create a blockwise list of vectors and apply the operator to it. A blockwise list is returned. >>> x4 = tf.random.normal(shape=[2, 1, 4])
>>> x5 = tf.random.normal(shape=[2, 3, 5])
>>> y_blockwise = operator_99.matvec([x4, x5])
>>> y_blockwise[0].shape
TensorShape([2, 3, 4])
>>> y_blockwise[1].shape
TensorShape([2, 3, 5])
 Performance Suppose operator is a LinearOperatorBlockLowerTriangular consisting of D row-partitions and D column-partitions, such that the total number of operators is N = D * (D + 1) // 2.
operator.matmul has complexity equal to the sum of the matmul complexities of the individual operators.
operator.solve has complexity equal to the sum of the solve complexities of the operators on the diagonal and the matmul complexities of the operators off the diagonal.
operator.determinant has complexity equal to the sum of the determinant complexities of the operators on the diagonal.  Matrix property hints This LinearOperator is initialized with boolean flags of the form is_X, for X = non_singular, self_adjoint, positive_definite, square. These have the following meaning:  If is_X == True, callers should expect the operator to have the property X. This is a promise that should be fulfilled, but is not a runtime assert. For example, finite floating point precision may result in these promises being violated. If is_X == False, callers should expect the operator to not have X. If is_X == None (the default), callers should have no expectation either way.

 Args
  operators   Iterable of iterables of LinearOperator objects, each with the same dtype. Each element of operators corresponds to a row- partition, in top-to-bottom order. The operators in each row-partition are filled in left-to-right. For example, operators = [[op_0], [op_1, op_2], [op_3, op_4, op_5]] creates a LinearOperatorBlockLowerTriangular with full block structure [[op_0, 0, 0], [op_1, op_2, 0], [op_3, op_4, op_5]]. The number of operators in the ith row must be equal to i, such that each operator falls on or below the diagonal of the blockwise structure. LinearOperators that fall on the diagonal (the last elements of each row) must be square. The other LinearOperators must have domain dimension equal to the domain dimension of the LinearOperators in the same column-partition, and range dimension equal to the range dimension of the LinearOperators in the same row-partition.
  is_non_singular   Expect that this operator is non-singular.
  is_self_adjoint   Expect that this operator is equal to its hermitian transpose.
  is_positive_definite   Expect that this operator is positive definite, meaning the quadratic form x^H A x has positive real part for all nonzero x. Note that we do not require the operator to be self-adjoint to be positive-definite. See: https://en.wikipedia.org/wiki/Positive-definite_matrix#Extension_for_non-symmetric_matrices
  is_square   Expect that this operator acts like square [batch] matrices. This will raise a ValueError if set to False.
  name   A name for this LinearOperator.

 Raises
  TypeError   If all operators do not have the same dtype.
  ValueError   If operators is empty, contains an erroneous number of elements, or contains operators with incompatible shapes.

 Attributes
  H   Returns the adjoint of the current LinearOperator. Given A representing this LinearOperator, return A*. Note that calling self.adjoint() and self.H are equivalent.

  batch_shape   TensorShape of batch dimensions of this LinearOperator. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns TensorShape([B1,...,Bb]), equivalent to A.shape[:-2]

  domain_dimension   Dimension (in the sense of vector spaces) of the domain of this operator. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns N.

  dtype   The DType of Tensors handled by this LinearOperator.
  graph_parents   List of graph dependencies of this LinearOperator. (deprecated) Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Do not call graph_parents.

  is_non_singular

  is_positive_definite

  is_self_adjoint

  is_square   Return True/False depending on if this operator is square.
  operators

  parameters   Dictionary of parameters used to instantiate this LinearOperator.
  range_dimension   Dimension (in the sense of vector spaces) of the range of this operator. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns M.

  shape   TensorShape of this LinearOperator. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns TensorShape([B1,...,Bb, M, N]), equivalent to A.shape.

  tensor_rank   Rank (in the sense of tensors) of matrix corresponding to this operator. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns b + 2.
   Methods add_to_tensor View source
add_to_tensor(
    x, name='add_to_tensor'
)
 Add matrix represented by this operator to x. Equivalent to A + x.

 Args
  x   Tensor with same dtype and shape broadcastable to self.shape.
  name   A name to give this Op.

 Returns   A Tensor with broadcast shape and same dtype as self.
 adjoint View source
adjoint(
    name='adjoint'
)
 Returns the adjoint of the current LinearOperator. Given A representing this LinearOperator, return A*. Note that calling self.adjoint() and self.H are equivalent.

 Args
  name   A name for this Op.

 Returns   LinearOperator which represents the adjoint of this LinearOperator.
 assert_non_singular View source
assert_non_singular(
    name='assert_non_singular'
)
 Returns an Op that asserts this operator is non singular. This operator is considered non-singular if ConditionNumber < max{100, range_dimension, domain_dimension} * eps,
eps := np.finfo(self.dtype.as_numpy_dtype).eps

 Args
  name   A string name to prepend to created ops.

 Returns   An Assert Op, that, when run, will raise an InvalidArgumentError if the operator is singular.
 assert_positive_definite View source
assert_positive_definite(
    name='assert_positive_definite'
)
 Returns an Op that asserts this operator is positive definite. Here, positive definite means that the quadratic form x^H A x has positive real part for all nonzero x. Note that we do not require the operator to be self-adjoint to be positive definite.

 Args
  name   A name to give this Op.

 Returns   An Assert Op, that, when run, will raise an InvalidArgumentError if the operator is not positive definite.
 assert_self_adjoint View source
assert_self_adjoint(
    name='assert_self_adjoint'
)
 Returns an Op that asserts this operator is self-adjoint. Here we check that this operator is exactly equal to its hermitian transpose.

 Args
  name   A string name to prepend to created ops.

 Returns   An Assert Op, that, when run, will raise an InvalidArgumentError if the operator is not self-adjoint.
 batch_shape_tensor View source
batch_shape_tensor(
    name='batch_shape_tensor'
)
 Shape of batch dimensions of this operator, determined at runtime. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns a Tensor holding [B1,...,Bb].

 Args
  name   A name for this Op.

 Returns   int32 Tensor
 cholesky View source
cholesky(
    name='cholesky'
)
 Returns a Cholesky factor as a LinearOperator. Given A representing this LinearOperator, if A is positive definite self-adjoint, return L, where A = L L^T, i.e. the cholesky decomposition.

 Args
  name   A name for this Op.

 Returns   LinearOperator which represents the lower triangular matrix in the Cholesky decomposition.

 Raises
  ValueError   When the LinearOperator is not hinted to be positive definite and self adjoint.    cond View source
cond(
    name='cond'
)
 Returns the condition number of this linear operator.

 Args
  name   A name for this Op.

 Returns   Shape [B1,...,Bb] Tensor of same dtype as self.
 determinant View source
determinant(
    name='det'
)
 Determinant for every batch member.

 Args
  name   A name for this Op.

 Returns   Tensor with shape self.batch_shape and same dtype as self.

 Raises
  NotImplementedError   If self.is_square is False.    diag_part View source
diag_part(
    name='diag_part'
)
 Efficiently get the [batch] diagonal part of this operator. If this operator has shape [B1,...,Bb, M, N], this returns a Tensor diagonal, of shape [B1,...,Bb, min(M, N)], where diagonal[b1,...,bb, i] = self.to_dense()[b1,...,bb, i, i]. my_operator = LinearOperatorDiag([1., 2.])

# Efficiently get the diagonal
my_operator.diag_part()
==> [1., 2.]

# Equivalent, but inefficient method
tf.linalg.diag_part(my_operator.to_dense())
==> [1., 2.]

 Args
  name   A name for this Op.

 Returns
  diag_part   A Tensor of same dtype as self.    domain_dimension_tensor View source
domain_dimension_tensor(
    name='domain_dimension_tensor'
)
 Dimension (in the sense of vector spaces) of the domain of this operator. Determined at runtime. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns N.

 Args
  name   A name for this Op.

 Returns   int32 Tensor
 eigvals View source
eigvals(
    name='eigvals'
)
 Returns the eigenvalues of this linear operator. If the operator is marked as self-adjoint (via is_self_adjoint) this computation can be more efficient.
Note: This currently only supports self-adjoint operators.

 Args
  name   A name for this Op.

 Returns   Shape [B1,...,Bb, N] Tensor of same dtype as self.
 inverse View source
inverse(
    name='inverse'
)
 Returns the Inverse of this LinearOperator. Given A representing this LinearOperator, return a LinearOperator representing A^-1.

 Args
  name   A name scope to use for ops added by this method.

 Returns   LinearOperator representing inverse of this matrix.

 Raises
  ValueError   When the LinearOperator is not hinted to be non_singular.    log_abs_determinant View source
log_abs_determinant(
    name='log_abs_det'
)
 Log absolute value of determinant for every batch member.

 Args
  name   A name for this Op.

 Returns   Tensor with shape self.batch_shape and same dtype as self.

 Raises
  NotImplementedError   If self.is_square is False.    matmul View source
matmul(
    x, adjoint=False, adjoint_arg=False, name='matmul'
)
 Transform [batch] matrix x with left multiplication: x --> Ax. # Make an operator acting like batch matrix A.  Assume A.shape = [..., M, N]
operator = LinearOperator(...)
operator.shape = [..., M, N]

X = ... # shape [..., N, R], batch matrix, R > 0.

Y = operator.matmul(X)
Y.shape
==> [..., M, R]

Y[..., :, r] = sum_j A[..., :, j] X[j, r]

 Args
  x   LinearOperator, Tensor with compatible shape and same dtype as self, or a blockwise iterable of LinearOperators or Tensors. See class docstring for definition of shape compatibility.
  adjoint   Python bool. If True, left multiply by the adjoint: A^H x.
  adjoint_arg   Python bool. If True, compute A x^H where x^H is the hermitian transpose (transposition and complex conjugation).
  name   A name for this Op.

 Returns   A LinearOperator or Tensor with shape [..., M, R] and same dtype as self, or if x is blockwise, a list of Tensors with shapes that concatenate to [..., M, R].
 matvec View source
matvec(
    x, adjoint=False, name='matvec'
)
 Transform [batch] vector x with left multiplication: x --> Ax. # Make an operator acting like batch matrix A.  Assume A.shape = [..., M, N]
operator = LinearOperator(...)

X = ... # shape [..., N], batch vector

Y = operator.matvec(X)
Y.shape
==> [..., M]

Y[..., :] = sum_j A[..., :, j] X[..., j]

 Args
  x   Tensor with compatible shape and same dtype as self, or an iterable of Tensors. Tensors are treated a [batch] vectors, meaning for every set of leading dimensions, the last dimension defines a vector. See class docstring for definition of compatibility.
  adjoint   Python bool. If True, left multiply by the adjoint: A^H x.
  name   A name for this Op.

 Returns   A Tensor with shape [..., M] and same dtype as self.
 range_dimension_tensor View source
range_dimension_tensor(
    name='range_dimension_tensor'
)
 Dimension (in the sense of vector spaces) of the range of this operator. Determined at runtime. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns M.

 Args
  name   A name for this Op.

 Returns   int32 Tensor
 shape_tensor View source
shape_tensor(
    name='shape_tensor'
)
 Shape of this LinearOperator, determined at runtime. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns a Tensor holding [B1,...,Bb, M, N], equivalent to tf.shape(A).

 Args
  name   A name for this Op.

 Returns   int32 Tensor
 solve View source
solve(
    rhs, adjoint=False, adjoint_arg=False, name='solve'
)
 Solve (exact or approx) R (batch) systems of equations: A X = rhs. The returned Tensor will be close to an exact solution if A is well conditioned. Otherwise closeness will vary. See class docstring for details. Given the blockwise n + 1-by-n + 1 linear operator: op = [[A_00 0 ... 0 ... 0], [A_10 A_11 ... 0 ... 0], ... [A_k0 A_k1 ... A_kk ... 0], ... [A_n0 A_n1 ... A_nk ... A_nn]] we find x = op.solve(y) by observing that y_k = A_k0.matmul(x_0) + A_k1.matmul(x_1) + ... + A_kk.matmul(x_k) and therefore x_k = A_kk.solve(y_k - A_k0.matmul(x_0) - ... - A_k(k-1).matmul(x_(k-1))) where x_k and y_k are the kth blocks obtained by decomposing x and y along their appropriate axes. We first solve x_0 = A_00.solve(y_0). Proceeding inductively, we solve for x_k, k = 1..n, given x_0..x_(k-1). The adjoint case is solved similarly, beginning with x_n = A_nn.solve(y_n, adjoint=True) and proceeding backwards. Examples: # Make an operator acting like batch matrix A.  Assume A.shape = [..., M, N]
operator = LinearOperator(...)
operator.shape = [..., M, N]

# Solve R > 0 linear systems for every member of the batch.
RHS = ... # shape [..., M, R]

X = operator.solve(RHS)
# X[..., :, r] is the solution to the r'th linear system
# sum_j A[..., :, j] X[..., j, r] = RHS[..., :, r]

operator.matmul(X)
==> RHS

 Args
  rhs   Tensor with same dtype as this operator and compatible shape, or a list of Tensors. Tensors are treated like a [batch] matrices meaning for every set of leading dimensions, the last two dimensions defines a matrix. See class docstring for definition of compatibility.
  adjoint   Python bool. If True, solve the system involving the adjoint of this LinearOperator: A^H X = rhs.
  adjoint_arg   Python bool. If True, solve A X = rhs^H where rhs^H is the hermitian transpose (transposition and complex conjugation).
  name   A name scope to use for ops added by this method.

 Returns   Tensor with shape [...,N, R] and same dtype as rhs.

 Raises
  NotImplementedError   If self.is_non_singular or is_square is False.    solvevec View source
solvevec(
    rhs, adjoint=False, name='solve'
)
 Solve single equation with best effort: A X = rhs. The returned Tensor will be close to an exact solution if A is well conditioned. Otherwise closeness will vary. See class docstring for details. Examples: # Make an operator acting like batch matrix A.  Assume A.shape = [..., M, N]
operator = LinearOperator(...)
operator.shape = [..., M, N]

# Solve one linear system for every member of the batch.
RHS = ... # shape [..., M]

X = operator.solvevec(RHS)
# X is the solution to the linear system
# sum_j A[..., :, j] X[..., j] = RHS[..., :]

operator.matvec(X)
==> RHS

 Args
  rhs   Tensor with same dtype as this operator, or list of Tensors (for blockwise operators). Tensors are treated as [batch] vectors, meaning for every set of leading dimensions, the last dimension defines a vector. See class docstring for definition of compatibility regarding batch dimensions.
  adjoint   Python bool. If True, solve the system involving the adjoint of this LinearOperator: A^H X = rhs.
  name   A name scope to use for ops added by this method.

 Returns   Tensor with shape [...,N] and same dtype as rhs.

 Raises
  NotImplementedError   If self.is_non_singular or is_square is False.    tensor_rank_tensor View source
tensor_rank_tensor(
    name='tensor_rank_tensor'
)
 Rank (in the sense of tensors) of matrix corresponding to this operator. If this operator acts like the batch matrix A with A.shape = [B1,...,Bb, M, N], then this returns b + 2.

 Args
  name   A name for this Op.

 Returns   int32 Tensor, determined at runtime.
 to_dense View source
to_dense(
    name='to_dense'
)
 Return a dense (batch) matrix representing this operator. trace View source
trace(
    name='trace'
)
 Trace of the linear operator, equal to sum of self.diag_part(). If the operator is square, this is also the sum of the eigenvalues.

 Args
  name   A name for this Op.

 Returns   Shape [B1,...,Bb] Tensor of same dtype as self.
 __matmul__ View source
__matmul__(
    other
)