Type LinearOperatorAdjoint
Namespace tensorflow.linalg
Parent LinearOperator
Interfaces ILinearOperatorAdjoint
`LinearOperator` representing the adjoint of another operator. This operator represents the adjoint of another operator.
#### 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.
Show Example
# 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)
Methods
- add_to_tensor
- add_to_tensor_dyn
- diag_part
- diag_part_dyn
- solve
- solve_dyn
- solvevec
- solvevec
- trace
- trace_dyn
Properties
- batch_shape
- batch_shape_dyn
- domain_dimension
- domain_dimension_dyn
- dtype
- dtype_dyn
- graph_parents
- graph_parents_dyn
- is_non_singular
- is_non_singular_dyn
- is_positive_definite
- is_positive_definite_dyn
- is_self_adjoint
- is_self_adjoint_dyn
- is_square
- is_square_dyn
- name
- name_dyn
- name_scope
- name_scope_dyn
- operator
- operator_dyn
- PythonObject
- range_dimension
- range_dimension_dyn
- shape
- shape_dyn
- submodules
- submodules_dyn
- tensor_rank
- tensor_rank_dyn
- trainable_variables
- trainable_variables_dyn
- variables
- variables_dyn
Public instance methods
Tensor add_to_tensor(IGraphNodeBase x, string name)
Add matrix represented by this operator to `mat`. Equiv to `I + mat`.
Parameters
-
IGraphNodeBase
x -
string
name - A name to give this `Op`.
Returns
-
Tensor
- A `Tensor` with broadcast shape and same `dtype` as `self`.
object add_to_tensor_dyn(object x, ImplicitContainer<T> name)
Add matrix represented by this operator to `mat`. Equiv to `I + mat`.
Parameters
-
object
x -
ImplicitContainer<T>
name - A name to give this `Op`.
Returns
-
object
- A `Tensor` with broadcast shape and same `dtype` as `self`.
Tensor diag_part(string name)
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.]
```
Parameters
-
string
name - A name for this `Op`.
Returns
object diag_part_dyn(ImplicitContainer<T> name)
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.]
```
Parameters
-
ImplicitContainer<T>
name - A name for this `Op`.
Returns
-
object
object solve(PythonClassContainer rhs, bool adjoint, bool adjoint_arg, string name)
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:
Parameters
-
PythonClassContainer
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.
-
bool
adjoint - Python `bool`. If `True`, solve the system involving the adjoint of this `LinearOperator`: `A^H X = rhs`.
-
bool
adjoint_arg - Python `bool`. If `True`, solve `A X = rhs^H` where `rhs^H` is the hermitian transpose (transposition and complex conjugation).
-
string
name - A name scope to use for ops added by this method.
Returns
-
object
- `Tensor` with shape `[...,N, R]` and same `dtype` as `rhs`.
Show Example
# 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
object solve_dyn(object rhs, ImplicitContainer<T> adjoint, ImplicitContainer<T> adjoint_arg, ImplicitContainer<T> name)
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:
Parameters
-
object
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.
-
ImplicitContainer<T>
adjoint - Python `bool`. If `True`, solve the system involving the adjoint of this `LinearOperator`: `A^H X = rhs`.
-
ImplicitContainer<T>
adjoint_arg - Python `bool`. If `True`, solve `A X = rhs^H` where `rhs^H` is the hermitian transpose (transposition and complex conjugation).
-
ImplicitContainer<T>
name - A name scope to use for ops added by this method.
Returns
-
object
- `Tensor` with shape `[...,N, R]` and same `dtype` as `rhs`.
Show Example
# 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
Tensor solvevec(ndarray rhs, bool adjoint, string name)
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:
Parameters
-
ndarray
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.
-
bool
adjoint - Python `bool`. If `True`, solve the system involving the adjoint of this `LinearOperator`: `A^H X = rhs`.
-
string
name - A name scope to use for ops added by this method.
Returns
-
Tensor
- `Tensor` with shape `[...,N]` and same `dtype` as `rhs`.
Show Example
# 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
Tensor solvevec(IEnumerable<PythonClassContainer> rhs, bool adjoint, string name)
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:
Parameters
-
IEnumerable<PythonClassContainer>
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.
-
bool
adjoint - Python `bool`. If `True`, solve the system involving the adjoint of this `LinearOperator`: `A^H X = rhs`.
-
string
name - A name scope to use for ops added by this method.
Returns
-
Tensor
- `Tensor` with shape `[...,N]` and same `dtype` as `rhs`.
Show Example
# 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
object trace(string name)
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.
Parameters
-
string
name - A name for this `Op`.
Returns
-
object
- Shape `[B1,...,Bb]` `Tensor` of same `dtype` as `self`.
object trace_dyn(ImplicitContainer<T> name)
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.
Parameters
-
ImplicitContainer<T>
name - A name for this `Op`.
Returns
-
object
- Shape `[B1,...,Bb]` `Tensor` of same `dtype` as `self`.
Public properties
object batch_shape get;
object batch_shape_dyn get;
Dimension domain_dimension get;
object domain_dimension_dyn get;
object dtype get;
object dtype_dyn get;
IList<object> graph_parents get;
object graph_parents_dyn get;
Nullable<bool> is_non_singular get;
object is_non_singular_dyn get;
object is_positive_definite get;
object is_positive_definite_dyn get;
object is_self_adjoint get;
object is_self_adjoint_dyn get;
Nullable<bool> is_square get;
object is_square_dyn get;
object name get;
object name_dyn get;
object name_scope get;
object name_scope_dyn get;
object operator get;
object operator_dyn get;
The operator before taking the adjoint.