[英]What is the difference between matrix and array?
What is the more generalized term? 什么是更普遍的术语? Why is MATLAB named matrix laboratory, then? 为什么MATLAB命名为矩阵实验室呢?
A matrix is a practical way to represent a linear transformation from a space of dimension n to a space of dimension m in the form of a nxm array of scalar values. 矩阵是表示以nxm标量值数组的形式从维n的空间到维m的空间的线性变换的实用方法。
It is also very practical to perform linear algebra operation in a very systematic way that can be implemented on a computer. 以非常系统的方式执行线性代数操作也是非常实用的,可以在计算机上实现。 For instance if matrix A represents the linear transformation f and matrix B the linear transformation g , then the composition f o g writes as A*B where *
denotes matrix multiplication. 例如,如果矩阵A表示线性变换f而矩阵B表示线性变换g ,则组成f o g写为A * B,其中*
表示矩阵乘法。 Matlab has also a lot of routines related to matrix operations (ie linear algebra operations) like det
, pinv
, svd
etc... Matlab还有许多与矩阵运算相关的例程(即线性代数运算),如det
, pinv
, svd
等......
As you can still see nowadays in Matlab, operators like *
, /
are strongly tied to matrix operations and thus strongly tied to linear algebra operations, which I think was the original goal of matlab in its early elaboration, hence its name (surely quite speculative but guess not so far from reality). 正如您现在仍然可以在Matlab中看到的那样,像*
, /
这样的运算符与矩阵运算密切相关,因而与线性代数运算密切相关,我认为这是matlab在其早期阐述中的最初目标,因此它的名字(当然是非常具有推测性)但是猜测离现实不远)。
To perform element-wise operations on n-dimensional data sets, you have to write .*
, or ./
. 要对n维数据集执行逐元素操作,您必须编写.*
或./
。 denoting you are now performing array operations . 表示您现在正在执行数组操作 。
I would not say array operations encompass matrix operations , they are different. 我不会说数组操作包含矩阵运算 ,它们是不同的。 The later ones relate to linear algebra, while the other ones just relate to a practical way to operate on large sets of data. 后者与线性代数有关,而其他则只涉及对大型数据集进行操作的实用方法。 These data are not limited to be numbers, they are just n-dimensional data sets of whatever (string, numbers, cells, etc...). 这些数据不限于数字,它们只是n维数据集(字符串,数字,单元格等)。
Matlab also has a very synthetic syntax to perform array operations on sub-blocks (ie linear/logical subscripts) that makes it very easy to reorganize data sets in just one line of code before applying subsequent matrix or array operations. Matlab还具有非常合成的语法,可以对子块(即线性/逻辑下标)执行数组操作 ,这使得在应用后续矩阵或数组操作之前,只需在一行代码中重新组织数据集就非常容易。
If you're asking about MATLAB, the word "matrix" typically refers to a 2d array, whereas an "array" can be n-dimensional. 如果您询问MATLAB,“矩阵”一词通常是指2d阵列,而“阵列”可以是n维。
Early versions of MATLAB supported only 2d matrices, not n-dimensional arrays. 早期版本的MATLAB仅支持2d矩阵,而不支持n维数组。 I believe support for n-dimensional arrays was introduced in version 5 of MATLAB. 我相信在MATLAB的第5版中引入了对n维数组的支持。
I would say that MATLABs matrix is a more advanced kind of array if you compare to the c-style arrays, eg double array[]
, or the Java array, eg double arry2[]
. 我会说MATLABs矩阵是一种更高级的数组,如果你比较c样式数组,例如double array[]
,或Java数组,例如double arry2[]
。 I would also say that the matlab matrix is better for mathematical purposed than the c++ vector or Java ArrayList. 我还要说matlab矩阵比c ++向量或Java ArrayList更适合数学目的。 However, if you mean the matlab array I would say that it is more complicated. 但是,如果你的意思是matlab数组,我会说它更复杂。 I would then recommend the link about matlab data which describes the mxArray
type, used to store most of the data in matlab. 然后我会推荐关于matlab数据的链接,它描述了mxArray
类型,用于存储matlab中的大部分数据。 The question is hard to answer completely without better description of what you mean with array, but I would say that regarding the type there is no difference between an array like a = [1,2,3,4]
and matrix like b = [1,2,3,4;5,6,7,8]
. 如果没有更好地描述你对数组的意思,这个问题很难完全回答,但我会说,关于类型,像a = [1,2,3,4]
这样的数组和像b = [1,2,3,4;5,6,7,8]
这样的矩阵没有区别b = [1,2,3,4;5,6,7,8]
。 There can also be matrices of higher dimensions as c = ones(3,4,3)
. 还有更高维度的矩阵,因为c = ones(3,4,3)
。 These are in general called matrices as well in MATLAB, or if you need to be more specific N dimensional matrices. 这些通常在MATLAB中也称为矩阵,或者如果您需要更具体的N维矩阵。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.