3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-26 22:33:48 +01:00
dft_tools/doc/reference/c++/gf/clef.rst
Olivier Parcollet 579368f24b gf. Clean Fourier
- lazy_fourier and co --> fourier
- ex fourier --> make_gf_from_fourier to make a new gf
- = fourier (g) works only iif lhs is a view, like scalar.
- updated python (commented fourier method).
2013-10-23 18:46:55 +02:00

49 lines
1.3 KiB
ReStructuredText

.. highlight:: c
.. _gf_clef:
Interaction with CLEF expressions
============================================
* The gf containers and their view classes can be used with the :doc:`../clef/contents` library :
* They can be called with CLEF expressions.
* :doc:`Automatic assignment<../clef/assign>` has been set up.
* Using the CLEF library offers a quick and efficient way to fill an array with multiple advantages :
* It is simpler and more readeable than a series of for loops.
* It is usually more optimal since the for loops are automatically written in the TraversalOrder of the array.
* **Example** :
.. compileblock::
#include <triqs/gfs.hpp>
using namespace triqs::gfs; using triqs::clef::placeholder;
int main(){
// Cf gf<imfreq> specialisation page for the constructor
double beta=10; int Nfreq =100;
auto g = gf<imfreq> { {beta,Fermion,Nfreq}, {1,1} };
// Filling the gf with something...
placeholder<0> wn_;
g(wn_) << 1/ (wn_ + 2);
g(wn_) << 1/ (wn_ + 2 + g(wn_) );
}
.. note::
The syntax uses a <<, not = since the array is not assigned to an expression
but filled by the evaluation thereof.
The LHS uses () and not brackets, even though it is on the mesh, because of the strange C++ limitation
that [] can not be overloaded for several variables...