矩阵的秩是0,矩阵奇异,见下面的代码:
import numpy as np
mul=np.array([[ 2.79358336e-03, -4.33801272e-03, 1.49405606e-01, -1.49494674e-01],
[-4.33801272e-03, 6.73628032e-03, -2.32004399e-01, 2.32142708e-01],
[ 1.49405606e-01, -2.32004399e-01, 7.99047014e+00, -7.99523365e+00],
[-1.49494674e-01, 2.32142708e-01, -7.99523365e+00 , 8.00000000e+00]])
print(np.linalg.det(mul)) #矩阵的秩是9.606177199181016e-28,矩阵奇异
invert = np.linalg.pinv(mul)
res = mul @ invert
print(res)
print(np.allclose(res ,np.identity(4),atol=1e-5))
"""
运行结果如下:
9.606177199181016e-28
[[ 9.99999067e-01 -2.57493788e-06 -8.34044913e-06 -8.27511874e-06]
[-2.70488427e-08 9.99999971e-01 -1.43064478e-07 4.40046838e-08]
[ 1.02612640e-06 2.64162443e-06 9.99999986e-01 3.03112968e-06]
[-9.53674316e-07 -1.90734863e-06 0.00000000e+00 1.00000000e+00]]
True
"""
【 在 feng321 的大作中提到: 】
: mul=np.array([[ 2.79358336e-03, -4.33801272e-03, 1.49405606e-01, -1.49494674e-01],
: [-4.33801272e-03, 6.73628032e-03, -2.32004399e-01, 2.32142708e-01],
: [ 1.49405606e-01, -2.32004399e-01, 7.99047014e+00, -7.99523365e+00],
: ...................
--
FROM 120.245.130.*