From 7fcf04ced4883548a2c419e39c7353916b2a722b Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Mon, 28 Oct 2019 16:46:23 -0400 Subject: [PATCH] Fix various compiler warnings --- c++/triqs_tprf/channel_grouping.hpp | 12 ++++-------- c++/triqs_tprf/fourier/fourier.hpp | 13 +++---------- c++/triqs_tprf/fourier/fourier_matsubara.cpp | 12 ++++-------- c++/triqs_tprf/types.hpp | 2 -- test/c++/linalg_ops.cpp | 5 +---- 5 files changed, 12 insertions(+), 32 deletions(-) diff --git a/c++/triqs_tprf/channel_grouping.hpp b/c++/triqs_tprf/channel_grouping.hpp index c6e84603..88fc2422 100644 --- a/c++/triqs_tprf/channel_grouping.hpp +++ b/c++/triqs_tprf/channel_grouping.hpp @@ -37,7 +37,7 @@ template class channel_grouping { Channel_t channel = C; inline memory_layout_t<6> memory_layout() const; - inline triqs::arrays::matrix_view matrix_view(array_view arr) const; + inline triqs::arrays::matrix_view matrix_view(array_view arr) const; }; // ---------------------------------------------------- @@ -64,8 +64,7 @@ channel_grouping::memory_layout() const { } template <> -inline triqs::arrays::matrix_view channel_grouping::matrix_view( - array_view arr) const { +inline triqs::arrays::matrix_view channel_grouping::matrix_view(array_view arr) const { return make_matrix_view(group_indices_view(arr, {0, 2, 3}, {1, 5, 4})); } @@ -83,8 +82,7 @@ channel_grouping::memory_layout() const { } template <> -inline triqs::arrays::matrix_view channel_grouping::matrix_view( - array_view arr) const { +inline triqs::arrays::matrix_view channel_grouping::matrix_view(array_view arr) const { return make_matrix_view(group_indices_view(arr, {0, 2, 5}, {1, 4, 3})); } @@ -100,9 +98,7 @@ channel_grouping::memory_layout() const { return make_memory_layout(0, 2, 4, 1, 3, 5); } -template <> -inline matrix_view channel_grouping::matrix_view( - array_view arr) const { +template <> inline matrix_view channel_grouping::matrix_view(array_view arr) const { return make_matrix_view(group_indices_view(arr, {0, 2, 4}, {1, 3, 5})); } diff --git a/c++/triqs_tprf/fourier/fourier.hpp b/c++/triqs_tprf/fourier/fourier.hpp index 789263e9..553a4814 100644 --- a/c++/triqs_tprf/fourier/fourier.hpp +++ b/c++/triqs_tprf/fourier/fourier.hpp @@ -123,12 +123,8 @@ gf_vec_t _fourier_impl(gf_mesh const &iw_mesh, gf_vec_t _fourier_impl(gf_mesh const &tau_mesh, gf_vec_cvt gw, fourier_plan &p, array_const_view mom_123 = {}); -fourier_plan _fourier_plan(gf_mesh const &iw_mesh, - gf_vec_cvt gt, - array_const_view mom_23 = {}); -fourier_plan _fourier_plan(gf_mesh const &tau_mesh, - gf_vec_cvt gw, - array_const_view mom_123 = {}); +fourier_plan _fourier_plan(gf_mesh const &iw_mesh, gf_vec_cvt gt); +fourier_plan _fourier_plan(gf_mesh const &tau_mesh, gf_vec_cvt gw); // real /* @@ -221,15 +217,12 @@ void _fourier_with_plan(gf_const_view gin, gf_view gout, else { // inverse operation as flatten_2d, exactly auto g_rot = rotate_index_view(gout.data(), N); - auto a_0 = g_rot(0, _); for (auto const &mp : out_mesh) { auto g_rot_sl = g_rot( mp.linear_index(), _); // if the array is long, it is faster to precompute the view ... auto gout_col = gout_flatten.data()(mp.linear_index(), _); - assign_foreach(g_rot_sl, [&gout_col, c = 0ll](auto &&... i) mutable { - return gout_col(c++); - }); + assign_foreach(g_rot_sl, [&gout_col, c = 0ll](auto &&...) mutable { return gout_col(c++); }); } } } diff --git a/c++/triqs_tprf/fourier/fourier_matsubara.cpp b/c++/triqs_tprf/fourier/fourier_matsubara.cpp index 051e987f..aa57d2f1 100644 --- a/c++/triqs_tprf/fourier/fourier_matsubara.cpp +++ b/c++/triqs_tprf/fourier/fourier_matsubara.cpp @@ -125,9 +125,7 @@ array fit_derivatives(gf_const_view> gt) { // ------------------------ DIRECT TRANSFORM // -------------------------------------------- -fourier_plan _fourier_plan(gf_mesh const &iw_mesh, - gf_vec_cvt gt, - arrays::array_const_view mom_23) { +fourier_plan _fourier_plan(gf_mesh const &iw_mesh, gf_vec_cvt gt) { auto L = gt.mesh().size() - 1; if (L < 2 * (iw_mesh.last_index() + 1)) @@ -229,16 +227,14 @@ gf_vec_t _fourier_impl(gf_mesh const &iw_mesh, gf_vec_t _fourier_impl(gf_mesh const &iw_mesh, gf_vec_cvt gt, arrays::array_const_view mom_23) { - auto p = _fourier_plan(iw_mesh, gt, mom_23); + auto p = _fourier_plan(iw_mesh, gt); auto gw = _fourier_impl(iw_mesh, gt, p, mom_23); return gw; } // ------------------------ INVERSE TRANSFORM // -------------------------------------------- -fourier_plan _fourier_plan(gf_mesh const &tau_mesh, - gf_vec_cvt gw, - arrays::array_const_view mom_123) { +fourier_plan _fourier_plan(gf_mesh const &tau_mesh, gf_vec_cvt gw) { TRIQS_ASSERT2(!gw.mesh().positive_only(), "Fourier is only implemented for g(i omega_n) with full mesh " @@ -369,7 +365,7 @@ gf_vec_t _fourier_impl(gf_mesh const &tau_mesh, gf_vec_t _fourier_impl(gf_mesh const &tau_mesh, gf_vec_cvt gw, arrays::array_const_view mom_123) { - auto p = _fourier_plan(tau_mesh, gw, mom_123); + auto p = _fourier_plan(tau_mesh, gw); auto gt = _fourier_impl(tau_mesh, gw, p, mom_123); return gt; } diff --git a/c++/triqs_tprf/types.hpp b/c++/triqs_tprf/types.hpp index c86a94ba..6742a0b3 100644 --- a/c++/triqs_tprf/types.hpp +++ b/c++/triqs_tprf/types.hpp @@ -170,8 +170,6 @@ typedef gf, tensor_valued<4>> g2_iw_t; typedef g2_iw_t::const_view_type g2_iw_cvt; typedef g2_iw_t::view_type g2_iw_vt; -using scalar_t = g2_iw_t::scalar_t; - // block greens functions typedef block2_gf, tensor_valued<4>> b_g2_iw_t; typedef b_g2_iw_t::view_type b_g2_iw_vt; diff --git a/test/c++/linalg_ops.cpp b/test/c++/linalg_ops.cpp index 454a6699..70213846 100644 --- a/test/c++/linalg_ops.cpp +++ b/test/c++/linalg_ops.cpp @@ -37,11 +37,8 @@ using namespace triqs_tprf; // Fill two-particle Green's function with random complex numbers Re/Im in [-1, // 1] void random_fill(g2_iw_t &G, int rng_seed = 23432) { - typedef size_t st; triqs::mc_tools::random_generator RNG("mt19937", rng_seed); - assign_foreach(G.data(), [&RNG](st n1, st n2, st n3, st i, st j, st k, st l) { - return std::complex(RNG(2.) - 1., RNG(2.) - 1.); - }); + for (auto &v : G.data()) { v = std::complex(RNG(2.) - 1., RNG(2.) - 1.); } } void print(g2_iw_t const &G) {