迹函数(trace function) ###################### * 迹函数(trace function)是线性代数中一个非常重要的概念 * 迹函数是矩阵的重要标量特征之一 定义 ==== * 对于一个 𝑛×𝑛 的方阵 **𝐴** ,其迹(trace)定义为矩阵对角线元素的总和,用符号 tr(𝐴) 表示: .. math:: tr(\mathbf{A}) = \sum_{i=1}^n{a_{ii}} * 其中, :math:`a_{ii}` 是矩阵 **A** 的第i行、第i列的元素 性质 ==== * 线性性 .. math:: tr(\mathbf{A} + \mathbf{B}) = tr(\mathbf{A}) + tr(\mathbf{B}) \\ tr(c \mathbf{A}) = c \cdot tr(\mathbf{A}) ,其中 c 是常量 * 对转置的性质:迹值对转置操作不变 .. math:: tr(\mathbf{A^\top}) = tr(\mathbf{A}) * 对乘积的性质(循环不变性) .. math:: 若 \mathbf{A} \in \mathbb{R}^{m \times n} 且 \mathbf{B} \in \mathbb{R}^{n \times m} ,则 \\ tr(\mathbf{A} \mathbf{B}) = tr(\mathbf{B} \mathbf{A}) * 迹和特征值:矩阵 **𝐴** 的迹等于其特征值之和。 * 迹的导数 .. math:: 对于可导矩阵函数 \mathbf{X} ,tr(\mathbf{X}) 关于 \mathbf{X} 的梯度为 \\ \nabla_{\mathbf{x}} tr(\mathbf{X}) = \mathbf{I} \\ 其中, \mathbf{I} 是单位矩阵