math-skill 3.0.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/README.en-US.md +42 -30
  2. package/README.md +18 -6
  3. package/agents/math-critic.en.md +6 -6
  4. package/agents/math-critic.md +6 -6
  5. package/commands/ask.en.md +6 -1
  6. package/commands/ask.md +6 -1
  7. package/design-patterns/attention/equivariant-attention.en.md +8 -2
  8. package/design-patterns/attention/equivariant-attention.md +7 -1
  9. package/design-patterns/attention/geometry-aware-attention.en.md +2 -2
  10. package/design-patterns/attention/geometry-aware-attention.md +1 -1
  11. package/design-patterns/attention/information-bottleneck-attention.en.md +32 -12
  12. package/design-patterns/attention/information-bottleneck-attention.md +32 -12
  13. package/design-patterns/attention/projection-attention.en.md +3 -3
  14. package/design-patterns/attention/projection-attention.md +2 -2
  15. package/design-patterns/attention/spectral-attention.en.md +19 -5
  16. package/design-patterns/attention/spectral-attention.md +18 -4
  17. package/design-patterns/compression/leverage-score-selection.en.md +13 -13
  18. package/design-patterns/compression/leverage-score-selection.md +13 -13
  19. package/design-patterns/compression/low-rank-kv-cache.en.md +39 -12
  20. package/design-patterns/compression/low-rank-kv-cache.md +38 -12
  21. package/design-patterns/compression/spectral-token-pruning.en.md +16 -14
  22. package/design-patterns/compression/spectral-token-pruning.md +16 -14
  23. package/design-patterns/compression/topology-preserving-compression.en.md +10 -10
  24. package/design-patterns/compression/topology-preserving-compression.md +10 -10
  25. package/design-patterns/loss/constraint-penalty.en.md +8 -4
  26. package/design-patterns/loss/constraint-penalty.md +9 -6
  27. package/design-patterns/loss/contrastive-loss.en.md +37 -11
  28. package/design-patterns/loss/contrastive-loss.md +38 -12
  29. package/design-patterns/loss/information-bottleneck-loss.en.md +5 -5
  30. package/design-patterns/loss/information-bottleneck-loss.md +6 -6
  31. package/design-patterns/loss/orthogonality-loss.en.md +24 -17
  32. package/design-patterns/loss/orthogonality-loss.md +24 -18
  33. package/design-patterns/loss/variational-loss.en.md +4 -4
  34. package/design-patterns/loss/variational-loss.md +5 -5
  35. package/design-patterns/overview.en.md +36 -0
  36. package/design-patterns/overview.md +36 -0
  37. package/design-patterns/representation/equivariant-split.en.md +4 -4
  38. package/design-patterns/representation/equivariant-split.md +4 -5
  39. package/design-patterns/representation/manifold-representation.en.md +12 -12
  40. package/design-patterns/representation/manifold-representation.md +13 -14
  41. package/design-patterns/representation/shared-private-decomposition.en.md +12 -7
  42. package/design-patterns/representation/shared-private-decomposition.md +12 -9
  43. package/design-patterns/representation/subspace-alignment.en.md +12 -12
  44. package/design-patterns/representation/subspace-alignment.md +12 -12
  45. package/design-patterns/routing/graph-routing.en.md +11 -11
  46. package/design-patterns/routing/graph-routing.md +11 -11
  47. package/design-patterns/routing/moe-routing.en.md +12 -12
  48. package/design-patterns/routing/moe-routing.md +12 -14
  49. package/design-patterns/routing/optimal-transport-routing.en.md +5 -5
  50. package/design-patterns/routing/optimal-transport-routing.md +6 -6
  51. package/design-patterns/routing/spectral-clustering-routing.en.md +26 -15
  52. package/design-patterns/routing/spectral-clustering-routing.md +26 -17
  53. package/knowledge-base/differential-geometry/connection.en.md +17 -2
  54. package/knowledge-base/differential-geometry/connection.md +17 -2
  55. package/knowledge-base/differential-geometry/curvature.en.md +14 -1
  56. package/knowledge-base/differential-geometry/curvature.md +14 -1
  57. package/knowledge-base/differential-geometry/geodesic.en.md +16 -2
  58. package/knowledge-base/differential-geometry/geodesic.md +16 -2
  59. package/knowledge-base/differential-geometry/index.en.md +52 -0
  60. package/knowledge-base/differential-geometry/index.md +52 -0
  61. package/knowledge-base/differential-geometry/manifold.en.md +15 -2
  62. package/knowledge-base/differential-geometry/manifold.md +15 -2
  63. package/knowledge-base/differential-geometry/metric-tensor.en.md +16 -2
  64. package/knowledge-base/differential-geometry/metric-tensor.md +16 -2
  65. package/knowledge-base/differential-geometry/tangent-space.en.md +17 -3
  66. package/knowledge-base/differential-geometry/tangent-space.md +17 -3
  67. package/knowledge-base/information-geometry/fisher-metric.en.md +24 -5
  68. package/knowledge-base/information-geometry/fisher-metric.md +24 -5
  69. package/knowledge-base/information-geometry/index.en.md +45 -0
  70. package/knowledge-base/information-geometry/index.md +45 -0
  71. package/knowledge-base/information-geometry/natural-gradient.en.md +17 -3
  72. package/knowledge-base/information-geometry/natural-gradient.md +17 -3
  73. package/knowledge-base/lie-theory/equivariance.en.md +18 -3
  74. package/knowledge-base/lie-theory/equivariance.md +18 -3
  75. package/knowledge-base/lie-theory/group-action.en.md +16 -2
  76. package/knowledge-base/lie-theory/group-action.md +16 -2
  77. package/knowledge-base/lie-theory/index.en.md +52 -0
  78. package/knowledge-base/lie-theory/index.md +52 -0
  79. package/knowledge-base/lie-theory/lie-algebra.en.md +17 -2
  80. package/knowledge-base/lie-theory/lie-algebra.md +17 -2
  81. package/knowledge-base/lie-theory/lie-group.en.md +17 -3
  82. package/knowledge-base/lie-theory/lie-group.md +17 -3
  83. package/knowledge-base/lie-theory/representation.en.md +17 -2
  84. package/knowledge-base/lie-theory/representation.md +17 -2
  85. package/knowledge-base/matrix-analysis/index.en.md +49 -0
  86. package/knowledge-base/matrix-analysis/index.md +49 -0
  87. package/knowledge-base/matrix-analysis/low-rank-approximation.en.md +20 -7
  88. package/knowledge-base/matrix-analysis/low-rank-approximation.md +20 -7
  89. package/knowledge-base/matrix-analysis/matrix-perturbation.en.md +13 -1
  90. package/knowledge-base/matrix-analysis/matrix-perturbation.md +13 -1
  91. package/knowledge-base/matrix-analysis/positive-semidefinite.en.md +20 -6
  92. package/knowledge-base/matrix-analysis/positive-semidefinite.md +20 -6
  93. package/knowledge-base/matrix-analysis/projection.en.md +14 -1
  94. package/knowledge-base/matrix-analysis/projection.md +14 -1
  95. package/knowledge-base/matrix-analysis/spectral-decomposition.en.md +14 -1
  96. package/knowledge-base/matrix-analysis/spectral-decomposition.md +14 -1
  97. package/knowledge-base/optimization/constrained-optimization.en.md +17 -3
  98. package/knowledge-base/optimization/constrained-optimization.md +17 -3
  99. package/knowledge-base/optimization/convex-optimization.en.md +15 -2
  100. package/knowledge-base/optimization/convex-optimization.md +15 -2
  101. package/knowledge-base/optimization/index.en.md +50 -0
  102. package/knowledge-base/optimization/index.md +50 -0
  103. package/knowledge-base/optimization/lagrangian-duality.en.md +18 -4
  104. package/knowledge-base/optimization/lagrangian-duality.md +18 -4
  105. package/knowledge-base/optimization/proximal-method.en.md +15 -1
  106. package/knowledge-base/optimization/proximal-method.md +15 -1
  107. package/knowledge-base/optimization/riemannian-optimization.en.md +18 -4
  108. package/knowledge-base/optimization/riemannian-optimization.md +18 -4
  109. package/knowledge-base/overview.en.md +20 -8
  110. package/knowledge-base/overview.md +20 -8
  111. package/knowledge-base/probability/concentration-inequality.en.md +16 -2
  112. package/knowledge-base/probability/concentration-inequality.md +16 -2
  113. package/knowledge-base/probability/entropy.en.md +19 -3
  114. package/knowledge-base/probability/entropy.md +18 -2
  115. package/knowledge-base/probability/fisher-information.en.md +17 -3
  116. package/knowledge-base/probability/fisher-information.md +17 -3
  117. package/knowledge-base/probability/index.en.md +51 -0
  118. package/knowledge-base/probability/index.md +51 -0
  119. package/knowledge-base/probability/information-bottleneck.en.md +18 -2
  120. package/knowledge-base/probability/information-bottleneck.md +18 -2
  121. package/knowledge-base/probability/kl-divergence.en.md +15 -2
  122. package/knowledge-base/probability/kl-divergence.md +15 -2
  123. package/knowledge-base/topology/euler-characteristic.en.md +15 -2
  124. package/knowledge-base/topology/euler-characteristic.md +15 -2
  125. package/knowledge-base/topology/fundamental-group.en.md +16 -2
  126. package/knowledge-base/topology/fundamental-group.md +16 -2
  127. package/knowledge-base/topology/index.en.md +48 -0
  128. package/knowledge-base/topology/index.md +48 -0
  129. package/knowledge-base/topology/persistent-homology.en.md +17 -2
  130. package/knowledge-base/topology/persistent-homology.md +17 -2
  131. package/lenses/spectral.en.md +1 -1
  132. package/lenses/spectral.md +1 -1
  133. package/lenses/topological.en.md +1 -1
  134. package/lenses/topological.md +1 -1
  135. package/package.json +5 -5
  136. package/references/agentic-workflow.en.md +2 -2
  137. package/references/books/abstract-algebra.en.md +12 -12
  138. package/references/books/abstract-algebra.md +9 -9
  139. package/references/books/algebraic-geometry-rising-sea.en.md +2 -2
  140. package/references/books/differential-geometry.en.md +16 -16
  141. package/references/books/differential-geometry.md +14 -14
  142. package/references/books/matrix-analysis.en.md +3 -3
  143. package/references/books/matrix-analysis.md +24 -24
  144. package/references/books/micro-lie-theory.en.md +1 -1
  145. package/references/books/optimization-ml.en.md +15 -15
  146. package/references/books/optimization-ml.md +14 -14
  147. package/references/books/smooth-manifolds.en.md +3 -3
  148. package/references/books/smooth-manifolds.md +6 -6
  149. package/references/gpu-friendly-math.en.md +21 -8
  150. package/references/gpu-friendly-math.md +19 -4
  151. package/references/skill-index.en.md +105 -0
  152. package/references/skill-index.md +105 -0
  153. package/skills/math-research-activator/SKILL.en.md +70 -112
  154. package/skills/math-research-activator/SKILL.md +60 -100
