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

Silence warnings on gcc

gcc 4.9 with -Wall -Wno-unknown-pragmas -Wno-maybe-uninitialized -Wno-sign-compare

-> uninit : not reliable apparently.
-> sign compare : to be fixed later.
-> fix all, but parenthesis suggestion
This commit is contained in:
Olivier Parcollet 2014-10-18 21:05:36 +02:00
parent 0a3f07a6cb
commit a857aca301
13 changed files with 20 additions and 23 deletions

View File

@ -4,8 +4,6 @@ using namespace triqs::arrays;
int main() { int main() {
typedef std::complex<double> dcomplex;
array<double,3> A(10,2,2); A() = 0; array<double,3> A(10,2,2); A() = 0;
A(4,range(),range()) = 1; A(4,range(),range()) = 1;
@ -24,10 +22,8 @@ int main() {
M1 = M2; M1 = M2;
//M1 = M1*M2; //M1 = M1*M2;
// aie! M1 is zero!
std::cout << M1 << std::endl; std::cout << M1 << std::endl;
std::cout << M2 << std::endl; std::cout << M2 << std::endl;
} }

View File

@ -14,11 +14,10 @@ using namespace triqs::lattice;
int main() { int main() {
try { try {
double beta = 1;
int N = 10; int N = 10;
int S = 2; int S = 2;
placeholder<0> k_; placeholder<0> k_;
placeholder<1> r_; //placeholder<1> r_;
auto bz_ = brillouin_zone{bravais_lattice{make_unit_matrix<double>(2)}}; auto bz_ = brillouin_zone{bravais_lattice{make_unit_matrix<double>(2)}};
auto gk = gf<bz>{{bz_, N}, {S, S}}; auto gk = gf<bz>{{bz_, N}, {S, S}};

View File

@ -34,8 +34,7 @@ int main() {
placeholder<0> k_; placeholder<0> k_;
placeholder<1> w_; placeholder<1> w_;
placeholder<2> wn_; //placeholder<2> tau_;
placeholder<3> tau_;
auto eps_k = -2 * (cos(k_(0)) + cos(k_(1))); auto eps_k = -2 * (cos(k_(0)) + cos(k_(1)));
gkw(k_, w_) << 1 / (w_ - eps_k - 1 / (w_ + 2)); gkw(k_, w_) << 1 / (w_ - eps_k - 1 / (w_ + 2));

View File

@ -15,7 +15,6 @@ using namespace triqs::lattice;
int main() { int main() {
try { try {
double beta = 1;
auto bz_ = brillouin_zone{bravais_lattice{make_unit_matrix<double>(2)}}; auto bz_ = brillouin_zone{bravais_lattice{make_unit_matrix<double>(2)}};
auto t = tail{1,1}; auto t = tail{1,1};

View File

@ -47,7 +47,7 @@ int main(int argc, char* argv[]) {
VEC A(7), B(7), AA(7); VEC A(7), B(7), AA(7);
clef::placeholder<0> i_; clef::placeholder<0> i_;
clef::placeholder<1> j_; //clef::placeholder<1> j_;
triqs::clef::make_expr(A)[i_] << i_+1; triqs::clef::make_expr(A)[i_] << i_+1;

View File

@ -32,7 +32,7 @@ void test_1(int argc, char ** argv){
correlated_gaussian_vector(A, seed, L); correlated_gaussian_vector(A, seed, L);
double intrinsic_variance = 1; double intrinsic_variance = 1;
auto t1 = clock(); //auto t1 = clock();
TEST( autocorrelation_time(A)); TEST( autocorrelation_time(A));
//std::cout << "time = " << double( clock()-t1)/CLOCKS_PER_SEC << std::endl; //std::cout << "time = " << double( clock()-t1)/CLOCKS_PER_SEC << std::endl;
//t1 = clock(); //t1 = clock();

View File

@ -77,7 +77,8 @@ namespace arrays {
buffer.resize(s); buffer.resize(s);
h5::dataspace mspace1 = H5Screate_simple(RANK, dims.ptr(), maxdims.ptr()); h5::dataspace mspace1 = H5Screate_simple(RANK, dims.ptr(), maxdims.ptr());
h5::proplist cparms = H5Pcreate(H5P_DATASET_CREATE); h5::proplist cparms = H5Pcreate(H5P_DATASET_CREATE);
auto err = H5Pset_chunk(cparms, RANK, dim_chunk.ptr()); //auto err = H5Pset_chunk(cparms, RANK, dim_chunk.ptr());
H5Pset_chunk(cparms, RANK, dim_chunk.ptr());
d_set = g.create_dataset(name, h5::native_type_from_C(T()), mspace1, cparms); d_set = g.create_dataset(name, h5::native_type_from_C(T()), mspace1, cparms);
if (triqs::is_complex<T>::value) h5::write_string_attribute(d_set, "__complex__", "1"); if (triqs::is_complex<T>::value) h5::write_string_attribute(d_set, "__complex__", "1");
} }

View File

@ -163,12 +163,12 @@ namespace gfs {
// specific operations (for legacy python code). // specific operations (for legacy python code).
// +=, -= with a matrix // +=, -= with a matrix
inline void operator+=(gf_view<imfreq> g, arrays::matrix<std::complex<double>> m) { inline void operator+=(gf_view<imfreq> g, arrays::matrix<std::complex<double>> m) {
for (int u = 0; u < first_dim(g.data()); ++u) g.data()(u, arrays::ellipsis()) += m; for (int u = 0; u < int(first_dim(g.data())); ++u) g.data()(u, arrays::ellipsis()) += m;
g.singularity()(0) += m; g.singularity()(0) += m;
} }
inline void operator-=(gf_view<imfreq> g, arrays::matrix<std::complex<double>> m) { inline void operator-=(gf_view<imfreq> g, arrays::matrix<std::complex<double>> m) {
for (int u = 0; u < first_dim(g.data()); ++u) g.data()(u, arrays::ellipsis()) -= m; for (int u = 0; u < int(first_dim(g.data())); ++u) g.data()(u, arrays::ellipsis()) -= m;
g.singularity()(0) -= m; g.singularity()(0) -= m;
} }
} }

View File

@ -59,7 +59,6 @@ namespace gfs {
r() = 0; r() = 0;
auto omin = t.order_min(); auto omin = t.order_min();
auto omax = t.order_max(); // precompute since long to do... auto omax = t.order_max(); // precompute since long to do...
auto _ = arrays::range{};
for (int u = omax; u >= omin; --u) for (int u = omax; u >= omin; --u)
r = r / omega + matrix_view<dcomplex>{t.data()(u - omin, ellipsis())}; // need to make a matrix view because otherwise + is not defined r = r / omega + matrix_view<dcomplex>{t.data()(u - omin, ellipsis())}; // need to make a matrix view because otherwise + is not defined
r /= pow(omega, omin); r /= pow(omega, omin);

View File

@ -31,9 +31,9 @@ namespace gfs {
auto t = tail_omega(s.get_from_linear_index(0)); auto t = tail_omega(s.get_from_linear_index(0));
// a bit faster to first replace (some part of expression are precomputed). // a bit faster to first replace (some part of expression are precomputed).
clef::placeholder<0> x_; clef::placeholder<0> x_;
//auto expr = rhs(x_, t); auto expr = rhs(x_, t);
//for (auto x : s.mesh()) s[x] = eval(expr, x_ = x); for (auto x : s.mesh()) s[x] = eval(expr, x_ = x);
for (auto x : s.mesh()) s[x] = rhs(x, t); //for (auto x : s.mesh()) s[x] = rhs(x, t);
} }
/// --------------------------- singularity --------------------------------- /// --------------------------- singularity ---------------------------------

View File

@ -28,7 +28,8 @@ namespace h5 {
datatype strdatatype = H5Tcopy(H5T_C_S1); datatype strdatatype = H5Tcopy(H5T_C_S1);
// auto status = H5Tset_size (strdatatype, H5T_VARIABLE); // auto status = H5Tset_size (strdatatype, H5T_VARIABLE);
auto status = H5Tset_size(strdatatype, value.size() + 1); //auto status = H5Tset_size(strdatatype, value.size() + 1);
H5Tset_size(strdatatype, value.size() + 1);
dataspace space = H5Screate(H5S_SCALAR); dataspace space = H5Screate(H5S_SCALAR);
dataset ds = g.create_dataset(name, strdatatype, space); dataset ds = g.create_dataset(name, strdatatype, space);
@ -47,7 +48,8 @@ namespace h5 {
size_t size = H5Dget_storage_size(ds); size_t size = H5Dget_storage_size(ds);
datatype strdatatype = H5Tcopy(H5T_C_S1); datatype strdatatype = H5Tcopy(H5T_C_S1);
auto status = H5Tset_size(strdatatype, size); H5Tset_size(strdatatype, size);
//auto status = H5Tset_size(strdatatype, size);
// auto status = H5Tset_size (strdatatype, H5T_VARIABLE); // auto status = H5Tset_size (strdatatype, H5T_VARIABLE);
std::vector<char> buf(size + 1, 0x00); std::vector<char> buf(size + 1, 0x00);

View File

@ -29,7 +29,8 @@ namespace h5 {
for (auto &x : V) s = std::max(s, x.size()); for (auto &x : V) s = std::max(s, x.size());
datatype strdatatype = H5Tcopy (H5T_C_S1); datatype strdatatype = H5Tcopy (H5T_C_S1);
auto status = H5Tset_size (strdatatype, s); H5Tset_size (strdatatype, s);
//auto status = H5Tset_size (strdatatype, s);
//auto status = H5Tset_size (strdatatype, H5T_VARIABLE); //auto status = H5Tset_size (strdatatype, H5T_VARIABLE);
const size_t n = V.size(); const size_t n = V.size();
@ -65,7 +66,8 @@ namespace h5 {
size_t size = H5Dget_storage_size(ds); size_t size = H5Dget_storage_size(ds);
datatype strdatatype = H5Tcopy (H5T_C_S1); datatype strdatatype = H5Tcopy (H5T_C_S1);
auto status = H5Tset_size (strdatatype, size); H5Tset_size (strdatatype, size);
//auto status = H5Tset_size (strdatatype, size);
//auto status = H5Tset_size (strdatatype, H5T_VARIABLE); //auto status = H5Tset_size (strdatatype, H5T_VARIABLE);
std::vector<char> buf(Len * (size + 1), 0x00); std::vector<char> buf(Len * (size + 1), 0x00);

View File

@ -25,7 +25,7 @@ namespace triqs {
namespace utility { namespace utility {
class index3_generator { class index3_generator {
mini_vector<long, 3> i, d; // rely on mini_vector initialization mini_vector<long, 3> d, i; // rely on mini_vector initialization
long i_flat =0; long i_flat =0;
bool _at_end = false; bool _at_end = false;