Numpy提供用于矩阵乘法的dot函数

x = np.array([[1., 2., 3.], [4., 5., 6.]])
y = np.array([[6., 23.], [-1, 7], [8, 9]])
x
y
x.dot(y)  # equivalently np.dot(x, y)

numpy.linalg中有关于矩阵分解运算,以及求逆和行列式的东西,它们跟MATLAB和R等语言使用的是相同的行业标准级的Fortran库,如BLAS、LAPACK、Intel MKL等

from numpy.linalg import inv, qr
X = randn(5, 5)
mat = X.T.dot(X)
inv(mat)
mat.dot(inv(mat))
q, r = qr(mat)
r

results matching ""

    No results matching ""