提出无需中心化即可高效计算协方差矩阵的新方法,显著提速。
High-Performance Variance-Covariance Matrix Construction Using an Uncentered Gram Formulation
- 用未中心化的格拉姆矩阵与修正项代替传统中心化,实现线性时间计算
- 仅需一次p×p外积和一次减法,计算复杂度大幅降低
- 特别适合无BLAS优化的环境,适合高性能统计计算场景
Reichel (2025) 定义了方差的一种成对差值度量,可通过仅依赖标量求和在线性时间内重写。本文将该思想扩展至协方差矩阵,证明标准矩阵表达式(基于未中心化的格拉姆矩阵与修正项)在代数上等价于成对差值定义,同时避免了显式中心化操作。计算过程简化为一次 p×p 外积和一次减法。Python 基准测试显示,在缺乏 BLAS 优化时运行时间明显缩短。可选地,使用更快速的格拉姆矩阵算法如 RXTX (Rybin et al., 2025) 可进一步降低总体开销。
原文摘要 · Abstract (English)
Reichel (2025) defined the bariance as a pairwise-difference measure that can be rewritten in linear time using only scalar sums. We extend this idea to the covariance matrix by showing that the standard matrix expression involving the uncentered Gram matrix and a correction term is algebraically identical to the pairwise-difference definition while avoiding explicit centering. The computation then reduces to one outer product of dimension p-by-p and a single subtraction. Benchmarks in Python show clear runtime gains, especially when BLAS optimizations are absent. Optionally faster Gram-matrix routines such as RXTX (Rybin et al., 2025) further reduce overall cost.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。