From 1033b1c36726c89c8b3249c690a54eceabab4368 Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Thu, 29 Oct 2020 20:28:07 +0000 Subject: [PATCH] Documentation for fee3a74e35b19be0bd24b584cff7e56a790fb1cf --- d0/d6d/modular__exponentiation_8cpp.html | 233 +++++++++ d0/d6d/modular__exponentiation_8cpp.js | 6 + ...8dca7b867074164d5f45b0f3851269d_cgraph.map | 6 + ...8dca7b867074164d5f45b0f3851269d_cgraph.md5 | 1 + ...8dca7b867074164d5f45b0f3851269d_cgraph.svg | 67 +++ ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map | 7 + ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 | 1 + ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg | 82 +++ d0/dd3/modular__exponentiation_8cpp__incl.map | 5 + d0/dd3/modular__exponentiation_8cpp__incl.md5 | 1 + d0/dd3/modular__exponentiation_8cpp__incl.svg | 52 ++ d1/dbe/lu__decomposition_8h_source.html | 3 + d5/d88/md__d_i_r_e_c_t_o_r_y.html | 1 + d6/d42/miller__rabin_8cpp.html | 6 +- ...f9c31c1047aa3191676d64571d4c506_cgraph.map | 4 +- ...f9c31c1047aa3191676d64571d4c506_cgraph.md5 | 2 +- ...f9c31c1047aa3191676d64571d4c506_cgraph.svg | 20 +- ...8ec9ad42717780d6caaff9d3d6977f9_cgraph.map | 4 +- ...8ec9ad42717780d6caaff9d3d6977f9_cgraph.md5 | 2 +- ...8ec9ad42717780d6caaff9d3d6977f9_cgraph.svg | 20 +- ...ad42717780d6caaff9d3d6977f9_cgraph_org.svg | 20 +- ...01288288ef5ebe8e97414cc30797cce_cgraph.map | 4 +- ...01288288ef5ebe8e97414cc30797cce_cgraph.md5 | 2 +- ...01288288ef5ebe8e97414cc30797cce_cgraph.svg | 20 +- ...8288ef5ebe8e97414cc30797cce_cgraph_org.svg | 20 +- ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map | 4 +- ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 | 2 +- ...66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg | 20 +- ...b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg | 20 +- dd/d47/namespacemath.html | 78 +++ ...cd07701d73ed65cd616bcba02737f3d_cgraph.map | 4 + ...cd07701d73ed65cd616bcba02737f3d_cgraph.md5 | 1 + ...cd07701d73ed65cd616bcba02737f3d_cgraph.svg | 37 ++ dir_296d53ceaeaa7e099814a6def439fe8a.html | 3 + dir_296d53ceaeaa7e099814a6def439fe8a.js | 1 + files.html | 25 +- globals_func_m.html | 19 +- globals_func_t.html | 53 +- globals_m.html | 31 +- globals_t.html | 53 +- namespacemembers.html | 3 + namespacemembers_func.html | 3 + navtreedata.js | 14 +- navtreeindex0.js | 38 +- navtreeindex1.js | 52 +- navtreeindex2.js | 24 +- navtreeindex3.js | 42 +- navtreeindex4.js | 44 +- navtreeindex5.js | 38 +- navtreeindex6.js | 36 +- search/all_10.js | 138 ++--- search/all_11.js | 234 ++++----- search/all_12.js | 42 +- search/all_13.js | 212 ++++---- search/all_14.js | 494 +++++++++--------- search/all_15.js | 220 ++++---- search/all_16.js | 128 ++--- search/all_17.js | 92 ++-- search/all_18.js | 170 +++--- search/all_19.js | 12 +- search/all_1a.js | 8 +- search/all_1b.js | 6 +- search/all_1c.js | 186 +++---- search/all_e.js | 49 +- search/all_f.js | 144 ++--- search/classes_0.js | 40 +- search/classes_1.js | 78 +-- search/classes_10.js | 6 +- search/classes_11.js | 80 +-- search/classes_12.js | 96 ++-- search/classes_13.js | 46 +- search/classes_14.js | 64 +-- search/classes_15.js | 38 +- search/classes_16.js | 62 +-- search/classes_17.js | 4 +- search/classes_18.js | 2 +- search/classes_2.js | 70 +-- search/classes_3.js | 32 +- search/classes_4.js | 34 +- search/classes_5.js | 34 +- search/classes_6.js | 12 +- search/classes_7.js | 18 +- search/classes_8.js | 196 +++---- search/classes_9.js | 2 +- search/classes_a.js | 4 +- search/classes_b.js | 36 +- search/classes_c.js | 76 +-- search/classes_d.js | 36 +- search/classes_e.js | 24 +- search/classes_f.js | 34 +- search/defines_0.js | 4 +- search/defines_1.js | 4 +- search/defines_2.js | 4 +- search/defines_3.js | 2 +- search/defines_4.js | 4 +- search/defines_5.js | 4 +- search/defines_6.js | 4 +- search/files_0.js | 2 +- search/files_1.js | 8 +- search/files_10.js | 26 +- search/files_11.js | 14 +- search/files_12.js | 6 +- search/files_13.js | 36 +- search/files_14.js | 10 +- search/files_15.js | 6 +- search/files_16.js | 4 +- search/files_17.js | 2 +- search/files_2.js | 26 +- search/files_3.js | 20 +- search/files_4.js | 18 +- search/files_5.js | 6 +- search/files_6.js | 18 +- search/files_7.js | 14 +- search/files_8.js | 16 +- search/files_9.js | 8 +- search/files_a.js | 6 +- search/files_b.js | 10 +- search/files_c.js | 26 +- search/files_d.js | 19 +- search/files_e.js | 14 +- search/files_f.js | 8 +- search/functions_0.js | 6 +- search/functions_1.js | 162 +++--- search/functions_10.js | 164 +++--- search/functions_11.js | 18 +- search/functions_12.js | 154 +++--- search/functions_13.js | 378 +++++++------- search/functions_14.js | 164 +++--- search/functions_15.js | 84 +-- search/functions_16.js | 46 +- search/functions_17.js | 150 +++--- search/functions_18.js | 6 +- search/functions_19.js | 2 +- search/functions_1a.js | 4 +- search/functions_1b.js | 186 +++---- search/functions_2.js | 122 ++--- search/functions_3.js | 162 +++--- search/functions_4.js | 188 +++---- search/functions_5.js | 114 ++-- search/functions_6.js | 208 ++++---- search/functions_7.js | 128 ++--- search/functions_8.js | 44 +- search/functions_9.js | 190 +++---- search/functions_a.js | 6 +- search/functions_b.js | 18 +- search/functions_c.js | 102 ++-- search/functions_d.js | 174 +++--- search/functions_e.js | 102 ++-- search/functions_f.js | 116 ++-- search/groups_0.js | 2 +- search/groups_1.js | 4 +- search/groups_2.js | 2 +- search/namespaces_0.js | 2 +- search/namespaces_1.js | 2 +- search/namespaces_10.js | 30 +- search/namespaces_11.js | 2 +- search/namespaces_12.js | 2 +- search/namespaces_13.js | 4 +- search/namespaces_14.js | 2 +- search/namespaces_2.js | 8 +- search/namespaces_3.js | 6 +- search/namespaces_4.js | 4 +- search/namespaces_5.js | 4 +- search/namespaces_6.js | 2 +- search/namespaces_7.js | 2 +- search/namespaces_8.js | 4 +- search/namespaces_9.js | 6 +- search/namespaces_a.js | 10 +- search/namespaces_b.js | 8 +- search/namespaces_c.js | 2 +- search/namespaces_d.js | 6 +- search/namespaces_e.js | 4 +- search/namespaces_f.js | 4 +- search/pages_0.js | 4 +- search/pages_1.js | 2 +- search/pages_2.js | 2 +- search/pages_3.js | 2 +- search/pages_4.js | 4 +- search/related_0.js | 10 +- search/typedefs_0.js | 2 +- search/typedefs_1.js | 2 +- search/typedefs_2.js | 2 +- search/variables_0.js | 4 +- search/variables_1.js | 10 +- search/variables_10.js | 20 +- search/variables_11.js | 2 +- search/variables_12.js | 4 +- search/variables_13.js | 2 +- search/variables_14.js | 2 +- search/variables_15.js | 2 +- search/variables_2.js | 2 +- search/variables_3.js | 4 +- search/variables_4.js | 4 +- search/variables_5.js | 8 +- search/variables_6.js | 16 +- search/variables_7.js | 4 +- search/variables_8.js | 2 +- search/variables_9.js | 6 +- search/variables_a.js | 12 +- search/variables_b.js | 8 +- search/variables_c.js | 16 +- search/variables_d.js | 4 +- search/variables_e.js | 2 +- search/variables_f.js | 18 +- 204 files changed, 4475 insertions(+), 3869 deletions(-) create mode 100644 d0/d6d/modular__exponentiation_8cpp.html create mode 100644 d0/d6d/modular__exponentiation_8cpp.js create mode 100644 d0/d6d/modular__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map create mode 100644 d0/d6d/modular__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 create mode 100644 d0/d6d/modular__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg create mode 100644 d0/d6d/modular__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map create mode 100644 d0/d6d/modular__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 create mode 100644 d0/d6d/modular__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg create mode 100644 d0/dd3/modular__exponentiation_8cpp__incl.map create mode 100644 d0/dd3/modular__exponentiation_8cpp__incl.md5 create mode 100644 d0/dd3/modular__exponentiation_8cpp__incl.svg create mode 100644 dd/d47/namespacemath_afcd07701d73ed65cd616bcba02737f3d_cgraph.map create mode 100644 dd/d47/namespacemath_afcd07701d73ed65cd616bcba02737f3d_cgraph.md5 create mode 100644 dd/d47/namespacemath_afcd07701d73ed65cd616bcba02737f3d_cgraph.svg diff --git a/d0/d6d/modular__exponentiation_8cpp.html b/d0/d6d/modular__exponentiation_8cpp.html new file mode 100644 index 000000000..65f4234dc --- /dev/null +++ b/d0/d6d/modular__exponentiation_8cpp.html @@ -0,0 +1,233 @@ + + + + + + + +Algorithms_in_C++: math/modular_exponentiation.cpp File Reference + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
Algorithms_in_C++ +  1.0.0 +
+
Set of algorithms implemented in C++.
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
modular_exponentiation.cpp File Reference
+
+
+ +