@@ -45,7 +45,22 @@ High GPU friendliness. The core advantage of the Lie algebra is that it is a "li
45
45
 
46
46
  ## Further References
47
47
 
48
- - Distillation notes: references/books/micro-lie-theory.md (Section II-C Tangent Space and Lie Algebra, hat/vee operators)
49
- - Distillation notes: references/books/differential-geometry.md (Ch 5 Lie Groups, Lie algebra section)
48
+ - Distillation notes: ../../references/books/micro-lie-theory.en.md (Section II-C Tangent Space and Lie Algebra, hat/vee operators)
49
+ - Distillation notes: ../../references/books/differential-geometry.en.md (Ch 5 Lie Groups, Lie algebra section)
50
50
  - Original text: Joan Sola et al., *A micro Lie theory*, Section II-C (Lie algebra definition and hat/vee), Section II-D (exp/log bridge)
51
51
  - Original text: Jeffrey M. Lee, *Manifolds and Differential Geometry*, Ch 5 (Lie groups and Lie algebras)
52
+
53
+
54
+ ## Routing Extensions
55
+ - If the corresponding global group is needed -> `lie-group.en.md` (integrating Lie algebra yields Lie group)
56
+ - If algebra representations are needed -> `representation.en.md` (representation theory of Lie algebras)
57
+ - If acting as the tangent space of a group -> `../differential-geometry/tangent-space.md` (Lie algebra structure on tangent space)
58
+
59
+ ## Extensible Directions
60
+ - Structure constants: components of Lie bracket in a basis
61
+ - Jacobi identity: fundamental axiom of Lie algebras
62
+ - Ideal / subalgebra: substructures of Lie algebras
63
+ - Nilpotent / solvable / semisimple classification: structure theorems for Lie algebras
64
+ - Killing form: invariant bilinear form of Lie algebras
65
+ - Cartan subalgebra: maximal toral subalgebra of semisimple Lie algebras
66
+ - Root system: root system classification of semisimple Lie algebras
@@ -45,7 +45,22 @@ GPU 友好度高。李代数的核心优势是"线性空间":
45
45
 
46
46
  ## 深入参考
47
47
 
48
- - 蒸馏稿:references/books/micro-lie-theory.md(§II-C 切空间与李代数, hat/vee 算子)
49
- - 蒸馏稿:references/books/differential-geometry.md(Ch 5 Lie Groups, 李代数部分)
48
+ - 蒸馏稿:../../references/books/micro-lie-theory.md(§II-C 切空间与李代数, hat/vee 算子)
49
+ - 蒸馏稿:../../references/books/differential-geometry.md(Ch 5 Lie Groups, 李代数部分)
50
50
  - 原书:Joan Sola et al., *A micro Lie theory*, §II-C(李代数定义与 hat/vee)、§II-D(exp/log 桥梁)
51
51
  - 原书:Jeffrey M. Lee, *Manifolds and Differential Geometry*, Ch 5(李群与李代数)
52
+
53
+
54
+ ## 路由扩展
55
+ - 若需要对应的全局群 → `lie-group.md`(李代数积分得到李群)
56
+ - 若需要代数表示 → `representation.md`(李代数的表示理论)
57
+ - 若作为群的切空间 → `../differential-geometry/tangent-space.md`(切空间的李代数结构)
58
+
59
+ ## 可扩展方向
60
+ - 结构常数(structure constants):李括号在基下的分量
61
+ - Jacobi 恒等式:李代数的基本公理
62
+ - 理想/子代数(ideal / subalgebra):李代数的子结构
63
+ - 幂零/可解/半单分类(nilpotent / solvable / semisimple):李代数的结构定理
64
+ - Killing 型(Killing form):李代数的不变双线性型
65
+ - Cartan 子代数(Cartan subalgebra):半单李代数的极大环面子代数
66
+ - 根系(root system):半单李代数的根系分类
@@ -45,7 +45,21 @@ GPU friendliness: the key factor is whether exp/log has a closed form.
45
45
 
46
46
  ## Further References
47
47
 
48
- - Distillation notes: references/books/micro-lie-theory.md (Section II-A Lie Group Definition, Section II-D Exponential Map, Section II-E Plus/Minus Operators)
49
- - Distillation notes: references/books/differential-geometry.md (Ch 5 Lie Groups)
50
- - Distillation notes: references/books/smooth-manifolds.md (Ch 7 Lie Groups)
48
+ - Distillation notes: ../../references/books/micro-lie-theory.en.md (Section II-A Lie Group Definition, Section II-D Exponential Map, Section II-E Plus/Minus Operators)
49
+ - Distillation notes: ../../references/books/differential-geometry.en.md (Ch 5 Lie Groups)
50
+ - Distillation notes: ../../references/books/smooth-manifolds.en.md (Ch 7 Lie Groups)
51
51
  - Original text: Joan Sola et al., *A micro Lie theory*, Section II-A through Section II-F (complete Lie group toolkit)
52
+
53
+
54
+ ## Routing Extensions
55
+ - If infinitesimal structure is needed -> `lie-algebra.en.md` (Lie algebra is the tangent space of a Lie group)
56
+ - If linear representations are needed -> `representation.en.md` (finite-dimensional representations of Lie groups)
57
+ - If optimization on Lie groups is needed -> `../optimization/riemannian-optimization.md` (Riemannian optimization on Lie groups)
58
+
59
+ ## Extensible Directions
60
+ - Simply connected Lie group: universal covering group
61
+ - Covering group: covering maps between Lie groups
62
+ - Maximal torus: maximal abelian subgroup in compact Lie groups
63
+ - Compact / semisimple / solvable: structural classification of Lie groups
64
+ - Nilpotent: nilpotent Lie groups and nilpotent Lie algebras
65
+ - Exponential map properties: properties of the map from Lie algebra to Lie group
@@ -45,7 +45,21 @@ GPU 友好度:关键看 exp/log 是否有闭式。
45
45
 
46
46
  ## 深入参考
47
47
 
48
- - 蒸馏稿:references/books/micro-lie-theory.md(§II-A 李群定义, §II-D 指数映射, §II-E 加减算子)
49
- - 蒸馏稿:references/books/differential-geometry.md(Ch 5 Lie Groups)
50
- - 蒸馏稿:references/books/smooth-manifolds.md(Ch 7 Lie Groups)
48
+ - 蒸馏稿:../../references/books/micro-lie-theory.md(§II-A 李群定义, §II-D 指数映射, §II-E 加减算子)
49
+ - 蒸馏稿:../../references/books/differential-geometry.md(Ch 5 Lie Groups)
50
+ - 蒸馏稿:../../references/books/smooth-manifolds.md(Ch 7 Lie Groups)
51
51
  - 原书:Joan Sola et al., *A micro Lie theory*, §II-A ~ §II-F(完整李群工具链)
