转自:https://www.cnblogs.com/chamie/p/4870078.html
python中的矩阵运算
摘自:http://m.blog.csdn.net/blog/taxueguilai1992.../46581861
python的numpy库提供矩阵运算的功能,因此我们在需要矩阵运算的时候,需要导入numpy的包。...[5, 3, 3, 4, 6]])
>>>data6=mat(eye(2,2,dtype=int)) #产生一个2*2的对角矩阵
>>> data6
matrix([[1, 0],
[0..., 1]])
a1=[1,2,3]
a2=mat(diag(a1)) #生成一个对角线为1、2、3的对角矩阵
>>> a2
matrix([[1, 0, 0],
[0, 2, 0],...5.矩阵的分隔和合并
矩阵的分隔,同列表和数组的分隔一致。
?