1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-13 01:05:36 +00:00

No compile fixes on gcc/Cray

This commit is contained in:
paboyle 2015-11-29 03:14:44 -08:00
parent f35fc4b76c
commit 93356fd246
6 changed files with 40 additions and 36 deletions

View File

@ -25,6 +25,9 @@ template<class T> void SizeSquare(DenseMatrix<T> & mat, int &N)
assert(N==M); assert(N==M);
} }
template<class T> void Resize(DenseVector<T > & mat, int N) {
mat.resize(N);
}
template<class T> void Resize(DenseMatrix<T > & mat, int N, int M) { template<class T> void Resize(DenseMatrix<T > & mat, int N, int M) {
mat.resize(N); mat.resize(N);
for(int i=0;i<N;i++){ for(int i=0;i<N;i++){

View File

@ -649,7 +649,7 @@ until convergence
int M=Nm; int M=Nm;
DenseMatrix<RealD> H; Resize(H,Nm,Nm); DenseMatrix<RealD> H; Resize(H,Nm,Nm);
Resize(evals,Nm,Nm); Resize(evals,Nm);
Resize(evecs,Nm); Resize(evecs,Nm);
int ff = Lanczos_Factor(0, M, cont, bq,bf,H); // 0--M to begin with int ff = Lanczos_Factor(0, M, cont, bq,bf,H); // 0--M to begin with
@ -765,11 +765,11 @@ until convergence
RealD resid_nrm= norm2(bf); RealD resid_nrm= norm2(bf);
if(!lock) converged = 0; if(!lock) converged = 0;
#if 0
for(int i = SS - lock_num - 1; i >= SS - Nk && i >= 0; --i){ for(int i = SS - lock_num - 1; i >= SS - Nk && i >= 0; --i){
RealD diff = 0; RealD diff = 0;
diff = abs(tevecs[i][Nm - 1 - lock_num]) * resid_nrm; diff = abs( tevecs[i][Nm - 1 - lock_num] ) * resid_nrm;
std::cout << "residual estimate " << SS-1-i << " " << diff << " of (" << tevals[i] << ")" << std::endl; std::cout << "residual estimate " << SS-1-i << " " << diff << " of (" << tevals[i] << ")" << std::endl;
@ -792,6 +792,7 @@ until convergence
break; break;
} }
} }
#endif
std::cout << "Got " << converged << " so far " <<std::endl; std::cout << "Got " << converged << " so far " <<std::endl;
} }

View File

@ -1,15 +1,14 @@
#include <Grid.h> #include <Grid.h>
using namespace Grid;
using namespace std;
namespace Grid {
// Writer implementation /////////////////////////////////////////////////////// // Writer implementation ///////////////////////////////////////////////////////
BinaryWriter::BinaryWriter(const string &fileName) BinaryWriter::BinaryWriter(const std::string &fileName)
: file_(fileName, ios::binary|ios::out) : file_(fileName, std::ios::binary|std::ios::out)
{} {}
template <> template <>
void BinaryWriter::writeDefault(const string &s, const string &output) void BinaryWriter::writeDefault(const std::string &s, const std::string &output)
{ {
uint64_t sz = output.size(); uint64_t sz = output.size();
@ -21,12 +20,12 @@ void BinaryWriter::writeDefault(const string &s, const string &output)
} }
// Reader implementation /////////////////////////////////////////////////////// // Reader implementation ///////////////////////////////////////////////////////
BinaryReader::BinaryReader(const string &fileName) BinaryReader::BinaryReader(const std::string &fileName)
: file_(fileName, ios::binary|ios::in) : file_(fileName, std::ios::binary|std::ios::in)
{} {}
template <> template <>
void BinaryReader::readDefault(const string &s, string &output) void BinaryReader::readDefault(const std::string &s, std::string &output)
{ {
uint64_t sz; uint64_t sz;
@ -34,3 +33,4 @@ void BinaryReader::readDefault(const string &s, string &output)
output.reserve(sz); output.reserve(sz);
file_.read((char *)output.data(), sz); file_.read((char *)output.data(), sz);
} }
}

View File