52
+
53
+
54
+ ## 路由扩展
55
+ - 若需要无穷小结构 → `lie-algebra.md`(李代数是李群的切空间)
56
+ - 若需要线性表示 → `representation.md`(李群的有限维表示)
57
+ - 若需要在李群上优化 → `../optimization/riemannian-optimization.md`(李群上的黎曼优化)
58
+
59
+ ## 可扩展方向
60
+ - 单连通李群(simply connected Lie group):万有覆叠群
61
+ - 覆叠群(covering group):李群之间的覆叠映射
62
+ - 极大环面(maximal torus):紧李群中的极大交换子群
63
+ - 紧/半单/可解(compact / semisimple / solvable):李群的结构分类
64
+ - 幂零(nilpotent):幂零李群与幂零李代数
65
+ - 指数映射性质(exponential map properties):李代数到李群的映射特性
@@ -46,7 +46,22 @@ GPU friendliness depends on the group size and representation dimension:
46
46
 
47
47
  ## Further References
48
48
 
49
- - Distillation notes: references/books/micro-lie-theory.md (Section II-F Adjoint $\text{Ad}_X$ and Adjoint Matrix)
50
- - Distillation notes: references/books/differential-geometry.md (Ch 5 Lie Groups, adjoint representation section)
49
+ - Distillation notes: ../../references/books/micro-lie-theory.en.md (Section II-F Adjoint $\text{Ad}_X$ and Adjoint Matrix)
50
+ - Distillation notes: ../../references/books/differential-geometry.en.md (Ch 5 Lie Groups, adjoint representation section)
51
51
  - Original text: Joan Sola et al., *A micro Lie theory*, Section II-F (adjoint representation, equations 30--35)
52
52
  - Original text: Jeffrey M. Lee, *Manifolds and Differential Geometry*, Ch 5 (representations of Lie groups)
53
+
54
+
55
+ ## Routing Extensions
56
+ - If equivariant network design is needed -> `equivariance.en.md` (representation theory drives equivariant network construction)
57
+ - If the specific form of group action is needed -> `group-action.en.md` (representations are linear group actions)
58
+ - If irreducible decomposition is needed -> `../matrix-analysis/spectral-decomposition.md` (analogous to spectral decomposition of matrices)
59
+
60
+ ## Extensible Directions
61
+ - Irreducible representation: basic building blocks of representations
62
+ - Character: trace function and classification of representations
63
+ - Schur's lemma: morphisms between irreducible representations
64
+ - Peter-Weyl theorem: decomposition of regular representation for compact groups
65
+ - Induced representation: constructing representations of large groups from subgroups
66
+ - Tensor product of representations: combining multi-particle systems
67
+ - Clebsch-Gordan coefficients: transformation coefficients for tensor product decomposition into irreducibles
@@ -46,7 +46,22 @@ GPU 友好度取决于群的规模和表示维数:
46
46
 
47
47
  ## 深入参考
48
48
 
49
- - 蒸馏稿:references/books/micro-lie-theory.md(§II-F 伴随 Ad_X 与伴随矩阵)
50
- - 蒸馏稿:references/books/differential-geometry.md(Ch 5 Lie Groups, 伴随表示部分)
49
+ - 蒸馏稿:../../references/books/micro-lie-theory.md(§II-F 伴随 Ad_X 与伴随矩阵)
50
+ - 蒸馏稿:../../references/books/differential-geometry.md(Ch 5 Lie Groups, 伴随表示部分)
51
51
  - 原书:Joan Sola et al., *A micro Lie theory*, §II-F(伴随表示,式 30-35)
52
52
  - 原书:Jeffrey M. Lee, *Manifolds and Differential Geometry*, Ch 5(李群的表示)
53
+
54
+
55
+ ## 路由扩展
56
+ - 若需要等变网络设计 → `equivariance.md`(表示理论驱动等变网络构造)
57
+ - 若需要群作用的具体形式 → `group-action.md`(表示是线性群作用)
58
+ - 若需要不可约分解 → `../matrix-analysis/spectral-decomposition.md`(类比为矩阵的谱分解)
59
+
60
+ ## 可扩展方向
61
+ - 不可约表示(irreducible representation):表示的基本构建块
62
+ - 特征标(character):表示的迹函数与分类
63
+ - Schur 引理:不可约表示间的态射
64
+ - Peter-Weyl 定理:紧群的正则表示分解
65
+ - 诱导表示(induced representation):从子群构造大群表示
66
+ - 表示的张量积(tensor product of representations):多粒子系统的组合
67
+ - Clebsch-Gordan 系数:张量积分解为不可约的变换系数
@@ -0,0 +1,49 @@
1
+ # Matrix Analysis Activation Index
2
+
3
+ ## Domain Signals
4
+ Activate this domain direction when the problem involves:
5
+ - Dimensionality reduction / compression: need to compress high-dimensional data or parameters into a low-dimensional subspace
6
+ - Low-rank approximation: need to approximate large matrices with low-rank ones
7
+ - Condition number / ill-conditioning: numerical stability issues in matrix computations
8
+ - Orthogonal decomposition: need to decompose space into orthogonal subspaces
9
+ - Spectral structure: need to analyze eigenvalue / singular value distributions
10
+ - Subspace separation: need to measure or control relationships between subspaces
11
+
12
+ ## Core Anchors
13
+ - `projection.en.md` — Projection operators and subspace projection
14
+ - `spectral-decomposition.en.md` — Spectral decomposition and eigendecomposition
15
+ - `low-rank-approximation.en.md` — Low-rank approximation and truncated SVD
16
+ - `positive-semidefinite.en.md` — Positive semidefinite matrices and PSD cone
17
+ - `matrix-perturbation.en.md` — Matrix perturbation theory and error bounds
18
+
19
+ ## Extended Concepts
20
+ When core anchors are insufficient, the following concepts may need temporary activation:
21
+ - SVD variants (truncated SVD, randomized SVD): fast decomposition methods for large-scale matrices
22
+ - PCA / kernel PCA: principal component analysis and its kernelized version
23
+ - condition number: computation and control of condition numbers
24
+ - pseudoinverse: Moore-Penrose generalized inverse and its applications
25
+ - matrix equation (Sylvester / Lyapunov): solution methods and stability for matrix equations
26
+ - Schur decomposition: Schur decomposition and invariant subspaces
27
+ - Jordan form: Jordan canonical form and generalized eigenspaces
28
+ - matrix function: definition and computation of matrix functions
29
+ - Kronecker product / vectorization: tensor product and vectorization operations
30
+ - randomized linear algebra: randomized linear algebra methods
31
+ - CUR decomposition: column/row sampling-based matrix approximation
32
+ - Nystrom approximation: low-rank approximation of kernel matrices
33
+ - matrix concentration inequalities: concentration inequalities for random matrices
34
+
35
+ ## Reference Book Directions
36
+ - `../../references/books/matrix-analysis.en.md`: comprehensive coverage of matrix analysis, especially spectral decomposition, perturbation theory, and matrix function chapters
37
+
38
+ ## AI Translation Directions
39
+ - projection → subspace attention / conflict removal / shared-private split
40
+ - spectral decomposition → low-rank KV cache / token pruning / stability monitor
41
+ - low-rank approximation → LoRA / adapter modules / memory-efficient attention
42
+ - positive-semidefinite → covariance-aware regularization / PSD-constrained loss
43
+ - matrix perturbation → condition number monitoring / robustness-aware training
44
+
45
+ ## Temporary Activation Rules
46
+ When the problem requires mathematics not in the core anchors:
47
+ 1. First check whether extended concepts contain a match
48
+ 2. If yes, generate a temporary knowledge card based on the lens
49
+ 3. If no, enter the Knowledge Gap Protocol
@@ -0,0 +1,49 @@
1
+ # 矩阵分析 激活索引 / Matrix Analysis Activation Index
2
+
3
+ ## 领域信号
4
+ 当问题涉及以下信号时,激活本领域方向:
5
+ - 降维/压缩:需要将高维数据或参数压缩到低维子空间
6
+ - 低秩近似:需要用低秩矩阵近似大规模矩阵
7
+ - 条件数/病态:矩阵运算的数值稳定性出现问题
8
+ - 正交分解:需要将空间分解为正交子空间
9
+ - 谱结构:需要分析矩阵的特征值/奇异值分布
10
+ - 子空间分离:需要度量或控制子空间之间的关系
11
+
12
+ ## 核心锚点
13
+ - `projection.md` — 投影算子与子空间投影
14
+ - `spectral-decomposition.md` — 谱分解与特征分解
15
+ - `low-rank-approximation.md` — 低秩近似与截断 SVD
16
+ - `positive-semidefinite.md` — 半正定矩阵与 PSD 锥
17
+ - `matrix-perturbation.md` — 矩阵扰动理论与误差界
18
+
19
+ ## 扩展概念
20
+ 当核心锚点不够时,以下概念可能需要临时激活:
21
+ - SVD 变体(truncated SVD, randomized SVD):大规模矩阵的快速分解方法
22
+ - PCA / kernel PCA:主成分分析及其核化版本
23
+ - condition number:条件数的计算与控制
24
+ - pseudoinverse:Moore-Penrose 广义逆及其应用
25
+ - matrix equation(Sylvester / Lyapunov):矩阵方程的解法与稳定性
26
+ - Schur decomposition:Schur 分解与不变子空间
27
+ - Jordan form:Jordan 标准形与广义特征空间
28
+ - matrix function:矩阵函数的定义与计算
29
+ - Kronecker product / vectorization:张量积与向量化运算
30
+ - randomized linear algebra:随机化线性代数方法
31
+ - CUR decomposition:基于列/行采样的矩阵近似
32
+ - Nystrom approximation:核矩阵的低秩近似
33
+ - matrix concentration inequalities:随机矩阵的集中不等式
34
+
35
+ ## 参考书方向
36
+ - `../../references/books/matrix-analysis.md`:矩阵分析全面覆盖,特别是谱分解、扰动理论和矩阵函数章节
37
+
38
+ ## AI 翻译方向
39
+ - projection → subspace attention / conflict removal / shared-private split
40
+ - spectral decomposition → low-rank KV cache / token pruning / stability monitor
41
+ - low-rank approximation → LoRA / adapter modules / memory-efficient attention
42
+ - positive-semidefinite → covariance-aware regularization / PSD-constrained loss
43
+ - matrix perturbation → condition number monitoring / robustness-aware training
44
+
45
+ ## 临时激活规则
46
+ 当问题需要的数学不在核心锚点中时:
47
+ 1. 先检查扩展概念中是否有匹配
48
+ 2. 若有,根据透镜生成临时知识卡
49
+ 3. 若无,进入 Knowledge Gap Protocol
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Minimal Definition
4
4
 
