mirror of
https://github.com/triqs/dft_tools
synced 2025-01-12 05:58:18 +01:00
gf : corrections
- correct previous commit (for scalar gf, the new check was not compiling) - correct windowing of linear mesh (left point corrected as right point for rounding error
This commit is contained in:
parent
b76a61680c
commit
2b315fcdea
@ -9,8 +9,6 @@ using triqs::gfs::local::tail;
|
||||
#define TEST(X) std::cout << BOOST_PP_STRINGIZE((X)) << " ---> "<< (X) <<std::endl<<std::endl;
|
||||
void test_0(){
|
||||
|
||||
double precision=10e-9;
|
||||
|
||||
triqs::clef::placeholder<0> iom_;
|
||||
double beta =10;
|
||||
int N=100;
|
||||
|
@ -66,7 +66,7 @@
|
||||
... Order 2 =
|
||||
[[(1,0)]]
|
||||
... Order 3 =
|
||||
[[(0.999288,0)]]
|
||||
[[(0.999247,0)]]
|
||||
... Order 4 =
|
||||
[[(0.998655,0)]]
|
||||
|
||||
@ -80,7 +80,7 @@
|
||||
... Order 2 =
|
||||
[[(1,0)]]
|
||||
... Order 3 =
|
||||
[[(0.999209,0)]]
|
||||
[[(0.999186,0)]]
|
||||
... Order 4 =
|
||||
[[(0.998631,0)]]
|
||||
|
||||
@ -94,7 +94,7 @@
|
||||
... Order 2 =
|
||||
[[(1,0)]]
|
||||
... Order 3 =
|
||||
[[(0.999251,0)]]
|
||||
[[(0.999214,0)]]
|
||||
... Order 4 =
|
||||
[[(0.998655,0)]]
|
||||
|
||||
|
@ -57,8 +57,6 @@ namespace triqs { namespace gfs { namespace local {
|
||||
// if known_moments.size()==0, the lowest order to be obtained from the fit is determined by order_min in known_moments
|
||||
// if known_moments.size()==0, the lowest order is the one following order_max in known_moments
|
||||
|
||||
const double beta = gf.mesh().domain().beta;
|
||||
|
||||
int n_unknown_moments = n_moments - known_moments.size();
|
||||
if (n_unknown_moments < 1) return known_moments;
|
||||
|
||||
|
@ -33,10 +33,22 @@ namespace gfs {
|
||||
return {g.mesh(), g.data(), {}, g.symmetry()};
|
||||
}
|
||||
|
||||
namespace details { // dispatch the test for scalar_valued and matrix_valued
|
||||
using arrays::mini_vector;
|
||||
|
||||
inline void _equal_or_throw(mini_vector<size_t, 2> const &s_t, mini_vector<size_t, 2> const &g_t) {
|
||||
if (s_t != g_t) TRIQS_RUNTIME_ERROR << "make_gf_from_g_and_tail: Shape of the gf target and of the tail mismatch";
|
||||
}
|
||||
|
||||
inline void _equal_or_throw(mini_vector<size_t, 2> const &s_t, mini_vector<size_t, 0> const &g_t) {
|
||||
if (s_t != mini_vector<size_t, 2>{1, 1})
|
||||
TRIQS_RUNTIME_ERROR << "make_gf_from_g_and_tail: tail shape must be 1x1 for a scalar gf";
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Variable, typename Target, bool V, bool C>
|
||||
gf_view<Variable, Target> make_gf_from_g_and_tail(gf_impl<Variable, Target, no_tail, V, C> const &g, local::tail t) {
|
||||
if (t.shape() != get_target_shape(g))
|
||||
TRIQS_RUNTIME_ERROR << "make_gf_from_g_and_tail: Shape of the gf target and of the tail mismatch";
|
||||
details::_equal_or_throw(t.shape(), get_target_shape(g));
|
||||
auto g2 = gf<Variable, Target, no_tail>{g}; // copy the function without tail
|
||||
return {std::move(g2.mesh()), std::move(g2.data()), std::move(t), g2.symmetry()};
|
||||
}
|
||||
@ -44,8 +56,7 @@ namespace gfs {
|
||||
template <typename Variable, typename Target, bool V, bool C>
|
||||
gf_view<Variable, Target, void, C> make_gf_view_from_g_and_tail(gf_impl<Variable, Target, no_tail, V, C> const &g,
|
||||
local::tail_view t) {
|
||||
if (t.shape() != get_target_shape(g))
|
||||
TRIQS_RUNTIME_ERROR << "make_gf_from_g_and_tail: Shape of the gf target and of the tail mismatch";
|
||||
details::_equal_or_throw(t.shape(), get_target_shape(g));
|
||||
return {g.mesh(), g.data(), t, g.symmetry()};
|
||||
}
|
||||
}
|
||||
|
@ -200,7 +200,12 @@ namespace gfs {
|
||||
double w = a - i;
|
||||
if (i == imax) {
|
||||
--i;
|
||||
in = (std::abs(w) < 1.e-14);
|
||||
in = (std::abs(w) < 1.e-12);
|
||||
w = 1.0;
|
||||
}
|
||||
if (i == -1) {
|
||||
i = 0;
|
||||
in = (std::abs(1 - w) < 1.e-12);
|
||||
w = 1.0;
|
||||
}
|
||||
return std::make_tuple(in, i, w);
|
||||
|
Loading…
Reference in New Issue
Block a user