3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-25 13:53:40 +01:00

remove warnings in compilation

- triqs & tests now compiles with -Wall on clang (3.2)
Checked on OS X.
Todo : recheck on other compilers.
This commit is contained in:
Olivier Parcollet 2014-01-30 22:17:28 +01:00
parent 9f0915acb6
commit 85141350e7
20 changed files with 16 additions and 34 deletions

View File

@ -50,7 +50,7 @@ struct expression_template {
MM B(A), C(A), D(A); MM B(A), C(A), D(A);
auto ex = B + 3* C+ D; //auto ex = B + 3* C+ D;
for (int u =0; u<5000; ++u) for (int u =0; u<5000; ++u)
A = B + 3*C + D; A = B + 3*C + D;
} }
@ -84,7 +84,7 @@ struct expression_template_big {
MM B(A), C(A), D(A); MM B(A), C(A), D(A);
auto ex = B + 3* C+ D; //auto ex = B + 3* C+ D;
for (int u =0; u<500; ++u) for (int u =0; u<500; ++u)
A = B + 3*C + D; A = B + 3*C + D;
} }

View File

@ -43,6 +43,7 @@ int main() {
auto x = A + B + 2*A; auto x = A + B + 2*A;
std::cerr << x << std::endl;
C = A+2*A+3*A - 2*A+A -A+A+A*3+A+A+A+A+A+A+A+A+A+A+A+A+A; C = A+2*A+3*A - 2*A+A -A+A+A*3+A+A+A+A+A+A+A+A+A+A+A+A+A;
std::cout << C << std::endl ; std::cout << C << std::endl ;

View File

@ -36,7 +36,6 @@ int main(int argc, char **argv) {
{ {
array<long, 2> A(2, 3); array<long, 2> A(2, 3);
A() = 3; A() = 3;
auto const &AA = A;
f2(A()); f2(A());

View File

@ -63,7 +63,6 @@ struct test {
std::cerr<<" ------------------------------------------------"<<std::endl; std::cerr<<" ------------------------------------------------"<<std::endl;
std::cerr <<" i = "<< i << " size = "<< D.size() << std::endl; std::cerr <<" i = "<< i << " size = "<< D.size() << std::endl;
// choose a move // choose a move
int mn = RNG(4);
size_t s = D.size(); size_t s = D.size();
size_t i0,j0,i1,j1; size_t i0,j0,i1,j1;
det_old = D.determinant(); det_old = D.determinant();

View File

@ -47,12 +47,11 @@ struct test {
std::cerr<<" ------------------------------------------------"<<std::endl; std::cerr<<" ------------------------------------------------"<<std::endl;
std::cerr <<" i = "<< i << " size = "<< D.size() << std::endl; std::cerr <<" i = "<< i << " size = "<< D.size() << std::endl;
// choose a move // choose a move
int mn = RNG(4);
size_t s = D.size(); size_t s = D.size();
size_t w,w1; size_t w,w1;
det_old = D.determinant(); det_old = D.determinant();
detratio =1; detratio =1;
double x,y,x1; double x,x1;
switch(RNG(( i>10 ? 4 : 1))) { switch(RNG(( i>10 ? 4 : 1))) {
case 0 : case 0 :

View File

@ -65,7 +65,6 @@ struct test {
std::cerr<<" ------------------------------------------------"<<std::endl; std::cerr<<" ------------------------------------------------"<<std::endl;
std::cerr <<" i = "<< i << " size = "<< D.size() << std::endl; std::cerr <<" i = "<< i << " size = "<< D.size() << std::endl;
// choose a move // choose a move
int mn = RNG(4);
size_t s = D.size(); size_t s = D.size();
size_t i0,j0,i1,j1; size_t i0,j0,i1,j1;
det_old = D.determinant(); det_old = D.determinant();

View File

@ -66,7 +66,6 @@ struct test {
std::cerr<<" ------------------------------------------------"<<std::endl; std::cerr<<" ------------------------------------------------"<<std::endl;
std::cerr <<" i = "<< i << " size = "<< D.size() << std::endl; std::cerr <<" i = "<< i << " size = "<< D.size() << std::endl;
// choose a move // choose a move
int mn = RNG(4);
size_t s = D.size(); size_t s = D.size();
size_t i0,j0,i1,j1; size_t i0,j0,i1,j1;
det_old = D.determinant(); det_old = D.determinant();

View File

@ -10,7 +10,6 @@ int main() {
try { try {
double precision=10e-9;
double beta =1.; double beta =1.;
double tmin=0.; double tmin=0.;

View File

@ -13,13 +13,10 @@ using namespace triqs::gfs;
int main() { int main() {
try { try {
double beta =1.;
double tmin=0.;
double tmax=10; double tmax=10;
double wmin=0.; double wmin=0.;
double wmax=1.0; double wmax=1.0;
int n_re_freq=100; int n_re_freq=100;
int n_im_freq=100;
int Nt=100; int Nt=100;
triqs::clef::placeholder<0> w_; triqs::clef::placeholder<0> w_;

View File

@ -6,8 +6,6 @@ using namespace triqs::gfs;
int main() { int main() {
triqs::gfs::freq_infty inf;
double beta =1; double beta =1;
auto G = gf<imfreq> {{beta, Fermion}, {2,2}}; auto G = gf<imfreq> {{beta, Fermion}, {2,2}};
auto Gc = G; auto Gc = G;

View File

@ -24,12 +24,11 @@ int main() {
std::cout << G.data().shape() << 2*G(0,0)<<std::endl; std::cout << G.data().shape() << 2*G(0,0)<<std::endl;
auto xx =eval ( G(t_,tp_), t_=2, tp_=1.2); auto xx =eval ( G(t_,tp_), t_=2, tp_=1.2);
std::cerr << xx << std::endl;
//xx =0; //xx =0;
std::cout << eval ( gg(t_), t_=2)<< std::endl ; std::cout << eval ( gg(t_), t_=2)<< std::endl ;
double beta = 1; double beta = 1;
double wmin=0.;
double wmax=1.0;
int n_im_freq=100; int n_im_freq=100;
auto G_w_wn2 = gf<cartesian_product<imfreq,imfreq>>( {gf_mesh<imfreq>(beta, Fermion, n_im_freq), gf_mesh<imfreq>(beta, Fermion, n_im_freq)}, {2,2}); auto G_w_wn2 = gf<cartesian_product<imfreq,imfreq>>( {gf_mesh<imfreq>(beta, Fermion, n_im_freq), gf_mesh<imfreq>(beta, Fermion, n_im_freq)}, {2,2});

View File

@ -24,7 +24,6 @@ int main() {
auto Giw2 = gf<imfreq,scalar_valued> {{beta, Fermion, N}}; auto Giw2 = gf<imfreq,scalar_valued> {{beta, Fermion, N}};
auto Git2 = gf<imtime,scalar_valued> {{beta, Fermion, N}}; auto Git2 = gf<imtime,scalar_valued> {{beta, Fermion, N}};
int i =0;
for (auto & t : Gt.mesh()) Gt[t] = 1.0*t; for (auto & t : Gt.mesh()) Gt[t] = 1.0*t;
for (auto & w : Gw.mesh()) Gw[w] = 1.0*w; for (auto & w : Gw.mesh()) Gw[w] = 1.0*w;
for (auto & it : Git.mesh()) Git[it] = 1.0*it; for (auto & it : Git.mesh()) Git[it] = 1.0*it;

View File

@ -36,7 +36,6 @@ int main() {
TEST( G( 0) ) ; TEST( G( 0) ) ;
triqs::clef::placeholder<0> om_; triqs::clef::placeholder<0> om_;
triqs::clef::placeholder<1> nu_;
TEST( G(om_) ) ; TEST( G(om_) ) ;
TEST( eval(G(om_), om_=0) ) ; TEST( eval(G(om_), om_=0) ) ;

View File

@ -43,7 +43,7 @@ struct move_right {
struct compute_histo{ struct compute_histo{
configuration *config; configuration *config;
triqs::arrays::array<double,1> H; // an histogram triqs::arrays::array<double,1> H; // an histogram
int tot, xmax; int xmax, tot;
compute_histo(configuration &config_, triqs::arrays::array<double,1> &H_, int xmax_) : config(&config_), H(H_), xmax(xmax_), tot(0) {} compute_histo(configuration &config_, triqs::arrays::array<double,1> &H_, int xmax_) : config(&config_), H(H_), xmax(xmax_), tot(0) {}
void accumulate(double sign) { void accumulate(double sign) {
if( config->x+xmax>=0 && config->x-xmax<0){ if( config->x+xmax>=0 && config->x-xmax<0){

View File

@ -134,7 +134,7 @@ namespace triqs { namespace arrays { namespace storages { //namespace details {
#endif #endif
//Construct to state 0 //Construct to state 0
mem_block():size_(0),p(nullptr),py_numpy(nullptr), py_guard(nullptr), ref_count(1), weak_ref_count(0){} mem_block() : size_(0), p(nullptr), ref_count(1), weak_ref_count(0), py_numpy(nullptr), py_guard(nullptr) {}
// construct to state 1 with a given size. // construct to state 1 with a given size.
mem_block (size_t s):size_(s),py_numpy(nullptr), py_guard(nullptr){ mem_block (size_t s):size_(s),py_numpy(nullptr), py_guard(nullptr){

View File

@ -54,7 +54,7 @@ namespace triqs { namespace clef {
/* --------------------------------------------------------------------------------------------------- /* ---------------------------------------------------------------------------------------------------
* Placeholder and corresponding traits * Placeholder and corresponding traits
* --------------------------------------------------------------------------------------------------- */ * --------------------------------------------------------------------------------------------------- */
template<int i, typename T> class pair; // forward template<int i, typename T> struct pair; // forward
// a placeholder is an empty struct, labelled by an int. // a placeholder is an empty struct, labelled by an int.
template<int N> struct placeholder { template<int N> struct placeholder {

View File

@ -293,7 +293,7 @@ namespace gfs {
return "Gf" + gfs_implementation::h5_name<Variable, Target, Opt>::invoke(); return "Gf" + gfs_implementation::h5_name<Variable, Target, Opt>::invoke();
} }
friend class gfs_implementation::h5_rw<Variable, Target, Opt>; friend struct gfs_implementation::h5_rw<Variable, Target, Opt>;
/// Write into HDF5 /// Write into HDF5
friend void h5_write(h5::group fg, std::string subgroup_name, gf_impl const &g) { friend void h5_write(h5::group fg, std::string subgroup_name, gf_impl const &g) {

View File

@ -97,7 +97,7 @@ namespace triqs { namespace gfs { namespace local {
mask() = order_min+size_-1; mask() = order_min+size_-1;
_data() = 0; _data() = 0;
} }
tail_impl(data_type const &d, mask_type const &m, long omin_): mask(m), _data(d), omin(omin_) {} tail_impl(data_type const &d, mask_type const &m, long omin_) : omin(omin_), mask(m), _data(d) {}
tail_impl(tail_impl<!IsView> const & x): omin(x.omin), mask(x.mask), _data(x._data) {} tail_impl(tail_impl<!IsView> const & x): omin(x.omin), mask(x.mask), _data(x._data) {}
tail_impl(tail_impl const &) = default; tail_impl(tail_impl const &) = default;
tail_impl(tail_impl &&) = default; tail_impl(tail_impl &&) = default;
@ -309,9 +309,9 @@ namespace triqs { namespace gfs { namespace local {
inline tail mult_impl(tail_view const & l, tail_view const& r) { inline tail mult_impl(tail_view const & l, tail_view const& r) {
if (l.shape()[1] != r.shape()[0] || l.order_min() != r.order_min() || l.size() != r.size()) if (l.shape()[1] != r.shape()[0] || l.order_min() != r.order_min() || l.size() != r.size())
TRIQS_RUNTIME_ERROR<< "tail multiplication: shape mismatch"; TRIQS_RUNTIME_ERROR<< "tail multiplication: shape mismatch";
long omin1 = l.smallest_nonzero() + r.smallest_nonzero(); //long omin1 = l.smallest_nonzero() + r.smallest_nonzero();
long omax1 = std::min(std::min(r.order_max()+l.smallest_nonzero(), l.order_max()+r.smallest_nonzero()), r.order_min()+long(r.size())-1); long omax1 = std::min(std::min(r.order_max()+l.smallest_nonzero(), l.order_max()+r.smallest_nonzero()), r.order_min()+long(r.size())-1);
size_t si = omax1-omin1+1; //size_t si = omax1-omin1+1;
tail res(l.shape(), l.size(), l.order_min()); tail res(l.shape(), l.size(), l.order_min());
res.mask_view() = omax1; res.mask_view() = omax1;

View File

@ -18,8 +18,7 @@
* TRIQS. If not, see <http://www.gnu.org/licenses/>. * TRIQS. If not, see <http://www.gnu.org/licenses/>.
* *
******************************************************************************/ ******************************************************************************/
#ifndef TRIQS_C14_FIX_H #pragma once
#define TRIQS_C14_FIX_H
#include <memory> #include <memory>
//#include <functional> //#include <functional>
#include <tuple> #include <tuple>
@ -57,11 +56,7 @@ namespace std {
template<int i, typename ... Args> template<int i, typename ... Args>
auto get(c14::tuple<Args...> const & t) DECL_AND_RETURN( std::get<i>(static_cast<std::tuple<Args...>>(t))); auto get(c14::tuple<Args...> const & t) DECL_AND_RETURN( std::get<i>(static_cast<std::tuple<Args...>>(t)));
template<typename ... Args> struct tuple_size<c14::tuple<Args...>>: tuple_size<std::tuple<Args...>>{}; template<typename ... Args> class tuple_size<c14::tuple<Args...>>: public tuple_size<std::tuple<Args...>>{};
} }
#endif

View File

@ -42,7 +42,7 @@ namespace std {
template<int pos, typename TU> auto get(_triqs_reversed_tuple<TU> && t) template<int pos, typename TU> auto get(_triqs_reversed_tuple<TU> && t)
DECL_AND_RETURN(std::get<std::tuple_size<typename std::remove_const<typename std::remove_reference<TU>::type>::type>::value-1-pos>(move(t)._x)); DECL_AND_RETURN(std::get<std::tuple_size<typename std::remove_const<typename std::remove_reference<TU>::type>::type>::value-1-pos>(move(t)._x));
template<typename TU> struct tuple_size<_triqs_reversed_tuple<TU>> : tuple_size<typename std::remove_const<typename std::remove_reference<TU>::type>::type>{}; template<typename TU> class tuple_size<_triqs_reversed_tuple<TU>> : public tuple_size<typename std::remove_const<typename std::remove_reference<TU>::type>::type>{};
} }
namespace triqs { namespace tuple { namespace triqs { namespace tuple {