5
- Given a matrix $A \in \mathbb{R}^{m \times n}$, find a matrix $B$ with rank at most $k$ that minimizes $\|A - B\|$. The Eckart-Young-Mirsky theorem guarantees that the truncated SVD provides the unique optimal solution under both the Frobenius norm and the spectral norm: $B_k = \sum_{i=1}^k \sigma_i u_i v_i^H$.
5
+ Given a matrix $A \in \mathbb{R}^{m \times n}$, find a matrix $B$ with rank at most $k$ that minimizes $\|A - B\|$. The Eckart-Young-Mirsky theorem guarantees that the truncated SVD provides an optimal solution under both the Frobenius norm and the spectral norm; the principal subspace is unique when $\sigma_k > \sigma_{k+1}$: $B_k = \sum_{i=1}^k \sigma_i u_i v_i^H$.
6
6
 
7
7
  ## Core Formulas
8
8
 
@@ -16,7 +16,7 @@ Given a matrix $A \in \mathbb{R}^{m \times n}$, find a matrix $B$ with rank at m
16
16
  ## Applicable Problems
17
17
 
18
18
  - LoRA weight compression: $W \approx W_0 + BA$, $B \in \mathbb{R}^{d \times r}, A \in \mathbb{R}^{r \times d}$, $r \ll d$
19
- - KV-Cache compression: projecting Key/Value caches into a low-dimensional subspace, reducing memory from $O(n)$ to $O(k)$
19
+ - KV-Cache compression: projecting Key/Value caches into a low-rank factor format, reducing memory from $O(Ld)$ to $O(Lk + kd)$; standard softmax still has sequence length $L$
20
20
  - PCA / whitening: the top $k$ principal components of the data covariance matrix correspond to the truncated SVD
21
21
  - Gradient compression: the effective rank of gradient matrices in large models is often much lower than the nominal rank, allowing safe truncation
22
22
  - Recommender systems / matrix completion: low-rank factorization $R \approx UV^H$
@@ -25,16 +25,16 @@ Given a matrix $A \in \mathbb{R}^{m \times n}$, find a matrix $B$ with rank at m
25
25
 
26
26
  - **LoRA (Low-Rank Adaptation)**: Freeze $W_0$, train $\Delta W = BA$ ($r \ll d$), and merge $W = W_0 + BA$ at inference time. Forward pass = two matmul operations ($x \to Ax \to BAx$), reducing trainable parameters from $O(d^2)$ to $O(dr)$. Implemented via `torch.mm(B, torch.mm(A, x))` or merged into a single matmul.
27
27
  - **Randomized SVD operator**: For a large matrix $A \in \mathbb{R}^{m \times n}$, first sample $Y = A\Omega$ ($\Omega \in \mathbb{R}^{n \times (k+p)}$ random Gaussian), compute QR decomposition $Y = QR$, then form $B = Q^HA$ (small matrix $O(k \times n)$), and perform SVD on $B$. Total complexity $O(mnk)$ instead of $O(mn^2)$; all core operations are matmul.
28
- - **KV-Cache low-rank reduction**: Maintain $K_k = K P_k$ ($P_k$ being the projection onto the top $k$ principal components), performing incremental PCA or streaming SVD updates for each new token. Attention computation $\text{softmax}(Q K_k^H / \sqrt{d}) V_k$ involves three matmul operations, reducing the sequence dimension from $L$ to $k$.
28
+ - **KV-Cache low-rank reduction**: Maintain $K$ in factored low-rank form $K \approx U_k \Sigma_k V_k^H$ (storing $U_k \in \mathbb{R}^{L \times k}$ and $\Sigma_k V_k^H \in \mathbb{R}^{k \times d}$, totaling $O(Lk + kd)$ instead of $O(Ld)$). Perform incremental PCA or streaming SVD updates for each new token. **Note**: for standard softmax attention, low-rank factors cannot be treated as $k$ compressed tokens; softmax is still normalized over length $L$. However, one can compute $qK^T = (q(\Sigma_k V_k^H)^T)U_k^T$ in factored form, avoiding materialized $L \times d$ reconstruction and reducing the QK inner dimension from $d$ to $k$. Only in linear attention, and only when compressing additive statistics such as $\phi(K)^T V$ and $\phi(K)^T\mathbf{1}$, can the historical state truly shrink from $L$ tokens to $k$ statistical factors.
29
29
  - **Nuclear norm regularization**: $\mathcal{L} = \mathcal{L}_{\text{task}} + \lambda \|W\|_*$ promotes low-rank solutions. However, nuclear norm computation requires full SVD ($O(n^3)$). Alternatives: (1) approximate with truncated SVD; (2) factorize $\|W\|_* = \min_{W=UV^H} \frac{1}{2}(\|U\|_F^2 + \|V\|_F^2)$, converting to Frobenius regularization on $U, V$.
30
- - **Gradient low-rank compression (distributed training)**: Truncate gradient $G$ to $G_k$ (top-$k$ SVD) before all-reduce, reducing communication from $O(d)$ to $O(kd)$. Use randomized SVD locally on each device, then merge.
30
+ - **Gradient low-rank compression (distributed training)**: For a gradient matrix $G \in \mathbb{R}^{m \times n}$, transmit top-$k$ SVD factors before all-reduce, reducing communication from $O(mn)$ to $O(k(m+n))$ (if $m \approx n \approx d$, this is $O(d^2) \to O(kd)$). Use randomized SVD locally on each device, then merge.
31
31
 
32
32
  ## Engineering Feasibility
33
33
 
34
- - **Primary operations**: matmul + small-matrix SVD. LoRA forward = two matmul operations; randomized SVD = three matmul operations + one small QR; truncated SVD = $O(k/n)$ fraction of full SVD (using Lanczos).
34
+ - **Primary operations**: matmul + small-matrix SVD. LoRA forward = two matmul operations; randomized SVD = several matmuls + one thin QR + one small SVD, typically $O(mnk)$ (also depending on oversampling, power iterations, and spectral gaps). Lanczos / randomized truncated SVD is usually far cheaper than full SVD, but should not be summarized as an $O(k/n)$ fraction of full SVD.
35
35
  - **GPU friendliness**: Extremely high. LoRA forward/backward are all tensor core matmul operations; the dominant cost of randomized SVD is also matmul. Small-matrix SVD has cuSOLVER batched implementations.
36
36
  - **Complexity**: LoRA forward $O(dk)$ per sample vs. $O(d^2)$ full rank; randomized SVD $O(mnk)$; full SVD $O(\min(m^2n, mn^2))$.
