Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Schönhage–Strassen algorithm
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Pseudocode=== Following algorithm, the standard Modular Schönhage-Strassen Multiplication algorithm (with some optimizations), is found in overview through <ref>{{cite web | year=2014 | page=28 |last1=Lüders |first1=Christoph |title=Fast Multiplication of Large Integers: Implementation and Analysis of the DKSS Algorithm |url=https://www.researchgate.net/publication/273701188}}</ref> {{olist |1= Split both input numbers {{mvar|a}} and {{mvar|b}} into n coefficients of s bits each. Use at least {{tmath|K + 1}} bits to store them, to allow encoding of the value {{tmath|2^{K}.}} |2= Weight both coefficient vectors according to (2.24) with powers of {{mvar|θ}} by performing cyclic shifts on them. |3= Shuffle the coefficients {{tmath|a_i}} and {{tmath|b_j}} . |4= Evaluate {{tmath|a_i}} and {{tmath|b_j}} . Multiplications by powers of ω are cyclic shifts. |5= Do {{mvar|n}} pointwise multiplications {{tmath|1=c_k := a_kb_k}} in {{tmath|Z/(2^K + 1)Z}}. If SMUL is used recursively, provide {{mvar|K}} as parameter. Otherwise, use some other multiplication function like T3MUL and reduce modulo {{tmath|2^{K} + 1}} afterwards. |6= Shuffle the product coefficients {{tmath|c_k}}. |7= Evaluate the product coefficients {{tmath|c_k}}. |8= Apply the counterweights to the {{tmath|c_k}} according to (2.25). Since {{tmath|\theta^{2n} \equiv 1}} it follows that {{tmath|\theta^{-k} \equiv \theta^{n-k} }} |9= Normalize the {{tmath|c_k}} with {{tmath|1/n \equiv 2^{-m} }} (again a cyclic shift). |10= Add up the {{tmath|c_k}} and propagate the carries. Make sure to properly handle negative coefficients. |11= Do a reduction modulo {{tmath|2^{N} + 1}}. }} * T3MUL = Toom–Cook multiplication * SMUL = Schönhage–Strassen multiplication * Evaluate = FFT/IFFT
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)