Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Schönhage–Strassen algorithm

From Wikipedia, the free encyclopedia
Multiplication algorithm
icon
This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Schönhage–Strassen algorithm" – news ·newspapers ·books ·scholar ·JSTOR
(October 2024) (Learn how and when to remove this message)
The Schönhage–Strassen algorithm is based on thefast Fourier transform (FFT) method of integer multiplication. This figure demonstrates multiplying 1234 × 5678 = 7006652 using the simple FFT method. Base 10 is used in place of base 2w for illustrative purposes.
Schönhage (on the right) and Strassen (on the left) playing chess inOberwolfach, 1979

TheSchönhage–Strassen algorithm is an asymptotically fastmultiplication algorithm for largeintegers, published byArnold Schönhage andVolker Strassen in 1971.[1] It works by recursively applyingfast Fourier transform (FFT) overthe integers modulo2n+1{\displaystyle 2^{n}+1}. The run-timebit complexity to multiply twon-digit numbers using the algorithm isO(nlognloglogn){\displaystyle O(n\cdot \log n\cdot \log \log n)} inbigO notation.

The Schönhage–Strassen algorithm was theasymptotically fastest multiplication method known from 1971 until 2007. It is asymptotically faster than older methods such asKaratsuba andToom–Cook multiplication, and starts to outperform them in practice for numbers beyond about 10,000 to 100,000 decimal digits.[2] In 2007, Martin Fürer publishedan algorithm with faster asymptotic complexity.[3] In 2019, David Harvey andJoris van der Hoeven demonstrated that multi-digit multiplication has theoreticalO(nlogn){\displaystyle O(n\log n)} complexity; however, their algorithm has constant factors which make it impossibly slow for any conceivable practical problem (seegalactic algorithm).[4]

Applications of the Schönhage–Strassen algorithm include large computations done for their own sake such as theGreat Internet Mersenne Prime Search andapproximations ofπ, as well as practical applications such asLenstra elliptic curve factorization viaKronecker substitution, which reduces polynomial multiplication to integer multiplication.[5][6]

Description

[edit]

This section has a simplified version of the algorithm, showing how to compute the productab{\displaystyle ab} of two natural numbersa,b{\displaystyle a,b}, modulo a number of the form2n+1{\displaystyle 2^{n}+1}, wheren=2kM{\displaystyle n=2^{k}M} is some fixed number. The integersa,b{\displaystyle a,b} are to be divided intoD=2k{\displaystyle D=2^{k}} blocks ofM{\displaystyle M} bits, so in practical implementations, it is important to strike the right balance between the parametersM,k{\displaystyle M,k}. In any case, this algorithm will provide a way to multiply two positive integers, providedn{\displaystyle n} is chosen so thatab<2n+1{\displaystyle ab<2^{n}+1}.

Letn=DM{\displaystyle n=DM} be the number of bits in the signalsa{\displaystyle a} andb{\displaystyle b}, whereD=2k{\displaystyle D=2^{k}} is a power of two. Divide the signalsa{\displaystyle a} andb{\displaystyle b} intoD{\displaystyle D} blocks ofM{\displaystyle M} bits each, storing the resulting blocks as arraysA,B{\displaystyle A,B} (whose entries we shall consider for simplicity as arbitrary precision integers).