37
- - **Memory**: LoRA storage $O(dr)$ vs. $O(d^2)$; KV-Cache low-rank reduction $O(Lk)$ vs. $O(Ld)$.
37
+ - **Memory**: LoRA storage $O(dr)$ vs. $O(d^2)$; KV-Cache low-rank factor storage $O(Lk + kd)$ vs. $O(Ld)$.
38
38
 
39
39
  ## Risks and Failure Conditions
40
40
 
@@ -45,5 +45,18 @@ Given a matrix $A \in \mathbb{R}^{m \times n}$, find a matrix $B$ with rank at m
45
45
 
46
46
  ## Further References
47
47
 
48
- - Distilled notes: references/books/matrix-analysis.md (Section 2.6 SVD, Section 7.4 Polar Decomposition and SVD, nuclear norm-spectral norm duality Section 5.5)
48
+ - Distilled notes: ../../references/books/matrix-analysis.en.md (Section 2.6 SVD, Section 7.4 Polar Decomposition and SVD, nuclear norm-spectral norm duality Section 5.5)
49
49
  - Original text: Horn & Johnson, *Matrix Analysis* 2nd Ed., Chapter 2 Section 2.6 (SVD) + Chapter 7 Section 7.3-7.4 (Polar Decomposition & SVD)
50
+
51
+
52
+ ## Routing Extensions
53
+ - If subspace projection implementation is needed -> `projection.en.md` (projection operators)
54
+ - If detailed decomposition tools are needed -> `spectral-decomposition.en.md` (SVD/EVD)
55
+ - If the goal is information-preserving compression -> `../probability/information-bottleneck.en.md` (information bottleneck theory)
56
+
57
+ ## Extensible Directions
58
+ - Tensor decomposition (CP / Tucker / TT): low-rank decomposition of higher-order tensors
59
+ - Structured low-rank (Toeplitz / Hankel): structure-preserving low-rank approximation
60
+ - Online / streaming low-rank: incrementally updated low-rank estimation
61
+ - Matrix completion: recovering low-rank matrices from partial observations
62
+ - Robust PCA: low-rank + sparse decomposition
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## 最小定义
4
4
 
5
- 给定矩阵 $A \in \mathbb{R}^{m \times n}$,寻找秩不超过 $k$ 的矩阵 $B$ 使得 $\|A - B\|$ 最小。Eckart-Young-Mirsky 定理保证截断 SVD 给出 Frobenius 范数和谱范数下的唯一最优解:$B_k = \sum_{i=1}^k \sigma_i u_i v_i^H$。
5
+ 给定矩阵 $A \in \mathbb{R}^{m \times n}$,寻找秩不超过 $k$ 的矩阵 $B$ 使得 $\|A - B\|$ 最小。Eckart-Young-Mirsky 定理保证截断 SVD 给出 Frobenius 范数和谱范数下的一个最优解;当 $\sigma_k > \sigma_{k+1}$ 时,对应主子空间唯一:$B_k = \sum_{i=1}^k \sigma_i u_i v_i^H$。
6
6
 
7
7
  ## 核心公式
8
8
 
@@ -16,7 +16,7 @@
16
16
  ## 适用问题
17
17
 
18
18
  - LoRA 权重压缩:$W \approx W_0 + BA$,$B \in \mathbb{R}^{d \times r}, A \in \mathbb{R}^{r \times d}$,$r \ll d$
19
- - KV-Cache 压缩:将 Key/Value 缓存投影到低维子空间,显存 $O(n) \to O(k)$
19
+ - KV-Cache 压缩:将 Key/Value 缓存投影到低秩因子格式,显存从 $O(Ld)$ 变为 $O(Lk + kd)$;标准 softmax 下序列长度仍为 $L$
20
20
  - PCA / 白化:数据协方差的前 $k$ 个主成分即截断 SVD
21
21
  - 梯度压缩:大模型梯度矩阵的有效秩通常远低于名义秩,可安全截断
22
22
  - 推荐系统 / 矩阵补全:低秩因子分解 $R \approx UV^H$
@@ -25,16 +25,16 @@
25
25
 
26
26
  - **LoRA (Low-Rank Adaptation)**:冻结 $W_0$,训练 $\Delta W = BA$($r \ll d$),推理时合并 $W = W_0 + BA$。前向传播 = 两次 matmul($x \to Ax \to BAx$),训练参数量从 $O(d^2)$ 降到 $O(dr)$。用 `torch.mm(B, torch.mm(A, x))` 或合并为单次 matmul。
27
27
  - **随机化 SVD 算子**:对大矩阵 $A \in \mathbb{R}^{m \times n}$,先采样 $Y = A\Omega$($\Omega \in \mathbb{R}^{n \times (k+p)}$ 随机高斯),QR 分解 $Y = QR$,再算 $B = Q^HA$(小矩阵 $O(k \times n)$),对 $B$ 做 SVD。总复杂度 $O(mnk)$ 而非 $O(mn^2)$,核心操作全是 matmul。
28
- - **KV-Cache 低秩化**:维护 $K_k = K P_k$($P_k$ 为投影到前 $k$ 主成分),每新到 token 做增量 PCA 或 streaming SVD 更新。Attention 计算 $\text{softmax}(Q K_k^H / \sqrt{d}) V_k$,三次 matmul,序列维度从 $L$ 降到 $k$。
28
+ - **KV-Cache 低秩化**:维护 $K$ 的低秩因子形式 $K \approx U_k \Sigma_k V_k^H$(存储 $U_k \in \mathbb{R}^{L \times k}$ 和 $\Sigma_k V_k^H \in \mathbb{R}^{k \times d}$,共 $O(Lk + kd)$ 而非 $O(Ld)$)。每新到 token 做增量 PCA 或 streaming SVD 更新。**注意**:对标准 softmax attention,低秩因子不能当作 $k$ 个压缩 token;softmax 仍在长度 $L$ 上归一化。但可用因子化计算 $qK^T = (q(\Sigma_k V_k^H)^T)U_k^T$,避免物化 $L \times d$ 重构,并将 QK 内维从 $d$ 降到 $k$。仅在线性注意力中,且压缩 $\phi(K)^T V$、$\phi(K)^T\mathbf{1}$ 等可加统计量时,历史状态才可真正从 $L$ 降至 $k$ 个统计因子。
29
29
  - **核范数正则化**:$\mathcal{L} = \mathcal{L}_{\text{task}} + \lambda \|W\|_*$ 促进低秩解。但核范数计算需完整 SVD($O(n^3)$),替代方案:(1) 用截断 SVD 近似;(2) 因子化 $\|W\|_* = \min_{W=UV^H} \frac{1}{2}(\|U\|_F^2 + \|V\|_F^2)$ 转为对 $U, V$ 的 Frobenius 正则。
30
- - **梯度低秩压缩 (分布式训练)**:将梯度 $G$ 截断为 $G_k$(top-$k$ SVD)后 all-reduce 通信量从 $O(d)$ 降到 $O(kd)$。用随机化 SVD 在每卡本地算,再合并。
30
+ - **梯度低秩压缩 (分布式训练)**:对梯度矩阵 $G \in \mathbb{R}^{m \times n}$ top-$k$ SVD 后传输因子,all-reduce 通信量从 $O(mn)$ 降到 $O(k(m+n))$(若 $m \approx n \approx d$,即 $O(d^2) \to O(kd)$)。用随机化 SVD 在每卡本地算,再合并。
31
31
 
32
32
  ## 工程可行性
33
33
 
34
- - **主要操作**:matmul + 小矩阵 SVD。LoRA 前向 = 两次 matmul;随机化 SVD = 三次 matmul + 一次小 QR;截断 SVD = 完整 SVD 的 $O(k/n)$ 倍(用 Lanczos)。
34
+ - **主要操作**:matmul + 小矩阵 SVD。LoRA 前向 = 两次 matmul;随机化 SVD = 若干次 matmul + 一次 thin QR + 小矩阵 SVD,典型复杂度 $O(mnk)$(还依赖 oversampling、power iteration 和谱间隙);Lanczos/随机化截断 SVD 通常远低于完整 SVD,但不能简单写成完整 SVD 的 $O(k/n)$ 倍。
35
35
  - **GPU 友好度**:极高。LoRA 前向/反向全是 tensor core matmul;随机化 SVD 的主要开销也是 matmul。小矩阵 SVD 有 cuSOLVER 的 batched 实现。
36
36
  - **复杂度**:LoRA 前向 $O(dk)$ per sample vs. $O(d^2)$ 全秩;随机化 SVD $O(mnk)$;完整 SVD $O(\min(m^2n, mn^2))$。
37
- - **显存**:LoRA 存储 $O(dr)$ vs. $O(d^2)$;KV-Cache 低秩化 $O(Lk)$ vs. $O(Ld)$。
37
+ - **显存**:LoRA 存储 $O(dr)$ vs. $O(d^2)$;KV-Cache 低秩因子存储 $O(Lk + kd)$ vs. $O(Ld)$。
38
38
 
