本文介绍: 大多数可用于数组的函数也可用于矩阵。矩阵使用一些算术运算符,使矩阵运算更加直观。例如,我们可以使用 * 运算符获取两个矩阵的点积,这与 np.dot 函数的功能相同。由于矩阵只是数组的一种特殊情况,而且在未来的 NumPy 版本中可能会被弃用,因此通常最好使用 NumPy 数组。《Python数据分析技术栈》第05章 06 矩阵(Matrices)矩阵是一种二维数据结构,而数组可以包含任意维数。
06 矩阵(Matrices)
《Python数据分析技术栈》第05章 06 矩阵(Matrices)
A matrix is a two-dimensional data structure, while an array can consist of any number of dimensions.
矩阵是一种二维数据结构,而数组可以包含任意维数。
With the np.matrix class, we can create a matrix object, using the following syntax:
通过 np.matrix 类,我们可以使用以下语法创建一个矩阵对象:
Most of the functions that can be applied to arrays can be used on matrices as well. Matrices use some arithmetic operators that make matrix operations more intuitive. For instance, we can use the * operator to get the dot product of two matrices that replicates the functionality of the np.dot function.
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。