令矩陣每個元素四舍五入,使順序高斯與列主元高斯結果不同
實現思路就是在每次循環中對矩陣進行四舍五入處理
實現代碼如下
# 四舍五入
def matrixRound(M, decPts=5):
# 對行循環
for index in range(M.shape[0]):
# 對列循環
for _index in range(M.shape[1]):
M[index, _index] = round(M[index, _index], decPts)
return M

浙公網安備 33010602011771號