mirror of
https://github.com/triqs/dft_tools
synced 2024-11-01 11:43:47 +01:00
2c542647fd
- change : all objects are by default stored now by reference, not by copy any more. Unless the trait force_copy_in_expr is true. - rvalue refs are moved into the tree - simplifies a lot the writing of lazy method, objects. - added a macro for methods - tests ok. Further check needed to control absence of copies... - improved documentation
24 lines
520 B
C++
24 lines
520 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 make_expr math function
|
|
tql::placeholder <0> k_;
|
|
tql::make_expr(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;
|
|
|
|
}
|
|
|
|
|