实现思路就是在每次循环中对矩阵进行四舍五入处理
实现代码如下
# 四舍五入
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