3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-25 05:43:40 +01:00

gf : mesh now the class, not a trait.

simplify : mesh was a impl trait,
make it the class itself.
corrected the gf, tests and the cython.
This commit is contained in:
Olivier Parcollet 2013-08-24 14:47:47 +02:00
parent 3d6c030b1f
commit 7898bd8d88
21 changed files with 348 additions and 372 deletions

View File

@ -5,8 +5,7 @@ cdef extern from "triqs/gfs/imfreq.hpp" namespace "triqs::gfs" :
statistic_enum statistic statistic_enum statistic
imfreq_domain () imfreq_domain ()
#cdef cppclass mesh_imfreq "triqs::gfs::linear_mesh<triqs::gfs::imfreq::domain_t>" : cdef cppclass mesh_imfreq "triqs::gfs::mesh<triqs::gfs::imfreq>" :
cdef cppclass mesh_imfreq "triqs::gfs::linear_mesh<triqs::gfs::matsubara_domain<true>>" :
mesh_imfreq () mesh_imfreq ()
mesh_imfreq (mesh_imfreq &) mesh_imfreq (mesh_imfreq &)
imfreq_domain & domain() imfreq_domain & domain()
@ -14,7 +13,7 @@ cdef extern from "triqs/gfs/imfreq.hpp" namespace "triqs::gfs" :
long size() long size()
bint operator ==( mesh_imfreq &) bint operator ==( mesh_imfreq &)
cdef mesh_imfreq make_mesh_imfreq "triqs::gfs::make_gf_mesh<triqs::gfs::imfreq>" (double beta, statistic_enum S, size_t n_max) cdef mesh_imfreq make_mesh_imfreq "triqs::gfs::mesh<triqs::gfs::imfreq>" (double beta, statistic_enum S, size_t n_max)
#cdef mesh_imfreq make_mesh_imfreq "triqs::gfs::gf_implementation::gf_factories<triqs::gfs::imfreq,triqs::gfs::matrix>::make_mesh" (double beta, statistic_enum S, size_t n_max) #cdef mesh_imfreq make_mesh_imfreq "triqs::gfs::gf_implementation::gf_factories<triqs::gfs::imfreq,triqs::gfs::matrix>::make_mesh" (double beta, statistic_enum S, size_t n_max)
cdef cppclass gf_imfreq "triqs::python_tools::cython_proxy<triqs::gfs::gf_view<triqs::gfs::imfreq> >" : cdef cppclass gf_imfreq "triqs::python_tools::cython_proxy<triqs::gfs::gf_view<triqs::gfs::imfreq> >" :

View File

@ -5,8 +5,7 @@ cdef extern from "triqs/gfs/imtime.hpp" namespace "triqs::gfs" :
statistic_enum statistic statistic_enum statistic
imtime_domain () imtime_domain ()
#cdef cppclass mesh_imtime "triqs::gfs::linear_mesh<triqs::gfs::imtime::domain_t>" : cdef cppclass mesh_imtime "triqs::gfs::mesh<triqs::gfs::imtime>" :
cdef cppclass mesh_imtime "triqs::gfs::linear_mesh<triqs::gfs::matsubara_domain<false>>" :
mesh_imtime () mesh_imtime ()
mesh_imtime (mesh_imtime &) mesh_imtime (mesh_imtime &)
imtime_domain & domain() imtime_domain & domain()
@ -15,7 +14,7 @@ cdef extern from "triqs/gfs/imtime.hpp" namespace "triqs::gfs" :
long kind() long kind()
bint operator ==( mesh_imtime &) bint operator ==( mesh_imtime &)
cdef mesh_imtime make_mesh_imtime "triqs::gfs::make_gf_mesh<triqs::gfs::imtime>" (double beta, statistic_enum S, size_t n_time_slices, mesh_enum mk) cdef mesh_imtime make_mesh_imtime "triqs::gfs::mesh<triqs::gfs::imtime>" (double beta, statistic_enum S, size_t n_time_slices, mesh_enum mk)
#cdef mesh_imtime make_mesh_imtime "triqs::gfs::gf_factories<triqs::gfs::imtime>::make_mesh" (double beta, statistic_enum S, size_t n_time_slices, mesh_enum mk) #cdef mesh_imtime make_mesh_imtime "triqs::gfs::gf_factories<triqs::gfs::imtime>::make_mesh" (double beta, statistic_enum S, size_t n_time_slices, mesh_enum mk)
cdef cppclass gf_imtime "triqs::python_tools::cython_proxy<triqs::gfs::gf_view<triqs::gfs::imtime>>" : cdef cppclass gf_imtime "triqs::python_tools::cython_proxy<triqs::gfs::gf_view<triqs::gfs::imtime>>" :

View File

@ -6,15 +6,14 @@ cdef extern from "triqs/gfs/legendre.hpp" namespace "triqs::gfs" :
statistic_enum statistic statistic_enum statistic
legendre_domain () legendre_domain ()
#cdef cppclass mesh_legendre "triqs::gfs::discrete_mesh<triqs::gfs::legendre::domain_t>": cdef cppclass mesh_legendre "triqs::gfs::mesh<triqs::gfs::legendre>" :
cdef cppclass mesh_legendre "triqs::gfs::discrete_mesh<triqs::gfs::legendre_domain>":
mesh_legendre () mesh_legendre ()
mesh_legendre (mesh_legendre &) mesh_legendre (mesh_legendre &)
legendre_domain & domain() legendre_domain & domain()
long size() long size()
bint operator == (mesh_legendre &) bint operator == (mesh_legendre &)
cdef mesh_legendre make_mesh_legendre "triqs::gfs::make_gf_mesh<triqs::gfs::legendre>" (double beta, statistic_enum S, size_t n_leg) cdef mesh_legendre make_mesh_legendre "triqs::gfs::mesh<triqs::gfs::legendre>" (double beta, statistic_enum S, size_t n_leg)
#cdef mesh_legendre make_mesh_legendre "triqs::gfs::gf_factories<triqs::gfs::legendre>::make_mesh" (double beta, statistic_enum S, size_t n_leg) #cdef mesh_legendre make_mesh_legendre "triqs::gfs::gf_factories<triqs::gfs::legendre>::make_mesh" (double beta, statistic_enum S, size_t n_leg)
cdef cppclass gf_legendre "triqs::python_tools::cython_proxy<triqs::gfs::gf_view<triqs::gfs::legendre>>" : cdef cppclass gf_legendre "triqs::python_tools::cython_proxy<triqs::gfs::gf_view<triqs::gfs::legendre>>" :

View File

