arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2302.13600cs.SC
收藏

快速原地累加

Fast in-place accumulation

Jean-Guillaume Dumas, Bruno Grenet

AI总结:

本文提出自动设计快速原地累加算法的方法,通过允许修改输入后恢复的放宽原地模型,实现快速多项式乘法、类 Strassen 矩阵乘法及欧几里得多项式余式的原地计算,并达到与非原地算法相同的复杂度界。

摘要:

本文研究同时具备快速与原地特性的算法,用于结果需要线性累加的公式:某些输出变量同时也是输入变量,并通过线性依赖关系相关联。基本示例包括多项式或矩阵的原地累加乘法(即仅使用 $O(1)$ 额外空间)。难点在于将原地计算与快速算法相结合:快速算法通常以(可能很大的)额外临时空间为代价。我们首先针对任意双线性公式(因此也适用于多项式和矩阵乘法)提出一种新颖的快速原地累加算法的自动设计方法,然后将其扩展到一组函数的任意线性累加。为此,我们将原地模型放宽为允许算法修改其输入,但要求之后将这些输入恢复到初始状态。这使我们能够推导出用于快速多项式乘法和类 Strassen 矩阵乘法的原地累加算法。接着,我们考虑欧几里得多项式余式 $R = A \bmod B$ 的同时快速原地计算。若 $A$ 和 $B$ 的次数分别为 $m+n$ 和 $n$,且 $M(k)$ 表示(非原地)算法计算两个 $k$ 次多项式乘法的复杂度,则我们的算法至多使用 $O((n/m) M(m)\log(m))$ 次算术运算。若对某个 $ε>0$ 有 $M(n) = Θ(n^{1+ε})$,则我们的算法确实达到非原地复杂度界 $O((n/m) M(m))$。我们还提出变体,以原地方式且在相同复杂度界内计算 $A = A \bmod B$、$R += A \bmod B$ 以及 $R += AC \bmod B$,即有限域扩张中的乘法。为实现这一目标,我们发展了针对 Toeplitz 矩阵运算、广义卷积、短乘积以及幂级数除法和余式的技术,其中输出同时也是输入的一部分。

英文摘要:

This paper deals with simultaneously fast and in-place algorithms for formulae where the result has to be linearly accumulated: some output variables are also input variables, linked by a linear dependency. Fundamental examples include the in-place accumulated multiplication of polynomials or matrices (that is with only $O(1)$ extra space). The difficulty is to combine in-place computations with fast algorithms: those usually come at the expense of (potentially large) extra temporary space. We first propose a novel automatic design of fast and in-place accumulating algorithms for any bilinear formulae (and thus for polynomial and matrix multiplication) and then extend it to any linear accumulation of a collection of functions. For this, we relax the in-place model to any algorithm allowed to modify its inputs, provided that those are restored to their initial state afterwards. This allows us to derive in-place accumulating algorithms for fast polynomial multiplications and for Strassen-like matrix multiplications. We then consider the simultaneously fast and in-place computation of the Euclidean polynomial remainder $R = A \bmod B$. If $A$ and $B$ have respective degree $m+n$ and $n$, and $M(k)$ denotes the complexity of a (not-in-place) algorithm to multiply two degree-$k$ polynomials, our algorithm uses at most $O((n/m) M(m)\log(m))$ arithmetic operations. If $M(n) = Θ(n^{1+ε})$ for some $ε>0$, then our algorithms do match the not-in-place complexity bound of $O((n/m) M(m))$. We also propose variants that compute - still in-place and with the same complexity bounds - $A = A \bmod B$, $R += A \bmod B$ and $R += AC \bmod B$, that is multiplication in a finite field extension. To achieve this, we develop techniques for Toeplitz matrix operations, for generalized convolutions, short product and power series division and remainder whose output is also part of the input.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