numpy 线性代数

本文介绍了NumPy中的线性代数模块,涵盖了矩阵与向量的基本运算,包括点积、外积、矩阵乘法等;还详细说明了各种矩阵分解方法,如Cholesky分解、QR分解和奇异值分解;并提供了特征值和特征向量的计算方法,以及求范数、条件数、行列式等数值分析手段。

https://docs.scipy.org/doc/numpy/reference/routines.linalg.html

矩阵与向量乘积

方法描述
dot(a, b[, out])Dot product of two arrays.
linalg.multi_dot(arrays)Compute the dot product of two or more arrays in a single function call, while automatically selecting the fastest evaluation order.
vdot(a, b)Return the dot product of two vectors.
inner(a, b)Inner product of two arrays.
outer(a, b[, out])Compute the outer product of two vectors.
matmul(a, b[, out])Matrix product of two arrays.
tensordot(a, b[, axes])Compute tensor dot product along specified axes for arrays >= 1-D.
einsum(subscripts, *operands[, out, dtype, …])Evaluates the Einstein summation convention on the operands.
einsum_path(subscripts, *operands[, optimize])Evaluates the lowest cost contraction order for an einsum expression by considering the creation of intermediate arrays.
linalg.matrix_power(M, n)Raise a square matrix to the (integer) power n.
kron(a, b)Kronecker product of two arrays.

分解

方法描述
linalg.cholesky(a)Cholesky decomposition.
linalg.qr(a[, mode])Compute the qr factorization of a matrix.
linalg.svd(a[, full_matrices, compute_uv])Singular Value Decomposition.

特征值特征向量

方法描述
linalg.eig(a)Compute the eigenvalues and right eigenvectors of a square array.
linalg.eigh(a[, UPLO])Return the eigenvalues and eigenvectors of a Hermitian or symmetric matrix.
linalg.eigvals(a)Compute the eigenvalues of a general matrix.
linalg.eigvalsh(a[, UPLO])Compute the eigenvalues of a Hermitian or real symmetric matrix.

Norms and other numbers

方法描述
linalg.norm(x[, ord, axis, keepdims])求范数, 默认是二范数
linalg.cond(x[, p])Compute the condition number of a matrix.
linalg.det(a)Compute the determinant of an array.
linalg.matrix_rank(M[, tol, hermitian])Return matrix rank of array using SVD method
linalg.slogdet(a)Compute the sign and (natural) logarithm of the determinant of an array.
trace(a[, offset, axis1, axis2, dtype, out])Return the sum along diagonals of the array.

Solving equations and inverting matrices

方法描述
linalg.solve(a, b)Solve a linear matrix equation, or system of linear scalar equations.
linalg.tensorsolve(a, b[, axes])Solve the tensor equation a x = b for x.
linalg.lstsq(a, b[, rcond])Return the least-squares solution to a linear matrix equation.
linalg.inv(a)Compute the (multiplicative) inverse of a matrix.
linalg.pinv(a[, rcond])Compute the (Moore-Penrose) pseudo-inverse of a matrix.
linalg.tensorinv(a[, ind])Compute the ‘inverse’ of an N-dimensional array.

Exceptions

方法描述
linalg.LinAlgErrorGeneric Python-exception-derived object raised by linalg functions.
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值