@ -3,8 +3,7 @@ cdef extern from "triqs/gfs/refreq.hpp" namespace "triqs::gfs" :
cdef cppclass refreq_domain : cdef cppclass refreq_domain :
refreq_domain() refreq_domain()
#cdef cppclass mesh_refreq "triqs::gfs::linear_mesh<triqs::gfs::refreq::domain_t>" : cdef cppclass mesh_refreq "triqs::gfs::mesh<triqs::gfs::refreq>" :
cdef cppclass mesh_refreq "triqs::gfs::linear_mesh<triqs::gfs::R_domain>" :
mesh_refreq () mesh_refreq ()
mesh_refreq (mesh_refreq &) mesh_refreq (mesh_refreq &)
refreq_domain & domain() refreq_domain & domain()
@ -14,7 +13,7 @@ cdef extern from "triqs/gfs/refreq.hpp" namespace "triqs::gfs" :
double kind() double kind()
bint operator ==( mesh_refreq &) bint operator ==( mesh_refreq &)
cdef mesh_refreq make_mesh_refreq "triqs::gfs::make_gf_mesh<triqs::gfs::refreq>" (double omega_min, double omega_max, size_t n_freq, mesh_enum mk) cdef mesh_refreq make_mesh_refreq "triqs::gfs::mesh<triqs::gfs::refreq>" (double omega_min, double omega_max, size_t n_freq, mesh_enum mk)
#cdef mesh_refreq make_mesh_refreq "triqs::gfs::gf_factories<triqs::gfs::refreq>::make_mesh" (double omega_min, double omega_max, size_t n_freq, mesh_enum mk) #cdef mesh_refreq make_mesh_refreq "triqs::gfs::gf_factories<triqs::gfs::refreq>::make_mesh" (double omega_min, double omega_max, size_t n_freq, mesh_enum mk)
cdef cppclass gf_refreq "triqs::python_tools::cython_proxy<triqs::gfs::gf_view<triqs::gfs::refreq>>" : cdef cppclass gf_refreq "triqs::python_tools::cython_proxy<triqs::gfs::gf_view<triqs::gfs::refreq>>" :

View File

@ -3,8 +3,7 @@ cdef extern from "triqs/gfs/retime.hpp" namespace "triqs::gfs" :
cdef cppclass retime_domain : cdef cppclass retime_domain :
retime_domain() retime_domain()
#cdef cppclass mesh_retime "triqs::gfs::linear_mesh<triqs::gfs::retime::domain_t>" : cdef cppclass mesh_retime "triqs::gfs::mesh<triqs::gfs::retime>" :
cdef cppclass mesh_retime "triqs::gfs::linear_mesh<triqs::gfs::R_domain>" :
mesh_retime () mesh_retime ()
mesh_retime (mesh_retime &) mesh_retime (mesh_retime &)
retime_domain & domain() retime_domain & domain()
@ -14,7 +13,7 @@ cdef extern from "triqs/gfs/retime.hpp" namespace "triqs::gfs" :
double kind() double kind()
bint operator ==( mesh_retime &) bint operator ==( mesh_retime &)
cdef mesh_retime make_mesh_retime "triqs::gfs::make_gf_mesh<triqs::gfs::retime>" (double t_min, double t_max, size_t n_freq, mesh_enum mk) cdef mesh_retime make_mesh_retime "triqs::gfs::mesh<triqs::gfs::retime>" (double t_min, double t_max, size_t n_freq, mesh_enum mk)
#cdef mesh_retime make_mesh_retime "triqs::gfs::gf_factories<triqs::gfs::retime>::make_mesh" (double t_min, double t_max, size_t n_freq, mesh_enum mk) #cdef mesh_retime make_mesh_retime "triqs::gfs::gf_factories<triqs::gfs::retime>::make_mesh" (double t_min, double t_max, size_t n_freq, mesh_enum mk)
cdef cppclass gf_retime "triqs::python_tools::cython_proxy<triqs::gfs::gf_view<triqs::gfs::retime>>" : cdef cppclass gf_retime "triqs::python_tools::cython_proxy<triqs::gfs::gf_view<triqs::gfs::retime>>" :

View File

@ -3,8 +3,7 @@ cdef extern from "triqs/gfs/two_real_times.hpp" namespace "triqs::gfs" :
cdef cppclass two_real_times_domain : cdef cppclass two_real_times_domain :
two_real_times_domain() two_real_times_domain()
#cdef cppclass mesh_retime "triqs::gfs::linear_mesh<triqs::gfs::retime::domain_t>" : cdef cppclass mesh_two_real_times "triqs::gfs::mesh<triqs::gfs::two_real_times>" :
cdef cppclass mesh_two_real_times "triqs::gfs::mesh_product<triqs::gfs::linear_mesh<triqs::gfs::R_domain>,triqs::gfs::linear_mesh<triqs::gfs::R_domain>>" :
mesh_two_real_times () mesh_two_real_times ()
mesh_two_real_times (mesh_two_real_times &) mesh_two_real_times (mesh_two_real_times &)
two_real_times_domain & domain() two_real_times_domain & domain()
@ -14,7 +13,7 @@ cdef extern from "triqs/gfs/two_real_times.hpp" namespace "triqs::gfs" :
double kind() double kind()
bint operator ==( mesh_two_real_times &) bint operator ==( mesh_two_real_times &)
cdef mesh_two_real_times make_mesh_two_real_times "triqs::gfs::make_gf_mesh<triqs::gfs::two_real_times>" (double t_max, double n_time_slices) cdef mesh_two_real_times make_mesh_two_real_times "triqs::gfs::mesh<triqs::gfs::two_real_times>" (double t_max, double n_time_slices)
cdef mesh_retime & get_1d_mesh_from_2times_mesh "triqs::gfs::get_1d_mesh_from_2times_mesh" (mesh_two_real_times &) cdef mesh_retime & get_1d_mesh_from_2times_mesh "triqs::gfs::get_1d_mesh_from_2times_mesh" (mesh_two_real_times &)

View File

