在给定 LU 分解的情况下,求解线性 eqns A X = RHS 系统。
用法
tf.linalg.lu_solve(
lower_upper, perm, rhs, 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)。 -
rhsMatrix-shaped floatTensor表示要求解的目标;A X = RHS。要处理向量情况,请使用:lu_solve(..., rhs[..., tf.newaxis])[..., 0]。 -
validate_argsPythonbool指示是否应检查参数的正确性。注意:此函数不验证隐含矩阵实际上是可逆的,即使在validate_args=True时也是如此。默认值:False(即不验证参数)。 -
namePythonstr赋予此对象管理的操作的名称。默认值:None(即'lu_solve')。
返回
-
xA @ X = RHS中的X。
注意:此函数不验证隐含矩阵实际上是可逆的,即使在 validate_args=True 时也不检查此条件。
例子
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
x = [[[1., 2],
[3, 4]],
[[7, 8],
[3, 4]]]
inv_x = tf.linalg.lu_solve(*tf.linalg.lu(x), rhs=tf.eye(2))
tf.assert_near(tf.matrix_inverse(x), inv_x)
# ==> True
相关用法
- Python tf.linalg.lu_matrix_inverse用法及代码示例
- Python tf.linalg.lu_reconstruct用法及代码示例
- 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_solve。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
