令矩阵每个元素四舍五入,使顺序高斯与列主元高斯结果不同

实现思路就是在每次循环中对矩阵进行四舍五入处理

实现代码如下

# 四舍五入
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

  

原文地址:https://www.cnblogs.com/muty/p/10057595.html