在給定一個或多個矩陣的 LU 分解的情況下計算逆。
用法
tf.linalg.lu_matrix_inverse(
lower_upper, perm, validate_args=False, name=None
)參數
-
lower_upperlu由tf.linalg.lu返回,即如果matmul(P, matmul(L, U)) = X則lower_upper = L + U - eye。 -
permp由tf.linag.lu返回,即如果matmul(P, matmul(L, U)) = X則perm = argmax(P)。 -
validate_argsPythonbool指示是否應檢查參數的正確性。注意:此函數不驗證隱含矩陣實際上是可逆的,即使在validate_args=True時也是如此。默認值:False(即不驗證參數)。 -
namePythonstr賦予此對象管理的操作的名稱。默認值:None(即'lu_matrix_inverse')。
返回
-
inv_xmatrix_inv,即tf.matrix_inverse(tf.linalg.lu_reconstruct(lu, perm)).
這個操作在概念上等同於,
inv_X = tf.lu_matrix_inverse(*tf.linalg.lu(X))
tf.assert_near(tf.matrix_inverse(X), inv_X)
# ==> True注意:此函數不驗證隱含矩陣實際上是可逆的,即使在 validate_args=True 時也不檢查此條件。
例子
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
x = [[[3., 4], [1, 2]],
[[7., 8], [3, 4]]]
inv_x = tf.linalg.lu_matrix_inverse(*tf.linalg.lu(x))
tf.assert_near(tf.matrix_inverse(x), inv_x)
# ==> True
相關用法
- Python tf.linalg.lu_reconstruct用法及代碼示例
- Python tf.linalg.lu_solve用法及代碼示例
- Python tf.linalg.logdet用法及代碼示例
- Python tf.linalg.LinearOperatorFullMatrix.matvec用法及代碼示例
- Python tf.linalg.LinearOperatorToeplitz.solve用法及代碼示例
- Python tf.linalg.LinearOperatorIdentity.solvevec用法及代碼示例
- Python tf.linalg.LinearOperatorPermutation.solve用法及代碼示例
- Python tf.linalg.band_part用法及代碼示例
- Python tf.linalg.LinearOperatorKronecker.diag_part用法及代碼示例
- Python tf.linalg.LinearOperatorToeplitz.matvec用法及代碼示例
- Python tf.linalg.LinearOperatorBlockLowerTriangular.solvevec用法及代碼示例
- Python tf.linalg.LinearOperatorLowerTriangular.matvec用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant2D.solve用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant3D.diag_part用法及代碼示例
- Python tf.linalg.LinearOperatorToeplitz.solvevec用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant2D.assert_non_singular用法及代碼示例
- Python tf.linalg.LinearOperatorPermutation.diag_part用法及代碼示例
- Python tf.linalg.LinearOperatorToeplitz用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant2D.matvec用法及代碼示例
- Python tf.linalg.LinearOperatorTridiag.solvevec用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.linalg.lu_matrix_inverse。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
