feat: Added Modular Exponentiation - #1411
Conversation
Added Modular Exponentiation iterative and recursive. Added bitwise operations to speed up the processing of program.
Panquesito7
left a comment
There was a problem hiding this comment.
Is this PR about adding Modular Exponentiation, or about improving math/binary_exponent.cpp?
|
|
||
| /// Recursive function to calculate exponent modular m (a^b %m) in \f$O(\log(n))\f$ using | ||
| /// binary exponentiation. | ||
| uint64_t binModExpo(uint64_t a, uint64_t b, uint64_t m) { |
There was a problem hiding this comment.
Function documentation is not up to the Doxygen guidelines.
|
|
||
| /// Iterative function to calculate exponent modular m (a^b %m) in \f$O(\log(n))\f$ using | ||
| /// binary exponentiation. | ||
| uint64_t binModExpo_alt(uint64_t a, uint64_t b, uint64_t m) { |
| return res; | ||
| } | ||
|
|
||
| /// Main function |
There was a problem hiding this comment.
| /// Main function | |
| /** | |
| * @brief Main function | |
| * @returns 0 on exit | |
| */ |
| std::cout << "Result of a^b Recursive : " << binExpo(a,b) << std::endl; | ||
| std::cout << "Result of a^b%m Recursive : " << binModExpo(a,b,m) << std::endl; | ||
| std::cout << "Result of a^b Iterative : " << binExpo_alt(a,b) << std::endl; | ||
| std::cout << "Result of a^b%m Iterative : " << binModExpo_alt(a,b,m) << std::endl; |
There was a problem hiding this comment.
| std::cout << "Result of a^b%m Iterative : " << binModExpo_alt(a,b,m) << std::endl; | |
| std::cout << "Result of a^b%m Iterative : " << binModExpo_alt(a,b,m) << std::endl; | |
| return 0; |
Adding Modular Exponentiation |
|
I do not see Modular Exponentiation being added. |
|
This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
Please ping one of the maintainers once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to ask for help in our Gitter channel. Thank you for your contributions! |
Description of Change
Added Modular Exponentiation iterative and recursive.
Added bitwise operations to speed up the processing of program.
Checklist
Notes: Added 2 functions with relevant descriptions and tests.