首页 > 运营 > 帮助中心 > 正文

numpy 返回函数的上三角矩阵实例

2020-07-28 14:02:48
字体:
来源:转载
供稿:网友

numpy 返回函数的上三角矩阵

np.triu()matrix2=np.triu(matrix1)

numpy.triu(m, k=0)[source]

Upper triangle of an array.

Return a copy of a matrix with the elements below the k-th diagonal zeroed.

np.triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1)array([[ 1, 2, 3],[ 4, 5, 6],[ 0, 8, 9],[ 0, 0, 12]])

以上这篇numpy 返回函数的上三角矩阵实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持错新网之家。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表