mirror of
https://github.com/triqs/dft_tools
synced 2024-12-26 06:14:14 +01:00
gf: correct auto_assign
- g(om_)(i_,j_) was not working. - add the triqs_clef_auto_assign function for matrix_proxy. - simplified a bit the triqs_clef_auto_assign for gf.
This commit is contained in:
parent
2fdba13bc5
commit
e1e9ee20fd
@ -120,6 +120,8 @@ namespace arrays {
|
|||||||
friend std::ostream &operator<<(std::ostream &out, matrix_tensor_proxy const &x) {
|
friend std::ostream &operator<<(std::ostream &out, matrix_tensor_proxy const &x) {
|
||||||
return out << view_type{x};
|
return out << view_type{x};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename F> friend void triqs_clef_auto_assign(matrix_tensor_proxy x, F &&f) { foreach(x(), std::forward<F>(f)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename A, bool IsMatrix>
|
template <typename A, bool IsMatrix>
|
||||||
|
@ -345,22 +345,20 @@ namespace gfs {
|
|||||||
triqs_clef_auto_assign(g, rhs);
|
triqs_clef_auto_assign(g, rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool B, typename G, typename RHS>
|
template <typename G, typename RHS> void triqs_gf_clef_auto_assign_impl_aux_assign(G &&g, RHS &&rhs) {
|
||||||
void triqs_gf_clef_auto_assign_impl_aux_assign(G &&g, RHS &&rhs, std::integral_constant<bool, B>) {
|
|
||||||
std::forward<G>(g) = std::forward<RHS>(rhs);
|
std::forward<G>(g) = std::forward<RHS>(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename G, bool B, typename Expr, int... Is>
|
template <typename G, typename Expr, int... Is>
|
||||||
void triqs_gf_clef_auto_assign_impl_aux_assign(G &&g, clef::make_fun_impl<Expr, Is...> &&rhs, std::integral_constant<bool, B>) {
|
void triqs_gf_clef_auto_assign_impl_aux_assign(G &&g, clef::make_fun_impl<Expr, Is...> &&rhs) {
|
||||||
triqs_clef_auto_assign_impl(std::forward<G>(g), std::forward<clef::make_fun_impl<Expr, Is...>>(rhs),
|
triqs_clef_auto_assign(std::forward<G>(g), std::forward<clef::make_fun_impl<Expr, Is...>>(rhs));
|
||||||
std::integral_constant<bool, B>());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename RHS, typename Variable, typename Target, typename Opt, bool IsView>
|
template <typename RHS, typename Variable, typename Target, typename Opt, bool IsView>
|
||||||
void triqs_clef_auto_assign_impl(gf_impl<Variable, Target, Opt, IsView, false> &g, RHS const &rhs,
|
void triqs_clef_auto_assign_impl(gf_impl<Variable, Target, Opt, IsView, false> &g, RHS const &rhs,
|
||||||
std::integral_constant<bool, false>) {
|
std::integral_constant<bool, false>) {
|
||||||
for (auto const &w : g.mesh()) {
|
for (auto const &w : g.mesh()) {
|
||||||
triqs_gf_clef_auto_assign_impl_aux_assign(g[w], rhs(w), std::integral_constant<bool, false>());
|
triqs_gf_clef_auto_assign_impl_aux_assign(g[w], rhs(w));
|
||||||
//(*this)[w] = rhs(w);
|
//(*this)[w] = rhs(w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -369,8 +367,7 @@ namespace gfs {
|
|||||||
void triqs_clef_auto_assign_impl(gf_impl<Variable, Target, Opt, IsView, false> &g, RHS const &rhs,
|
void triqs_clef_auto_assign_impl(gf_impl<Variable, Target, Opt, IsView, false> &g, RHS const &rhs,
|
||||||
std::integral_constant<bool, true>) {
|
std::integral_constant<bool, true>) {
|
||||||
for (auto const &w : g.mesh()) {
|
for (auto const &w : g.mesh()) {
|
||||||
triqs_gf_clef_auto_assign_impl_aux_assign(g[w], triqs::tuple::apply(rhs, w.components_tuple()),
|
triqs_gf_clef_auto_assign_impl_aux_assign(g[w], triqs::tuple::apply(rhs, w.components_tuple()));
|
||||||
std::integral_constant<bool, true>());
|
|
||||||
//(*this)[w] = triqs::tuple::apply(rhs, w.components_tuple());
|
//(*this)[w] = triqs::tuple::apply(rhs, w.components_tuple());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user