Skip to content

Commit c47117c

Browse files
chore: use iwyu on math/**.cpp
1 parent c3897d3 commit c47117c

23 files changed

+102
-88
lines changed

math/area.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
* @author [Focusucof](https://github.com/Focusucof)
1010
*/
1111
#define _USE_MATH_DEFINES
12-
#include <cassert> /// for assert
13-
#include <cmath> /// for M_PI definition and pow()
14-
#include <cmath>
15-
#include <cstdint> /// for uint16_t datatype
16-
#include <iostream> /// for IO operations
12+
#include <cassert> // for assert
13+
#include <cmath> // for NAN, M_PI, pow
14+
#include <cstdint> // for uint16_t
15+
#include <iostream> // for basic_ostream, operator<<, char_traits, endl, cout
1716

1817
/**
1918
* @namespace math

math/check_prime.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
* @author [ewd00010](https://github.com/ewd00010)
1515
*/
1616

17-
#include <cassert> /// for assert
18-
#include <iostream> /// for IO operations
17+
#include <stdint.h> // for int64_t
18+
#include <cassert> // for assert
19+
#include <iostream> // for char_traits, basic_ostream, operator<<, cout, endl
1920

2021
/**
2122
* @brief Mathematical algorithms

math/complex_numbers.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
* operators overloaded to accommodate (mathematical) field operations.
88
*/
99

10-
#include <cassert>
11-
#include <cmath>
12-
#include <complex>
13-
#include <ctime>
14-
#include <iostream>
15-
#include <stdexcept>
10+
#include <cassert> // for assert
11+
#include <cmath> // for atan2, cos, sin, sqrt
12+
#include <complex> // for complex, abs, arg, conj, operator*, operator+
13+
#include <ctime> // for time
14+
#include <iostream> // for basic_ostream, operator<<, char_traits, cout, endl
15+
#include <stdexcept> // for invalid_argument
16+
#include <cstdlib> // for rand, srand
1617

1718
/**
1819
* \brief Class Complex to represent complex numbers as a field.

math/eratosthenes.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@
1313
* @author [Keval Kapdee](https://github.com/thechubbypanda)
1414
*/
1515

16-
#include <cassert> /// For assert
17-
#include <chrono> /// For timing the sieve
18-
#include <iostream> /// For IO operations
19-
#include <string> /// For string handling
20-
#include <vector> /// For std::vector
16+
#include <bits/chrono.h> // for duration, duration_cast, high_resolution_clock
17+
#include <stdint.h> // for uint64_t
18+
#include <cassert> // for assert
19+
#include <iostream> // for basic_ostream, operator<<, cout, endl
20+
#include <string> // for char_traits, basic_string, operator==, string
21+
#include <vector> // for vector
22+
#include <ratio> // for ratio
2123

2224
/**
2325
* @namespace math

math/extended_euclid_algorithm.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
* multiplicative inverse of a number. (A * B)%M == 1 Here B is the MMI of A for
1010
* given M, so extendedEuclid (A, M) gives B.
1111
*/
12-
#include <algorithm> // for swap function
13-
#include <iostream>
14-
#include <cstdint>
12+
#include <iostream> // for char_traits, basic_ostream, basic_ostream::opera...
13+
#include <cstdint> // for uint32_t, int32_t
14+
#include <utility> // for swap
1515

1616
/**
1717
* function to update the coefficients per iteration

math/factorial.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
* @author [Akshay Gupta](https://github.com/Akshay1910)
1212
*/
1313

14-
#include <cassert> /// for assert
15-
#include <cstdint> /// for integral typedefs
16-
#include <iostream> /// for I/O operations
14+
#include <cassert> // for assert
15+
#include <cstdint> // for uint64_t, uint8_t
16+
#include <iostream> // for operator<<, basic_ostream, cout
17+
#include <stdexcept> // for invalid_argument
18+
1719
/**
1820
* @namespace
1921
* @brief Mathematical algorithms

math/fibonacci_fast.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
* @see fibonacci_large.cpp, fibonacci.cpp, string_fibonacci.cpp
1616
*/
1717

18-
#include <cinttypes>
19-
#include <cstdio>
20-
#include <iostream>
18+
#include <cinttypes> // for uint64_t
19+
#include <iostream> // for char_traits, basic_ostream, operator<<, cerr, cout
2120

2221
/**
2322
* maximum number that can be computed - The result after 93 cannot be stored

math/fibonacci_large.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
* @see fibonacci.cpp, fibonacci_fast.cpp, string_fibonacci.cpp
1212
*/
1313

14-
#include <cinttypes>
15-
#include <ctime>
16-
#include <iostream>
14+
#include <stdlib.h> // for strtoull
15+
#include <cinttypes> // for uint64_t
16+
#include <ctime> // for clock, clock_t, CLOCKS_PER_SEC, NULL
17+
#include <iostream> // for basic_ostream, char_traits, operator<<
1718

18-
#include "./large_number.h"
19+
#include "./large_number.h" // for large_number, operator<<, operator==
1920

2021
/** Compute fibonacci numbers using the relation
2122
* \f[f(n)=f(n-1)+f(n-2)\f]

math/gcd_recursive_euclidean.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
*
77
* @see gcd_iterative_euclidean.cpp, gcd_of_n_numbers.cpp
88
*/
9-
#include <iostream>
9+
#include <iostream> // for basic_ostream, char_traits, operator<<, basic_o...
10+
#include <stdexcept> // for domain_error
1011

1112
/**
1213
* algorithm

math/integral_approximation2.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@
2222
*/
2323

2424
#define _USE_MATH_DEFINES /// for M_PI on windows
25-
#include <cmath> /// for math functions
26-
#include <cstdint> /// for fixed size data types
27-
#include <ctime> /// for time to initialize rng
28-
#include <functional> /// for function pointers
29-
#include <iostream> /// for std::cout
30-
#include <random> /// for random number generation
31-
#include <vector> /// for std::vector
25+
#include <cmath> // for exp, M_PI, sin, sqrt
26+
#include <cstdint> // for uint32_t
27+
#include <ctime> // for time
28+
#include <functional> // for function
29+
#include <iostream> // for basic_ostream, char_traits, operator<<, endl
30+
#include <random> // for normal_distribution, uniform_real_distribution
31+
#include <vector> // for vector
32+
#include <algorithm> // for min
3233

3334
/**
3435
* @namespace math

0 commit comments

Comments
 (0)