C++ Program for Modular Exponentiation Iteratively. +More...

+
#include <cassert>
+#include <iostream>
+
+Include dependency graph for modular_exponentiation.cpp:
+
+
+
+
+
+ + + + +

+Namespaces

 math
 for std::vector
 
+ + + + + + + + + +

+Functions

uint64_t math::power (uint64_t a, uint64_t b, uint64_t c)
 This function calculates a raised to exponent b under modulo c using modular exponentiation. More...
 
static void test ()
 
int main ()
 Main function. More...
 
+

Detailed Description

+

C++ Program for Modular Exponentiation Iteratively.

+

The task is to calculate the value of an integer a raised to an integer exponent b under modulo c.

Note
The time complexity of this approach is O(log b).
+

Example: (4^3) % 5 (where ^ stands for exponentiation and % for modulo) (4*4*4) % 5 (4 % 5) * ( (4*4) % 5 ) 4 * (16 % 5) 4 * 1 4 We can also verify the result as 4^3 is 64 and 64 modulo 5 is 4

+
Author
Shri2206
+

Function Documentation

+ +

◆ main()

+ +
+
+ + + + + + + + +
int main (void )
+
+ +

Main function.

+
Returns
0 on exit
+
86  {
+
87  test(); // execute the tests
+
88  return 0;
+
89 }
+
+Here is the call graph for this function:
+
+
+
+
+ +
+
+ +

