Skip to content

Commit eff2f44

Browse files
chore: use iwyu on numerical_methods/**.cpp
1 parent c47117c commit eff2f44

12 files changed

+72
-61
lines changed

numerical_methods/babylonian_method.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
* @author [Ameya Chawla](https://github.com/ameyachawlaggsipu)
1010
*/
1111

12-
#include <cassert> /// for assert
13-
#include <cmath>
14-
#include <iostream> /// for IO operations
12+
#include <cassert> // for assert
13+
#include <cmath> // for NAN
14+
#include <iostream> // for operator<<, basic_ostream, cout
15+
#include <algorithm> // for max, min
1516

1617
/**
1718
* @namespace numerical_methods

numerical_methods/bisection_method.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
*
1414
* \see newton_raphson_method.cpp, false_position.cpp, secant_method.cpp
1515
*/
16-
#include <cmath>
17-
#include <iostream>
18-
#include <limits>
16+
#include <bits/std_abs.h> // for abs
17+
#include <cmath> // for pow
18+
#include <iostream> // for basic_ostream, char_traits, operator<<, cout
1919

2020
#define EPSILON \
2121
1e-6 // std::numeric_limits<double>::epsilon() ///< system accuracy limit

numerical_methods/brent_method_extrema.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
* \author [Krishna Vedala](https://github.com/kvedala)
1515
*/
1616
#define _USE_MATH_DEFINES ///< required for MS Visual C++
17-
#include <cassert>
18-
#include <cmath>
19-
#include <cstdint> /// for integral typedefs
20-
#include <functional>
21-
#include <iostream>
22-
#include <limits>
17+
#include <bits/std_abs.h> // for abs
18+
#include <cassert> // for assert
19+
#include <cmath> // for sqrt, cos, pow, M_E, M_PI
20+
#include <cstdint> // for uint32_t
21+
#include <functional> // for function
22+
#include <iostream> // for operator<<, basic_ostream, char_traits, cout
23+
#include <limits> // for numeric_limits
24+
#include <utility> // for swap
2325

2426
#define EPSILON \
2527
std::sqrt( \

numerical_methods/composite_simpson_rule.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@
3535
*
3636
*/
3737

38-
#include <cassert> /// for assert
39-
#include <cmath> /// for math functions
40-
#include <cmath>
41-
#include <cstdint> /// for integer allocation
42-
#include <cstdlib> /// for std::atof
43-
#include <functional> /// for std::function
44-
#include <iostream> /// for IO operations
45-
#include <map> /// for std::map container
38+
#include <cassert> // for assert
39+
#include <cmath> // for log, sqrt, pow, exp, NAN, isnan
40+
#include <cstdint> // for int32_t
41+
#include <cstdlib> // for atof, atoi
42+
#include <functional> // for function
43+
#include <iostream> // for basic_ostream, char_traits, operator<<, cout
44+
#include <map> // for map
45+
#include <utility> // for pair
4646

4747
/**
4848
* @namespace numerical_methods

numerical_methods/false_position.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
* \author Unknown author
2323
* \author [Samruddha Patil](https://github.com/sampatil578)
2424
*/
25-
#include <cmath> /// for math operations
26-
#include <iostream> /// for io operations
25+
#include <stdint.h> // for int16_t
26+
#include <iostream> // for basic_ostream, char_traits, operator<<, cout, endl
2727

2828
/**
2929
* @namespace numerical_methods

numerical_methods/golden_search_extrema.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
* \author [Krishna Vedala](https://github.com/kvedala)
99
*/
1010
#define _USE_MATH_DEFINES //< required for MS Visual C++
11-
#include <cassert>
12-
#include <cmath>
13-
#include <cstdint> /// for integral typedefs
14-
#include <functional>
15-
#include <iostream>
16-
#include <limits>
11+
#include <bits/std_abs.h> // for abs
12+
#include <cassert> // for assert
13+
#include <cmath> // for cos, pow, M_E, M_PI, sqrt
14+
#include <cstdint> // for uint32_t
15+
#include <functional> // for function
16+
#include <iostream> // for operator<<, basic_ostream, char_traits, cout
17+
#include <limits> // for numeric_limits
18+
#include <utility> // for swap
1719

1820
#define EPSILON 1e-7 ///< solution accuracy limit
1921

numerical_methods/gram_schmidt.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@
2828
* @author [Akanksha Gupta](https://github.com/Akanksha-Gupta920)
2929
*/
3030

31-
#include <array> /// for std::array
32-
#include <cassert> /// for assert
33-
#include <cmath> /// for fabs
34-
#include <iostream> /// for io operations
35-
36-
#include "math.h"
31+
#include <array> // for array
32+
#include <cassert> // for assert
33+
#include <cmath> // for fabs, NAN
34+
#include <iostream> // for operator<<, basic_ostream, char_traits, cout
3735

3836
/**
3937
* @namespace numerical_methods

numerical_methods/midpoint_integral_method.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818
*
1919
* @author [ggkogkou](https://github.com/ggkogkou)
2020
*/
21-
#include <cassert> /// for assert
22-
#include <cmath> /// for math functions
23-
#include <cstdint> /// for integer allocation
24-
#include <cstdlib> /// for std::atof
25-
#include <functional> /// for std::function
26-
#include <iostream> /// for IO operations
27-
#include <map> /// for std::map container
21+
#include <cassert> // for assert
22+
#include <cmath> // for log, sqrt, pow, exp, NAN, isnan
23+
#include <cstdint> // for int32_t
24+
#include <cstdlib> // for atof, atoi
25+
#include <functional> // for function
26+
#include <iostream> // for basic_ostream, char_traits, operator<<, cout
27+
#include <map> // for map
28+
#include <utility> // for pair
2829

2930
/**
3031
* @namespace numerical_methods

numerical_methods/newton_raphson_method.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
* \author [Krishna Vedala](https://github.com/kvedala)
1313
* \see bisection_method.cpp, false_position.cpp
1414
*/
15-
#include <cmath>
16-
#include <cstdint> /// for integral typedefs
17-
#include <ctime>
18-
#include <iostream>
19-
#include <limits>
15+
#include <bits/std_abs.h> // for abs
16+
#include <cmath> // for pow, NAN
17+
#include <cstdint> // for INT16_MAX, int16_t
18+
#include <ctime> // for time
19+
#include <iostream> // for char_traits, basic_ostream, operator<<
20+
#include <cstdlib> // for rand, srand
2021

2122
constexpr double EPSILON = 1e-10; ///< system accuracy limit
2223
constexpr int16_t MAX_ITERATIONS = INT16_MAX; ///< Maximum number of iterations

numerical_methods/ode_forward_euler.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@
3636
* \see ode_midpoint_euler.cpp, ode_semi_implicit_euler.cpp
3737
*/
3838

39-
#include <cmath>
40-
#include <ctime>
41-
#include <fstream>
42-
#include <iostream>
43-
#include <valarray>
39+
#include <cmath> // for cos, sin, NAN
40+
#include <ctime> // for clock, clock_t, CLOCKS_PER_SEC, size_t
41+
#include <fstream> // for operator<<, basic_ostream, char_traits, basic_of...
42+
#include <iostream> // for cout, cin
43+
#include <valarray> // for valarray, __multiplies, operator*, _BinClos
44+
#include <cstdio> // for perror
45+
#include <cstdlib> // for atof
4446

4547
/**
4648
* @brief Problem statement for a system with first-order differential

numerical_methods/ode_midpoint_euler.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@
3535
* \see ode_forward_euler.cpp, ode_semi_implicit_euler.cpp
3636
*/
3737

38-
#include <cmath>
39-
#include <ctime>
40-
#include <fstream>
41-
#include <iostream>
42-
#include <valarray>
38+
#include <cmath> // for cos, sin
39+
#include <ctime> // for clock, clock_t, CLOCKS_PER_SEC, size_t
40+
#include <fstream> // for operator<<, basic_ostream, char_traits, basic_of...
41+
#include <iostream> // for cout, cin
42+
#include <valarray> // for valarray, _BinClos, __multiplies, __plus, operator*
43+
#include <cstdio> // for perror
44+
#include <cstdlib> // for atof
4345

4446
/**
4547
* @brief Problem statement for a system with first-order differential

numerical_methods/ode_semi_implicit_euler.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@
3535
* \see ode_midpoint_euler.cpp, ode_forward_euler.cpp
3636
*/
3737

38-
#include <cmath>
39-
#include <ctime>
40-
#include <fstream>
41-
#include <iostream>
42-
#include <valarray>
38+
#include <cmath> // for cos, sin
39+
#include <ctime> // for clock, clock_t, CLOCKS_PER_SEC, size_t
40+
#include <fstream> // for operator<<, basic_ostream, char_traits, basic_of...
41+
#include <iostream> // for cout, cin
42+
#include <valarray> // for valarray, __multiplies, operator*, _BinClos
43+
#include <cstdio> // for perror
44+
#include <cstdlib> // for atof
4345

4446
/**
4547
* @brief Problem statement for a system with first-order differential

0 commit comments

Comments
 (0)