lu as returned by tf.linalg.lu, i.e., if
matmul(P, matmul(L, U)) = X then lower_upper = L + U - eye.
perm
p as returned by tf.linag.lu, i.e., if
matmul(P, matmul(L, U)) = X then perm = argmax(P).
validate_args
Python bool indicating whether arguments should be checked
for correctness. Note: this function does not verify the implied matrix is
actually invertible, even when validate_args=True.
Default value: False (i.e., don't validate arguments).
name
Python str name given to ops managed by this object.
Default value: None (i.e., 'lu_matrix_inverse').
Returns
inv_x
The matrix_inv, i.e.,
tf.matrix_inverse(tfp.math.lu_reconstruct(lu, perm)).
[null,null,["Last updated 2023-11-21 UTC."],[],[],null,["# tfp.math.lu_matrix_inverse\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/probability/blob/v0.23.0/tensorflow_probability/python/math/linalg.py#L642-L701) |\n\nComputes a matrix inverse given the matrix's LU decomposition. \n\n tfp.math.lu_matrix_inverse(\n lower_upper, perm, validate_args=False, name=None\n )\n\nThis op is conceptually identical to, \n\n inv_X = tf.lu_matrix_inverse(*tf.linalg.lu(X))\n tf.assert_near(tf.matrix_inverse(X), inv_X)\n # ==\u003e True\n\n| **Note:** this function does not verify the implied matrix is actually invertible nor is this condition checked even when `validate_args=True`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `lower_upper` | `lu` as returned by [`tf.linalg.lu`](https://www.tensorflow.org/api_docs/python/tf/linalg/lu), i.e., if `matmul(P, matmul(L, U)) = X` then `lower_upper = L + U - eye`. |\n| `perm` | `p` as returned by `tf.linag.lu`, i.e., if `matmul(P, matmul(L, U)) = X` then `perm = argmax(P)`. |\n| `validate_args` | Python `bool` indicating whether arguments should be checked for correctness. Note: this function does not verify the implied matrix is actually invertible, even when `validate_args=True`. Default value: `False` (i.e., don't validate arguments). |\n| `name` | Python `str` name given to ops managed by this object. Default value: `None` (i.e., 'lu_matrix_inverse'). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---------|-------------------------------------------------------------------------------|\n| `inv_x` | The matrix_inv, i.e., `tf.matrix_inverse(tfp.math.lu_reconstruct(lu, perm))`. |\n\n\u003cbr /\u003e\n\n#### Examples\n\n import numpy as np\n import tensorflow as tf\n import tensorflow_probability as tfp\n\n x = [[[3., 4], [1, 2]],\n [[7., 8], [3, 4]]]\n inv_x = tfp.math.lu_matrix_inverse(*tf.linalg.lu(x))\n tf.assert_near(tf.matrix_inverse(x), inv_x)\n # ==\u003e True"]]