{"title":"Fast in-place accumulation","authors":"Jean-Guillaume Dumas, Bruno Grenet","doi":"10.1016/j.jsc.2025.102523","DOIUrl":null,"url":null,"abstract":"<div><div>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, <span><math><mi>C</mi><mo>+</mo><mo>=</mo><mi>A</mi><mi>B</mi></math></span> (that is with only <span><math><mi>O</mi><mo>(</mo><mn>1</mn><mo>)</mo></math></span> 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, but with accumulation the output variables are not even available to store intermediate values. 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 ultimately derive unprecedented in-place accumulating algorithms for fast polynomial multiplications and for Strassen-like matrix multiplications.</div><div>We then consider the simultaneously fast and in-place computation of the Euclidean polynomial modular remainder <span><math><mi>R</mi><mo>(</mo><mi>X</mi><mo>)</mo><mo>≡</mo><mi>A</mi><mo>(</mo><mi>X</mi><mo>)</mo><mspace></mspace><mrow><mi>mod</mi></mrow><mspace></mspace><mi>B</mi><mo>(</mo><mi>X</mi><mo>)</mo></math></span>. Fast algorithms for this usually also come at the expense of a linear amount of extra temporary space. In particular, they require one to first compute and store the whole quotient <span><math><mi>Q</mi><mo>(</mo><mi>X</mi><mo>)</mo></math></span> such that <span><math><mi>A</mi><mo>=</mo><mi>B</mi><mi>Q</mi><mo>+</mo><mi>R</mi></math></span>. We here propose an <em>in-place</em> algorithm to compute the remainder only. If <em>A</em> and <em>B</em> have respective degree <span><math><mi>m</mi><mo>+</mo><mi>n</mi></math></span> and <em>n</em>, and <span><math><mi>M</mi><mo>(</mo><mi>k</mi><mo>)</mo></math></span> denotes the complexity of a (not-in-place) algorithm to multiply two degree-<em>k</em> polynomials, our algorithm uses at most <span><math><mi>O</mi><mrow><mo>(</mo><mfrac><mrow><mi>m</mi></mrow><mrow><mi>n</mi></mrow></mfrac><mi>M</mi><mo>(</mo><mi>n</mi><mo>)</mo><mi>log</mi><mo></mo><mo>(</mo><mi>n</mi><mo>)</mo><mo>)</mo></mrow></math></span> arithmetic operations. In this particular case this is a factor <span><math><mi>log</mi><mo></mo><mo>(</mo><mi>n</mi><mo>)</mo></math></span> more than the not-in-place algorithm. But if <span><math><mi>M</mi><mo>(</mo><mi>n</mi><mo>)</mo><mo>=</mo><mi>Θ</mi><mo>(</mo><msup><mrow><mi>n</mi></mrow><mrow><mn>1</mn><mo>+</mo><mi>ϵ</mi></mrow></msup><mo>)</mo></math></span> for some <span><math><mi>ϵ</mi><mo>></mo><mn>0</mn></math></span>, then our algorithms do match the not-in-place complexity bound of <span><math><mi>O</mi><mrow><mo>(</mo><mfrac><mrow><mi>m</mi></mrow><mrow><mi>n</mi></mrow></mfrac><mi>M</mi><mo>(</mo><mi>n</mi><mo>)</mo><mo>)</mo></mrow></math></span>. We also propose variants that compute – still in-place and with the same kind of complexity bounds – the over-place remainder <span><math><mi>A</mi><mo>(</mo><mi>X</mi><mo>)</mo><mo>≡</mo><mi>A</mi><mo>(</mo><mi>X</mi><mo>)</mo><mspace></mspace><mrow><mi>mod</mi></mrow><mspace></mspace><mi>B</mi><mo>(</mo><mi>X</mi><mo>)</mo></math></span>, the accumulated remainder <span><math><mi>R</mi><mo>(</mo><mi>X</mi><mo>)</mo><mo>+</mo><mo>=</mo><mi>A</mi><mo>(</mo><mi>X</mi><mo>)</mo><mspace></mspace><mrow><mi>mod</mi></mrow><mspace></mspace><mi>B</mi><mo>(</mo><mi>X</mi><mo>)</mo></math></span> and the accumulated modular multiplication <span><math><mi>R</mi><mo>(</mo><mi>X</mi><mo>)</mo><mo>+</mo><mo>=</mo><mi>A</mi><mo>(</mo><mi>X</mi><mo>)</mo><mi>C</mi><mo>(</mo><mi>X</mi><mo>)</mo><mspace></mspace><mrow><mi>mod</mi></mrow><mspace></mspace><mi>B</mi><mo>(</mo><mi>X</mi><mo>)</mo></math></span>, that is multiplication in a polynomial extension of a finite field.</div><div>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.</div></div>","PeriodicalId":50031,"journal":{"name":"Journal of Symbolic Computation","volume":"134 ","pages":"Article 102523"},"PeriodicalIF":0.9000,"publicationDate":"2026-05-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Journal of Symbolic Computation","FirstCategoryId":"100","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S0747717125001051","RegionNum":4,"RegionCategory":"数学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"2025/10/15 0:00:00","PubModel":"Epub","JCR":"Q4","JCRName":"COMPUTER SCIENCE, THEORY & METHODS","Score":null,"Total":0}
引用次数: 0
Abstract
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 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, but with accumulation the output variables are not even available to store intermediate values. 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 ultimately derive unprecedented 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 modular remainder . Fast algorithms for this usually also come at the expense of a linear amount of extra temporary space. In particular, they require one to first compute and store the whole quotient such that . We here propose an in-place algorithm to compute the remainder only. If A and B have respective degree and n, and denotes the complexity of a (not-in-place) algorithm to multiply two degree-k polynomials, our algorithm uses at most arithmetic operations. In this particular case this is a factor more than the not-in-place algorithm. But if for some , then our algorithms do match the not-in-place complexity bound of . We also propose variants that compute – still in-place and with the same kind of complexity bounds – the over-place remainder , the accumulated remainder and the accumulated modular multiplication , that is multiplication in a polynomial extension of a finite field.
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.
期刊介绍:
An international journal, the Journal of Symbolic Computation, founded by Bruno Buchberger in 1985, is directed to mathematicians and computer scientists who have a particular interest in symbolic computation. The journal provides a forum for research in the algorithmic treatment of all types of symbolic objects: objects in formal languages (terms, formulas, programs); algebraic objects (elements in basic number domains, polynomials, residue classes, etc.); and geometrical objects.
It is the explicit goal of the journal to promote the integration of symbolic computation by establishing one common avenue of communication for researchers working in the different subareas. It is also important that the algorithmic achievements of these areas should be made available to the human problem-solver in integrated software systems for symbolic computation. To help this integration, the journal publishes invited tutorial surveys as well as Applications Letters and System Descriptions.