@ -34,11 +34,11 @@ try {
auto G_w_tau= make_gf<refreq_imtime, scalar_valued>(wmin, wmax, n_re_freq, beta, Fermion, n_im_time); auto G_w_tau= make_gf<refreq_imtime, scalar_valued>(wmin, wmax, n_re_freq, beta, Fermion, n_im_time);
auto G_w= make_gf<refreq, scalar_valued>(wmin, wmax, n_re_freq); auto G_w= make_gf<refreq, scalar_valued>(wmin, wmax, n_re_freq);
auto G_t_tau= make_gf<cartesian_product<retime,imtime>, scalar_valued>( make_gf_mesh<retime>(tmin, tmax, n_re_time), make_gf_mesh<imtime>(beta, Fermion, n_im_time)); auto G_t_tau= make_gf<cartesian_product<retime,imtime>, scalar_valued>(mesh<retime>(tmin, tmax, n_re_time), mesh<imtime>(beta, Fermion, n_im_time));
//auto G_t_tau_N= make_gf<cartesian_product<retime,imtime>, scalar_valued>( {tmin, tmax, n_re_time}, {beta, Fermion, n_im_time}); //auto G_t_tau_N= make_gf<cartesian_product<retime,imtime>, scalar_valued>( {tmin, tmax, n_re_time}, {beta, Fermion, n_im_time});
auto G_w_wn2 = make_gf<cartesian_product<refreq,imfreq>, scalar_valued>( make_gf_mesh<refreq>(wmin, wmax, n_re_freq), make_gf_mesh<imfreq>(beta, Fermion, n_im_freq)); auto G_w_wn2 = make_gf<cartesian_product<refreq,imfreq>, scalar_valued>( mesh<refreq>(wmin, wmax, n_re_freq), mesh<imfreq>(beta, Fermion, n_im_freq));
auto G_w_tau2 = make_gf<cartesian_product<refreq,imtime>, scalar_valued>( make_gf_mesh<refreq>(wmin, wmax, n_re_freq), make_gf_mesh<imtime>(beta, Fermion, n_im_time,full_bins)); auto G_w_tau2 = make_gf<cartesian_product<refreq,imtime>, scalar_valued>( mesh<refreq>(wmin, wmax, n_re_freq), mesh<imtime>(beta, Fermion, n_im_time,full_bins));
//auto g_tau = slice_mesh1(G_w_tau(),1); //auto g_tau = slice_mesh1(G_w_tau(),1);

View File

@ -29,9 +29,13 @@ namespace triqs { namespace gfs {
struct block_index {}; struct block_index {};
template<typename Opt> struct mesh<block_index,Opt> : discrete_mesh<discrete_domain> {
mesh() = default;
mesh(size_t s) : discrete_mesh<discrete_domain>(s) {}
};
namespace gfs_implementation { namespace gfs_implementation {
template<typename Opt> struct mesh<block_index,Opt> { typedef discrete_mesh<discrete_domain> type;};
template<typename Target, typename Opt> struct h5_name<block_index,Target,Opt> { static std::string invoke(){ return "BlockGf";}}; template<typename Target, typename Opt> struct h5_name<block_index,Target,Opt> { static std::string invoke(){ return "BlockGf";}};
/// --------------------------- h5_rw --------------------------------- /// --------------------------- h5_rw ---------------------------------
@ -62,7 +66,7 @@ namespace triqs { namespace gfs {
template<typename Target, typename Opt> template<typename Target, typename Opt>
struct factories<block_index,Target,Opt> { struct factories<block_index,Target,Opt> {
typedef typename mesh<block_index, Opt>::type mesh_t; typedef mesh<block_index, Opt> mesh_t;
typedef gf<block_index,Target> gf_t; typedef gf<block_index,Target> gf_t;
typedef gf_view<block_index,Target> gf_view_t; typedef gf_view<block_index,Target> gf_view_t;
@ -80,7 +84,7 @@ namespace triqs { namespace gfs {
auto v = std::vector<Target> {l}; auto v = std::vector<Target> {l};
return make_gf(v); return make_gf(v);
} }
*/ */
/* template<typename... Args> /* template<typename... Args>
static gf_t make_gf(size_t N, Args&& ...args) { static gf_t make_gf(size_t N, Args&& ...args) {
std::vector<Target> V; V.reserve(N); std::vector<Target> V; V.reserve(N);

View File

@ -119,7 +119,7 @@ namespace triqs { namespace gfs {
Opt> Opt>
curry (gf_impl<cartesian_product<Ms...>, Target,Opt,B> const & g) { curry (gf_impl<cartesian_product<Ms...>, Target,Opt,B> const & g) {
auto comp = pv_<cartesian_product<Ms...>,pos...>::m(std::make_tuple(),g.mesh().components()); auto comp = pv_<cartesian_product<Ms...>,pos...>::m(std::make_tuple(),g.mesh().components());
typedef typename mesh< typename pv_<cartesian_product<Ms...>,pos...>::type,Opt>::type m_t; typedef mesh< typename pv_<cartesian_product<Ms...>,pos...>::type,Opt> m_t;
return {triqs::tuple::apply_construct<m_t>(comp),curry_polymorphic_lambda<gf_view<cartesian_product<Ms...>, Target,Opt>, pos ...>{g}, nothing(), nothing()}; return {triqs::tuple::apply_construct<m_t>(comp),curry_polymorphic_lambda<gf_view<cartesian_product<Ms...>, Target,Opt>, pos ...>{g}, nothing(), nothing()};
}; };

View File

@ -34,13 +34,12 @@ namespace triqs { namespace gfs {
using arrays::make_shape; using arrays::make_shape;
// GENERALISE matrxi TO DEFAULT // GENERALISE matrxi TO DEFAULT
template<typename Variable, typename Opt=void> struct mesh;
template<typename Variable, typename Target=matrix_valued, typename Opt=void> class gf; // the value class template<typename Variable, typename Target=matrix_valued, typename Opt=void> class gf; // the value class
template<typename Variable, typename Target=matrix_valued, typename Opt=void> class gf_view; // the view class template<typename Variable, typename Target=matrix_valued, typename Opt=void> class gf_view; // the view class
// various implementation traits // various implementation traits
namespace gfs_implementation { // never use using of this... namespace gfs_implementation { // never use using of this...
// what is the mesh
template<typename Variable, typename Opt> struct mesh;
// evaluator regroup functions to evaluate the function. Cf descriptors // evaluator regroup functions to evaluate the function. Cf descriptors
template<typename Variable, typename Target, typename Opt> struct evaluator{ static constexpr int arity = 0;}; template<typename Variable, typename Target, typename Opt> struct evaluator{ static constexpr int arity = 0;};
@ -80,9 +79,6 @@ namespace triqs { namespace gfs {
template <typename Variable, typename Target=matrix_valued, typename Opt=void, typename ... U> template <typename Variable, typename Target=matrix_valued, typename Opt=void, typename ... U>
gf_view<Variable,Target,Opt> make_gf_view(U && ... x) { return gfs_implementation::factories<Variable,Target,Opt>::make_gf_view(std::forward<U>(x)...);} gf_view<Variable,Target,Opt> make_gf_view(U && ... x) { return gfs_implementation::factories<Variable,Target,Opt>::make_gf_view(std::forward<U>(x)...);}
template <typename Variable, typename Opt=void, typename ... U>
typename gfs_implementation::mesh<Variable,Opt>::type make_gf_mesh(U && ... x) { return gfs_implementation::mesh<Variable,Opt>::make(std::forward<U>(x)...);}
template<typename Variable, typename Target, typename Opt> struct gf_desc{}; template<typename Variable, typename Target, typename Opt> struct gf_desc{};
template<typename Descriptor> struct gf_tag{}; template<typename Descriptor> struct gf_tag{};
@ -105,7 +101,7 @@ namespace triqs { namespace gfs {
typedef Variable variable_t; typedef Variable variable_t;
typedef Opt option_t; typedef Opt option_t;
typedef typename gfs_implementation::mesh<Variable,Opt>::type mesh_t; typedef mesh<Variable,Opt> mesh_t;
typedef typename mesh_t::domain_t domain_t; typedef typename mesh_t::domain_t domain_t;
typedef typename mesh_t::mesh_point_t mesh_point_t; typedef typename mesh_t::mesh_point_t mesh_point_t;
typedef typename mesh_t::index_t mesh_index_t; typedef typename mesh_t::index_t mesh_index_t;

View File

@ -29,19 +29,16 @@ namespace triqs { namespace gfs {
struct imfreq {}; struct imfreq {};
namespace gfs_implementation { template<typename Opt> struct mesh<imfreq,Opt> : linear_mesh<matsubara_domain<true>> {
typedef linear_mesh<matsubara_domain<true>> B;
// mesh type and its factories static double m1(double beta) { return std::acos(-1)/beta;}
template<typename Opt> struct mesh<imfreq,Opt> { mesh() = default;
typedef linear_mesh<matsubara_domain<true>> type; mesh (double beta, statistic_enum S, size_t Nmax = 1025) :
typedef typename type::domain_t domain_t; B(typename B::domain_t(beta,S), S==Fermion?m1(beta):0, S==Fermion?(2*Nmax+1)*m1(beta): 2*Nmax*m1(beta), Nmax, without_last){}
static type make(double beta, statistic_enum S, size_t Nmax = 1025) {
double m1 = std::acos(-1)/beta;
return type( domain_t(beta,S), S==Fermion?m1:0, S==Fermion?(2*Nmax+1)*m1: 2*Nmax*m1, Nmax, without_last);
}
}; };
namespace gfs_implementation {
//singularity //singularity
template<typename Opt> struct singularity<imfreq,matrix_valued,Opt> { typedef local::tail type;}; template<typename Opt> struct singularity<imfreq,matrix_valued,Opt> { typedef local::tail type;};
template<typename Opt> struct singularity<imfreq,scalar_valued,Opt> { typedef local::tail type;}; template<typename Opt> struct singularity<imfreq,scalar_valued,Opt> { typedef local::tail type;};
@ -79,13 +76,13 @@ namespace triqs { namespace gfs {
return gf_t ( std::forward<MeshType>(m), std::move(A), t, nothing() ) ; return gf_t ( std::forward<MeshType>(m), std::move(A), t, nothing() ) ;
} }
static gf_t make_gf(double beta, statistic_enum S, tqa::mini_vector<size_t,2> shape) { static gf_t make_gf(double beta, statistic_enum S, tqa::mini_vector<size_t,2> shape) {
return make_gf(mesh<imfreq,Opt>::make(beta,S), shape, local::tail(shape)); return make_gf(mesh<imfreq,Opt>(beta,S), shape, local::tail(shape));
} }
static gf_t make_gf(double beta, statistic_enum S, tqa::mini_vector<size_t,2> shape, size_t Nmax) { static gf_t make_gf(double beta, statistic_enum S, tqa::mini_vector<size_t,2> shape, size_t Nmax) {
return make_gf(mesh<imfreq,Opt>::make(beta,S,Nmax), shape, local::tail(shape)); return make_gf(mesh<imfreq,Opt>(beta,S,Nmax), shape, local::tail(shape));
} }
static gf_t make_gf(double beta, statistic_enum S, tqa::mini_vector<size_t,2> shape, size_t Nmax, local::tail_view const & t) { static gf_t make_gf(double beta, statistic_enum S, tqa::mini_vector<size_t,2> shape, size_t Nmax, local::tail_view const & t) {
return make_gf(mesh<imfreq,Opt>::make(beta,S,Nmax), shape, t); return make_gf(mesh<imfreq,Opt>(beta,S,Nmax), shape, t);
} }
}; };
@ -99,13 +96,13 @@ namespace triqs { namespace gfs {
return gf_t ( std::forward<MeshType>(m), std::move(A), t, nothing() ) ; return gf_t ( std::forward<MeshType>(m), std::move(A), t, nothing() ) ;
} }
static gf_t make_gf(double beta, statistic_enum S) { static gf_t make_gf(double beta, statistic_enum S) {
return make_gf(mesh<imfreq,Opt>::make(beta,S), local::tail(tqa::mini_vector<size_t,2> (1,1))); return make_gf(mesh<imfreq,Opt>(beta,S), local::tail(tqa::mini_vector<size_t,2> (1,1)));
} }
static gf_t make_gf(double beta, statistic_enum S, size_t Nmax) { static gf_t make_gf(double beta, statistic_enum S, size_t Nmax) {
return make_gf(mesh<imfreq,Opt>::make(beta,S,Nmax), local::tail(tqa::mini_vector<size_t,2> (1,1))); return make_gf(mesh<imfreq,Opt>(beta,S,Nmax), local::tail(tqa::mini_vector<size_t,2> (1,1)));
} }
static gf_t make_gf(double beta, statistic_enum S, size_t Nmax, local::tail_view const & t) { static gf_t make_gf(double beta, statistic_enum S, size_t Nmax, local::tail_view const & t) {
return make_gf(mesh<imfreq,Opt>::make(beta,S,Nmax), t); return make_gf(mesh<imfreq,Opt>(beta,S,Nmax), t);
} }
}; };
} // gfs_implementation } // gfs_implementation

View File

@ -30,17 +30,16 @@ namespace triqs { namespace gfs {
struct imtime {}; struct imtime {};
namespace gfs_implementation {
// mesh type and its factories // mesh type and its factories
template<typename Opt> struct mesh<imtime,Opt> { template<typename Opt> struct mesh<imtime,Opt> : linear_mesh<matsubara_domain<false>> {
typedef linear_mesh<matsubara_domain<false>> type; typedef linear_mesh<matsubara_domain<false>> B;
typedef typename type::domain_t domain_t; mesh() = default;
static type make(double beta, statistic_enum S, size_t n_time_slices, mesh_kind mk=half_bins) { mesh (double beta, statistic_enum S, size_t n_time_slices, mesh_kind mk=half_bins):
return type(domain_t(beta,S), 0, beta, n_time_slices, mk); B( typename B::domain_t(beta,S), 0, beta, n_time_slices, mk){}
}
}; };
namespace gfs_implementation {
// singularity // singularity
template<typename Opt> struct singularity<imtime,matrix_valued,Opt> { typedef local::tail type;}; template<typename Opt> struct singularity<imtime,matrix_valued,Opt> { typedef local::tail type;};
template<typename Opt> struct singularity<imtime,scalar_valued,Opt> { typedef local::tail type;}; template<typename Opt> struct singularity<imtime,scalar_valued,Opt> { typedef local::tail type;};
@ -135,10 +134,10 @@ namespace triqs { namespace gfs {
return gf_t (std::forward<MeshType>(m), std::move(A), t, nothing(), evaluator<imtime,matrix_valued,Opt>(shape[0],shape[1]) ) ; return gf_t (std::forward<MeshType>(m), std::move(A), t, nothing(), evaluator<imtime,matrix_valued,Opt>(shape[0],shape[1]) ) ;
} }
static gf_t make_gf(double beta, statistic_enum S, tqa::mini_vector<size_t,2> shape, size_t Nmax=1025, mesh_kind mk= half_bins) { static gf_t make_gf(double beta, statistic_enum S, tqa::mini_vector<size_t,2> shape, size_t Nmax=1025, mesh_kind mk= half_bins) {
return make_gf(mesh<imtime,Opt>::make(beta,S,Nmax,mk), shape, local::tail(shape)); return make_gf(mesh<imtime,Opt>(beta,S,Nmax,mk), shape, local::tail(shape));
} }
static gf_t make_gf(double beta, statistic_enum S, tqa::mini_vector<size_t,2> shape, size_t Nmax, mesh_kind mk, local::tail_view const & t) { static gf_t make_gf(double beta, statistic_enum S, tqa::mini_vector<size_t,2> shape, size_t Nmax, mesh_kind mk, local::tail_view const & t) {
return make_gf(mesh<imtime,Opt>::make(beta,S,Nmax,mk), shape, t); return make_gf(mesh<imtime,Opt>(beta,S,Nmax,mk), shape, t);
} }
}; };
@ -151,10 +150,10 @@ namespace triqs { namespace gfs {
return gf_t (std::forward<MeshType>(m), std::move(A), t, nothing()); return gf_t (std::forward<MeshType>(m), std::move(A), t, nothing());
} }
static gf_t make_gf(double beta, statistic_enum S, size_t Nmax=1025, mesh_kind mk= half_bins) { static gf_t make_gf(double beta, statistic_enum S, size_t Nmax=1025, mesh_kind mk= half_bins) {
return make_gf(mesh<imtime,Opt>::make(beta,S,Nmax,mk), local::tail(tqa::mini_vector<size_t,2> (1,1))); return make_gf(mesh<imtime,Opt>(beta,S,Nmax,mk), local::tail(tqa::mini_vector<size_t,2> (1,1)));
} }
static gf_t make_gf(double beta, statistic_enum S, size_t Nmax, mesh_kind mk, local::tail_view const & t) { static gf_t make_gf(double beta, statistic_enum S, size_t Nmax, mesh_kind mk, local::tail_view const & t) {
return make_gf(mesh<imtime,Opt>::make(beta,S,Nmax,mk), t); return make_gf(mesh<imtime,Opt>(beta,S,Nmax,mk), t);
} }
}; };
} // gfs_implementation. } // gfs_implementation.

View File

@ -30,15 +30,15 @@ namespace triqs { namespace gfs {
struct legendre {}; struct legendre {};
namespace gfs_implementation {
// mesh type and its factories // mesh type and its factories
template<typename Opt> struct mesh<legendre,Opt> { template<typename Opt> struct mesh<legendre,Opt> :discrete_mesh<legendre_domain> {
typedef discrete_mesh<legendre_domain> type; typedef discrete_mesh<legendre_domain> B;
typedef typename type::domain_t domain_t; mesh() = default;
static type make(double beta, statistic_enum S, size_t n_leg) { return type(domain_t(beta,S,n_leg)); } mesh(double beta, statistic_enum S, size_t n_leg) : B(typename B::domain_t(beta,S,n_leg)) {}
}; };
namespace gfs_implementation {
// h5 name // h5 name
template<typename Opt> struct h5_name<legendre,matrix_valued,Opt> { static std::string invoke(){ return "Legendre";}}; template<typename Opt> struct h5_name<legendre,matrix_valued,Opt> { static std::string invoke(){ return "Legendre";}};
@ -66,7 +66,7 @@ namespace triqs { namespace gfs {
static gf_t make_gf(double beta, statistic_enum S, tqa::mini_vector<size_t,2> shape, size_t n_leg) { static gf_t make_gf(double beta, statistic_enum S, tqa::mini_vector<size_t,2> shape, size_t n_leg) {
typename gf_t::data_regular_t A(shape.front_append(n_leg)); A() = 0; typename gf_t::data_regular_t A(shape.front_append(n_leg)); A() = 0;
return gf_t(mesh<legendre,Opt>::make(beta, S, n_leg), std::move(A), nothing(), nothing()); return gf_t(mesh<legendre,Opt>(beta, S, n_leg), std::move(A), nothing(), nothing());
} }
}; };

View File

@ -116,6 +116,7 @@ namespace triqs { namespace gfs {
/// Mesh comparison /// Mesh comparison
bool operator == (linear_mesh const & M) const { return ((_dom == M._dom) && (size() ==M.size()) && (std::abs(xmin - M.xmin)<1.e-15) && (std::abs(xmax - M.xmax)<1.e-15));} bool operator == (linear_mesh const & M) const { return ((_dom == M._dom) && (size() ==M.size()) && (std::abs(xmin - M.xmin)<1.e-15) && (std::abs(xmax - M.xmax)<1.e-15));}
bool operator != (linear_mesh const & M) const { return !(operator==(M));}
/// Write into HDF5 /// Write into HDF5
friend void h5_write (h5::group fg, std::string subgroup_name, linear_mesh const & m) { friend void h5_write (h5::group fg, std::string subgroup_name, linear_mesh const & m) {

View File

@ -31,14 +31,15 @@ namespace triqs { namespace gfs {
static constexpr size_t size = sizeof...(Ms); static constexpr size_t size = sizeof...(Ms);
}; };
namespace gfs_implementation {
// the mesh is simply a cartesian product // the mesh is simply a cartesian product
template<typename Opt, typename ... Ms> struct mesh<cartesian_product<Ms...>,Opt> { template<typename Opt, typename ... Ms> struct mesh<cartesian_product<Ms...>,Opt> : mesh_product< mesh<Ms,Opt> ... > {
typedef mesh_product< typename mesh<Ms,Opt>::type ... > type; typedef mesh_product< mesh<Ms,Opt> ... > B;
typedef std::tuple<Ms...> mesh_name_t; typedef std::tuple<Ms...> mesh_name_t;
static type make (typename mesh<Ms,Opt>::type ... ms) { return type{std::move(ms)...};} mesh (mesh<Ms,Opt> ... ms) : B {std::move(ms)...} {}
}; };
namespace gfs_implementation {
// h5 name : name1_x_name2_..... // h5 name : name1_x_name2_.....
template<typename Opt, typename ... Ms> struct h5_name<cartesian_product<Ms...>,matrix_valued,Opt> { template<typename Opt, typename ... Ms> struct h5_name<cartesian_product<Ms...>,matrix_valued,Opt> {
static std::string invoke(){ static std::string invoke(){
@ -159,7 +160,7 @@ namespace triqs { namespace gfs {
template<typename ... Meshes> template<typename ... Meshes>
static gf_t make_gf(Meshes && ... meshes) { static gf_t make_gf(Meshes && ... meshes) {
auto m = make_gf_mesh<cartesian_product<Ms...>,Opt>(meshes...); auto m = mesh<cartesian_product<Ms...>,Opt>(meshes...);
typename gf_t::data_regular_t A(m.size()); typename gf_t::data_regular_t A(m.size());
A() =0; A() =0;
return gf_t (m, std::move(A), nothing(), nothing()); return gf_t (m, std::move(A), nothing(), nothing());

View File

@ -30,18 +30,17 @@ namespace triqs { namespace gfs {
struct re_im_freq {}; struct re_im_freq {};
namespace gfs_implementation {
// the mesh // the mesh
template<typename Opt> struct mesh<re_im_freq,Opt> { template<typename Opt> struct mesh<re_im_freq,Opt> : mesh_product<mesh<refreq,Opt>,mesh<imfreq,Opt>> {
typedef typename mesh<refreq,Opt>::type m1_t; typedef mesh<refreq,Opt> m1_t;
typedef typename mesh<imfreq,Opt>::type m2_t; typedef mesh<imfreq,Opt> m2_t;
typedef mesh_product<m1_t,m2_t> type; typedef mesh_product<m1_t,m2_t> B;
static type make (double wmin, double wmax, size_t n_freq_re, double beta, statistic_enum S, size_t n_freq_im) { mesh (double wmin, double wmax, size_t n_freq_re, double beta, statistic_enum S, size_t n_freq_im) :
return {gfs::make_gf_mesh<refreq,Opt>(wmin,wmax,n_freq_re,full_bins), make_gf_mesh<imfreq,Opt>(beta, S, n_freq_im)}; B { mesh<refreq,Opt>(wmin,wmax,n_freq_re,full_bins), mesh<imfreq,Opt>(beta, S, n_freq_im)} {}
}
}; };
namespace gfs_implementation {
// singularity // singularity
template<typename Opt> struct singularity<re_im_freq,scalar_valued,Opt> { typedef gf<refreq,scalar_valued> type;}; template<typename Opt> struct singularity<re_im_freq,scalar_valued,Opt> { typedef gf<refreq,scalar_valued> type;};
@ -73,17 +72,17 @@ namespace triqs { namespace gfs {
template<typename Opt> struct factories<re_im_freq, scalar_valued,Opt> { template<typename Opt> struct factories<re_im_freq, scalar_valued,Opt> {
typedef gf<re_im_freq, scalar_valued,Opt> gf_t; typedef gf<re_im_freq, scalar_valued,Opt> gf_t;
// typedef typename mesh<re_im_freq, Opt>::type mesh_t; // typedef typename mesh<re_im_freq, Opt>::type mesh_t;
static gf_t make_gf(double wmin, double wmax, size_t nw, double beta, statistic_enum S, size_t nwn) { static gf_t make_gf(double wmin, double wmax, size_t nw, double beta, statistic_enum S, size_t nwn) {
auto m = make_gf_mesh<re_im_freq,Opt>(wmin, wmax, nw, beta, S, nwn); auto m = mesh<re_im_freq,Opt>(wmin, wmax, nw, beta, S, nwn);
typename gf_t::data_regular_t A(m.size()); typename gf_t::data_regular_t A(m.size());
A() =0; A() =0;
return gf_t (m, std::move(A), gfs::make_gf<refreq,scalar_valued>(wmin, wmax, nw), nothing() ) ; return gf_t (m, std::move(A), gfs::make_gf<refreq,scalar_valued>(wmin, wmax, nw), nothing() ) ;
} }
}; };
} // gfs_implementation } // gfs_implementation
}} }}
#endif #endif

View File

@ -30,18 +30,17 @@ namespace triqs { namespace gfs {
struct re_im_time {}; struct re_im_time {};
namespace gfs_implementation {
// the mesh // the mesh
template<typename Opt> struct mesh<re_im_time,Opt> { template<typename Opt> struct mesh<re_im_time,Opt> : mesh_product<mesh<retime,Opt>,mesh<imtime,Opt>> {
typedef typename mesh<retime,Opt>::type m1_t; typedef mesh<retime,Opt> m1_t;
typedef typename mesh<imtime,Opt>::type m2_t; typedef mesh<imtime,Opt> m2_t;
typedef mesh_product<m1_t,m2_t> type; typedef mesh_product<m1_t,m2_t> B;
static type make (double tmin, double tmax, size_t nt, double beta, statistic_enum S, size_t ntau, mesh_kind mk=full_bins) { mesh (double tmin, double tmax, size_t nt, double beta, statistic_enum S, size_t ntau, mesh_kind mk=full_bins) :
return {make_gf_mesh<retime,Opt>(tmin,tmax,nt), make_gf_mesh<imtime,Opt>(beta,S, ntau, mk)}; B {mesh<retime,Opt>(tmin,tmax,nt), mesh<imtime,Opt>(beta,S, ntau, mk)} {}
}
}; };
namespace gfs_implementation {
// singularity // singularity
//template<typename Opt> struct singularity<re_im_time, scalar_valued, Opt> { typedef gf<retime,scalar_valued> type;}; //template<typename Opt> struct singularity<re_im_time, scalar_valued, Opt> { typedef gf<retime,scalar_valued> type;};
@ -87,7 +86,7 @@ namespace triqs { namespace gfs {
} }
static gf_t make_gf(double tmin, double tmax, size_t nt, double beta, statistic_enum S, size_t ntau, mesh_kind mk=full_bins) { static gf_t make_gf(double tmin, double tmax, size_t nt, double beta, statistic_enum S, size_t ntau, mesh_kind mk=full_bins) {
auto m = make_gf_mesh<re_im_time,Opt>(tmin,tmax, nt, beta, S, ntau, mk); auto m = mesh<re_im_time,Opt>(tmin,tmax, nt, beta, S, ntau, mk);
typename gf_t::data_regular_t A(m.size()); typename gf_t::data_regular_t A(m.size());
A() =0; A() =0;
return gf_t (m, std::move(A), nothing(), nothing()); return gf_t (m, std::move(A), nothing(), nothing());

View File

@ -30,16 +30,15 @@ namespace triqs { namespace gfs {
struct refreq {}; struct refreq {};
namespace gfs_implementation { template<typename Opt> struct mesh<refreq,Opt> : linear_mesh<R_domain> {
typedef linear_mesh<R_domain> B;
template<typename Opt> struct mesh<refreq,Opt> { mesh() = default;
typedef linear_mesh<R_domain> type; mesh (double wmin, double wmax, size_t n_freq, mesh_kind mk=full_bins) :
typedef typename type::domain_t domain_t; B(typename B::domain_t(), wmin, wmax, n_freq, mk){}
static type make(double wmin, double wmax, size_t n_freq, mesh_kind mk=full_bins) {
return type(domain_t(), wmin, wmax, n_freq, mk);
}
}; };
namespace gfs_implementation {
// singularity // singularity
template<typename Opt> struct singularity<refreq,matrix_valued,Opt> { typedef local::tail type;}; template<typename Opt> struct singularity<refreq,matrix_valued,Opt> { typedef local::tail type;};
template<typename Opt> struct singularity<refreq,scalar_valued,Opt> { typedef local::tail type;}; template<typename Opt> struct singularity<refreq,scalar_valued,Opt> { typedef local::tail type;};
@ -83,12 +82,12 @@ namespace triqs { namespace gfs {
static gf_t make_gf(double wmin, double wmax, size_t n_freq, tqa::mini_vector<size_t,2> shape) { static gf_t make_gf(double wmin, double wmax, size_t n_freq, tqa::mini_vector<size_t,2> shape) {
typename gf_t::data_regular_t A(shape.front_append(n_freq)); A() =0; typename gf_t::data_regular_t A(shape.front_append(n_freq)); A() =0;
return gf_t(mesh<refreq,Opt>::make(wmin, wmax, n_freq, full_bins), std::move(A), local::tail(shape), nothing()); return gf_t(mesh<refreq,Opt>(wmin, wmax, n_freq, full_bins), std::move(A), local::tail(shape), nothing());
} }
static gf_t make_gf(double wmin, double wmax, size_t n_freq, tqa::mini_vector<size_t,2> shape, mesh_kind mk) { static gf_t make_gf(double wmin, double wmax, size_t n_freq, tqa::mini_vector<size_t,2> shape, mesh_kind mk) {
typename gf_t::data_regular_t A(shape.front_append(n_freq)); A() =0; typename gf_t::data_regular_t A(shape.front_append(n_freq)); A() =0;
return gf_t(mesh<refreq,Opt>::make(wmin, wmax, n_freq, mk), std::move(A), local::tail(shape), nothing()); return gf_t(mesh<refreq,Opt>(wmin, wmax, n_freq, mk), std::move(A), local::tail(shape), nothing());
} }
}; };
@ -104,17 +103,17 @@ namespace triqs { namespace gfs {
static gf_t make_gf(double wmin, double wmax, size_t n_freq) { static gf_t make_gf(double wmin, double wmax, size_t n_freq) {
typename gf_t::data_regular_t A(n_freq); A() =0; typename gf_t::data_regular_t A(n_freq); A() =0;
return gf_t(mesh<refreq,Opt>::make(wmin, wmax, n_freq), std::move(A), local::tail(tqa::mini_vector<size_t,2>(1,1)), nothing()); return gf_t(mesh<refreq,Opt>(wmin, wmax, n_freq), std::move(A), local::tail(tqa::mini_vector<size_t,2>(1,1)), nothing());
} }
static gf_t make_gf(double wmin, double wmax, size_t n_freq, mesh_kind mk) { static gf_t make_gf(double wmin, double wmax, size_t n_freq, mesh_kind mk) {
typename gf_t::data_regular_t A(n_freq); A() =0; typename gf_t::data_regular_t A(n_freq); A() =0;
return gf_t(mesh<refreq,Opt>::make(wmin, wmax, n_freq, mk), std::move(A), local::tail(tqa::mini_vector<size_t,2>(1,1)), nothing()); return gf_t(mesh<refreq,Opt>(wmin, wmax, n_freq, mk), std::move(A), local::tail(tqa::mini_vector<size_t,2>(1,1)), nothing());
} }
}; };
} // gfs_implementation } // gfs_implementation
}} }}
#endif #endif

View File

@ -30,18 +30,16 @@ namespace triqs { namespace gfs {
struct refreq_imtime {}; struct refreq_imtime {};
namespace gfs_implementation {
// the mesh // the mesh
template<typename Opt> struct mesh<refreq_imtime,Opt> { template<typename Opt> struct mesh<refreq_imtime,Opt> :mesh_product<mesh<refreq,Opt>,mesh<imtime,Opt>> {
typedef typename mesh<refreq,Opt>::type m1_t; typedef mesh<refreq,Opt> m1_t;
typedef typename mesh<imtime,Opt>::type m2_t; typedef mesh<imtime,Opt> m2_t;
typedef mesh_product<m1_t,m2_t> type; typedef mesh_product<m1_t,m2_t> B;
static type make (double wmin, double wmax, size_t n_freq, double beta, statistic_enum S, size_t nt, mesh_kind mk=full_bins ) { mesh (double wmin, double wmax, size_t n_freq, double beta, statistic_enum S, size_t nt, mesh_kind mk=full_bins ) :
return {make_gf_mesh<refreq,Opt>(wmin,wmax,n_freq), make_gf_mesh<imtime,Opt>(beta,S,nt,mk)}; B {mesh<refreq,Opt>(wmin,wmax,n_freq), mesh<imtime,Opt>(beta,S,nt,mk)} {}
}
}; };
namespace gfs_implementation {
// singularity // singularity
//template<typename Opt> struct singularity<refreq_imtime,scalar_valued,Opt> { typedef gf<retime,scalar_valued> type;}; //template<typename Opt> struct singularity<refreq_imtime,scalar_valued,Opt> { typedef gf<retime,scalar_valued> type;};
@ -89,7 +87,7 @@ namespace triqs { namespace gfs {
} }
static gf_t make_gf(double wmin, double wmax, size_t n_freq, double beta, statistic_enum S, size_t nt, mesh_kind mk=full_bins) { static gf_t make_gf(double wmin, double wmax, size_t n_freq, double beta, statistic_enum S, size_t nt, mesh_kind mk=full_bins) {
auto m = make_gf_mesh<refreq_imtime,Opt>(wmin, wmax, n_freq, beta,S, nt, mk); auto m = mesh<refreq_imtime,Opt>(wmin, wmax, n_freq, beta,S, nt, mk);
typename gf_t::data_regular_t A(m.size()); typename gf_t::data_regular_t A(m.size());
A() =0; A() =0;
return gf_t (m, std::move(A), nothing(), nothing() ) ; return gf_t (m, std::move(A), nothing(), nothing() ) ;

View File

@ -30,18 +30,14 @@ namespace triqs { namespace gfs {
struct retime {}; struct retime {};
namespace gfs_implementation { template<typename Opt> struct mesh<retime,Opt> : linear_mesh<R_domain> {
typedef linear_mesh<R_domain> B;
template<typename Opt> struct mesh<retime,Opt> { mesh() = default;
typedef linear_mesh<R_domain> type; mesh(double tmin, double tmax, size_t n_points, mesh_kind mk=full_bins) : B (typename B::domain_t(), tmin, tmax, n_points, mk){}
typedef typename type::domain_t domain_t;
static type make(double tmin, double tmax, size_t n_points, mesh_kind mk=full_bins) {
return type(domain_t(), tmin, tmax, n_points, mk);
}
}; };
namespace gfs_implementation {
// singularity // singularity
template<typename Opt> struct singularity<retime,matrix_valued,Opt> { typedef local::tail type;}; template<typename Opt> struct singularity<retime,matrix_valued,Opt> { typedef local::tail type;};
template<typename Opt> struct singularity<retime,scalar_valued,Opt> { typedef local::tail type;}; template<typename Opt> struct singularity<retime,scalar_valued,Opt> { typedef local::tail type;};
@ -85,12 +81,12 @@ namespace triqs { namespace gfs {
static gf_t make_gf(double tmin, double tmax, size_t n_points, tqa::mini_vector<size_t,2> shape, mesh_kind mk) { static gf_t make_gf(double tmin, double tmax, size_t n_points, tqa::mini_vector<size_t,2> shape, mesh_kind mk) {
typename gf_t::data_regular_t A(shape.front_append(n_points)); A() =0; typename gf_t::data_regular_t A(shape.front_append(n_points)); A() =0;
return gf_t(mesh<retime,Opt>::make(tmin, tmax, n_points,mk), std::move(A), local::tail(shape), nothing()); return gf_t(mesh<retime,Opt>(tmin, tmax, n_points,mk), std::move(A), local::tail(shape), nothing());
} }
static gf_t make_gf(double tmin, double tmax, size_t n_points, tqa::mini_vector<size_t,2> shape) { static gf_t make_gf(double tmin, double tmax, size_t n_points, tqa::mini_vector<size_t,2> shape) {
typename gf_t::data_regular_t A(shape.front_append(n_points)); A() =0; typename gf_t::data_regular_t A(shape.front_append(n_points)); A() =0;
return gf_t(mesh<retime,Opt>::make(tmin, tmax, n_points), std::move(A), local::tail(shape), nothing()); return gf_t(mesh<retime,Opt>(tmin, tmax, n_points), std::move(A), local::tail(shape), nothing());
} }
}; };
@ -107,12 +103,12 @@ namespace triqs { namespace gfs {
static gf_t make_gf(double tmin, double tmax, size_t n_points, mesh_kind mk) { static gf_t make_gf(double tmin, double tmax, size_t n_points, mesh_kind mk) {
typename gf_t::data_regular_t A(n_points); A() =0; typename gf_t::data_regular_t A(n_points); A() =0;
return gf_t(mesh<retime,Opt>::make(tmin, tmax, n_points,mk), std::move(A), local::tail(tqa::mini_vector<size_t,2>(1,1)), nothing()); return gf_t(mesh<retime,Opt>(tmin, tmax, n_points,mk), std::move(A), local::tail(tqa::mini_vector<size_t,2>(1,1)), nothing());
} }
static gf_t make_gf(double tmin, double tmax, size_t n_points) { static gf_t make_gf(double tmin, double tmax, size_t n_points) {
typename gf_t::data_regular_t A(n_points); A() =0; typename gf_t::data_regular_t A(n_points); A() =0;
return gf_t(mesh<retime,Opt>::make(tmin, tmax, n_points), std::move(A), local::tail(tqa::mini_vector<size_t,2>(1,1)), nothing()); return gf_t(mesh<retime,Opt>(tmin, tmax, n_points), std::move(A), local::tail(tqa::mini_vector<size_t,2>(1,1)), nothing());
} }
}; };

View File

@ -29,24 +29,17 @@ namespace triqs { namespace gfs {
struct two_real_times {}; struct two_real_times {};
namespace gfs_implementation {
// the mesh // the mesh
template<typename Opt> struct mesh<two_real_times,Opt> { template<typename Opt> struct mesh<two_real_times,Opt> :mesh_product<mesh<retime,Opt> ,mesh<retime,Opt> > {
typedef typename mesh<retime,Opt>::type m1_t; typedef mesh_product<mesh<retime,Opt> ,mesh<retime,Opt> > B;
typedef mesh_product<m1_t,m1_t> type; mesh() = default;
static type make (double tmax, double n_time_slices) { mesh (double tmax, double n_time_slices) :
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS B(mesh<retime,Opt> ( 0, tmax,n_time_slices, full_bins),
m1_t m1({},0, tmax,n_time_slices, full_bins); mesh<retime,Opt> ( 0, tmax,n_time_slices, full_bins) ) {}
return {m1,m1};
#else
m1_t m1(typename m1_t::domain_t(),0, tmax,n_time_slices, full_bins);
type m(m1,m1);
return m;
#endif
}
}; };
namespace gfs_implementation {
// h5 name // h5 name
template<typename Opt> struct h5_name<two_real_times,matrix_valued,Opt> { static std::string invoke(){ return "GfTwoRealTime";}}; template<typename Opt> struct h5_name<two_real_times,matrix_valued,Opt> { static std::string invoke(){ return "GfTwoRealTime";}};
@ -56,11 +49,11 @@ namespace triqs { namespace gfs {
struct get_closest_point <two_real_times,matrix_valued,Opt> { struct get_closest_point <two_real_times,matrix_valued,Opt> {
typedef typename mesh<two_real_times, Opt>::type mesh_t; typedef typename mesh<two_real_times, Opt>::type mesh_t;
// // NOT FINISHED, NOT TESTED // // NOT FINISHED, NOT TESTED
// template<typename G, typename T> // template<typename G, typename T>
// static typename mesh_t::index_t invoke(G const * g, closest_pt_wrap<T,T> const & p) { // static typename mesh_t::index_t invoke(G const * g, closest_pt_wrap<T,T> const & p) {
// return std::floor( double(p.value) / g->mesh().delta() + 0.5); // return std::floor( double(p.value) / g->mesh().delta() + 0.5);
// } // }
}; };
@ -91,10 +84,10 @@ namespace triqs { namespace gfs {
template<typename Opt> struct factories<two_real_times, matrix_valued,Opt> { template<typename Opt> struct factories<two_real_times, matrix_valued,Opt> {
typedef gf<two_real_times, matrix_valued,Opt> gf_t; typedef gf<two_real_times, matrix_valued,Opt> gf_t;
typedef typename mesh<two_real_times, Opt>::type mesh_t; typedef mesh<two_real_times, Opt> mesh_t;
static gf_t make_gf(double tmax, double n_time_slices, tqa::mini_vector<size_t,2> shape) { static gf_t make_gf(double tmax, double n_time_slices, tqa::mini_vector<size_t,2> shape) {
auto m = mesh<two_real_times,Opt>::make(tmax, n_time_slices); auto m = mesh<two_real_times,Opt>(tmax, n_time_slices);
typename gf_t::data_regular_t A(shape.front_append(m.size())); A() =0; typename gf_t::data_regular_t A(shape.front_append(m.size())); A() =0;
return gf_t (m, std::move(A), nothing(), nothing() ) ; return gf_t (m, std::move(A), nothing(), nothing() ) ;
} }