Tensor
参考:
1. 预备知识:covectorPermalink
假定
- linear functional
- linear form
- one-form
- covector
指的是同一个对象:a function
一般这个 field
但本质上,我们也可以把 covector 理解为一个 (row) vector,因为我们可以定义
注:
的意思是 “homomorphism”, a transformation of one set, say , into another, say , that the relations between elements of are preserved in .- 换个角度考虑,vector 可以看做一个
,但是研究这个似乎没有意义
2. 预备知识:Einstein summation conventionPermalink
其实就是个简写。比如把
应用到 vector 的场合,假设有
其中
用 Einstein summation convention 就可以简写成:
为了以示区别,covector
其中:
3. 预备知识:Banach space / Vector space from continuous -linear mapsPermalink
… a Banach space (pronounced [ˈbanax]) is a complete normed vector space. Thus, a Banach space is a vector space with a metric that allows the computation of vector length and distance between vectors and is complete in the sense that a Cauchy sequence of vectors always converges to a well defined limit that is within the space.
Let
注意:
- 这里
的 是 cartesian product,也就是说: 是一个函数,它接收一个 -tuple of vectors,返回一个 的元素- 即
其中
- 即
可以理解成一个 -tuple of covectors,比如 ,因为我们可以定义 。- 这么一来,
其实是一个 “元素为 -tuple of covectors” 的 space。但是你结合 Digest of Essence of Linear Algebra 最后的部分,” -tuple of covectors” 满足 vector addition and scaling 的 8 条 axioms,所以可以看做一个 generalized 的 vector;换言之, 也就是一个 generalized 的 vector space
4. Tensor Space / RankPermalink
For a vector space
Elements of
Special cases:
注意:
- 0 阶 tensor 是 scalar
- 1 阶 tensor 是 vector/covector
- 2 阶 tensor 中只有
是 matrix- 即你只能说 matrix 是 2 阶 tensor;不能说 2 阶 tensor 都是 matrix
- 仔细考虑一下,其实所有
阶的 都是 matrix,见 6.2 的讨论- 当然这里说的都是 2-D 的实数 matrix
5. TensorPermalink
从 tensor space 来看,一个 tensor 就是个
- 从函数的角度来看,
和 的顺序其实是可以打乱的,也可以是交错的;但为了研究起来方便,tensor 的定义强制要求了这个 “连续 再连续 ” 的顺序
这个
6. Tensor Product OperatorPermalink
为了表示起来方便,我们引入 tensor product operator
- 两个 tensor space over vector space
, 和 的 tensor product 仍然是一个 tensor over vector space- 考虑特殊情况:假设
和 都是 vector space (i.e. ) over field ,那么 仍然是一个 vector space over field
- 考虑特殊情况:假设
- 两个 tensor,
和 的 tensor product 仍然是一个 tensor- 考虑特殊情况:vector/covector/matrix 之间也可以有
操作
- 考虑特殊情况:vector/covector/matrix 之间也可以有
如果
我觉得暂时不要关注计算细节,先掌握大的计算原则比较重要。
6.1 用 表示 Permalink
这个逻辑其实要绕一下:
- 假定有
,则 - 又:
可以看做一个 -tuple of vectors/covectors - 我们可以写
- 注意这里
、 的顺序和 里是反的、和 -tuple 是一致的
- 注意这里
6.2 Rank of Tensor ProductPermalink
基本原则 (参考 StackExchange: Understanding the definition of tensors as multilinear maps, by celtschk):
对
- 按 Wikipedia: Tensor product of linear maps 的例子,matrix 对应 tensor,matrix 的 Kronecker Product 对应 tensor product。两个
matrix (看作 ) 的 Kronecker Product 是一个 matrix,按道理它应该是一个 。按照这个逻辑展开,所有的 都是 matrix - 至于这个 matrix 本身的维度,要从
的维度说起:- 如果
,那么你的 应该是一个 matrix (的集合)- 不可能不是 square matrix,因为
- 不可能不是 square matrix,因为
- 按照 Kronecker Product 的算法,你的
应该是一个 matrix (的集合)
- 如果
这引出一个很重要的思想:tensor 其实是 matrix of matrices;或者更宽泛一点来讲:tensor 是一个 meta-matrix,是一个 matrix of something,这个 something 是你可以自己定义的。接着用上面那个例子:
是一个 meta-matrix,它只有一个元素,但是这个元素是一个 matrix,所以它整体上是一个 matrix- 你也可以看成是
个
- 你也可以看成是
是一个 meta-matrix,它的每个元素都是一个 ,所以它整体上是一个 matrix- 你也可以看成是
个
- 你也可以看成是
- 依此类推:
是一个 meta-matrix,它的每个元素都是一个 ,所以它整体上是一个 matrix- 你也可以看成是
个
- 你也可以看成是
- 或者我们写成
,其中 “ 次方” 定义为:- 明显
- 明显
- 考虑不规则的情况:
- 若
,则 是一个 meta-matrix,它的每个元素都是一个 - 若
,则 是一个 meta-matrix,它的每个元素都是一个
- 若
6.3 的特殊性Permalink
严格来说,如果
从函数的角度来看:
但是因为我们一般处理
所以我们一般的
6.4 只有在把 tensor/tensor product 当作函数来做运算时你才会用到 Einstein summation conventionPermalink
这里我就不展开了,可以参考:
- http://rinterested.github.io/statistics/tensors3.html
- https://www.uio.no/studier/emner/matnat/math/nedlagte-emner/MAT-INF2360/v12/tensortheory.pdf
最后说明一点:在工程应用中经常忽略掉运算结果里 basis 的 tensor product,只保留 tensor product 的分量。这和你写 vector 时只关注分量而忽略约定俗成的 basis
Comments