@ -1,14 +1,12 @@
#include <Grid.h> #include <Grid.h>
using namespace Grid; namespace Grid {
using namespace std;
// Writer implementation /////////////////////////////////////////////////////// // Writer implementation ///////////////////////////////////////////////////////
TextWriter::TextWriter(const string &fileName) TextWriter::TextWriter(const std::string &fileName)
: file_(fileName, ios::out) : file_(fileName, std::ios::out)
{} {}
void TextWriter::push(const string &s) void TextWriter::push(const std::string &s)
{ {
level_++; level_++;
}; };
@ -27,11 +25,11 @@ void TextWriter::indent(void)
}; };
// Reader implementation /////////////////////////////////////////////////////// // Reader implementation ///////////////////////////////////////////////////////
TextReader::TextReader(const string &fileName) TextReader::TextReader(const std::string &fileName)
: file_(fileName, ios::in) : file_(fileName, std::ios::in)
{} {}
void TextReader::push(const string &s) void TextReader::push(const std::string &s)
{ {
level_++; level_++;
}; };
@ -50,17 +48,18 @@ void TextReader::checkIndent(void)
file_.get(c); file_.get(c);
if (c != '\t') if (c != '\t')
{ {
cerr << "mismatch on tab " << c << " level " << level_; std::cerr << "mismatch on tab " << c << " level " << level_;
cerr << " i "<< i <<endl; std::cerr << " i "<< i <<std::endl;
abort(); std::abort();
} }
} }
} }
template <> template <>
void TextReader::readDefault(const string &s, string &output) void TextReader::readDefault(const std::string &s, std::string &output)
{ {
checkIndent(); checkIndent();
output.clear(); output.clear();
getline(file_, output); getline(file_, output);
} }
}

View File

@ -1,10 +1,8 @@
#include <Grid.h> #include <Grid.h>
using namespace Grid; namespace Grid {
using namespace std;
// Writer implementation /////////////////////////////////////////////////////// // Writer implementation ///////////////////////////////////////////////////////
XmlWriter::XmlWriter(const string &fileName) XmlWriter::XmlWriter(const std::string &fileName)
: fileName_(fileName) : fileName_(fileName)
{ {
node_ = doc_.append_child(); node_ = doc_.append_child();
@ -16,7 +14,7 @@ XmlWriter::~XmlWriter(void)
doc_.save_file(fileName_.c_str(), " "); doc_.save_file(fileName_.c_str(), " ");
} }
void XmlWriter::push(const string &s) void XmlWriter::push(const std::string &s)
{ {
node_ = node_.append_child(s.c_str()); node_ = node_.append_child(s.c_str());
} }
@ -27,22 +25,22 @@ void XmlWriter::pop(void)
} }
// Reader implementation /////////////////////////////////////////////////////// // Reader implementation ///////////////////////////////////////////////////////
XmlReader::XmlReader(const string &fileName) XmlReader::XmlReader(const std::string &fileName)
: fileName_(fileName) : fileName_(fileName)
{ {
pugi::xml_parse_result result = doc_.load_file(fileName_.c_str()); pugi::xml_parse_result result = doc_.load_file(fileName_.c_str());
if ( !result ) if ( !result )
{ {
cerr << "XML error description: " << result.description() << "\n"; std::cerr << "XML error description: " << result.description() << "\n";
cerr << "XML error offset : " << result.offset << "\n"; std::cerr << "XML error offset : " << result.offset << "\n";
abort(); std::abort();
} }
node_ = doc_.child("grid"); node_ = doc_.child("grid");
} }
void XmlReader::push(const string &s) void XmlReader::push(const std::string &s)
{ {
node_ = node_.child(s.c_str()); node_ = node_.child(s.c_str());
} }
@ -53,7 +51,8 @@ void XmlReader::pop(void)
} }
template <> template <>
void XmlReader::readDefault(const string &s, string &output) void XmlReader::readDefault(const std::string &s, std::string &output)
{ {
output = node_.child(s.c_str()).first_child().value(); output = node_.child(s.c_str()).first_child().value();
} }
}

View File

@ -8,6 +8,7 @@ using namespace Grid::QCD;
static int static int
FEenableexcept (unsigned int excepts) FEenableexcept (unsigned int excepts)
{ {
#if 0
static fenv_t fenv; static fenv_t fenv;
unsigned int new_excepts = excepts & FE_ALL_EXCEPT, unsigned int new_excepts = excepts & FE_ALL_EXCEPT,
old_excepts; // previous masks old_excepts; // previous masks
@ -20,6 +21,7 @@ FEenableexcept (unsigned int excepts)
fenv.__mxcsr &= ~(new_excepts << 7); fenv.__mxcsr &= ~(new_excepts << 7);
return ( fesetenv (&fenv) ? -1 : old_excepts ); return ( fesetenv (&fenv) ? -1 : old_excepts );
#endif
} }
@ -70,7 +72,7 @@ public:
int main (int argc, char ** argv) int main (int argc, char ** argv)
{ {
FEenableexcept(FE_ALL_EXCEPT & ~FE_INEXACT); // FEenableexcept(FE_ALL_EXCEPT & ~FE_INEXACT);
Grid_init(&argc,&argv); Grid_init(&argc,&argv);