加快十进制乘法
Speeding up decimal multiplication
摘要:
十进制乘法是将两个数字在基$10^N.$中相乘的任务。具体来说,我们将重点讨论数论变换(NTT)系列算法。仅使用可移植的技术,我们实现了3倍-5倍的加速比mpdecimal库。在本文中,我们描述了我们的实现,并讨论进一步可能的优化。我们还提出了一个简单的高速缓存有效的算法,就地$2n \times n$或$n \times 2n$矩阵转置,需要出现在“六步算法”的矩阵傅立叶算法的变化,这似乎并不广为人知。另一个发现是,使用两个素数模而不是三个素数模是有意义的,即使考虑到增加输入大小的最坏情况,也会使答案恢复更简单。
英文摘要:
Decimal multiplication is the task of multiplying two numbers in base $10^N.$ Specifically, we focus on the number-theoretic transform (NTT) family of algorithms. Using only portable techniques, we achieve a 3x-5x speedup over the mpdecimal library. In this paper we describe our implementation and discuss further possible optimizations. We also present a simple cache-efficient algorithm for in-place $2n \times n$ or $n \times 2n$ matrix transposition, the need for which arises in the "six-step algorithm" variation of the matrix Fourier algorithm, and which does not seem to be widely known. Another finding is that use of two prime moduli instead of three makes sense even considering the worst case of increasing the size of the input, and makes for simpler answer recovery.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。