TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
fourier_lattice.cpp
Go to the documentation of this file.
1// Copyright (c) 2014-2018 Commissariat à l'énergie atomique et aux énergies alternatives (CEA)
2// Copyright (c) 2014-2018 Centre national de la recherche scientifique (CNRS)
3// Copyright (c) 2018-2021 Simons Foundation
4//
5// This program is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You may obtain a copy of the License at
16// https://www.gnu.org/licenses/gpl-3.0.txt
17//
18// Authors: Michel Ferrero, Olivier Parcollet, Nils Wentzell
19
24
25#include "./fourier.hpp"
26#include "./fourier_common.hpp"
27
28#include <array>
29
30namespace triqs::gfs {
31
32 // Shared driver for both lattice transform directions: batched multi-dimensional FFT of g_in onto out_mesh.
33 template <typename M1, typename M2> gf_vec_t<M1> fourier_lattice_impl(int fftw_backward_forward, M1 const &out_mesh, gf_vec_cvt<M2> g_in) {
34
35 auto g_out = gf_vec_t<M1>{out_mesh, std::array{g_in.target_shape()[0]}};
36 long n_others = second_dim(g_in.data());
37
38 auto dims = g_in.mesh().dims();
39 auto dims_int = stdutil::make_std_array<int>(dims);
40
41 _fourier_base(g_in.data(), g_out.data(), dims.size(), dims_int.data(), n_others, fftw_backward_forward);
42
43 return g_out;
44 }
45
46 // ------------------------ DIRECT TRANSFORM --------------------------------------------
47
48 gf_vec_t<mesh::cyclat> _fourier_impl(mesh::cyclat const &r_mesh, gf_vec_cvt<mesh::brzone> gk) {
49 auto gr = fourier_lattice_impl(FFTW_FORWARD, r_mesh, gk);
50 gr.data() /= gk.mesh().size();
51 return gr;
52 }
53
54 // ------------------------ INVERSE TRANSFORM --------------------------------------------
55
56 gf_vec_t<mesh::brzone> _fourier_impl(mesh::brzone const &k_mesh, gf_vec_cvt<mesh::cyclat> gr) {
57 return fourier_lattice_impl(FFTW_BACKWARD, k_mesh, gr);
58 }
59
60} // namespace triqs::gfs
Provides the Fourier transform factories and the lazy fourier(...) assignment for Green's functions.
Declares the low-level FFTW wrapper shared by the Fourier transform implementations.