From 8490dcfa8db4c5298b7cfb2dc8e15d1ecfc91c18 Mon Sep 17 00:00:00 2001 From: soblin Date: Sat, 22 Oct 2022 08:20:59 +0900 Subject: [PATCH] renamed sombrero.cpp Signed-off-by: soblin --- gallery/contrib/{sombrero,cpp => sombrero.cpp} | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) rename gallery/contrib/{sombrero,cpp => sombrero.cpp} (62%) diff --git a/gallery/contrib/sombrero,cpp b/gallery/contrib/sombrero.cpp similarity index 62% rename from gallery/contrib/sombrero,cpp rename to gallery/contrib/sombrero.cpp index 8b03ff3..c7c5b00 100644 --- a/gallery/contrib/sombrero,cpp +++ b/gallery/contrib/sombrero.cpp @@ -1,8 +1,7 @@ #include #include -int main() -{ +int main() { pybind11::scoped_interpreter guard{}; const int size = 1000; @@ -11,9 +10,11 @@ int main() const auto i = nc::arange(size) - (0.5 * size); const auto [x, y] = nc::meshgrid(i, i); - const auto xy = (nc::power(x, 2) + nc::power(y, 2)) / (-2.0 * nc::power(sigma, 2)); + const auto xy = + (nc::power(x, 2) + nc::power(y, 2)) / (-2.0 * nc::power(sigma, 2)); - const auto sombrero = nc::exp(xy) * (xy + 1.0) / (std::acos(-1.0) * nc::power(sigma, 4)); + const auto sombrero = + nc::exp(xy) * (xy + 1.0) / (std::acos(-1.0) * nc::power(sigma, 4)); const auto pysombrero = nc::pybindInterface::nc2pybind(sombrero); const auto min = nc::min(sombrero)[0]; @@ -21,9 +22,9 @@ int main() auto plt = matplotlibcpp17::pyplot::import(); - plt.imshow(Args(pysombrero), Kwargs( - "extent"_a = pybind11::make_tuple(-1, +1, -1, +1), - "cmap"_a = "inferno")); + plt.imshow(Args(pysombrero), + Kwargs("extent"_a = pybind11::make_tuple(-1, +1, -1, +1), + "cmap"_a = "inferno")); plt.colorbar();