3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-27 06:43:40 +01:00
dft_tools/test/triqs/clef_examples/vector_and_math.cpp
Olivier Parcollet f2c7d449cc First commit : triqs libs version 1.0 alpha1
for earlier commits, see TRIQS0.x repository.
2013-07-17 19:24:07 +02:00

24 lines
510 B
C++

#include "triqs/clef.hpp"
#include "triqs/clef/adapters/vector.hpp"
#include "triqs/clef/adapters/math.hpp"
#include <iostream>
namespace tql = triqs::clef;
int main() {
int N = 10;
double pi = std::acos(-1);
std::vector<double> V(N);
// automatic assignment of vector and use of lazy math function
tql::placeholder <0> k_;
tql::lazy(V) [k_] << cos( (2* pi* k_)/ N );
// check result...
for (size_t u=0; u<V.size(); ++u)
std::cout<< u << " "<<V[u]<< " "<< cos((2*pi*u)/N)<<std::endl;
}