2013-07-17 19:24:07 +02:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* TRIQS: a Toolbox for Research in Interacting Quantum Systems
|
|
|
|
*
|
2014-09-18 14:40:44 +02:00
|
|
|
* Copyright (C) 2011-2014 by M. Ferrero, O. Parcollet
|
2013-07-17 19:24:07 +02:00
|
|
|
*
|
|
|
|
* TRIQS is free software: you can redistribute it and/or modify it under the
|
|
|
|
* terms of the GNU General Public License as published by the Free Software
|
|
|
|
* Foundation, either version 3 of the License, or (at your option) any later
|
|
|
|
* version.
|
|
|
|
*
|
|
|
|
* TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* TRIQS. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2014-09-18 14:40:44 +02:00
|
|
|
#pragma once
|
2013-07-17 19:24:07 +02:00
|
|
|
#include <triqs/arrays/vector.hpp>
|
2014-09-18 14:40:44 +02:00
|
|
|
#include <triqs/gfs/gf.hpp>
|
2013-07-17 19:24:07 +02:00
|
|
|
|
2013-07-28 13:28:19 +02:00
|
|
|
namespace triqs { namespace gfs {
|
2013-07-17 19:24:07 +02:00
|
|
|
|
|
|
|
namespace details {
|
|
|
|
|
|
|
|
namespace tqa = triqs::arrays;
|
2014-09-18 14:40:44 +02:00
|
|
|
using dcomplex = std::complex<double>;
|
|
|
|
|
2013-07-17 19:24:07 +02:00
|
|
|
void fourier_base(const tqa::vector<dcomplex> &in, tqa::vector<dcomplex> &out, size_t L, bool direct);
|
2013-07-19 13:28:30 +02:00
|
|
|
void fourier_base(const tqa::vector<dcomplex> &in, tqa::vector<dcomplex> &out, size_t L1, size_t L2, bool direct);
|
2013-07-17 19:24:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace tags { struct fourier{}; }
|
|
|
|
|
2014-09-18 14:40:44 +02:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
|
|
|
|
// TO BE REPLACED BY A DIRECT CALL to many_fft in fftw, like for lattice case.
|
|
|
|
// The implementation of the Fourier transformation
|
|
|
|
// Reduce Matrix case to the scalar case.
|
|
|
|
template <typename X, typename Y, typename S>
|
|
|
|
void _fourier_impl(gf_view<X, matrix_valued, S> gw, gf_const_view<Y, matrix_valued, S> gt) {
|
|
|
|
if (gt.data().shape().front_pop() != gw.data().shape().front_pop())
|
|
|
|
TRIQS_RUNTIME_ERROR << "Fourier : matrix size of target mismatch";
|
|
|
|
for (size_t n1 = 0; n1 < gt.data().shape()[1]; n1++)
|
|
|
|
for (size_t n2 = 0; n2 < gt.data().shape()[2]; n2++) {
|
|
|
|
auto gw_sl = slice_target_to_scalar(gw, n1, n2);
|
|
|
|
auto gt_sl = slice_target_to_scalar(gt, n1, n2);
|
|
|
|
_fourier_impl(gw_sl, gt_sl);
|
|
|
|
}
|
|
|
|
}
|
2013-07-17 19:24:07 +02:00
|
|
|
|
2014-09-18 14:40:44 +02:00
|
|
|
template <typename X, typename Y, typename T, typename S>
|
|
|
|
void triqs_gf_view_assign_delegation(gf_view<X, T, S> g, gf_keeper<tags::fourier, Y, T, S> const &L) {
|
|
|
|
_fourier_impl(g, L.g);
|
|
|
|
}
|
|
|
|
}}
|