python numpy矩阵和数组的转换
数组转换矩阵:
A = mat(s[])
矩阵转换数组:
s[]= A.getA()
举例:
s=[[4,2],[3,2],[3,1]]
A =mat(s)
A
matrix([[4, 2],
[3, 2],
[3, 1]])
ss = A.getA()
ss
array([[4, 2],
[3, 2],
[3, 1]])
数组转换矩阵:
A = mat(s[])
矩阵转换数组:
s[]= A.getA()
举例:
s=[[4,2],[3,2],[3,1]]
A =mat(s)
A
matrix([[4, 2],
[3, 2],
[3, 1]])
ss = A.getA()
ss
array([[4, 2],
[3, 2],
[3, 1]])