2024-03-28 15:03:49 发布
网友
我试着用numpy和tensorflow计算矩阵的特征值,但我得到的每个实现的特征值都不同。以下是详细情况
A=([1,2,3],[1,2,3],[1,2,3])
带numpy的A的特征值是[0,6,0]
[0,6,0]
具有张量流的A的特征值是[ 0.30797836, 0.64310414, 5.04891825]
[ 0.30797836, 0.64310414, 5.04891825]
我使用tf.self_adjoint_eig实现tensorflow,使用numpy.linalg.eig实现numpy。在
tf.self_adjoint_eig
numpy.linalg.eig
根据功能描述: https://www.tensorflow.org/versions/master/api_docs/python/math_ops.html#self_adjoint_eig
Calculates the Eigen Decomposition of a square Self-Adjoint matrix.Only the lower-triangular part of the input will be used in this case. The upper-triangular part will not be read.
Calculates the Eigen Decomposition of a square Self-Adjoint matrix.
Only the lower-triangular part of the input will be used in this case. The upper-triangular part will not be read.
因此,你的矩阵上的TensorFlow的self_adjoint_eig等同于下面矩阵的numpy eig
self_adjoint_eig
eig
({1,1,1},{1,2,2},{1,2,3})
根据功能描述: https://www.tensorflow.org/versions/master/api_docs/python/math_ops.html#self_adjoint_eig
因此,你的矩阵上的TensorFlow的
self_adjoint_eig
等同于下面矩阵的numpyeig
相关问题 更多 >
编程相关推荐