<s>
The	O
Schönhage	B-Algorithm
–	I-Algorithm
Strassen	I-Algorithm
algorithm	I-Algorithm
is	O
an	O
asymptotically	O
fast	B-Algorithm
multiplication	I-Algorithm
algorithm	O
for	O
large	O
integers	O
,	O
published	O
by	O
Arnold	O
Schönhage	O
and	O
Volker	O
Strassen	O
in	O
1971	O
.	O
</s>
<s>
The	O
Schönhage	B-Algorithm
–	I-Algorithm
Strassen	I-Algorithm
algorithm	I-Algorithm
was	O
the	O
asymptotically	O
fastest	O
multiplication	O
method	O
known	O
from	O
1971	O
until	O
2007	O
.	O
</s>
<s>
It	O
is	O
asymptotically	O
faster	O
than	O
older	O
methods	O
such	O
as	O
Karatsuba	B-Algorithm
and	O
Toom	B-Algorithm
–	I-Algorithm
Cook	I-Algorithm
multiplication	I-Algorithm
,	O
and	O
starts	O
to	O
outperform	O
them	O
in	O
practice	O
for	O
numbers	O
beyond	O
about	O
10,000	O
to	O
100,000	O
decimal	O
digits	O
.	O
</s>
<s>
Applications	O
of	O
the	O
Schönhage	B-Algorithm
–	I-Algorithm
Strassen	I-Algorithm
algorithm	I-Algorithm
include	O
large	O
computations	O
done	O
for	O
their	O
own	O
sake	O
such	O
as	O
the	O
Great	O
Internet	O
Mersenne	O
Prime	O
Search	O
and	O
approximations	O
of	O
,	O
as	O
well	O
as	O
practical	O
applications	O
such	O
as	O
Lenstra	B-Algorithm
elliptic	I-Algorithm
curve	I-Algorithm
factorization	I-Algorithm
via	O
Kronecker	B-Algorithm
substitution	I-Algorithm
,	O
which	O
reduces	O
polynomial	O
multiplication	O
to	O
integer	O
multiplication	O
.	O
</s>
<s>
This	O
variant	O
differs	O
somewhat	O
from	O
Schönhage	O
's	O
original	O
method	O
in	O
that	O
it	O
exploits	O
the	O
discrete	O
weighted	O
transform	O
to	O
perform	O
negacyclic	B-Algorithm
convolutions	I-Algorithm
more	O
efficiently	O
.	O
</s>
<s>
Another	O
source	O
for	O
detailed	O
information	O
is	O
Knuth	O
's	O
The	B-General_Concept
Art	I-General_Concept
of	I-General_Concept
Computer	I-General_Concept
Programming	I-General_Concept
.	O
</s>
<s>
This	O
sequence	O
(	O
4	O
,	O
13	O
,	O
28	O
,	O
27	O
,	O
18	O
)	O
is	O
called	O
the	O
acyclic	O
or	O
linear	O
convolution	B-Language
of	O
the	O
two	O
original	O
sequences	O
(	O
1	O
,	O
2	O
,	O
3	O
)	O
and	O
(	O
4	O
,	O
5	O
,	O
6	O
)	O
.	O
</s>
<s>
Once	O
we	O
have	O
the	O
acyclic	O
convolution	B-Language
of	O
two	O
sequences	O
,	O
computing	O
the	O
product	O
of	O
the	O
original	O
numbers	O
is	O
easy	O
:	O
we	O
just	O
perform	O
the	O
carrying	O
(	O
for	O
example	O
,	O
in	O
the	O
rightmost	O
column	O
,	O
we	O
keep	O
the	O
8	O
and	O
add	O
the	O
1	O
to	O
the	O
column	O
containing	O
27	O
)	O
.	O
</s>
<s>
There	O
are	O
two	O
other	O
types	O
of	O
convolutions	B-Language
that	O
will	O
be	O
useful	O
.	O
</s>
<s>
Then	O
the	O
acyclic	O
convolution	B-Language
has	O
n+n−1	O
elements	O
;	O
if	O
we	O
take	O
the	O
rightmost	O
n	O
elements	O
and	O
add	O
the	O
leftmost	O
n−1	O
elements	O
,	O
identifying	O
digits	O
which	O
are	O
n	O
apart	O
,	O
this	O
produces	O
the	O
cyclic	B-Algorithm
convolution	I-Algorithm
:	O
</s>
<s>
If	O
we	O
perform	O
carrying	O
on	O
the	O
cyclic	B-Algorithm
convolution	I-Algorithm
,	O
the	O
result	O
is	O
equivalent	O
to	O
the	O
product	O
of	O
the	O
inputs	O
mod	O
Bn−1	O
.	O
</s>
<s>
Conversely	O
,	O
if	O
we	O
take	O
the	O
rightmost	O
n	O
elements	O
and	O
subtract	O
the	O
leftmost	O
n−1	O
elements	O
,	O
this	O
produces	O
the	O
negacyclic	B-Algorithm
convolution	I-Algorithm
:	O
</s>
<s>
If	O
we	O
perform	O
carrying	O
on	O
the	O
negacyclic	B-Algorithm
convolution	I-Algorithm
,	O
the	O
result	O
is	O
equivalent	O
to	O
the	O
product	O
of	O
the	O
inputs	O
mod	O
Bn+1	O
.	O
</s>
<s>
The	O
negacyclic	B-Algorithm
convolution	I-Algorithm
can	O
contain	O
negative	O
numbers	O
,	O
which	O
can	O
be	O
eliminated	O
during	O
carrying	O
using	O
borrowing	O
,	O
as	O
is	O
done	O
in	O
long	O
subtraction	O
.	O
</s>
<s>
Like	O
other	O
multiplication	O
methods	O
based	O
on	O
the	O
fast	O
Fourier	O
transform	O
,	O
Schönhage	O
–	O
Strassen	O
depends	O
fundamentally	O
on	O
the	O
convolution	B-Language
theorem	O
,	O
which	O
provides	O
an	O
efficient	O
way	O
to	O
compute	O
the	O
cyclic	B-Algorithm
convolution	I-Algorithm
of	O
two	O
sequences	O
.	O
</s>
<s>
The	O
cyclic	B-Algorithm
convolution	I-Algorithm
of	O
two	O
vectors	O
can	O
be	O
found	O
by	O
taking	O
the	O
discrete	B-Algorithm
Fourier	I-Algorithm
transform	I-Algorithm
(	O
DFT	O
)	O
of	O
each	O
of	O
them	O
,	O
multiplying	O
the	O
resulting	O
vectors	O
element	O
by	O
element	O
,	O
and	O
then	O
taking	O
the	O
inverse	B-Algorithm
discrete	I-Algorithm
Fourier	I-Algorithm
transform	I-Algorithm
(	O
IDFT	O
)	O
.	O
</s>
<s>
If	O
we	O
compute	O
the	O
DFT	O
and	O
IDFT	O
using	O
a	O
fast	O
Fourier	O
transform	O
algorithm	O
,	O
and	O
invoke	O
our	O
multiplication	B-Algorithm
algorithm	I-Algorithm
recursively	O
to	O
multiply	O
the	O
entries	O
of	O
the	O
transformed	O
vectors	O
DFT(X )	O
and	O
DFT(Y )	O
,	O
this	O
yields	O
an	O
efficient	O
algorithm	O
for	O
computing	O
the	O
cyclic	B-Algorithm
convolution	I-Algorithm
.	O
</s>
<s>
In	O
this	O
algorithm	O
,	O
it	O
will	O
be	O
more	O
useful	O
to	O
compute	O
the	O
negacyclic	B-Algorithm
convolution	I-Algorithm
;	O
as	O
it	O
turns	O
out	O
,	O
a	O
slightly	O
modified	O
version	O
of	O
the	O
convolution	B-Language
theorem	O
(	O
see	O
discrete	O
weighted	O
transform	O
)	O
can	O
enable	O
this	O
as	O
well	O
.	O
</s>
<s>
The	O
discrete	B-Algorithm
Fourier	I-Algorithm
transform	I-Algorithm
is	O
an	O
abstract	O
operation	O
that	O
can	O
be	O
performed	O
in	O
any	O
algebraic	O
ring	O
;	O
typically	O
it	O
's	O
performed	O
in	O
the	O
complex	O
numbers	O
,	O
but	O
actually	O
performing	O
complex	O
arithmetic	O
to	O
sufficient	O
precision	O
to	O
ensure	O
accurate	O
results	O
for	O
multiplication	O
is	O
slow	O
and	O
error-prone	O
.	O
</s>
<s>
The	O
element-by-element	O
recursive	O
multiplications	O
of	O
the	O
transformed	O
vectors	O
can	O
be	O
performed	O
using	O
a	O
negacyclic	B-Algorithm
convolution	I-Algorithm
,	O
which	O
is	O
faster	O
than	O
an	O
acyclic	O
convolution	B-Language
and	O
already	O
has	O
"	O
for	O
free	O
"	O
the	O
effect	O
of	O
reducing	O
its	O
result	O
mod	O
2n+1	O
.	O
</s>
<s>
To	O
make	O
the	O
recursive	O
multiplications	O
convenient	O
,	O
we	O
will	O
frame	O
Schönhage	O
–	O
Strassen	O
as	O
being	O
a	O
specialized	O
multiplication	B-Algorithm
algorithm	I-Algorithm
for	O
computing	O
not	O
just	O
the	O
product	O
of	O
two	O
numbers	O
,	O
but	O
the	O
product	O
of	O
two	O
numbers	O
mod	O
2n+1	O
for	O
some	O
given	O
n	O
.	O
This	O
is	O
not	O
a	O
loss	O
of	O
generality	O
,	O
since	O
one	O
can	O
always	O
choose	O
n	O
large	O
enough	O
so	O
that	O
the	O
product	O
mod	O
2n+1	O
is	O
simply	O
the	O
product	O
.	O
</s>
<s>
The	O
algorithm	O
follows	O
a	O
split	O
,	O
evaluate	O
(	O
forward	O
FFT	O
)	O
,	O
pointwise	O
multiply	O
,	O
interpolate	O
(	O
inverse	O
FFT	O
)	O
,	O
and	O
combine	O
phases	O
similar	O
to	O
Karatsuba	B-Algorithm
and	O
Toom-Cook	B-Algorithm
methods	O
.	O
</s>
<s>
Compute	O
the	O
product	O
of	O
X	O
and	O
Y	O
mod	O
2N+1	O
using	O
the	O
negacyclic	B-Algorithm
convolution	I-Algorithm
:	O
</s>
<s>
Each	O
element	O
of	O
the	O
convolution	B-Language
is	O
the	O
sum	O
of	O
at	O
most	O
2k	O
such	O
products	O
,	O
and	O
so	O
cannot	O
exceed	O
2N/2k	O
+	O
k	O
bits	O
.	O
</s>
<s>
It	O
is	O
based	O
primarily	O
on	O
a	O
2007	O
work	O
by	O
Gaudry	O
,	O
Kruppa	O
,	O
and	O
Zimmermann	O
describing	O
enhancements	O
to	O
the	O
GNU	B-Application
Multi-Precision	I-Application
Library	I-Application
.	O
</s>
<s>
Below	O
a	O
certain	O
cutoff	O
point	O
,	O
it	O
's	O
more	O
efficient	O
to	O
perform	O
the	O
recursive	O
multiplications	O
using	O
other	O
algorithms	O
,	O
such	O
as	O
Toom	B-Algorithm
–	I-Algorithm
Cook	I-Algorithm
multiplication	I-Algorithm
.	O
</s>
<s>
Iterative	O
FFT	O
algorithms	O
such	O
as	O
the	O
Cooley	B-Algorithm
–	I-Algorithm
Tukey	I-Algorithm
FFT	I-Algorithm
algorithm	I-Algorithm
,	O
although	O
frequently	O
used	O
for	O
FFTs	O
on	O
vectors	O
of	O
complex	O
numbers	O
,	O
tend	O
to	O
exhibit	O
very	O
poor	O
cache	B-General_Concept
locality	I-General_Concept
with	O
the	O
large	O
vector	O
entries	O
used	O
in	O
Schönhage	O
–	O
Strassen	O
.	O
</s>
