Skip to content

Commit 8490dcf

Browse files
committed
renamed sombrero.cpp
Signed-off-by: soblin <hilo.soblin@gmail.com>
1 parent bb9e692 commit 8490dcf

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

gallery/contrib/sombrero,cpp renamed to gallery/contrib/sombrero.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#include <matplotlibcpp17/pyplot.h>
22
#include <NumCpp.hpp>
33

4-
int main()
5-
{
4+
int main() {
65
pybind11::scoped_interpreter guard{};
76

87
const int size = 1000;
@@ -11,19 +10,21 @@ int main()
1110
const auto i = nc::arange<double>(size) - (0.5 * size);
1211
const auto [x, y] = nc::meshgrid<double>(i, i);
1312

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));
1515

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));
1718
const auto pysombrero = nc::pybindInterface::nc2pybind(sombrero);
1819

1920
const auto min = nc::min(sombrero)[0];
2021
const auto max = nc::max(sombrero)[0];
2122

2223
auto plt = matplotlibcpp17::pyplot::import();
2324

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"));
2728

2829
plt.colorbar();
2930

0 commit comments

Comments
 (0)