Type LinearOperatorBlockDiag
Namespace tensorflow.linalg
Parent LinearOperator
Interfaces ILinearOperatorBlockDiag
Combines one or more `LinearOperators` in to a Block Diagonal matrix. 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.
#### 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.
Show Example
# 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
Methods
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
- operators
- operators_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
object determinant(string name)
Determinant for every batch member.
Parameters
-
string
name - A name for this `Op`.
Returns
-
object
- `Tensor` with shape `self.batch_shape` and same `dtype` as `self`.
object determinant_dyn(ImplicitContainer<T> name)
Determinant for every batch member.
Parameters
-
ImplicitContainer<T>
name - A name for this `Op`.
Returns
-
object
- `Tensor` with shape `self.batch_shape` and same `dtype` as `self`.
object log_abs_determinant(string name)
Log absolute value of determinant for every batch member.
Parameters
-
string
name - A name for this `Op`.
Returns
-
object
- `Tensor` with shape `self.batch_shape` and same `dtype` as `self`.
object log_abs_determinant_dyn(ImplicitContainer<T> name)
Log absolute value of determinant for every batch member.
Parameters
-
ImplicitContainer<T>
name - A name for this `Op`.
Returns
-
object
- `Tensor` with shape `self.batch_shape` and same `dtype` as `self`.