Skip to content

Commit

Permalink
Fix various compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Wentzell committed Oct 28, 2019
1 parent 20dcde4 commit 7fcf04c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 32 deletions.
12 changes: 4 additions & 8 deletions c++/triqs_tprf/channel_grouping.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ template <Channel_t C> class channel_grouping {
Channel_t channel = C;

inline memory_layout_t<6> memory_layout() const;
inline triqs::arrays::matrix_view<scalar_t> matrix_view(array_view<scalar_t, 6> arr) const;
inline triqs::arrays::matrix_view<g2_iw_t::scalar_t> matrix_view(array_view<g2_iw_t::scalar_t, 6> arr) const;
};

// ----------------------------------------------------
Expand All @@ -64,8 +64,7 @@ channel_grouping<Channel_t::PH>::memory_layout() const {
}

template <>
inline triqs::arrays::matrix_view<scalar_t> channel_grouping<Channel_t::PH>::matrix_view(
array_view<scalar_t, 6> arr) const {
inline triqs::arrays::matrix_view<g2_iw_t::scalar_t> channel_grouping<Channel_t::PH>::matrix_view(array_view<g2_iw_t::scalar_t, 6> arr) const {
return make_matrix_view(group_indices_view(arr, {0, 2, 3}, {1, 5, 4}));
}

Expand All @@ -83,8 +82,7 @@ channel_grouping<Channel_t::PH_bar>::memory_layout() const {
}

template <>
inline triqs::arrays::matrix_view<scalar_t> channel_grouping<Channel_t::PH_bar>::matrix_view(
array_view<scalar_t, 6> arr) const {
inline triqs::arrays::matrix_view<g2_iw_t::scalar_t> channel_grouping<Channel_t::PH_bar>::matrix_view(array_view<g2_iw_t::scalar_t, 6> arr) const {
return make_matrix_view(group_indices_view(arr, {0, 2, 5}, {1, 4, 3}));
}

Expand All @@ -100,9 +98,7 @@ channel_grouping<Channel_t::PP>::memory_layout() const {
return make_memory_layout(0, 2, 4, 1, 3, 5);
}

template <>
inline matrix_view<scalar_t> channel_grouping<Channel_t::PP>::matrix_view(
array_view<scalar_t, 6> arr) const {
template <> inline matrix_view<g2_iw_t::scalar_t> channel_grouping<Channel_t::PP>::matrix_view(array_view<g2_iw_t::scalar_t, 6> arr) const {
return make_matrix_view(group_indices_view(arr, {0, 2, 4}, {1, 3, 5}));
}

Expand Down
13 changes: 3 additions & 10 deletions c++/triqs_tprf/fourier/fourier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,8 @@ gf_vec_t<imfreq> _fourier_impl(gf_mesh<imfreq> const &iw_mesh,
gf_vec_t<imtime> _fourier_impl(gf_mesh<imtime> const &tau_mesh,
gf_vec_cvt<imfreq> gw, fourier_plan &p,
array_const_view<dcomplex, 2> mom_123 = {});
fourier_plan _fourier_plan(gf_mesh<imfreq> const &iw_mesh,
gf_vec_cvt<imtime> gt,
array_const_view<dcomplex, 2> mom_23 = {});
fourier_plan _fourier_plan(gf_mesh<imtime> const &tau_mesh,
gf_vec_cvt<imfreq> gw,
array_const_view<dcomplex, 2> mom_123 = {});
fourier_plan _fourier_plan(gf_mesh<imfreq> const &iw_mesh, gf_vec_cvt<imtime> gt);
fourier_plan _fourier_plan(gf_mesh<imtime> const &tau_mesh, gf_vec_cvt<imfreq> gw);

// real
/*
Expand Down Expand Up @@ -221,15 +217,12 @@ void _fourier_with_plan(gf_const_view<V1, T> gin, gf_view<V2, T> 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++); });
}
}
}
Expand Down
12 changes: 4 additions & 8 deletions c++/triqs_tprf/fourier/fourier_matsubara.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ array<dcomplex, 2> fit_derivatives(gf_const_view<imtime, tensor_valued<1>> gt) {
// ------------------------ DIRECT TRANSFORM
// --------------------------------------------

fourier_plan _fourier_plan(gf_mesh<imfreq> const &iw_mesh,
gf_vec_cvt<imtime> gt,
arrays::array_const_view<dcomplex, 2> mom_23) {
fourier_plan _fourier_plan(gf_mesh<imfreq> const &iw_mesh, gf_vec_cvt<imtime> gt) {

auto L = gt.mesh().size() - 1;
if (L < 2 * (iw_mesh.last_index() + 1))
Expand Down Expand Up @@ -229,16 +227,14 @@ gf_vec_t<imfreq> _fourier_impl(gf_mesh<imfreq> const &iw_mesh,
gf_vec_t<imfreq> _fourier_impl(gf_mesh<imfreq> const &iw_mesh,
gf_vec_cvt<imtime> gt,
arrays::array_const_view<dcomplex, 2> 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<imtime> const &tau_mesh,
gf_vec_cvt<imfreq> gw,
arrays::array_const_view<dcomplex, 2> mom_123) {
fourier_plan _fourier_plan(gf_mesh<imtime> const &tau_mesh, gf_vec_cvt<imfreq> gw) {

TRIQS_ASSERT2(!gw.mesh().positive_only(),
"Fourier is only implemented for g(i omega_n) with full mesh "
Expand Down Expand Up @@ -369,7 +365,7 @@ gf_vec_t<imtime> _fourier_impl(gf_mesh<imtime> const &tau_mesh,
gf_vec_t<imtime> _fourier_impl(gf_mesh<imtime> const &tau_mesh,
gf_vec_cvt<imfreq> gw,
arrays::array_const_view<dcomplex, 2> 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;
}
Expand Down
2 changes: 0 additions & 2 deletions c++/triqs_tprf/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ typedef gf<cartesian_product<imfreq, imfreq, imfreq>, 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<cartesian_product<imfreq, imfreq, imfreq>, tensor_valued<4>> b_g2_iw_t;
typedef b_g2_iw_t::view_type b_g2_iw_vt;
Expand Down
5 changes: 1 addition & 4 deletions test/c++/linalg_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<double>(RNG(2.) - 1., RNG(2.) - 1.);
});
for (auto &v : G.data()) { v = std::complex<double>(RNG(2.) - 1., RNG(2.) - 1.); }
}

void print(g2_iw_t const &G) {
Expand Down

0 comments on commit 7fcf04c

Please sign in to comment.