1
1
#include < matplotlibcpp17/pyplot.h>
2
2
#include < NumCpp.hpp>
3
3
4
- int main()
5
- {
4
+ int main () {
6
5
pybind11::scoped_interpreter guard{};
7
6
8
7
const int size = 1000 ;
@@ -11,19 +10,21 @@ int main()
11
10
const auto i = nc::arange<double >(size) - (0.5 * size);
12
11
const auto [x, y] = nc::meshgrid<double >(i, i);
13
12
14
- const auto xy = (nc::power(x, 2) + nc::power(y, 2)) / (-2.0 * nc::power(sigma, 2));
13
+ const auto xy =
14
+ (nc::power (x, 2 ) + nc::power (y, 2 )) / (-2.0 * nc::power (sigma, 2 ));
15
15
16
- const auto sombrero = nc::exp(xy) * (xy + 1.0) / (std::acos(-1.0) * nc::power(sigma, 4));
16
+ const auto sombrero =
17
+ nc::exp (xy) * (xy + 1.0 ) / (std::acos (-1.0 ) * nc::power (sigma, 4 ));
17
18
const auto pysombrero = nc::pybindInterface::nc2pybind (sombrero);
18
19
19
20
const auto min = nc::min (sombrero)[0 ];
20
21
const auto max = nc::max (sombrero)[0 ];
21
22
22
23
auto plt = matplotlibcpp17::pyplot::import ();
23
24
24
- plt.imshow(Args(pysombrero), Kwargs(
25
- "extent"_a = pybind11::make_tuple(-1, +1, -1, +1),
26
- "cmap"_a = "inferno"));
25
+ plt.imshow (Args (pysombrero),
26
+ Kwargs ( " extent" _a = pybind11::make_tuple (-1 , +1 , -1 , +1 ),
27
+ " cmap" _a = " inferno" ));
27
28
28
29
plt.colorbar ();
29
30
0 commit comments