From 6c9c7c7c6c8636d87462c407a7060840165d3f1f Mon Sep 17 00:00:00 2001 From: realstealthninja Date: Sat, 31 Aug 2024 00:57:25 +0000 Subject: [PATCH] Documentation for 4a03c62dd37ed54a2f1b0208d4bd10df0e354e43 --- ...extended__euclid__algorithm_8cpp__incl.map | 8 +- ...extended__euclid__algorithm_8cpp__incl.md5 | 2 +- ...extended__euclid__algorithm_8cpp__incl.svg | 36 ++++-- ...nded__euclid__algorithm_8cpp__incl_org.svg | 36 ++++-- d9/d5d/extended__euclid__algorithm_8cpp.html | 105 +++++++++--------- 5 files changed, 113 insertions(+), 74 deletions(-) diff --git a/d4/dc7/extended__euclid__algorithm_8cpp__incl.map b/d4/dc7/extended__euclid__algorithm_8cpp__incl.map index 19dbc9843..ba65fa1cc 100644 --- a/d4/dc7/extended__euclid__algorithm_8cpp__incl.map +++ b/d4/dc7/extended__euclid__algorithm_8cpp__incl.map @@ -1,7 +1,9 @@ - + - + - + + + diff --git a/d4/dc7/extended__euclid__algorithm_8cpp__incl.md5 b/d4/dc7/extended__euclid__algorithm_8cpp__incl.md5 index 07a3cc3fd..660162c78 100644 --- a/d4/dc7/extended__euclid__algorithm_8cpp__incl.md5 +++ b/d4/dc7/extended__euclid__algorithm_8cpp__incl.md5 @@ -1 +1 @@ -912a5ae6442784e10eaa3b2b127524ce \ No newline at end of file +bda3ede91d5270b35a16a11d5046c4a8 \ No newline at end of file diff --git a/d4/dc7/extended__euclid__algorithm_8cpp__incl.svg b/d4/dc7/extended__euclid__algorithm_8cpp__incl.svg index 1d7feaf93..3c9dfd52c 100644 --- a/d4/dc7/extended__euclid__algorithm_8cpp__incl.svg +++ b/d4/dc7/extended__euclid__algorithm_8cpp__incl.svg @@ -4,8 +4,8 @@ - + @@ -23,9 +23,9 @@ Node1 - -math/extended_euclid -_algorithm.cpp + +math/extended_euclid +_algorithm.cpp @@ -42,8 +42,8 @@ Node1->Node2 - - + + @@ -60,8 +60,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +cstdint + + + + + +Node1->Node4 + + + diff --git a/d4/dc7/extended__euclid__algorithm_8cpp__incl_org.svg b/d4/dc7/extended__euclid__algorithm_8cpp__incl_org.svg index b478abd33..4ef376518 100644 --- a/d4/dc7/extended__euclid__algorithm_8cpp__incl_org.svg +++ b/d4/dc7/extended__euclid__algorithm_8cpp__incl_org.svg @@ -4,17 +4,17 @@ - + math/extended_euclid_algorithm.cpp Node1 - -math/extended_euclid -_algorithm.cpp + +math/extended_euclid +_algorithm.cpp @@ -31,8 +31,8 @@ Node1->Node2 - - + + @@ -49,8 +49,26 @@ Node1->Node3 - - + + + + + + + +Node4 + + +cstdint + + + + + +Node1->Node4 + + + diff --git a/d9/d5d/extended__euclid__algorithm_8cpp.html b/d9/d5d/extended__euclid__algorithm_8cpp.html index fdac8c3c0..5c8479829 100644 --- a/d9/d5d/extended__euclid__algorithm_8cpp.html +++ b/d9/d5d/extended__euclid__algorithm_8cpp.html @@ -114,10 +114,11 @@ $(function(){initNavTree('d9/d5d/extended__euclid__algorithm_8cpp.html','../../' More...

#include <algorithm>
#include <iostream>
+#include <cstdint>
Include dependency graph for extended_euclid_algorithm.cpp:
-
+

@@ -188,22 +189,22 @@ template<typename T , typename T2 >

-
70 {
-
71 if (B > A)
-
72 std::swap(A, B); // Ensure that A >= B
-
73
-
74 if (B == 0) {
-
75 *GCD = A;
-
76 *x = 1;
-
77 *y = 0;
-
78 } else {
-
79 extendedEuclid(B, A % B, GCD, x, y);
-
80 T2 temp = *x;
-
81 *x = *y;
-
82 *y = temp - (A / B) * (*y);
-
83 }
-
84}
-
void extendedEuclid(T A, T B, T *GCD, T2 *x, T2 *y)
Definition extended_euclid_algorithm.cpp:70
+
71 {
+
72 if (B > A)
+
73 std::swap(A, B); // Ensure that A >= B
+
74
+
75 if (B == 0) {
+
76 *GCD = A;
+
77 *x = 1;
+
78 *y = 0;
+
79 } else {
+
80 extendedEuclid(B, A % B, GCD, x, y);
+
81 T2 temp = *x;
+
82 *x = *y;
+
83 *y = temp - (A / B) * (*y);
+
84 }
+
85}
+
void extendedEuclid(T A, T B, T *GCD, T2 *x, T2 *y)
Definition extended_euclid_algorithm.cpp:71
T swap(T... args)
Here is the call graph for this function:
@@ -259,25 +260,25 @@ template<typename T1 , typename T2 >
-
41 {
-
42 if (B > A)
-
43 std::swap(A, B); // Ensure that A >= B
-
44
-
45 T2 s = 0, s0 = 1;
-
46 T2 t = 1, t0 = 0;
-
47 T1 r = B, r0 = A;
-
48
-
49 while (r != 0) {
-
50 T1 quotient = r0 / r;
-
51 update_step(&r, &r0, quotient);
-
52 update_step(&s, &s0, quotient);
-
53 update_step(&t, &t0, quotient);
-
54 }
-
55 *GCD = r0;
-
56 *x = s0;
-
57 *y = t0;
-
58}
-
void update_step(T *r, T *r0, const T2 quotient)
Definition extended_euclid_algorithm.cpp:24
+
42 {
+
43 if (B > A)
+
44 std::swap(A, B); // Ensure that A >= B
+
45
+
46 T2 s = 0, s0 = 1;
+
47 T2 t = 1, t0 = 0;
+
48 T1 r = B, r0 = A;
+
49
+
50 while (r != 0) {
+
51 T1 quotient = r0 / r;
+
52 update_step(&r, &r0, quotient);
+
53 update_step(&s, &s0, quotient);
+
54 update_step(&t, &t0, quotient);
+
55 }
+
56 *GCD = r0;
+
57 *x = s0;
+
58 *y = t0;
+
59}
+
void update_step(T *r, T *r0, const T2 quotient)
Definition extended_euclid_algorithm.cpp:25
Here is the call graph for this function:
@@ -302,20 +303,20 @@ Here is the call graph for this function:

Main function.

-
87 {
-
88 uint32_t a, b, gcd;
-
89 int32_t x, y;
-
90 std::cin >> a >> b;
-
91 extendedEuclid(a, b, &gcd, &x, &y);
-
92 std::cout << gcd << " " << x << " " << y << std::endl;
-
93 extendedEuclid_1(a, b, &gcd, &x, &y);
-
94 std::cout << gcd << " " << x << " " << y << std::endl;
-
95 return 0;
-
96}
+
88 {
+
89 uint32_t a, b, gcd;
+
90 int32_t x, y;
+
91 std::cin >> a >> b;
+
92 extendedEuclid(a, b, &gcd, &x, &y);
+
93 std::cout << gcd << " " << x << " " << y << std::endl;
+
94 extendedEuclid_1(a, b, &gcd, &x, &y);
+
95 std::cout << gcd << " " << x << " " << y << std::endl;
+
96 return 0;
+
97}
T endl(T... args)
-
void extendedEuclid_1(T1 A, T1 B, T1 *GCD, T2 *x, T2 *y)
Definition extended_euclid_algorithm.cpp:41
+
void extendedEuclid_1(T1 A, T1 B, T1 *GCD, T2 *x, T2 *y)
Definition extended_euclid_algorithm.cpp:42
int gcd(int num1, int num2)
Definition gcd_iterative_euclidean.cpp:15
Here is the call graph for this function:
@@ -369,11 +370,11 @@ template<typename T , typename T2 >
-
24 {
-
25 T temp = *r;
-
26 *r = *r0 - (quotient * temp);
-
27 *r0 = temp;
-
28}
+
25 {
+
26 T temp = *r;
+
27 *r = *r0 - (quotient * temp);
+
28 *r0 = temp;
+
29}