3
0
mirror of https://github.com/triqs/dft_tools synced 2024-10-31 19:23:45 +01:00

gf: retime, imtime: constructor from mesh added

- also on product.... (gf: re_im_time, refreq_imtime)
This commit is contained in:
Laura Messio 2013-07-19 14:39:32 +02:00 committed by Olivier Parcollet
parent 5f133154e8
commit 3bf00059a4
4 changed files with 26 additions and 3 deletions

View File

@ -70,7 +70,6 @@ namespace triqs { namespace gf {
// matrix_valued
template<typename Opt> struct factories<imfreq,matrix_valued,Opt> {
typedef gf<imfreq,matrix_valued,Opt> gf_t;
typedef gf_view<imfreq,matrix_valued,Opt> gf_view_t;
template<typename MeshType>
static gf_t make_gf(MeshType && m, tqa::mini_vector<size_t,2> shape, local::tail_view const & t) {
@ -91,7 +90,6 @@ namespace triqs { namespace gf {
// scalar_valued
template<typename Opt> struct factories<imfreq,scalar_valued,Opt> {
typedef gf<imfreq,scalar_valued,Opt> gf_t;
typedef gf_view<imfreq,scalar_valued,Opt> gf_view_t;
template<typename MeshType>
static gf_t make_gf(MeshType && m, local::tail_view const & t) {

View File

@ -78,7 +78,13 @@ namespace triqs { namespace gf {
template<typename Opt> struct factories<re_im_time, scalar_valued,Opt> {
typedef gf<re_im_time, scalar_valued,Opt> gf_t;
// typedef typename mesh<re_im_time, Opt>::type mesh_t;
template<typename MeshType>
static gf_t make_gf(MeshType && m) {
typename gf_t::data_non_view_t A(m.size());
A() =0;
return gf_t (m, std::move(A), nothing(), nothing(), nothing() ) ;
}
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);

View File

@ -78,6 +78,13 @@ namespace triqs { namespace gf {
template<typename Opt> struct factories<refreq_imtime, scalar_valued,Opt> {
typedef gf<refreq_imtime, scalar_valued,Opt> gf_t;
template<typename MeshType>
static gf_t make_gf(MeshType && m) {
typename gf_t::data_non_view_t A(m.size());
A() =0;
return gf_t (m, std::move(A), nothing(), nothing(), nothing() ) ;
}
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);
typename gf_t::data_non_view_t A(m.size());

View File

@ -81,6 +81,12 @@ namespace triqs { namespace gf {
template<typename Opt> struct factories<retime, matrix_valued,Opt> {
typedef gf<retime,matrix_valued> gf_t;
template<typename MeshType>
static gf_t make_gf(MeshType && m, tqa::mini_vector<size_t,2> shape, local::tail_view const t) {
typename gf_t::data_non_view_t A(shape.front_append(m.size())); A() =0;
return gf_t ( std::forward<MeshType>(m), std::move(A), t, nothing() ) ;
}
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_non_view_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());
@ -97,6 +103,12 @@ namespace triqs { namespace gf {
template<typename Opt> struct factories<retime, scalar_valued,Opt> {
typedef gf<retime,scalar_valued> gf_t;
template<typename MeshType>
static gf_t make_gf(MeshType && m, local::tail_view const t) {
typename gf_t::data_non_view_t A(m.size()); A() =0;
return gf_t ( std::forward<MeshType>(m), std::move(A), t, nothing() ) ;
}
static gf_t make_gf(double tmin, double tmax, size_t n_points, mesh_kind mk) {
typename gf_t::data_non_view_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());