39
39
  ## 风险与失效条件
40
40
 
@@ -45,5 +45,18 @@
45
45
 
46
46
  ## 深入参考
47
47
 
48
- - 蒸馏稿:references/books/matrix-analysis.md(§2.6 SVD、§7.4 极分解与 SVD、核范数-谱范数对偶 §5.5)
48
+ - 蒸馏稿:../../references/books/matrix-analysis.md(§2.6 SVD、§7.4 极分解与 SVD、核范数-谱范数对偶 §5.5)
49
49
  - 原书:Horn & Johnson, *Matrix Analysis* 2nd Ed., Chapter 2 §2.6 (SVD) + Chapter 7 §7.3-7.4 (Polar Decomposition & SVD)
50
+
51
+
52
+ ## 路由扩展
53
+ - 若需要子空间投影的具体实现 → `projection.md`(投影算子)
54
+ - 若需要分解工具的详细分析 → `spectral-decomposition.md`(SVD/EVD)
55
+ - 若目标是信息保持压缩 → `../probability/information-bottleneck.md`(信息瓶颈理论)
56
+
57
+ ## 可扩展方向
58
+ - 张量分解(CP / Tucker / TT):高阶张量的低秩分解
59
+ - 结构化低秩(Toeplitz / Hankel):保持结构的低秩近似
60
+ - 在线/流式低秩(online / streaming low-rank):增量更新的低秩估计
61
+ - 矩阵补全(matrix completion):从部分观测恢复低秩矩阵
62
+ - 鲁棒 PCA(robust PCA):低秩+稀疏分解
@@ -45,5 +45,17 @@ Studies how the eigenvalues, singular values, and eigenspaces of a matrix $A$ ch
45
45
 
46
46
  ## Further References
47
47
 
48
- - Distilled notes: references/books/matrix-analysis.md (Section 4.3 Eigenvalue Inequalities Weyl/Interlacing, Section 6.1-6.3 Geršgorin Discs and Perturbation Theorems, Section 5.8 Condition Numbers)
48
+ - Distilled notes: ../../references/books/matrix-analysis.en.md (Section 4.3 Eigenvalue Inequalities Weyl/Interlacing, Section 6.1-6.3 Geršgorin Discs and Perturbation Theorems, Section 5.8 Condition Numbers)
49
49
  - Original text: Horn & Johnson, *Matrix Analysis* 2nd Ed., Chapter 4 Section 4.3 (Eigenvalue Inequalities) + Chapter 6 (Location and Perturbation of Eigenvalues Section 6.1-6.3)
50
+
51
+
52
+ ## Routing Extensions
53
+ - If focusing on eigenvalue sensitivity -> `spectral-decomposition.en.md` (perturbation analysis of spectral decomposition)
54
+ - If random perturbation bounds are involved -> `../probability/concentration-inequality.md` (random matrix concentration inequalities)
55
+
56
+ ## Extensible Directions
57
+ - Pseudospectra: spectral sensitivity analysis for non-normal matrices
58
+ - Structured perturbation: perturbation analysis preserving matrix structure
59
+ - Davis-Kahan theorem variants: multiple bounds for subspace perturbation
60
+ - Eigenvalue interlacing: relationship between submatrix and eigenvalues
61
+ - Wilkinson polynomial: condition numbers and sensitivity of polynomial roots
@@ -45,5 +45,17 @@
45
45
 
46
46
  ## 深入参考
47
47
 
48
- - 蒸馏稿:references/books/matrix-analysis.md(§4.3 特征值不等式 Weyl/交错、§6.1-6.3 Ger\v{s}gorin 圆盘与扰动定理、§5.8 条件数)
48
+ - 蒸馏稿:../../references/books/matrix-analysis.md(§4.3 特征值不等式 Weyl/交错、§6.1-6.3 Ger\v{s}gorin 圆盘与扰动定理、§5.8 条件数)
49
49
  - 原书:Horn & Johnson, *Matrix Analysis* 2nd Ed., Chapter 4 §4.3 (Eigenvalue Inequalities) + Chapter 6 (Location and Perturbation of Eigenvalues §6.1-6.3)
50
+
51
+
52
+ ## 路由扩展
53
+ - 若关注特征值灵敏度 → `spectral-decomposition.md`(谱分解的扰动分析)
54
+ - 若涉及随机扰动界 → `../probability/concentration-inequality.md`(随机矩阵集中不等式)
55
+
56
+ ## 可扩展方向
57
+ - 伪谱(pseudospectra):非正规矩阵的谱灵敏度分析
58
+ - 结构化扰动(structured perturbation):保持矩阵结构的扰动分析
59
+ - Davis-Kahan 定理变体:子空间扰动的多种界
60
+ - 特征值交错(eigenvalue interlacing):主子矩阵与特征值关系
61
+ - Wilkinson 多项式:多项式根的条件数与扰动灵敏度
@@ -2,12 +2,12 @@
2
2
 
3
3
  ## Minimal Definition
4
4
 
5
- A Hermitian matrix $A$ is positive semidefinite (PSD) if $x^HAx \geq 0$ for all nonzero vectors $x$, denoted $A \succeq 0$. Equivalent conditions: all eigenvalues $\geq 0$; there exists $B$ such that $A = B^HB$ (Gram representation); all leading principal minors $\geq 0$. Positive definite (PD) requires strict $> 0$, denoted $A \succ 0$.
5
+ A Hermitian matrix $A$ is positive semidefinite (PSD) if $x^HAx \geq 0$ for all nonzero vectors $x$, denoted $A \succeq 0$. Equivalent conditions: all eigenvalues $\geq 0$; there exists $B$ such that $A = B^HB$ (Gram representation); **all principal minors** $\geq 0$ (note: ALL principal minors, not just the leading ones). Positive definite (PD) requires strict $> 0$, denoted $A \succ 0$.
6
6
 
7
7
  ## Core Formulas
8
8
 
