You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add math module with number theory algorithms and code quality tooling (#15)
This pull request introduces a new math module to the project, adding
implementations for several number theory algorithms, and enhances the
build system by integrating code quality tools. It also makes minor
formatting improvements to existing graph and search code for
consistency.
**New Math Algorithms:**
* Added new math module (`src/math/`) with implementations for:
- Extended Euclidean Algorithm (recursive and iterative), GCD, LCM,
modular inverse (via Extended GCD), and related utilities in
`extended_gcd.hpp`
- Fast exponentiation (with and without modulo), modular inverse via
Fermat’s Little Theorem in `fast_exp.hpp`
- Sieve of Eratosthenes and related prime utilities in `sieve.hpp`
* Updated `CMakeLists.txt` to include new math sources and tests
[[1]](diffhunk://#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20aR23)
[[2]](diffhunk://#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20aR32)
**Build System and Code Quality:**
* Added code quality tooling to `CMakeLists.txt`:
- Targets for `clang-format` (formatting and format-check)
- Target for `clang-tidy` (linting)
- Automatically collects all source and test files for these tools
**Code Formatting and Style Consistency:**
* Refactored several methods in graph algorithms (`bfs.hpp`, `dfs.hpp`,
`kruskal.hpp`) to use single-line definitions for trivial functions,
improving code consistency
[[1]](diffhunk://#diff-3a4b361bf3976e77f349511ff7128ffa95605dd1f7439bf60d13a5c71a42b25dL26-R26)
[[2]](diffhunk://#diff-8e68f308a036639d8ef3c8d27b1d42015f92db971daba5e31fc26fd9acff1e40L26-R26)
[[3]](diffhunk://#diff-2cf88c17b45aaab80a3a46e62ee7e698ad0a621a513f96e8c5283467eada8e43L18-R18)
[[4]](diffhunk://#diff-2cf88c17b45aaab80a3a46e62ee7e698ad0a621a513f96e8c5283467eada8e43L120-R118)
[[5]](diffhunk://#diff-8e68f308a036639d8ef3c8d27b1d42015f92db971daba5e31fc26fd9acff1e40L103-R102)
* Improved comment formatting in binary search utilities for readability
(`binary_search.hpp`)
[[1]](diffhunk://#diff-a3fbb7e77fc266ed86ac6d96d669c727b8d1c328c30d1db10b48c44c66a8094aL46-R47)
[[2]](diffhunk://#diff-a3fbb7e77fc266ed86ac6d96d669c727b8d1c328c30d1db10b48c44c66a8094aL101-R103)
0 commit comments