|NO.Z.00034|——————————|BigDataEnd|——|Hadoop&Python.v12|——|Arithmetic.v12|NumPy科学计算库:NumPy线性代数|
一、线性代数:矩阵乘积
### --- 矩阵的乘积
A = np.array([[4,2,3],
[1,3,1]]) # shape(2,3)
B = np.array([[2,7],
[-5,-7],
[9,3]]) # shape(3,2)
np.dot(A,B) # 矩阵运算 A的最后⼀维和B的第⼀维必须⼀致
A @ B # 符号 @ 表示矩阵乘积运算
### --- 矩阵其他计算
~~~ # 下⾯可以计算矩阵的逆、⾏列式、特征值和特征向量、qr分解值,svd分解值
~~~ # 计算矩阵的逆
from numpy.linalg import inv,det,eig,qr,svd
A = np.array([[1,2,3],
[2,3,4],
[4,5,8]]) # shape(3,3)
inv(t) # 逆矩阵
det(t) #计算矩阵⾏列式
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
——W.S.Landor
浙公网安备 33010602011771号