9
- - PSD equivalence: $A \succeq 0 \iff \lambda_i(A) \geq 0 \ \forall i \iff A = B^HB$
10
- - PD equivalence: $A \succ 0 \iff \lambda_i(A) > 0 \ \forall i \iff$ all leading principal minors $> 0$ (Sylvester's criterion)
9
+ - PSD equivalence: $A \succeq 0 \iff \lambda_i(A) \geq 0 \ \forall i \iff A = B^HB \iff$ all principal minors $\geq 0$ (note: **all** principal minors, not just the leading ones)
10
+ - PD equivalence (Sylvester's criterion): $A \succ 0 \iff \lambda_i(A) > 0 \ \forall i \iff$ all leading principal minors $> 0$ (checking only leading principal minors suffices; this is necessary and sufficient for PD)
11
11
  - Cholesky decomposition: $A \succ 0 \implies A = LL^H$, $L$ lower triangular
12
12
  - Loewner partial order: $A \succeq B \iff A - B \succeq 0$
13
13
  - Schur product theorem: $A \succeq 0, B \succeq 0 \implies A \circ B \succeq 0$ (Hadamard product preserves PSD)
@@ -20,12 +20,12 @@ A Hermitian matrix $A$ is positive semidefinite (PSD) if $x^HAx \geq 0$ for all
20
20
  - Covariance matrices: $\Sigma = \mathbb{E}[xx^H] \succeq 0$; PCA/whitening relies on positive definiteness
21
21
  - Second-order optimization preconditioning: The PSD structure of the Hessian/Fisher information matrix guarantees descent directions
22
22
  - Semidefinite programming (SDP): optimizing a linear objective subject to $X \succeq 0$ constraints
23
- - Attention matrix analysis: Gram structure of the row-stochastic matrix output by softmax
23
+ - Attention matrix analysis: a row-stochastic softmax attention matrix is generally not a Gram/PSD matrix; PSD tools apply only after explicitly constructing a symmetric PSD kernel (e.g. $K_{ij}=k(x_i,x_j)$) or symmetrizing and projecting to the PSD cone.
24
24
 
25
25
  ## AI Design Translation
26
26
 
27
27
  - **PSD kernel engineering (learnable kernels)**: Use the Schur product theorem to combine multiple PSD kernels: $K = K_1 \circ K_2 \circ \cdots$ (Hadamard product), guaranteeing the result remains PSD. Implemented as elementwise tensor multiplication `K = K1 * K2`, $O(n^2)$ elementwise, extremely GPU-friendly. Can parameterize $K_\theta(x,y) = \exp(-\|f_\theta(x)-f_\theta(y)\|^2)$ to guarantee PSD.
28
- - **Covariance whitening**: $\hat{x} = \Sigma^{-1/2}x$, where $\Sigma^{-1/2}$ is approximated via Newton-Schulz iteration (pure matmul). Newton-Schulz: $X_{k+1} = \frac{1}{2}X_k(3I - AX_k)$, two matmul operations per step, converging in 5-6 steps. BatchNorm can be viewed as an approximation to diagonal whitening.
28
+ - **Covariance whitening**: $\hat{x} = \Sigma^{-1/2}x$, where $\Sigma^{-1/2}$ can be approximated via scaled Newton-Schulz iteration (pure matmul). A common coupled form uses $Y_0=A/\alpha, Z_0=I$, $T_k=\frac{1}{2}(3I-Z_kY_k)$, $Y_{k+1}=Y_kT_k, Z_{k+1}=T_kZ_k$, with $A^{-1/2}\approx Z_k/\sqrt{\alpha}$; an equivalent single-variable form is $X_{k+1}=\frac{1}{2}X_k(3I-AX_k^2)$. Convergence requires spectral scaling and positive definiteness; in low precision, residual checks are needed. 5-6 steps is an engineering budget, not a universal guarantee. BatchNorm can be viewed as an approximation to diagonal whitening.
29
29
  - **Cholesky preconditioner**: For a PSD Hessian $H$, use the $H = LL^H$ decomposition and solve $L^{-1}L^{-H}g$ instead of $H^{-1}g$. cuSOLVER provides batched Cholesky `potrf`. In K-FAC, the inversion of each Kronecker factor proceeds via Cholesky.
30
30
  - **Nearest PSD approximation (Higham)**: Given a symmetric matrix $A$, find the nearest PSD matrix $A_+ = \arg\min_{X \succeq 0} \|A - X\|_F$. Solution: EVD $A = U\Lambda U^H$, clamp negative values in $\Lambda$ to zero, $A_+ = U\Lambda_+ U^H$. Used to correct loss of positive definiteness in covariance matrices due to floating-point errors.
31
31
  - **Jitter / diagonal loading**: $A_{\text{stable}} = A + \epsilon I$ ($\epsilon \sim 10^{-6}$), ensuring numerical positive definiteness. Standard practice in Gaussian processes, kernel methods, and Cholesky decomposition. Implemented as `A + eps * torch.eye(n)`, a zero-cost operation.
@@ -46,5 +46,19 @@ A Hermitian matrix $A$ is positive semidefinite (PSD) if $x^HAx \geq 0$ for all
46
46
 
47
47
  ## Further References
48
48
 
49
- - Distilled notes: references/books/matrix-analysis.md (Ch 7 Positive Definite and Semidefinite Matrices, Section 7.5 Schur Product Theorem, Section 7.7 Loewner Partial Order)
49
+ - Distilled notes: ../../references/books/matrix-analysis.en.md (Ch 7 Positive Definite and Semidefinite Matrices, Section 7.5 Schur Product Theorem, Section 7.7 Loewner Partial Order)
50
50
  - Original text: Horn & Johnson, *Matrix Analysis* 2nd Ed., Chapter 7 (Positive Definite and Semidefinite Matrices Section 7.1-7.8)
51
+
52
+
53
+ ## Routing Extensions
54
+ - If solving SDP problems -> `../optimization/convex-optimization.md` (semidefinite programming as convex optimization)
55
+ - If PSD matrix conditioning and perturbation are involved -> `matrix-perturbation.en.md` (eigenvalue perturbation bounds)
56
+ - If used for Fisher information matrix -> `../probability/fisher-information.md` (PSD property of Fisher information)
57
+
58
+ ## Extensible Directions
59
+ - Semidefinite programming (SDP): solution methods and applications
60
+ - PSD completion: completing partially known PSD matrices
61
+ - Matrix square root: unique square root of PSD matrices
62
+ - Lowner order: partial order on the PSD cone
63
+ - Operator monotone functions: Loewner-Heinz theorem
64
+ - Completely positive matrices: CP decomposition and cone structure
@@ -2,12 +2,12 @@
2
2
 
3
3
  ## 最小定义
4
4
 
5
- Hermitian 矩阵 $A$ 若对所有非零向量 $x$ 满足 $x^HAx \geq 0$,则称半正定(PSD),记 $A \succeq 0$。等价条件:所有特征值 $\geq 0$;存在 $B$ 使 $A = B^HB$(Gram 表示);所有顺序主子式 $\geq 0$。正定(PD)要求严格 $> 0$,记 $A \succ 0$。
5
+ Hermitian 矩阵 $A$ 若对所有非零向量 $x$ 满足 $x^HAx \geq 0$,则称半正定(PSD),记 $A \succeq 0$。等价条件:所有特征值 $\geq 0$;存在 $B$ 使 $A = B^HB$(Gram 表示);**所有主子式** $\geq 0$(注意:是全部主子式,不仅是顺序主子式)。正定(PD)要求严格 $> 0$,记 $A \succ 0$。
6
6
 
7
7
  ## 核心公式
8
8
 
9
- - PSD 等价条件:$A \succeq 0 \iff \lambda_i(A) \geq 0 \ \forall i \iff A = B^HB$
10
- - 正定等价:$A \succ 0 \iff \lambda_i(A) > 0 \ \forall i \iff$ 所有顺序主子式 $> 0$(Sylvester 准则)
9
+ - PSD 等价条件:$A \succeq 0 \iff \lambda_i(A) \geq 0 \ \forall i \iff A = B^HB \iff$ 所有主子式 $\geq 0$(注意:是 **所有** 主子式,不仅是顺序主子式)
10
+ - 正定等价(Sylvester 准则):$A \succ 0 \iff \lambda_i(A) > 0 \ \forall i \iff$ 所有顺序主子式 $> 0$(仅需检验顺序主子式,这是 PD 的充分必要条件)
11
11
  - Cholesky 分解:$A \succ 0 \implies A = LL^H$,$L$ 下三角
12
12
  - Loewner 偏序:$A \succeq B \iff A - B \succeq 0$
13
13
  - Schur 积定理:$A \succeq 0, B \succeq 0 \implies A \circ B \succeq 0$(Hadamard 积保 PSD)
@@ -20,12 +20,12 @@ Hermitian 矩阵 $A$ 若对所有非零向量 $x$ 满足 $x^HAx \geq 0$,则称
20
20
  - 协方差矩阵:$\Sigma = \mathbb{E}[xx^H] \succeq 0$,PCA/白化依赖其正定性
21
21
  - 二阶优化预条件:Hessian/Fisher 信息矩阵的 PSD 结构保证下降方向
22
22
  - 半定规划 (SDP):约束 $X \succeq 0$ 下的线性目标优化
23
- - Attention 矩阵分析:softmax 输出的行随机矩阵的 Gram 结构
23
+ - Attention 矩阵分析:softmax 输出的行随机矩阵一般不是 Gram/PSD;只有显式构造对称 PSD kernel(如 $K_{ij}=k(x_i,x_j)$)或对称化并投影到 PSD cone 后,才能使用 PSD 工具。
24
24
 
25
25
  ## AI 设计翻译
26
26
 
27
27
  - **PSD 核工程 (可学习核)**:用 Schur 积定理组合多个 PSD 核:$K = K_1 \circ K_2 \circ \cdots$(Hadamard 积),保证结果始终 PSD。实现为 elementwise 张量乘 `K = K1 * K2`,$O(n^2)$ elementwise,极 GPU 友好。可参数化 $K_\theta(x,y) = \exp(-\|f_\theta(x)-f_\theta(y)\|^2)$ 保证 PSD。
28
- - **协方差白化 (Whitening)**:$\hat{x} = \Sigma^{-1/2}x$,其中 $\Sigma^{-1/2}$ 通过 Newton-Schulz 迭代近似(纯 matmul)。Newton-Schulz:$X_{k+1} = \frac{1}{2}X_k(3I - AX_k)$,每步两次 matmul,5-6 步收敛。BatchNorm 可视为对角白化的近似。
28
+ - **协方差白化 (Whitening)**:$\hat{x} = \Sigma^{-1/2}x$,其中 $\Sigma^{-1/2}$ 可通过缩放后的 Newton-Schulz 迭代近似(纯 matmul)。常用 coupled 形式:$Y_0=A/\alpha, Z_0=I$,$T_k=\frac{1}{2}(3I-Z_kY_k)$,$Y_{k+1}=Y_kT_k, Z_{k+1}=T_kZ_k$,最后 $A^{-1/2}\approx Z_k/\sqrt{\alpha}$;或单变量形式 $X_{k+1}=\frac{1}{2}X_k(3I-AX_k^2)$。收敛需要谱缩放和正定条件,低精度下需残差监控;5-6 步只是常见工程预算。BatchNorm 可视为对角白化的近似。
29
29
  - **Cholesky 预条件子**:对 PSD Hessian $H$,用 $H = LL^H$ 分解后解 $L^{-1}L^{-H}g$ 代替 $H^{-1}g$。cuSOLVER 有 batched Cholesky `potrf`。K-FAC 中每个 Kronecker 因子的求逆即走 Cholesky。
30
30
  - **最近 PSD 近似 (Higham)**:给定对称矩阵 $A$,求最近 PSD 矩阵 $A_+ = \arg\min_{X \succeq 0} \|A - X\|_F$。解法:EVD $A = U\Lambda U^H$,将 $\Lambda$ 中负值截零,$A_+ = U\Lambda_+ U^H$。用于修正浮点误差导致的协方差矩阵失去正定性。
31
31
  - **Jitter / 对角加载**:$A_{\text{stable}} = A + \epsilon I$($\epsilon \sim 10^{-6}$),保证数值正定性。高斯过程、核方法、Cholesky 分解中标准做法。实现为 `A + eps * torch.eye(n)`,零成本操作。
@@ -46,5 +46,19 @@ Hermitian 矩阵 $A$ 若对所有非零向量 $x$ 满足 $x^HAx \geq 0$,则称
46
46
 
47
47
  ## 深入参考
48
48
 
49
- - 蒸馏稿:references/books/matrix-analysis.md(Ch 7 Positive Definite and Semidefinite Matrices、§7.5 Schur 积定理、§7.7 Loewner 偏序)
49
+ - 蒸馏稿:../../references/books/matrix-analysis.md(Ch 7 Positive Definite and Semidefinite Matrices、§7.5 Schur 积定理、§7.7 Loewner 偏序)
50
50
  - 原书:Horn & Johnson, *Matrix Analysis* 2nd Ed., Chapter 7 (Positive Definite and Semidefinite Matrices §7.1-7.8)
51
+
52
+
53
+ ## 路由扩展
54
+ - 若需要求解 SDP 问题 → `../optimization/convex-optimization.md`(半正定规划作为凸优化)
55
+ - 若涉及 PSD 矩阵的条件与扰动 → `matrix-perturbation.md`(特征值扰动界)
56
+ - 若用于 Fisher 信息矩阵 → `../probability/fisher-information.md`(Fisher 信息的 PSD 性质)
57
+
58
+ ## 可扩展方向
59
+ - 半正定规划(semidefinite programming):SDP 的求解方法与应用
60
+ - PSD 补全(PSD completion):部分已知 PSD 矩阵的补全
61
+ - 矩阵平方根(matrix square root):PSD 矩阵的唯一平方根
62
+ - Lowner 序(Lowner order):PSD 锥上的偏序关系
63
+ - 算子单调函数(operator monotone functions):Loewner-Heinz 定理
64
+ - 完全正矩阵(completely positive matrices):CP 分解与锥结构
@@ -43,5 +43,18 @@ Maps a vector $v$ onto a subspace $\mathcal{S}$ such that the residual $v - Pv$
43
43
 
44
44
  ## Further References
45
45
 
46
- - Distilled notes: references/books/matrix-analysis.md (Section 2.1 QR Decomposition, Section 4.2 Courant-Fischer Variational Characterization, Section 2.6 SVD)
46
+ - Distilled notes: ../../references/books/matrix-analysis.en.md (Section 2.1 QR Decomposition, Section 4.2 Courant-Fischer Variational Characterization, Section 2.6 SVD)
47
47
  - Original text: Horn & Johnson, *Matrix Analysis* 2nd Ed., Chapter 2 (Unitary Similarity) + Chapter 4 (Hermitian Matrices Section 4.2 Variational Characterizations)
48
+
49
+
50
+ ## Routing Extensions
51
+ - If the goal is compression / dimensionality reduction -> `low-rank-approximation.en.md` (truncated SVD implementation)
52
+ - If projection constraints are needed on a manifold -> `../optimization/riemannian-optimization.md` (constrained optimization on Riemannian manifolds)
53
+ - If shared vs. private subspace separation is involved -> `shared-private-decomposition` (design pattern layer)
54
+
55
+ ## Extensible Directions
56
+ - Oblique projection: non-orthogonal projection operators
57
+ - Alternating projection: Von Neumann alternating projection convergence theorem
58
+ - Projection onto convex sets (POCS): projecting onto intersections of convex sets
59
+ - Randomized projection: Johnson-Lindenstrauss lemma and random projections
60
+ - Subspace tracking: online subspace estimation methods
@@ -43,5 +43,18 @@
43
43
 
44
44
  ## 深入参考
45
45
 
46
- - 蒸馏稿:references/books/matrix-analysis.md(§2.1 QR 分解、§4.2 Courant-Fischer 变分刻画、§2.6 SVD)
46
+ - 蒸馏稿:../../references/books/matrix-analysis.md(§2.1 QR 分解、§4.2 Courant-Fischer 变分刻画、§2.6 SVD)
47
47
  - 原书:Horn & Johnson, *Matrix Analysis* 2nd Ed., Chapter 2 (Unitary Similarity) + Chapter 4 (Hermitian Matrices §4.2 Variational Characterizations)
48
+
49
+
50
+ ## 路由扩展
51
+ - 若目标是压缩/降维 → `low-rank-approximation.md`(截断 SVD 实现)
52
+ - 若需要在流形上做投影约束 → `../optimization/riemannian-optimization.md`(黎曼流形上的约束优化)
53
+ - 若涉及共享与私有子空间分离 → `shared-private-decomposition`(设计模式层)
54
+
55
+ ## 可扩展方向
56
+ - 斜投影(oblique projection):非正交投影算子
57
+ - 交替投影(alternating projection):Von Neumann 交替投影收敛定理
58
+ - 凸集投影(POCS):投影到多个凸集交集的方法
59
+ - 随机投影(randomized projection):Johnson-Lindenstrauss 引理与随机投影
60
+ - 子空间跟踪(subspace tracking):在线更新的子空间估计方法
@@ -44,5 +44,18 @@ Decomposes a matrix into a linear combination of eigenvalue-eigenvector pairs. F
44
44
 
45
45
  ## Further References
46
46
 
47
- - Distilled notes: references/books/matrix-analysis.md (Ch 1 Eigenvalues and Similarity, Section 2.4-2.5 Schur Triangularization and Normal Matrices, Section 4.2 Courant-Fischer)
47
+ - Distilled notes: ../../references/books/matrix-analysis.en.md (Ch 1 Eigenvalues and Similarity, Section 2.4-2.5 Schur Triangularization and Normal Matrices, Section 4.2 Courant-Fischer)
48
48
  - Original text: Horn & Johnson, *Matrix Analysis* 2nd Ed., Chapter 1 (Eigenvalues, Eigenvectors, Similarity) + Chapter 2 (Unitary Similarity Section 2.4-2.5)
49
+
50
+
51
+ ## Routing Extensions
52
+ - If truncation approximation is needed -> `low-rank-approximation.en.md` (SVD-based low-rank approximation)
53
+ - If used for attention mechanism design -> `spectral-attention` (design pattern layer)
54
+ - If spectral concentration bounds are needed -> `../probability/concentration-inequality.md` (concentration inequalities for random matrix spectra)
55
+
56
+ ## Extensible Directions
57
+ - SVD variants (truncated / randomized SVD): fast decomposition for large-scale matrices
58
+ - CUR decomposition: interpretable matrix approximation via column/row sampling
59
+ - Nystrom method: low-rank approximation of kernel matrices
60
+ - Spectral graph theory (Laplacian eigenvalues): graph Laplacian eigenvalues and graph structure analysis
61
+ - Random matrix theory: spectral distributions of large random matrices
@@ -44,5 +44,18 @@
44
44
 
45
45
  ## 深入参考
46
46
 
47
- - 蒸馏稿:references/books/matrix-analysis.md(Ch 1 特征值与相似、§2.4-2.5 Schur 三角化与正规矩阵、§4.2 Courant-Fischer)
47
+ - 蒸馏稿:../../references/books/matrix-analysis.md(Ch 1 特征值与相似、§2.4-2.5 Schur 三角化与正规矩阵、§4.2 Courant-Fischer)
48
48
  - 原书:Horn & Johnson, *Matrix Analysis* 2nd Ed., Chapter 1 (Eigenvalues, Eigenvectors, Similarity) + Chapter 2 (Unitary Similarity §2.4-2.5)
49
+
50
+
51
+ ## 路由扩展
52
+ - 若需要截断近似 → `low-rank-approximation.md`(基于 SVD 的低秩近似)
53
+ - 若用于注意力机制设计 → `spectral-attention`(设计模式层)
54
+ - 若需要谱的集中界 → `../probability/concentration-inequality.md`(随机矩阵谱的集中不等式)
55
+
56
+ ## 可扩展方向
57
+ - SVD 变体(truncated / randomized SVD):大规模矩阵的快速分解
58
+ - CUR 分解:基于列/行采样的可解释矩阵近似
59
+ - Nystrom 方法:核矩阵的低秩近似
60
+ - 谱图理论(Laplacian eigenvalues):图拉普拉斯特征值与图结构分析
61
+ - 随机矩阵理论:大维随机矩阵的谱分布