3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-26 06:14:14 +01:00

gf: imfreq: fix out of bound product gf imfreq

- gf<cartesian_product<imfreq,imfreq>> was not correct
  when out bounds. Fixed evaluator.
- tensor_proxy : fix the trait for algebra which was incorrect.
- TODO: clean code (repetition, put in mesh some windowing).
This commit is contained in:
Olivier Parcollet 2014-01-06 17:46:09 +01:00
parent 1b3a66af24
commit 2200e2680f
4 changed files with 13 additions and 6 deletions

View File

@ -37,7 +37,7 @@ int main() {
auto zz = G_w_wn2(t_,tp_); auto zz = G_w_wn2(t_,tp_);
//std::cout << std::get<0>(zz.childs).data() << std::endl ; //std::cout << std::get<0>(zz.childs).data() << std::endl ;
auto yy = eval ( zz, t_=2, tp_=3); auto yy = eval ( zz, t_=2, tp_=3);
std::cout << yy.indexmap()<< std::endl ; //std::cout << yy.indexmap()<< std::endl ;
std::cout << yy << std::endl ; std::cout << yy << std::endl ;
//std::cout << eval ( zz, t_=2, tp_=3)<< std::endl ; //std::cout << eval ( zz, t_=2, tp_=3)<< std::endl ;
//std::cout << eval ( G_w_wn2(t_,tp_), t_=2, tp_=3)<< std::endl ; //std::cout << eval ( G_w_wn2(t_,tp_), t_=2, tp_=3)<< std::endl ;

View File

@ -35,7 +35,7 @@ namespace arrays {
// tensor const // tensor const
template <typename A, bool IsMatrix> template <typename A, bool IsMatrix>
struct const_matrix_tensor_proxy : std::conditional<IsMatrix, TRIQS_CONCEPT_TAG_NAME(ImmutableMatrix), struct const_matrix_tensor_proxy : std::conditional<IsMatrix, TRIQS_CONCEPT_TAG_NAME(ImmutableMatrix),
TRIQS_CONCEPT_TAG_NAME(ImmutableCuboidArray)>::type { TRIQS_CONCEPT_TAG_NAME(ImmutableArray)>::type {
typedef typename std::remove_reference<A>::type A_t; typedef typename std::remove_reference<A>::type A_t;
static constexpr bool is_const = true; static constexpr bool is_const = true;
@ -84,7 +84,7 @@ namespace arrays {
// tensor no const // tensor no const
template <typename A, bool IsMatrix> template <typename A, bool IsMatrix>
struct matrix_tensor_proxy : std::conditional<IsMatrix, TRIQS_CONCEPT_TAG_NAME(MutableMatrix), struct matrix_tensor_proxy : std::conditional<IsMatrix, TRIQS_CONCEPT_TAG_NAME(MutableMatrix),
TRIQS_CONCEPT_TAG_NAME(MutableCuboidArray)>::type { TRIQS_CONCEPT_TAG_NAME(MutableArray)>::type {
typedef typename std::remove_reference<A>::type A_t; typedef typename std::remove_reference<A>::type A_t;
static constexpr bool is_const = false; static constexpr bool is_const = false;

View File

@ -55,10 +55,14 @@ namespace gfs {
// simple evaluation : take the point on the grid... // simple evaluation : take the point on the grid...
template <> struct evaluator_fnt_on_mesh<imfreq> { template <> struct evaluator_fnt_on_mesh<imfreq> {
long n; long n;
double w;
evaluator_fnt_on_mesh() = default; evaluator_fnt_on_mesh() = default;
template <typename MeshType> evaluator_fnt_on_mesh(MeshType const &m, long p) { n = p; } template <typename MeshType> evaluator_fnt_on_mesh(MeshType const &m, long p) { n = p; w=1; }
template <typename MeshType> evaluator_fnt_on_mesh(MeshType const &m, matsubara_freq const &p) { n = p.n; } template <typename MeshType> evaluator_fnt_on_mesh(MeshType const &m, matsubara_freq const &p) {
template <typename F> auto operator()(F const &f) const DECL_AND_RETURN(f(n)); if ((p.n >= m.index_start()) && (p.n < m.size()+m.index_start())) {w=1; n =p.n;}
else {w=0; n=0;}
}
template <typename F> auto operator()(F const &f) const DECL_AND_RETURN(w*f(n));
}; };
// ------------- evaluator ------------------- // ------------- evaluator -------------------

View File

@ -69,6 +69,9 @@ namespace gfs {
/// Flatten the index in the positive linear index for memory storage (almost trivial here). /// Flatten the index in the positive linear index for memory storage (almost trivial here).
long index_to_linear(index_t ind) const { return ind - index_start(); } long index_to_linear(index_t ind) const { return ind - index_start(); }
/// Is the mesh only for positive omega_n (G(tau) real))
bool positive_only() const { return _positive_only;}
/** /**
* The mesh point * The mesh point
* *