We now select a modulus for the Fourier transform, as follows. LetM{\displaystyle M'} be such thatDM2M+k{\displaystyle DM'\geq 2M+k}. Also putn=DM{\displaystyle n'=DM'}, and regard the elements of the arraysA,B{\displaystyle A,B} as (arbitrary precision) integers modulo2n+1{\displaystyle 2^{n'}+1}. Observe that since2n+122M+k+1=D22M+1{\displaystyle 2^{n'}+1\geq 2^{2M+k}+1=D2^{2M}+1}, the modulus is large enough to accommodate any carries that can result from multiplyinga{\displaystyle a} andb{\displaystyle b}. Thus, the productab{\displaystyle ab} (modulo2n+1{\displaystyle 2^{n}+1}) can be calculated by evaluating the convolution ofA,B{\displaystyle A,B}. Also, withg=22M{\displaystyle g=2^{2M'}}, we havegD/21(mod2n+1){\displaystyle g^{D/2}\equiv -1{\pmod {2^{n'}+1}}}, and sog{\displaystyle g} is a primitiveD{\displaystyle D}th root of unity modulo2n+1{\displaystyle 2^{n'}+1}.

We now take the discrete Fourier transform of the arraysA,B{\displaystyle A,B} in the ringZ/(2n+1)Z{\displaystyle \mathbb {Z} /(2^{n'}+1)\mathbb {Z} }, using the root of unityg{\displaystyle g} for the Fourier basis, giving the transformed arraysA^,B^{\displaystyle {\widehat {A}},{\widehat {B}}}. BecauseD=2k{\displaystyle D=2^{k}} is a power of two, this can be achieved in logarithmic time using afast Fourier transform.

LetC^i=A^iB^i{\displaystyle {\widehat {C}}_{i}={\widehat {A}}_{i}{\widehat {B}}_{i}} (pointwise product), and compute the inverse transformC{\displaystyle C} of the arrayC^{\displaystyle {\widehat {C}}}, again using the root of unityg{\displaystyle g}. The arrayC{\displaystyle C} is now the convolution of the arraysA,B{\displaystyle A,B}. Finally, the productab(mod2n+1){\displaystyle ab{\pmod {2^{n}+1}}} is given by evaluatingabjCj2Mjmod2n+1.{\displaystyle ab\equiv \sum _{j}C_{j}2^{Mj}\mod {2^{n}+1}.}

This basic algorithm can be improved in several ways. Firstly, it is not necessary to store the digits ofa,b{\displaystyle a,b} to arbitrary precision, but rather only up ton+1{\displaystyle n'+1} bits, which gives a more efficient machine representation of the arraysA,B{\displaystyle A,B}. Secondly, it is clear that the multiplications in the forward transforms are simple bit shifts. With some care, it is also possible to compute the inverse transform using only shifts. Taking care, it is thus possible to eliminate any true multiplications from the algorithm except for where the pointwise productC^i=A^iB^i{\displaystyle {\widehat {C}}_{i}={\widehat {A}}_{i}{\widehat {B}}_{i}} is evaluated. It is therefore advantageous to select the parametersD,M{\displaystyle D,M} so that this pointwise product can be performed efficiently, either because it is a single machine word or using some optimized algorithm for multiplying integers of a (ideally small) number of words. Selecting the parametersD,M{\displaystyle D,M} is thus an important area for further optimization of the method.

Details

[edit]

Every number in base B, can be written as a polynomial:

X=i=0NxiBi{\displaystyle X=\sum _{i=0}^{N}{x_{i}B^{i}}}

Furthermore, multiplication of two numbers could be thought of as a product of two polynomials:

XY=(i=0NxiBi)(j=0NyiBj){\displaystyle XY=\left(\sum _{i=0}^{N}{x_{i}B^{i}}\right)\left(\sum _{j=0}^{N}{y_{i}B^{j}}\right)}

Because, forBk{\displaystyle B^{k}}:ck=(i,j):i+j=kaibj=i=0kaibki{\displaystyle c_{k}=\sum _{(i,j):i+j=k}{a_{i}b_{j}}=\sum _{i=0}^{k}{a_{i}b_{k-i}}},we have a convolution.

By using FFT (fast Fourier transform), used in the original version rather than NTT (Number-theoretic transform),[7] with convolution rule; we get

f^(ab)=f^(i=0kaibki)=f^(a)f^(b).{\displaystyle {\hat {f}}(a*b)={\hat {f}}\left(\sum _{i=0}^{k}a_{i}b_{k-i}\right)={\hat {f}}(a)\bullet {\hat {f}}(b).}

That is;Ck=akbk{\displaystyle C_{k}=a_{k}\bullet b_{k}}, whereCk{\displaystyle C_{k}}is the corresponding coefficient in Fourier space. This can also be written as:fft(ab)=fft(a)fft(b){\displaystyle {\text{fft}}(a*b)={\text{fft}}(a)\bullet {\text{fft}}(b)}.

We have the same coefficients due to linearity under the Fourier transform, and because these polynomials only consist of one unique term per coefficient:

f^(xn)=(i2π)nδ(n){\displaystyle {\hat {f}}(x^{n})=\left({\frac {i}{2\pi }}\right)^{n}\delta ^{(n)}} and
f^(aX(ξ)+bY(ξ))=aX^(ξ)+bY^(ξ){\displaystyle {\hat {f}}(a\,X(\xi )+b\,Y(\xi ))=a\,{\hat {X}}(\xi )+b\,{\hat {Y}}(\xi )}

Convolution rule:f^(XY)= f^(X)f^(Y){\displaystyle {\hat {f}}(X*Y)=\ {\hat {f}}(X)\bullet {\hat {f}}(Y)}

We have reduced our convolution problemto product problem, through FFT.

By finding the FFT of thepolynomial interpolation of eachCk{\displaystyle C_{k}}, one can determine the desired coefficients.

This algorithm uses thedivide-and-conquer method to divide the problem into subproblems.

Convolution under modN

[edit]
ck=(i,j):i+jk(modN(n))aibj{\displaystyle c_{k}=\sum _{(i,j):i+j\equiv k{\pmod {N(n)}}}a_{i}b_{j}}, whereN(n)=2n+1{\displaystyle N(n)=2^{n}+1}.

By letting:

ai=θiai{\displaystyle a_{i}'=\theta ^{i}a_{i}} andbj=θjbj,{\displaystyle b_{j}'=\theta ^{j}b_{j},}

whereθN=1{\displaystyle \theta ^{N}=-1} is the nth root, one sees that:[8]

Ck=(i,j):i+jk(modN(n))aibj=θk(i,j):i+jk(modN(n))aibj=θk((i,j):i+j=kaibj+(i,j):i+j=k+naibj)=θk((i,j):i+j=kaibjθk+(i,j):i+j=k+naibjθn+k)=(i,j):i+j=kaibj+θn(i,j):i+j=k+naibj.{\displaystyle {\begin{aligned}C_{k}&=\sum _{(i,j):i+j\equiv k{\pmod {N(n)}}}a_{i}b_{j}=\theta ^{-k}\sum _{(i,j):i+j\equiv k{\pmod {N(n)}}}a_{i}'b_{j}'\\[6pt]&=\theta ^{-k}\left(\sum _{(i,j):i+j=k}a_{i}'b_{j}'+\sum _{(i,j):i+j=k+n}a_{i}'b_{j}'\right)\\[6pt]&=\theta ^{-k}\left(\sum _{(i,j):i+j=k}a_{i}b_{j}\theta ^{k}+\sum _{(i,j):i+j=k+n}a_{i}b_{j}\theta ^{n+k}\right)\\[6pt]&=\sum _{(i,j):i+j=k}a_{i}b_{j}+\theta ^{n}\sum _{(i,j):i+j=k+n}a_{i}b_{j}.\end{aligned}}}

This mean, one can use weightθi{\displaystyle \theta ^{i}}, and then multiply withθk{\displaystyle \theta ^{-k}} after.

Instead of using weight, asθN=1{\displaystyle \theta ^{N}=-1}, in first step of recursion (whenn=N{\displaystyle n=N}), one can calculate:

Ck=(i,j):i+jk(modN(N))=(i,j):i+j=kaibj(i,j):i+j=k+naibj{\displaystyle C_{k}=\sum _{(i,j):i+j\equiv k{\pmod {N(N)}}}=\sum _{(i,j):i+j=k}a_{i}b_{j}-\sum _{(i,j):i+j=k+n}a_{i}b_{j}}

In a normal FFT which operates over complex numbers, one would use:

exp(2kπin)=cos2kπn+isin2kπn,k=0,1,,n1.{\displaystyle \exp \left({\frac {2k\pi i}{n}}\right)=\cos {\frac {2k\pi }{n}}+i\sin {\frac {2k\pi }{n}},\qquad k=0,1,\dots ,n-1.}
Ck=θk((i,j):i+j=kaibjθk+(i,j):i+j=k+naibjθn+k)=ei2πk/n((i,j):i+j=kaibjei2πk/n+(i,j):i+j=k+naibjei2π(n+k)/n){\displaystyle {\begin{aligned}C_{k}&=\theta ^{-k}\left(\sum _{(i,j):i+j=k}a_{i}b_{j}\theta ^{k}+\sum _{(i,j):i+j=k+n}a_{i}b_{j}\theta ^{n+k}\right)\\[6pt]&=e^{-i2\pi k/n}\left(\sum _{(i,j):i+j=k}a_{i}b_{j}e^{i2\pi k/n}+\sum _{(i,j):i+j=k+n}a_{i}b_{j}e^{i2\pi (n+k)/n}\right)\end{aligned}}}

However, FFT can also be used as a NTT (number theoretic transformation) in Schönhage–Strassen. This means that we have to use θ to generate numbers in a finite field (for exampleGF(2n+1){\displaystyle \mathrm {GF} (2^{n}+1)}).

A root of unity under a finite fieldGF(r), is an element a such thatθr11{\displaystyle \theta ^{r-1}\equiv 1} orθrθ{\displaystyle \theta ^{r}\equiv \theta }. For exampleGF(p), wherep is aprime number, gives{1,2,,p1}{\displaystyle \{1,2,\ldots ,p-1\}}.

Notice that2n1{\displaystyle 2^{n}\equiv -1} inGF(2n+1){\displaystyle \operatorname {GF} (2^{n}+1)} and21{\displaystyle {\sqrt {2}}\equiv -1} inGF(2n+2+1){\displaystyle \operatorname {GF} (2^{n+2}+1)}. For these candidates,θN1{\displaystyle \theta ^{N}\equiv -1} under its finite field, and therefore act the way we want .

Same FFT algorithms can still be used, though, as long asθ is aroot of unity of a finite field.

To find FFT/NTT transform, we do the following:

Ck=f^(k)=f^(θk((i,j):i+j=kaibjθk+(i,j):i+j=k+naibjθn+k))Ck+k=f^(k+k)=f^((i,j):i+j=2kaibjθk+(i,j):i+j=n+2kaibjθn+k)=f^((i,j):i+j=2kaibjθk+(i,j):i+j=2k+naibjθn+k)=f^(Akk)f^(Bkk)+f^(Akk+n)f^(Bkk+n){\displaystyle {\begin{aligned}C_{k}'&={\hat {f}}(k)={\hat {f}}\left(\theta ^{-k}\left(\sum _{(i,j):i+j=k}a_{i}b_{j}\theta ^{k}+\sum _{(i,j):i+j=k+n}a_{i}b_{j}\theta ^{n+k}\right)\right)\\[6pt]C_{k+k}'&={\hat {f}}(k+k)={\hat {f}}\left(\sum _{(i,j):i+j=2k}a_{i}b_{j}\theta ^{k}+\sum _{(i,j):i+j=n+2k}a_{i}b_{j}\theta ^{n+k}\right)\\[6pt]&={\hat {f}}\left(\sum _{(i,j):i+j=2k}a_{i}b_{j}\theta ^{k}+\sum _{(i,j):i+j=2k+n}a_{i}b_{j}\theta ^{n+k}\right)\\[6pt]&={\hat {f}}\left(A_{k\leftarrow k}\right)\bullet {\hat {f}}(B_{k\leftarrow k})+{\hat {f}}(A_{k\leftarrow k+n})\bullet {\hat {f}}(B_{k\leftarrow k+n})\end{aligned}}}

First product gives contribution tock{\displaystyle c_{k}}, for eachk. Second gives contribution tock{\displaystyle c_{k}}, due to(i+j){\displaystyle (i+j)} modN(n){\displaystyle N(n)}.

To do the inverse:

Ck=2mf1^(θkCk+k){\displaystyle C_{k}=2^{-m}{\hat {f^{-1}}}(\theta ^{-k}C_{k+k}')} orCk=f1^(θkCk+k){\displaystyle C_{k}={\hat {f^{-1}}}(\theta ^{-k}C_{k+k}')}

depending whether data needs to be normalized.

One multiplies by2m{\displaystyle 2^{-m}} to normalize FFT data into a specific range, where1n2mmodN(n){\displaystyle {\frac {1}{n}}\equiv 2^{-m}{\bmod {N}}(n)}, wherem is found using themodular multiplicative inverse.

Implementation details

[edit]

WhyN = 2M + 1 modN

[edit]

In Schönhage–Strassen algorithm,N=2M+1{\displaystyle N=2^{M}+1}. This should be thought of as a binary tree, where one have values in0index2M=2i+j{\displaystyle 0\leq {\text{index}}\leq 2^{M}=2^{i+j}}. By lettingK[0,M]{\displaystyle K\in [0,M]}, for eachK one can find alli+j=K{\displaystyle i+j=K}, and group all(i,j){\displaystyle (i,j)} pairs into M different groups. Usingi+j=k{\displaystyle i+j=k} to group(i,j){\displaystyle (i,j)} pairs through convolution is a classical problem in algorithms.[9]

Having this in mind,N=2M+1{\displaystyle N=2^{M}+1} help us to group(i,j){\displaystyle (i,j)} intoM2k{\displaystyle {\frac {M}{2^{k}}}} groups for each group of subtasks in depthk in a tree withN=2M2k+1{\displaystyle N=2^{\frac {M}{2^{k}}}+1}

Notice thatN=2M+1=22L+1{\displaystyle N=2^{M}+1=2^{2^{L}}+1}, for some L. This makes N aFermat number. When doing modN=2M+1=22L+1{\displaystyle N=2^{M}+1=2^{2^{L}}+1}, we have a Fermat ring.

Because some Fermat numbers are Fermat primes, one can in some cases avoid calculations.

There are otherN that could have been used, of course, with same prime number advantages. By lettingN=2k1{\displaystyle N=2^{k}-1}, one have the maximal number in a binary number withk+1{\displaystyle k+1} bits.N=2k1{\displaystyle N=2^{k}-1} is a Mersenne number, that in some cases is a Mersenne prime. It is a natural candidate against Fermat numberN=22L+1{\displaystyle N=2^{2^{L}}+1}

In search of anotherN

[edit]

Doing several mod calculations against differentN, can be helpful when it comes to solving integer product. By using theChinese remainder theorem, after splittingM into smaller different types ofN, one can find the answer of multiplicationxy[10]

Fermat numbers and Mersenne numbers are just two types of numbers, in something called generalized Fermat Mersenne number (GSM); with formula:[11]

Gq,p,n=i=1pq(pi)n=qpn1qn1{\displaystyle G_{q,p,n}=\sum _{i=1}^{p}q^{(p-i)n}={\frac {q^{pn}-1}{q^{n}-1}}}
Mp,n=G2,p,n{\displaystyle M_{p,n}=G_{2,p,n}}

In this formula,M2,2k{\displaystyle M_{2,2^{k}}} is a Fermat number, andMp,1{\displaystyle M_{p,1}} is a Mersenne number.

This formula can be used to generate sets of equations, that can be used in CRT (Chinese remainder theorem):[12]

g(Mp,n1)21(modMp,n){\displaystyle g^{\frac {(M_{p,n}-1)}{2}}\equiv -1{\pmod {M_{p,n}}}}, whereg is a number such that there exists anx wherex2g(modMp,n){\displaystyle x^{2}\equiv g{\pmod {M_{p,n}}}}, assumingN=2n{\displaystyle N=2^{n}}

Furthermore;g2(p1)n1a2n1(modMp,n){\displaystyle g^{2^{(p-1)n}-1}\equiv a^{2^{n}-1}{\pmod {M_{p,n}}}}, wherea is an element that generates elements in{1,2,4,...2n1,2n}{\displaystyle \{1,2,4,...2^{n-1},2^{n}\}} in a cyclic manner.

IfN=2t{\displaystyle N=2^{t}}, where1tn{\displaystyle 1\leq t\leq n}, thengt=a(2n1)2nt{\displaystyle g_{t}=a^{(2^{n}-1)2^{n-t}}}.

How to chooseK for a specificN

[edit]

The following formula is helpful, finding a properK (number of groups to divideN bits into) given bit sizeN by calculating efficiency :[13]

E=2NK+kn{\displaystyle E={\frac {{\frac {2N}{K}}+k}{n}}}N is bit size (the one used in2N+1{\displaystyle 2^{N}+1}) at outermost level.K givesNK{\displaystyle {\frac {N}{K}}} groups of bits, whereK=2k{\displaystyle K=2^{k}}.

n is found throughN, K andk by finding the smallestx, such that2N/K+kn=K2x{\displaystyle 2N/K+k\leq n=K2^{x}}

If one assume efficiency above 50%,n22NK,Kn{\displaystyle {\frac {n}{2}}\leq {\frac {2N}{K}},K\leq n} andk is very small compared to rest of formula; one get

K2N{\displaystyle K\leq 2{\sqrt {N}}}

This means: When something is very effective;K is bound above by2N{\displaystyle 2{\sqrt {N}}} or asymptotically bound above byN{\displaystyle {\sqrt {N}}}

Pseudocode

[edit]

Following algorithm, the standard Modular Schönhage-Strassen Multiplication algorithm (with some optimizations), is found in overview through[14]

  1. Split both input numbersa andb into n coefficients of s bits each.

    Use at leastK+1{\displaystyle K+1} bits to store them,

    to allow encoding of the value2K.{\displaystyle 2^{K}.}
  2. Weight both coefficient vectors according to (2.24) with powers ofθ by performing cyclic shifts on them.
  3. Shuffle the coefficientsai{\displaystyle a_{i}} andbj{\displaystyle b_{j}} .
  4. Evaluateai{\displaystyle a_{i}} andbj{\displaystyle b_{j}} . Multiplications by powers of ω are cyclic shifts.
  5. Don pointwise multiplicationsck:=akbk{\displaystyle c_{k}:=a_{k}b_{k}} inZ/(2K+1)Z{\displaystyle Z/(2^{K}+1)Z}. If SMUL is used recursively, provideK as parameter. Otherwise, use some other multiplication function like T3MUL and reduce modulo2K+1{\displaystyle 2^{K}+1} afterwards.
  6. Shuffle the product coefficientsck{\displaystyle c_{k}}.
  7. Evaluate the product coefficientsck{\displaystyle c_{k}}.
  8. Apply the counterweights to theck{\displaystyle c_{k}} according to (2.25). Sinceθ2n1{\displaystyle \theta ^{2n}\equiv 1} it follows thatθkθnk{\displaystyle \theta ^{-k}\equiv \theta ^{n-k}}
  9. Normalize theck{\displaystyle c_{k}} with1/n2m{\displaystyle 1/n\equiv 2^{-m}} (again a cyclic shift).
  10. Add up theck{\displaystyle c_{k}} and propagate the carries. Make sure to properly handle negative coefficients.
  11. Do a reduction modulo2N+1{\displaystyle 2^{N}+1}.
  • T3MUL = Toom–Cook multiplication
  • SMUL = Schönhage–Strassen multiplication
  • Evaluate = FFT/IFFT

Further study

[edit]

For implementation details, one can read the bookPrime Numbers: A Computational Perspective.[15] This variant differs somewhat from Schönhage's original method in that it exploits thediscrete weighted transform to performnegacyclic convolutions more efficiently. Another source for detailed information isKnuth'sThe Art of Computer Programming.[16]

Optimizations

[edit]

This section explains a number of important practical optimizations, when implementing Schönhage–Strassen.

Use of other multiplications algorithm, inside algorithm

[edit]

Below a certain cutoff point, it's more efficient to use other multiplication algorithms, such asToom–Cook multiplication.[17]

Square root of 2 trick

[edit]

The idea is to use2{\displaystyle {\sqrt {2}}} as aroot of unity of order2n+2{\displaystyle 2^{n+2}} in finite fieldGF(2n+2+1){\displaystyle \mathrm {GF} (2^{n+2}+1)} (it is a solution to equationθ2n+21(mod2n+2+1){\displaystyle \theta ^{2^{n+2}}\equiv 1{\pmod {2^{n+2}+1}}}), when weighting values in NTT (number theoretic transformation) approach. It has been shown to save 10% in integer multiplication time.[18]

Granlund's trick

[edit]

By lettingm=N+h{\displaystyle m=N+h}, one can computeuvmod2N+1{\displaystyle uv{\bmod {2^{N}+1}}} and(umod2h)(vmod2h){\displaystyle (u{\bmod {2^{h}}})(v{\bmod {2}}^{h})} in combination with CRT (Chinese Remainder Theorem) to find exact values of multiplicationuv.[19]

References

[edit]
  1. ^Schönhage, Arnold;Strassen, Volker (1971). "Schnelle Multiplikation großer Zahlen" [Fast multiplication of large numbers].Computing (in German).7 (3–4):281–292.doi:10.1007/BF02242355.S2CID 9738629.
  2. ^Karatsuba multiplication has asymptotic complexity of aboutO(n1.58){\displaystyle O(n^{1.58})} and Toom–Cook multiplication has asymptotic complexity of aboutO(n1.46).{\displaystyle O(n^{1.46}).}

    Van Meter, Rodney; Itoh, Kohei M. (2005). "Fast Quantum Modular Exponentiation".Physical Review.71 (5) 052320.arXiv:quant-ph/0408006.Bibcode:2005PhRvA..71e2320V.doi:10.1103/PhysRevA.71.052320.S2CID 14983569.

    A discussion of practical crossover points between various algorithms can be found in:Overview of Magma V2.9 Features, arithmetic sectionArchived 2006-08-20 at theWayback Machine

    Luis Carlos Coronado García, "Can Schönhage multiplication speed up the RSA encryption or decryption?Archived",University of Technology, Darmstadt (2005)

    TheGNU Multi-Precision Library uses it for values of at least 1728 to 7808 64-bit words (33,000 to 150,000 decimal digits), depending on architecture. See:

    "FFT Multiplication (GNU MP 6.2.1)".gmplib.org. Retrieved2021-07-20.

    "MUL_FFT_THRESHOLD".GMP developers' corner. Archived fromthe original on 24 November 2010. Retrieved3 November 2011.

    "MUL_FFT_THRESHOLD".gmplib.org. Retrieved2021-07-20.

  3. ^Fürer's algorithm has asymptotic complexityO(nlogn2Θ(logn)).{\textstyle O{\bigl (}n\cdot \log n\cdot 2^{\Theta (\log ^{*}n)}{\bigr )}.}
    Fürer, Martin (2007)."Faster Integer Multiplication"(PDF).Proc. STOC '07. Symposium on Theory of Computing, San Diego, Jun 2007. pp. 57–66.Archived(PDF) from the original on 2007-03-05. Retrieved2007-10-02.
    Fürer, Martin (2009). "Faster Integer Multiplication".SIAM Journal on Computing.39 (3):979–1005.doi:10.1137/070711761.ISSN 0097-5397.

    Fürer's algorithm is used in the Basic Polynomial Algebra Subprograms (BPAS) open source library. See:Covanov, Svyatoslav; Mohajerani, Davood; Moreno Maza, Marc; Wang, Linxiao (2019-07-08)."Big Prime Field FFT on Multi-core Processors".Proceedings of the 2019 on International Symposium on Symbolic and Algebraic Computation(PDF). Beijing China: ACM. pp. 106–113.doi:10.1145/3326229.3326273.ISBN 978-1-4503-6084-5.S2CID 195848601.

  4. ^Harvey, David;van der Hoeven, Joris (2021)."Integer multiplication in timeO(nlogn){\displaystyle O(n\log n)}"(PDF).Annals of Mathematics. Second Series.193 (2):563–617.doi:10.4007/annals.2021.193.2.4.MR 4224716.S2CID 109934776.
  5. ^This method is used in INRIA'sECM library.
  6. ^"ECMNET".members.loria.fr. Retrieved2023-04-09.
  7. ^Becker, Hanno; Hwang, Vincent; J. Kannwischer, Matthias; Panny, Lorenz (2022)."Efficient Multiplication of Somewhat Small Integers using Number-Theoretic Transforms"(PDF).
  8. ^Lüders, Christoph (2014)."Fast Multiplication of Large Integers: Implementation and Analysis of the DKSS Algorithm". p. 26.
  9. ^Kleinberg, Jon; Tardos, Eva (2005).Algorithm Design (1 ed.). Pearson. p. 237.ISBN 0-321-29535-8.
  10. ^Gaudry, Pierrick; Alexander, Kruppa; Paul, Zimmermann (2007)."A GMP-based implementation of Schönhage-Strassen's large integer multiplication algorithm"(PDF). p. 6.
  11. ^S. Dimitrov, Vassil; V. Cooklev, Todor; D. Donevsky, Borislav (1994)."Generalized Fermat-Mersenne Number Theoretic Transform". p. 2.
  12. ^S. Dimitrov, Vassil; V. Cooklev, Todor; D. Donevsky, Borislav (1994)."Generalized Fermat-Mersenne Number Theoretic Transform". p. 3.
  13. ^Gaudry, Pierrick; Kruppa, Alexander; Zimmermann, Paul (2007)."A GMP-based Implementation of Schönhage-Strassen's Large Integer Multiplication Algorithm"(PDF). p. 2.
  14. ^Lüders, Christoph (2014)."Fast Multiplication of Large Integers: Implementation and Analysis of the DKSS Algorithm". p. 28.
  15. ^R. Crandall & C. Pomerance.Prime Numbers – A Computational Perspective. Second Edition, Springer, 2005. Section 9.5.6: Schönhage method, p. 502.ISBN 0-387-94777-9
  16. ^Knuth, Donald E. (1997)."§ 4.3.3.C: Discrete Fourier transforms".The Art of Computer Programming. Vol. 2: Seminumerical Algorithms (3rd ed.). Addison-Wesley. pp. 305–311.ISBN 0-201-89684-2.
  17. ^Gaudry, Pierrick; Kruppa, Alexander; Zimmermann, Paul (2007)."A GMP-based implementation of Schönhage-Strassen's large integer multiplication algorithm"(PDF). p. 7.
  18. ^Gaudry, Pierrick; Kruppa, Alexander; Zimmermann, Paul (2007)."A GMP-based implementation of Schönhage-Strassen's large integer multiplication algorithm"(PDF). p. 6.
  19. ^Gaudry, Pierrick; Kruppa, Alexander; Zimmermann, Paul (2007)."A GMP-based implementation of Schönhage-Strassen's large integer multiplication algorithm"(PDF). p. 6.
Primality tests
Prime-generating
Integer factorization
Multiplication
Euclideandivision
Discrete logarithm
Greatest common divisor
Modular square root
Other algorithms
  • Italics indicate that algorithm is for numbers of special forms
Retrieved from "https://en.wikipedia.org/w/index.php?title=Schönhage–Strassen_algorithm&oldid=1329970629"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp