Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 20e5f5f

Browse files
committed
fast gcd computation reference and example
1 parent 4bec07a commit 20e5f5f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ __Arithmetic Operations__
113113
### Language-independent optimization
114114

115115

116-
* __Re-arranging Expressions__ : More efficient code for the evaluation of an expression (or the computation of a process) can often be produced if the operations occuring in the expression are evaluated in a different order. This works because by re-arranging expression/operations, what gets added or multiplied to what, gets changed, including the relative number of additions and multiplications, and thus the (overall) relative (computational) costs of each operation. In fact, this is not restricted to arithmetic operations, but any operations whatsoever using symmetries (eg commutative laws, associative laws and distributive laws, when they indeed hold, are actualy examples of arithmetic operator symmetries) of the process/operators and re-arrange to produce same result while having other advantages. That is it, so simple. Classic examples are Horner's Rule <sup> [13](#r13 "Horner rule, wikipedia") </sup>, Karatsuba Multiplication <sup> [14](#r14 "Karatsuba algorithm, wikipedia") </sup>, fast complex multiplication <sup> [15](#r15 "Fast multiplication of complex numbers") </sup>, fast matrix multiplication <sup> [18](#r18 "Strassen algorithm, wikipedia"), [19](#r19 "Coppersmith-Winograd algorithm, wikipedia") </sup>, fast exponentiation <sup> [16](#r16 "Exponentiation by squaring, wikipedia"), [17](#r17 "Fast Exponentiation") </sup>, fast factorials/binomials <sup> [20](#r20 "Comments on Factorial Programs"), [21](#r21 "Fast Factorial Functions") </sup>, fast fourier transform <sup> [57](#r57 "Fast Fourier transform, wikipedia") </sup>, fast fibonacci numbers <sup> [76](#r76 "Fast Fibonacci numbers") </sup>, sorting by merging <sup> [25](#r25 "Merge sort, wikipedia") </sup>, sorting by powers <sup> [26](#r26 "Radix sort, wikipedia") </sup>.
116+
* __Re-arranging Expressions__ : More efficient code for the evaluation of an expression (or the computation of a process) can often be produced if the operations occuring in the expression are evaluated in a different order. This works because by re-arranging expression/operations, what gets added or multiplied to what, gets changed, including the relative number of additions and multiplications, and thus the (overall) relative (computational) costs of each operation. In fact, this is not restricted to arithmetic operations, but any operations whatsoever using symmetries (eg commutative laws, associative laws and distributive laws, when they indeed hold, are actualy examples of arithmetic operator symmetries) of the process/operators and re-arrange to produce same result while having other advantages. That is it, so simple. Classic examples are Horner's Rule <sup> [13](#r13 "Horner rule, wikipedia") </sup>, Karatsuba Multiplication <sup> [14](#r14 "Karatsuba algorithm, wikipedia") </sup>, fast complex multiplication <sup> [15](#r15 "Fast multiplication of complex numbers") </sup>, fast matrix multiplication <sup> [18](#r18 "Strassen algorithm, wikipedia"), [19](#r19 "Coppersmith-Winograd algorithm, wikipedia") </sup>, fast exponentiation <sup> [16](#r16 "Exponentiation by squaring, wikipedia"), [17](#r17 "Fast Exponentiation") </sup>, fast gcd computation <sup> [78](#r78 "A Binary Recursive Gcd Algorithm") </sup>, fast factorials/binomials <sup> [20](#r20 "Comments on Factorial Programs"), [21](#r21 "Fast Factorial Functions") </sup>, fast fourier transform <sup> [57](#r57 "Fast Fourier transform, wikipedia") </sup>, fast fibonacci numbers <sup> [76](#r76 "Fast Fibonacci numbers") </sup>, sorting by merging <sup> [25](#r25 "Merge sort, wikipedia") </sup>, sorting by powers <sup> [26](#r26 "Radix sort, wikipedia") </sup>.
117117

118118

119119
* __Constant Substitution/Propagation__ : Many times an expression is under all cases evaluated to a single constant, the constant value can be replaced instead of the more complex and slower expression (sometimes compilers do that).
@@ -417,4 +417,5 @@ Database Access can be expensive, this means it is usually better to fetch the n
417417
75. <a id="r75" href="https://en.wikipedia.org/wiki/Methods_of_computing_square_roots">Methods of computing square roots</a>
418418
76. <a id="r76" href="https://www.nayuki.io/page/fast-fibonacci-algorithms">Fast Fibonacci numbers</a>
419419
77. <a id="r77" href="https://booking.ai/k-nearest-neighbours-from-slow-to-fast-thanks-to-maths-bec682357ccd">Fast k-Nearest Neighbors (k-NN) algorithm</a>
420+
78. <a id="r78" href="https://hal.inria.fr/file/index/docid/71533/filename/RR-5050.pdf">A Binary Recursive Gcd Algorithm</a>
420421

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /