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).
rhs
Matrix-shaped float Tensor representing targets for which to solve;
A X = RHS. To handle vector cases, use:
lu_solve(..., rhs[..., tf.newaxis])[..., 0].
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_solve').
[null,null,["Last updated 2023-11-21 UTC."],[],[],null,["# tfp.substrates.numpy.math.lu_solve\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/probability/blob/v0.23.0/tensorflow_probability/substrates/numpy/math/linalg.py#L545-L639) |\n\nSolves systems of linear eqns `A X = RHS`, given LU factorizations.\n\n#### View aliases\n\n\n**Main aliases**\n\n[`tfp.experimental.substrates.numpy.math.lu_solve`](https://www.tensorflow.org/probability/api_docs/python/tfp/substrates/numpy/math/lu_solve)\n\n\u003cbr /\u003e\n\n tfp.substrates.numpy.math.lu_solve(\n lower_upper, perm, rhs, validate_args=False, name=None\n )\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| `rhs` | Matrix-shaped float `Tensor` representing targets for which to solve; `A X = RHS`. To handle vector cases, use: `lu_solve(..., rhs[..., tf.newaxis])[..., 0]`. |\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_solve'). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|-----|---------------------------|\n| `x` | The `X` in `A @ X = RHS`. |\n\n\u003cbr /\u003e\n\n#### Examples\n\n import numpy as np\n from tensorflow_probability.python.internal.backend import numpy as tf\n import tensorflow_probability as tfp; tfp = tfp.substrates.numpy\n\n x = [[[1., 2],\n [3, 4]],\n [[7, 8],\n [3, 4]]]\n inv_x = tfp.math.lu_solve(*tf.linalg.lu(x), rhs=tf.eye(2))\n tf.assert_near(tf.matrix_inverse(x), inv_x)\n # ==\u003e True"]]