diff --git a/math/area.cpp b/math/area.cpp index 691fe91f0..f6ac5f4a8 100644 --- a/math/area.cpp +++ b/math/area.cpp @@ -9,11 +9,10 @@ * @author [Focusucof](https://github.com/Focusucof) */ #define _USE_MATH_DEFINES -#include /// for assert -#include /// for M_PI definition and pow() -#include -#include /// for uint16_t datatype -#include /// for IO operations +#include // for assert +#include // for NAN, M_PI, pow +#include // for uint16_t +#include // for basic_ostream, operator<<, char_traits, endl, cout /** * @namespace math diff --git a/math/check_prime.cpp b/math/check_prime.cpp index ebd48cab5..add436236 100644 --- a/math/check_prime.cpp +++ b/math/check_prime.cpp @@ -14,8 +14,9 @@ * @author [ewd00010](https://github.com/ewd00010) */ -#include /// for assert -#include /// for IO operations +#include // for int64_t +#include // for assert +#include // for char_traits, basic_ostream, operator<<, cout, endl /** * @brief Mathematical algorithms diff --git a/math/complex_numbers.cpp b/math/complex_numbers.cpp index f89238649..0482a088d 100644 --- a/math/complex_numbers.cpp +++ b/math/complex_numbers.cpp @@ -7,12 +7,13 @@ * operators overloaded to accommodate (mathematical) field operations. */ -#include -#include -#include -#include -#include -#include +#include // for assert +#include // for atan2, cos, sin, sqrt +#include // for complex, abs, arg, conj, operator*, operator+ +#include // for time +#include // for basic_ostream, operator<<, char_traits, cout, endl +#include // for invalid_argument +#include // for rand, srand /** * \brief Class Complex to represent complex numbers as a field. diff --git a/math/eratosthenes.cpp b/math/eratosthenes.cpp index 224e9f51b..875fce20b 100644 --- a/math/eratosthenes.cpp +++ b/math/eratosthenes.cpp @@ -13,11 +13,13 @@ * @author [Keval Kapdee](https://github.com/thechubbypanda) */ -#include /// For assert -#include /// For timing the sieve -#include /// For IO operations -#include /// For string handling -#include /// For std::vector +#include // for duration, duration_cast, high_resolution_clock +#include // for uint64_t +#include // for assert +#include // for basic_ostream, operator<<, cout, endl +#include // for char_traits, basic_string, operator==, string +#include // for vector +#include // for ratio /** * @namespace math diff --git a/math/extended_euclid_algorithm.cpp b/math/extended_euclid_algorithm.cpp index cc2eacac8..5fead27b1 100644 --- a/math/extended_euclid_algorithm.cpp +++ b/math/extended_euclid_algorithm.cpp @@ -9,9 +9,9 @@ * multiplicative inverse of a number. (A * B)%M == 1 Here B is the MMI of A for * given M, so extendedEuclid (A, M) gives B. */ -#include // for swap function -#include -#include +#include // for char_traits, basic_ostream, basic_ostream::opera... +#include // for uint32_t, int32_t +#include // for swap /** * function to update the coefficients per iteration diff --git a/math/factorial.cpp b/math/factorial.cpp index a6b039da4..f4dffc138 100644 --- a/math/factorial.cpp +++ b/math/factorial.cpp @@ -11,9 +11,11 @@ * @author [Akshay Gupta](https://github.com/Akshay1910) */ -#include /// for assert -#include /// for integral typedefs -#include /// for I/O operations +#include // for assert +#include // for uint64_t, uint8_t +#include // for operator<<, basic_ostream, cout +#include // for invalid_argument + /** * @namespace * @brief Mathematical algorithms diff --git a/math/fibonacci_fast.cpp b/math/fibonacci_fast.cpp index 0948276a0..ed33af4eb 100644 --- a/math/fibonacci_fast.cpp +++ b/math/fibonacci_fast.cpp @@ -15,9 +15,8 @@ * @see fibonacci_large.cpp, fibonacci.cpp, string_fibonacci.cpp */ -#include -#include -#include +#include // for uint64_t +#include // for char_traits, basic_ostream, operator<<, cerr, cout /** * maximum number that can be computed - The result after 93 cannot be stored diff --git a/math/fibonacci_large.cpp b/math/fibonacci_large.cpp index e4f4e5eaf..73e696bdd 100644 --- a/math/fibonacci_large.cpp +++ b/math/fibonacci_large.cpp @@ -11,11 +11,12 @@ * @see fibonacci.cpp, fibonacci_fast.cpp, string_fibonacci.cpp */ -#include -#include -#include +#include // for strtoull +#include // for uint64_t +#include // for clock, clock_t, CLOCKS_PER_SEC, NULL +#include // for basic_ostream, char_traits, operator<< -#include "./large_number.h" +#include "./large_number.h" // for large_number, operator<<, operator== /** Compute fibonacci numbers using the relation * \f[f(n)=f(n-1)+f(n-2)\f] diff --git a/math/gcd_recursive_euclidean.cpp b/math/gcd_recursive_euclidean.cpp index 2a3d2183c..368f67cde 100644 --- a/math/gcd_recursive_euclidean.cpp +++ b/math/gcd_recursive_euclidean.cpp @@ -6,7 +6,8 @@ * * @see gcd_iterative_euclidean.cpp, gcd_of_n_numbers.cpp */ -#include +#include // for basic_ostream, char_traits, operator<<, basic_o... +#include // for domain_error /** * algorithm diff --git a/math/integral_approximation2.cpp b/math/integral_approximation2.cpp index eed605e03..b858fedba 100644 --- a/math/integral_approximation2.cpp +++ b/math/integral_approximation2.cpp @@ -22,13 +22,14 @@ */ #define _USE_MATH_DEFINES /// for M_PI on windows -#include /// for math functions -#include /// for fixed size data types -#include /// for time to initialize rng -#include /// for function pointers -#include /// for std::cout -#include /// for random number generation -#include /// for std::vector +#include // for exp, M_PI, sin, sqrt +#include // for uint32_t +#include // for time +#include // for function +#include // for basic_ostream, char_traits, operator<<, endl +#include // for normal_distribution, uniform_real_distribution +#include // for vector +#include // for min /** * @namespace math diff --git a/math/inv_sqrt.cpp b/math/inv_sqrt.cpp index 1f625e1cf..55088b0c0 100644 --- a/math/inv_sqrt.cpp +++ b/math/inv_sqrt.cpp @@ -8,11 +8,12 @@ * This algorithm is used to calculate shadows in Quake III Arena. */ -#include /// for assert -#include /// for `std::sqrt` -#include /// for integral typedefs -#include /// for IO operations -#include /// for numeric_limits +#include // for assert +#include // for fabs, sqrt +#include // for int32_t, int64_t +#include // for basic_ostream, char_traits, operator<<, cout +#include // for conditional + /** * @brief This is the function that calculates the fast inverse square root. * The following code is the fast inverse square root implementation from diff --git a/math/iterative_factorial.cpp b/math/iterative_factorial.cpp index 12f6afe06..5a3454b28 100644 --- a/math/iterative_factorial.cpp +++ b/math/iterative_factorial.cpp @@ -25,10 +25,10 @@ * */ -#include /// for assert -#include /// for integral types -#include /// for std::invalid_argument -#include /// for std::cout +#include // for assert +#include // for uint64_t, uint8_t +#include // for operator<<, basic_ostream, cout +#include // for invalid_argument /** * @namespace diff --git a/math/large_factorial.cpp b/math/large_factorial.cpp index 20c677cdc..5f5b5562d 100644 --- a/math/large_factorial.cpp +++ b/math/large_factorial.cpp @@ -5,11 +5,12 @@ * \author [Krishna Vedala](https://github.com/kvedala) * @see factorial.cpp */ -#include -#include -#include +#include // for atoi +#include // for strlen, size_t +#include // for clock, clock_t, CLOCKS_PER_SEC +#include // for basic_ostream, char_traits, operator<< -#include "./large_number.h" +#include "./large_number.h" // for large_number, operator<< /** Test implementation for 10! Result must be 3628800. * @returns True if test pass else False diff --git a/math/linear_recurrence_matrix.cpp b/math/linear_recurrence_matrix.cpp index d59ad6aa1..ab5c928d3 100644 --- a/math/linear_recurrence_matrix.cpp +++ b/math/linear_recurrence_matrix.cpp @@ -17,10 +17,9 @@ * here](https://en.wikipedia.org/wiki/Exponentiation_by_squaring). * @author [Ashish Daulatabad](https://github.com/AshishYUO) */ -#include /// for assert -#include /// for integral typedefs -#include /// for IO operations -#include /// for std::vector STL +#include // for assert +#include // for int64_t, uint32_t, uint64_t +#include // for vector /** * @namespace math diff --git a/math/modular_inverse_fermat_little_theorem.cpp b/math/modular_inverse_fermat_little_theorem.cpp index 7550e14bf..bfbd2b419 100644 --- a/math/modular_inverse_fermat_little_theorem.cpp +++ b/math/modular_inverse_fermat_little_theorem.cpp @@ -43,8 +43,8 @@ * (as \f$a\times a^{-1} = 1\f$) */ -#include -#include +#include // for int64_t +#include // for char_traits, basic_ostream, operator<<, cout, endl /** Recursive function to calculate exponent in \f$O(\log n)\f$ using binary * exponent. diff --git a/math/n_bonacci.cpp b/math/n_bonacci.cpp index 601b2edf0..066070335 100644 --- a/math/n_bonacci.cpp +++ b/math/n_bonacci.cpp @@ -15,10 +15,12 @@ * @author [Swastika Gupta](https://github.com/Swastyy) */ -#include /// for assert -#include /// for integral typedefs -#include /// for std::cout -#include /// for std::vector +#include // for assert +#include // for uint64_t +#include // for char_traits, basic_ostream, operator<< +#include // for vector, operator== +#include // for initializer_list + /** * @namespace math * @brief Mathematical algorithms diff --git a/math/ncr_modulo_p.cpp b/math/ncr_modulo_p.cpp index cbf5e9e1a..f154821c4 100644 --- a/math/ncr_modulo_p.cpp +++ b/math/ncr_modulo_p.cpp @@ -9,9 +9,10 @@ * @author [Kaustubh Damania](https://github.com/KaustubhDamania) */ -#include /// for assert -#include /// for std::cout -#include /// for std::vector +#include // for int64_t +#include // for assert +#include // for char_traits, basic_ostream, operator<<, basic_os... +#include // for vector /** * @namespace math diff --git a/math/prime_factorization.cpp b/math/prime_factorization.cpp index 001c2c3c3..3617ea35c 100644 --- a/math/prime_factorization.cpp +++ b/math/prime_factorization.cpp @@ -2,10 +2,10 @@ * @file * @brief Prime factorization of positive integers */ -#include -#include -#include -#include +#include // for memset +#include // for char_traits, basic_ostream, operator<<, basic_os... +#include // for vector +#include // for pair, make_pair /** Declaring variables for maintaing prime numbers and to check whether a * number is prime or not diff --git a/math/prime_numbers.cpp b/math/prime_numbers.cpp index cd6aca0ca..50723d9bc 100644 --- a/math/prime_numbers.cpp +++ b/math/prime_numbers.cpp @@ -3,8 +3,9 @@ * @brief Get list of prime numbers * @see primes_up_to_billion.cpp sieve_of_eratosthenes.cpp */ -#include -#include +#include // for size_t +#include // for char_traits, basic_ostream, operator<<, cout +#include // for vector /** Generate an increasingly large number of primes * and store in a list diff --git a/math/primes_up_to_billion.cpp b/math/primes_up_to_billion.cpp index b7377cea5..d1dc00abf 100644 --- a/math/primes_up_to_billion.cpp +++ b/math/primes_up_to_billion.cpp @@ -3,8 +3,9 @@ * @brief Compute prime numbers upto 1 billion * @see prime_numbers.cpp sieve_of_eratosthenes.cpp */ -#include -#include +#include // for int64_t +#include // for memset +#include // for operator<<, basic_ostream, cout, basic_istream, cin /** array to store the primes */ char prime[100000000]; diff --git a/math/quadratic_equations_complex_numbers.cpp b/math/quadratic_equations_complex_numbers.cpp index 3a50719e5..1140e7760 100644 --- a/math/quadratic_equations_complex_numbers.cpp +++ b/math/quadratic_equations_complex_numbers.cpp @@ -28,13 +28,13 @@ * (-0.5,0.866025) (-0.5,0.866025) */ -#include /// std::array -#include /// assert -#include /// std::sqrt, std::trunc, std::pow -#include /// std::complex -#include /// std::invalid_argument -#include /// std::setprecision -#include /// std::cout +#include // for array, operator== +#include // for assert +#include // for round, sqrt, pow +#include // for complex, operator== +#include // for size_t +#include // for operator<<, basic_ostream, cout +#include // for invalid_argument /** * @namespace @@ -65,7 +65,7 @@ std::array, 2> quadraticEquation(long double a, solutions[1] = -b * 0.5 / a; return solutions; } - + // Complex root (discriminant < 0) // Note that the left term (-b / 2a) is always real. The imaginary part // appears when b^2 - 4ac < 0, so sqrt(b^2 - 4ac) has no real roots. So, diff --git a/math/realtime_stats.cpp b/math/realtime_stats.cpp index 672acfa03..6a455115d 100644 --- a/math/realtime_stats.cpp +++ b/math/realtime_stats.cpp @@ -7,9 +7,10 @@ * simple enough to be easily implemented in an embedded system. * \author [Krishna Vedala](https://github.com/kvedala) */ -#include -#include -#include +#include // for abs +#include // for assert +#include // for sqrt +#include // for basic_ostream, char_traits, operator<<, cout /** * \namespace statistics diff --git a/math/string_fibonacci.cpp b/math/string_fibonacci.cpp index a7ff4c8bb..34db60e7e 100644 --- a/math/string_fibonacci.cpp +++ b/math/string_fibonacci.cpp @@ -8,12 +8,12 @@ * @see fibonacci_large.cpp, fibonacci_fast.cpp, fibonacci.cpp */ -#include /// for integral typedefs -#include +#include // for uint64_t +#include // for char_traits, basic_ostream, operator<<, cout +#include // for allocator, basic_string, operator+, string, oper... #ifdef _MSC_VER -#include // use this for MS Visual C +#include // for allocator, basic_string, operator+, string, oper... #else -#include // otherwise #endif /**