◆ test()

+ +
+
+ + + + + +
+ + + + + + + +
static void test ()
+
+static
+
+

Function for testing power function. test cases and assert statement.

Returns
void
+
60  {
+
61  uint32_t test_case_1 = math::power(2, 5, 13);
+
62  assert(test_case_1 == 6);
+
63  std::cout << "Test 1 Passed!" << std::endl;
+
64 
+
65  uint32_t test_case_2 = math::power(14, 7, 15);
+
66  assert(test_case_2 == 14);
+
67  std::cout << "Test 2 Passed!" << std::endl;
+
68 
+
69  uint64_t test_case_3 = math::power(8, 15, 41);
+
70  assert(test_case_3 == 32);
+
71  std::cout << "Test 3 Passed!" << std::endl;
+
72 
+
73  uint64_t test_case_4 = math::power(27, 2, 5);
+
74  assert(test_case_4 == 4);
+
75  std::cout << "Test 4 Passed!" << std::endl;
+
76 
+
77  uint16_t test_case_5 = math::power(7, 3, 6);
+
78  assert(test_case_5 == 1);
+
79  std::cout << "Test 5 Passed!" << std::endl;
+
80 }
+
+Here is the call graph for this function:
+
+
+
+
+ +
+
+
+
+
test
static void test()
Definition: modular_exponentiation.cpp:60
+
std::cout
+
std::endl
T endl(T... args)
+
math::power
uint64_t power(uint64_t a, uint64_t b, uint64_t c)
This function calculates a raised to exponent b under modulo c using modular exponentiation.
Definition: modular_exponentiation.cpp:35
+ + + + diff --git a/d0/d6d/modular__exponentiation_8cpp.js b/d0/d6d/modular__exponentiation_8cpp.js new file mode 100644 index 000000000..697a9d4e1 --- /dev/null +++ b/d0/d6d/modular__exponentiation_8cpp.js @@ -0,0 +1,6 @@ +var modular__exponentiation_8cpp = +[ + [ "main", "d0/d6d/modular__exponentiation_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ], + [ "power", "d0/d6d/modular__exponentiation_8cpp.html#afcd07701d73ed65cd616bcba02737f3d", null ], + [ "test", "d0/d6d/modular__exponentiation_8cpp.html#aa8dca7b867074164d5f45b0f3851269d", null ] +]; \ No newline at end of file diff --git a/d0/d6d/modular__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map b/d0/d6d/modular__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map new file mode 100644 index 000000000..00b7d7fb8 --- /dev/null +++ b/d0/d6d/modular__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.map @@ -0,0 +1,6 @@ + + + + + + diff --git a/d0/d6d/modular__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 b/d0/d6d/modular__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 new file mode 100644 index 000000000..f39224c14 --- /dev/null +++ b/d0/d6d/modular__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.md5 @@ -0,0 +1 @@ +c98e258a360fbfbad5467a3a3e564bc5 \ No newline at end of file diff --git a/d0/d6d/modular__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg b/d0/d6d/modular__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg new file mode 100644 index 000000000..a73637db7 --- /dev/null +++ b/d0/d6d/modular__exponentiation_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg @@ -0,0 +1,67 @@ + + + + + + +test + + + +Node1 + + +test + + + + + +Node2 + + +std::endl + + + + + +Node1->Node2 + + + + + +Node3 + + +math::power + + + + + +Node1->Node3 + + + + + +Node4 + + +ans + + + + + +Node3->Node4 + + + + + diff --git a/d0/d6d/modular__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map b/d0/d6d/modular__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map new file mode 100644 index 000000000..f7b07b240 --- /dev/null +++ b/d0/d6d/modular__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map @@ -0,0 +1,7 @@ + + + + + + + diff --git a/d0/d6d/modular__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 b/d0/d6d/modular__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 new file mode 100644 index 000000000..0f80b3a18 --- /dev/null +++ b/d0/d6d/modular__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 @@ -0,0 +1 @@ +29d3adc14c19f395a32105f584f17320 \ No newline at end of file diff --git a/d0/d6d/modular__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg b/d0/d6d/modular__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg new file mode 100644 index 000000000..85f0aabd0 --- /dev/null +++ b/d0/d6d/modular__exponentiation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg @@ -0,0 +1,82 @@ + + + + + + +main + + + +Node1 + + +main + + + + + +Node2 + + +test + + + + + +Node1->Node2 + + + + + +Node3 + + +std::endl + + + + + +Node2->Node3 + + + + + +Node4 + + +math::power + + + + + +Node2->Node4 + + + + + +Node5 + + +ans + + + + + +Node4->Node5 + + + + + diff --git a/d0/dd3/modular__exponentiation_8cpp__incl.map b/d0/dd3/modular__exponentiation_8cpp__incl.map new file mode 100644 index 000000000..b7f11899e --- /dev/null +++ b/d0/dd3/modular__exponentiation_8cpp__incl.map @@ -0,0 +1,5 @@ + + + + + diff --git a/d0/dd3/modular__exponentiation_8cpp__incl.md5 b/d0/dd3/modular__exponentiation_8cpp__incl.md5 new file mode 100644 index 000000000..bd12acb79 --- /dev/null +++ b/d0/dd3/modular__exponentiation_8cpp__incl.md5 @@ -0,0 +1 @@ +1e323bfb5256fa048b24ade80c70278d \ No newline at end of file diff --git a/d0/dd3/modular__exponentiation_8cpp__incl.svg b/d0/dd3/modular__exponentiation_8cpp__incl.svg new file mode 100644 index 000000000..bd5be2c1b --- /dev/null +++ b/d0/dd3/modular__exponentiation_8cpp__incl.svg @@ -0,0 +1,52 @@ + + + + + + +math/modular_exponentiation.cpp + + + +Node1 + + +math/modular_exponentiation.cpp + + + + + +Node2 + + +cassert + + + + + +Node1->Node2 + + + + + +Node3 + + +iostream + + + + + +Node1->Node3 + + + + + diff --git a/d1/dbe/lu__decomposition_8h_source.html b/d1/dbe/lu__decomposition_8h_source.html index 3a23af20c..1384a59da 100644 --- a/d1/dbe/lu__decomposition_8h_source.html +++ b/d1/dbe/lu__decomposition_8h_source.html @@ -225,6 +225,7 @@ $(document).ready(function(){initNavTree('d1/dbe/lu__decomposition_8h_source.htm
std::vector
STL class.
test2
void test2()
Definition: lu_decompose.cpp:66
std::vector::size
T size(T... args)
+
test
static void test()
Definition: modular_exponentiation.cpp:60
multiply
int multiply(int x, int res[], int res_size)
Definition: power_for_huge_numbers.cpp:25
test_2
static void test_2()
Definition: heavy_light_decomposition.cpp:549
ans
ll ans(ll n)
Definition: matrix_exponentiation.cpp:91
@@ -290,6 +291,7 @@ $(document).ready(function(){initNavTree('d1/dbe/lu__decomposition_8h_source.htm
std::rand
T rand(T... args)
std::swap
T swap(T... args)
lu_decomposition.h
Functions associated with LU Decomposition of a square matrix.
+
main
int main()
Main function.
Definition: modular_exponentiation.cpp:86
test_function
void test_function(const float *test_data, const int number_of_samples)
Definition: realtime_stats.cpp:118
SieveOfEratosthenes
void SieveOfEratosthenes(int N)
Definition: prime_factorization.cpp:23
std::string::substr
T substr(T... args)
@@ -309,6 +311,7 @@ $(document).ready(function(){initNavTree('d1/dbe/lu__decomposition_8h_source.htm
main
int main()
Definition: number_of_positive_divisors.cpp:81
std::vector::cbegin
T cbegin(T... args)
main
int main()
Definition: miller_rabin.cpp:183
+
math::power
uint64_t power(uint64_t a, uint64_t b, uint64_t c)
This function calculates a raised to exponent b under modulo c using modular exponentiation.
Definition: modular_exponentiation.cpp:35
std::strtod
T strtod(T... args)
math
for std::vector
main
int main()
Definition: power_for_huge_numbers.cpp:82
diff --git a/d5/d88/md__d_i_r_e_c_t_o_r_y.html b/d5/d88/md__d_i_r_e_c_t_o_r_y.html index d678926f9..c9ac28991 100644 --- a/d5/d88/md__d_i_r_e_c_t_o_r_y.html +++ b/d5/d88/md__d_i_r_e_c_t_o_r_y.html @@ -264,6 +264,7 @@ Math
  • Least Common Multiple
  • Magic Number
  • Miller Rabin
  • +
  • Modular Exponentiation
  • Modular Inverse Fermat Little Theorem
  • Number Of Positive Divisors
  • Power For Huge Numbers
  • diff --git a/d6/d42/miller__rabin_8cpp.html b/d6/d42/miller__rabin_8cpp.html index 3a297c8da..06f2346ee 100644 --- a/d6/d42/miller__rabin_8cpp.html +++ b/d6/d42/miller__rabin_8cpp.html @@ -280,9 +280,9 @@ template<typename T >
    80  // Random number generated in the range [2, num -2].
    81  T random = distribution(gen);
    82  // vector for reverse binary of the power
    -
    83  std::vector<T> power = reverse_binary(d);
    +
    83  std::vector<T> power = reverse_binary(d);
    84  // x = random ^ d % num
    -
    85  T x = modular_exponentiation(random, power, num);
    +
    85  T x = modular_exponentiation(random, power, num);
    86  // miller conditions
    87  if (x == 1 || x == num - 1) {
    88  return true;
    @@ -474,7 +474,6 @@ Here is the call graph for this function:
    std::vector
    STL class.
    std::vector::size
    T size(T... args)
    reverse_binary
    std::vector< T > reverse_binary(T num)
    Definition: miller_rabin.cpp:19
    -
    power
    void power(int x, int n)
    Definition: power_for_huge_numbers.cpp:56
    std::mt19937
    std::vector::push_back
    T push_back(T... args)
    std::random_device
    @@ -483,6 +482,7 @@ Here is the call graph for this function:
    miller_test
    bool miller_test(T d, T num)
    Definition: miller_rabin.cpp:73
    std::endl
    T endl(T... args)
    std::vector::cbegin
    T cbegin(T... args)
    +
    math::power
    uint64_t power(uint64_t a, uint64_t b, uint64_t c)
    This function calculates a raised to exponent b under modulo c using modular exponentiation.
    Definition: modular_exponentiation.cpp:35
    std::vector::cend
    T cend(T... args)
    tests
    void tests()
    Definition: miller_rabin.cpp:157
    diff --git a/d6/d42/miller__rabin_8cpp_a6f9c31c1047aa3191676d64571d4c506_cgraph.map b/d6/d42/miller__rabin_8cpp_a6f9c31c1047aa3191676d64571d4c506_cgraph.map index 4399f8fe4..49f223fdf 100644 --- a/d6/d42/miller__rabin_8cpp_a6f9c31c1047aa3191676d64571d4c506_cgraph.map +++ b/d6/d42/miller__rabin_8cpp_a6f9c31c1047aa3191676d64571d4c506_cgraph.map @@ -1,11 +1,11 @@ - + - + diff --git a/d6/d42/miller__rabin_8cpp_a6f9c31c1047aa3191676d64571d4c506_cgraph.md5 b/d6/d42/miller__rabin_8cpp_a6f9c31c1047aa3191676d64571d4c506_cgraph.md5 index bee4cd4d9..39885b8f0 100644 --- a/d6/d42/miller__rabin_8cpp_a6f9c31c1047aa3191676d64571d4c506_cgraph.md5 +++ b/d6/d42/miller__rabin_8cpp_a6f9c31c1047aa3191676d64571d4c506_cgraph.md5 @@ -1 +1 @@ -5e44c3a25eccbcbc07571ee825b95385 \ No newline at end of file +9ed9375634f880334e3903435b0662d7 \ No newline at end of file diff --git a/d6/d42/miller__rabin_8cpp_a6f9c31c1047aa3191676d64571d4c506_cgraph.svg b/d6/d42/miller__rabin_8cpp_a6f9c31c1047aa3191676d64571d4c506_cgraph.svg index 8c200ce89..ed72b2b52 100644 --- a/d6/d42/miller__rabin_8cpp_a6f9c31c1047aa3191676d64571d4c506_cgraph.svg +++ b/d6/d42/miller__rabin_8cpp_a6f9c31c1047aa3191676d64571d4c506_cgraph.svg @@ -36,17 +36,17 @@ Node6 - - -power + + +math::power Node1->Node6 - - + + @@ -111,17 +111,17 @@ Node7 - - -multiply + + +ans Node6->Node7 - - + + diff --git a/d6/d42/miller__rabin_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.map b/d6/d42/miller__rabin_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.map index c409e4798..7587ff9f4 100644 --- a/d6/d42/miller__rabin_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.map +++ b/d6/d42/miller__rabin_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.map @@ -4,11 +4,11 @@ - + - + diff --git a/d6/d42/miller__rabin_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.md5 b/d6/d42/miller__rabin_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.md5 index 36f795500..ac7760e81 100644 --- a/d6/d42/miller__rabin_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.md5 +++ b/d6/d42/miller__rabin_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.md5 @@ -1 +1 @@ -4b7ba908b1de0da2a2dc92abb0efcd1f \ No newline at end of file +4d422e58ca12055ad8a39c3c2acbcc1d \ No newline at end of file diff --git a/d6/d42/miller__rabin_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.svg b/d6/d42/miller__rabin_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.svg index 6e643e698..ba58436f4 100644 --- a/d6/d42/miller__rabin_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.svg +++ b/d6/d42/miller__rabin_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.svg @@ -127,17 +127,17 @@ var sectionId = 'dynsection-6'; Node9 - - -power + + +math::power Node4->Node9 - - + + @@ -202,17 +202,17 @@ var sectionId = 'dynsection-6'; Node10 - - -multiply + + +ans Node9->Node10 - - + + diff --git a/d6/d42/miller__rabin_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph_org.svg b/d6/d42/miller__rabin_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph_org.svg index b954a44fa..47de14d6a 100644 --- a/d6/d42/miller__rabin_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph_org.svg +++ b/d6/d42/miller__rabin_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph_org.svg @@ -81,17 +81,17 @@ Node9 - - -power + + +math::power Node4->Node9 - - + + @@ -156,17 +156,17 @@ Node10 - - -multiply + + +ans Node9->Node10 - - + + diff --git a/d6/d42/miller__rabin_8cpp_a901288288ef5ebe8e97414cc30797cce_cgraph.map b/d6/d42/miller__rabin_8cpp_a901288288ef5ebe8e97414cc30797cce_cgraph.map index cf65fc5be..1f4c08854 100644 --- a/d6/d42/miller__rabin_8cpp_a901288288ef5ebe8e97414cc30797cce_cgraph.map +++ b/d6/d42/miller__rabin_8cpp_a901288288ef5ebe8e97414cc30797cce_cgraph.map @@ -2,11 +2,11 @@ - + - + diff --git a/d6/d42/miller__rabin_8cpp_a901288288ef5ebe8e97414cc30797cce_cgraph.md5 b/d6/d42/miller__rabin_8cpp_a901288288ef5ebe8e97414cc30797cce_cgraph.md5 index 2ce58e312..c1bed71a7 100644 --- a/d6/d42/miller__rabin_8cpp_a901288288ef5ebe8e97414cc30797cce_cgraph.md5 +++ b/d6/d42/miller__rabin_8cpp_a901288288ef5ebe8e97414cc30797cce_cgraph.md5 @@ -1 +1 @@ -7935e58bec1c0bf8de8038ff8ac9f185 \ No newline at end of file +d2aa7a0e1f5f7b113356f62255fbff25 \ No newline at end of file diff --git a/d6/d42/miller__rabin_8cpp_a901288288ef5ebe8e97414cc30797cce_cgraph.svg b/d6/d42/miller__rabin_8cpp_a901288288ef5ebe8e97414cc30797cce_cgraph.svg index a038a82eb..b153c970b 100644 --- a/d6/d42/miller__rabin_8cpp_a901288288ef5ebe8e97414cc30797cce_cgraph.svg +++ b/d6/d42/miller__rabin_8cpp_a901288288ef5ebe8e97414cc30797cce_cgraph.svg @@ -97,17 +97,17 @@ var sectionId = 'dynsection-2'; Node7 - - -power + + +math::power Node2->Node7 - - + + @@ -172,17 +172,17 @@ var sectionId = 'dynsection-2'; Node8 - - -multiply + + +ans Node7->Node8 - - + + diff --git a/d6/d42/miller__rabin_8cpp_a901288288ef5ebe8e97414cc30797cce_cgraph_org.svg b/d6/d42/miller__rabin_8cpp_a901288288ef5ebe8e97414cc30797cce_cgraph_org.svg index 8b5322a63..9dac4cba4 100644 --- a/d6/d42/miller__rabin_8cpp_a901288288ef5ebe8e97414cc30797cce_cgraph_org.svg +++ b/d6/d42/miller__rabin_8cpp_a901288288ef5ebe8e97414cc30797cce_cgraph_org.svg @@ -51,17 +51,17 @@ Node7 - - -power + + +math::power Node2->Node7 - - + + @@ -126,17 +126,17 @@ Node8 - - -multiply + + +ans Node7->Node8 - - + + diff --git a/d6/d42/miller__rabin_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map b/d6/d42/miller__rabin_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map index 105a94381..4ba04227f 100644 --- a/d6/d42/miller__rabin_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map +++ b/d6/d42/miller__rabin_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.map @@ -5,11 +5,11 @@ - + - + diff --git a/d6/d42/miller__rabin_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 b/d6/d42/miller__rabin_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 index 24c73e3eb..85057ed49 100644 --- a/d6/d42/miller__rabin_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 +++ b/d6/d42/miller__rabin_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.md5 @@ -1 +1 @@ -dd3c9811a5c95345c0955b82598d238e \ No newline at end of file +3005cba12d7a65cf63b3f2b68d67b756 \ No newline at end of file diff --git a/d6/d42/miller__rabin_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg b/d6/d42/miller__rabin_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg index e694c3ef3..b51729aab 100644 --- a/d6/d42/miller__rabin_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg +++ b/d6/d42/miller__rabin_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg @@ -142,17 +142,17 @@ var sectionId = 'dynsection-1'; Node10 - - -power + + +math::power Node5->Node10 - - + + @@ -217,17 +217,17 @@ var sectionId = 'dynsection-1'; Node11 - - -multiply + + +ans Node10->Node11 - - + + diff --git a/d6/d42/miller__rabin_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg b/d6/d42/miller__rabin_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg index e40575b57..9ee8b358a 100644 --- a/d6/d42/miller__rabin_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg +++ b/d6/d42/miller__rabin_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph_org.svg @@ -96,17 +96,17 @@ Node10 - - -power + + +math::power Node5->Node10 - - + + @@ -171,17 +171,17 @@ Node11 - - -multiply + + +ans Node10->Node11 - - + + diff --git a/dd/d47/namespacemath.html b/dd/d47/namespacemath.html index 9bb6f3c8f..6267fa26f 100644 --- a/dd/d47/namespacemath.html +++ b/dd/d47/namespacemath.html @@ -106,6 +106,9 @@ Functions   bool magic_number (const uint64_t &n)   +uint64_t power (uint64_t a, uint64_t b, uint64_t c) + This function calculates a raised to exponent b under modulo c using modular exponentiation. More...
    +  uint64_t binomialCoeffSum (uint64_t n)   @@ -240,11 +243,86 @@ Functions
    43  }
    44 }
    + + + +

    ◆ power()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    uint64_t math::power (uint64_t a,
    uint64_t b,
    uint64_t c 
    )
    +
    + +

    This function calculates a raised to exponent b under modulo c using modular exponentiation.

    +
    Parameters
    + + + + +
    ainteger base
    bunsigned integer exponent
    cinteger modulo
    +
    +
    +
    Returns
    a raised to power b modulo c
    +

    Initialize the answer to be returned

    +

    Update a if it is more than or equal to c

    +

    In case a is divisible by c;

    +

    If b is odd, multiply a with answer

    +

    b must be even now

    +

    b = b/2

    +
    35  {
    +
    36  uint64_t ans = 1; /// Initialize the answer to be returned
    +
    37  a = a % c; /// Update a if it is more than or equal to c
    +
    38  if (a == 0) {
    +
    39  return 0; /// In case a is divisible by c;
    +
    40  }
    +
    41  while (b > 0) {
    +
    42  /// If b is odd, multiply a with answer
    +
    43  if (b & 1) {
    +
    44  ans = ((ans % c) * (a % c)) % c;
    +
    45  }
    +
    46  /// b must be even now
    +
    47  b = b >> 1; /// b = b/2
    +
    48  a = ((a % c) * (a % c)) % c;
    +
    49  }
    +
    50  return ans;
    +
    51 }
    +
    +Here is the call graph for this function:
    +
    +
    +
    +
    +
    STL class.
    +
    ll ans(ll n)
    Definition: matrix_exponentiation.cpp:91