码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2018-12-03 12:55:04      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:turn   for   四舍五入   [1]   pre   index   .sh   循环   元素   

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

实现代码如下

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

  

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

标签:turn   for   四舍五入   [1]   pre   index   .sh   循环   元素   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!