Import and use of 1.numpy
from numpy import *; #导入numpy的库函数
Import NumPy as NP; #这个方式使用numpy的函数时, need to start with NP.
2. Creation of matrices
Create matrices from one-dimensional or two-dimensional data
A1=array ([i])
A1=mat (A1)
A1=mat ([i])
Create a common matrix
Data1=mat (Zeros (3,3))
Data2=mat (Ones (2,4))
Data3=mat (Random.rand (2,2))
Data4=mat (Random.randint (10,size= (3,3)))
Data5=mat (Random.randint (2,8,size= (2,5)))
Data6=mat (Eye (2,2,dtype=int))
a1=[1,2,3]
A2=mat (DIAG (A1)) Diagonal matrix of #生成一个对角线为1, 2, 3
3. Common matrix operations 1. Matrix multiplication
A3=A1*A2
2. Matrix Point multiplication
A3=multiply (A1,A2)
A2=a1*2
3. Matrix inversion, transpose
a2=a1. I a2=a1. T
4. Conversion of matrices, lists, and arrays
4. Calculate the maximum, minimum, and value of the matrix corresponding to the column.
5. Partitioning and merging of matrices
4. Conversion of matrices, lists, and arrays
Http://www.cnblogs.com/chamie/p/4870078.html
Matrix operations in Python