1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-09 23:45: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);
}
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) {
mat.resize(N);
for(int i=0;i<N;i++){

View File

@ -649,7 +649,7 @@ until convergence
int M=Nm;
DenseMatrix<RealD> H; Resize(H,Nm,Nm);
Resize(evals,Nm,Nm);
Resize(evals,Nm);
Resize(evecs,Nm);
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);
if(!lock) converged = 0;
#if 0
for(int i = SS - lock_num - 1; i >= SS - Nk && i >= 0; --i){
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;
@ -792,6 +792,7 @@ until convergence
break;
}
}
#endif
std::cout << "Got " << converged << " so far " <<std::endl;
}

View File

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

View File

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

View File

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

View File

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