我需要使用单值分解在Python中反转以下矩阵,并且我需要将这些矩阵相乘以获得初始矩阵以供确认。当矩阵有不同的维数时,我怎么做
X_b= [[array([2.52390408]), array([2.4962137]), array([2.46467486]), array([2.48760957])], [array([2.52390408]), array([2.4962137]), array([2.46467486]), array([2.48760957])]]
我使用了命令
svd=linalg.svd(x_b, full_matrices=True, compute_uv=True, hermitian=False)
结果是
a=svd[0]
a =[[ 0.50615947 -0.50060626 -0.49428127 -0.49888074]
[ 0.50060626 0.83361215 -0.16428559 -0.16581433]
[ 0.49428127 -0.16428559 0.8377901 -0.16371932]
[ 0.49888074 -0.16581433 -0.16371932 0.83475721]]]
b=svd[1]
b= [[4.98638127]
[4.98638127]]
c=svd[2]
c= [[[1.]]
[[1.]]]
在
numpy.linalg.svd
的文档页面中,说明了如何使用svd
的返回值重构输入矩阵:您可以根据您的用例调整给定的示例:
重建
X_b
:相关问题 更多 >
编程相关推荐