1.random.rand(n,n)
产生一个n×n的随机数组
2.mat(random.rand(n,n))
mat方法可以将数组转化成为矩阵
3.Mat.I
求矩阵Mat的逆矩阵
4.eye(4,4)
生成n×n单位矩阵
#first.py from numpy import * #build 4x4 rand matrix print random.rand(4,4) print ‘============‘ randMat = mat(random.rand(4,4)) #randMat.I randMat print ‘randMat:‘ print randMat print ‘randMat.I:‘ print randMat.I #randMat.I solve the inverse of a matrix myEye = randMat*randMat.I print myEye #eye function create an identity matrix of n print eye(4,4)
原文:http://hongjinwei.blog.51cto.com/9107852/1533798