1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-11-10 00:45:36 +00:00

portability fixes

This commit is contained in:
Antonin Portelli 2015-05-23 14:44:43 +01:00
parent 7f2c8b6742
commit 389a52374c
7 changed files with 32 additions and 18 deletions

View File

@ -28,6 +28,10 @@
#include <iostream>
#include <LatAnalyze/AsciiFile.hpp>
#include "AsciiParser.hpp"
#if (defined __INTEL_COMPILER)
#pragma warning disable 1682 2259
#elif (defined __GNUC__)||(defined __clang__)
#pragma GCC diagnostic ignored "-Wshorten-64-to-32"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
@ -35,6 +39,7 @@
#pragma GCC diagnostic ignored "-Wdeprecated-register"
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
using namespace std;
using namespace Latan;

View File

@ -28,9 +28,13 @@
#include <utility>
#include <cstring>
#if (defined __INTEL_COMPILER)
#pragma warning disable 1682 2259
#elif (defined __GNUC__)||(defined __clang__)
#pragma GCC diagnostic ignored "-Wshorten-64-to-32"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
using namespace std;
using namespace Latan;

View File

@ -75,9 +75,11 @@ Index Chi2Function::getNPar(void) const
void Chi2Function::setModel(const DoubleModel &model, const Index j)
{
typedef decltype(model_.size()) size_type;
if (static_cast<Index>(model_.size()) != data_.getYDim())
{
model_.resize(static_cast<unsigned int>(data_.getYDim()));
model_.resize(static_cast<size_type>(data_.getYDim()));
}
if (model.getNArg() != data_.getXDim())
{
@ -93,17 +95,19 @@ void Chi2Function::setModel(const DoubleModel &model, const Index j)
}
}
}
model_[static_cast<unsigned int>(j)] = &model;
model_[static_cast<size_type>(j)] = &model;
nPar_ = model.getNPar();
}
void Chi2Function::setModel(const vector<const DoubleModel *> &modelVector)
{
typedef decltype(model_.size()) size_type;
if (static_cast<Index>(model_.size()) != data_.getYDim())
{
model_.resize(static_cast<unsigned int>(data_.getYDim()));
model_.resize(static_cast<size_type>(data_.getYDim()));
}
if (modelVector.size() != static_cast<unsigned int>(data_.getYDim()))
if (modelVector.size() != static_cast<size_type>(data_.getYDim()))
{
LATAN_ERROR(Size, "number of models and y-dimension mismatch");
}
@ -117,7 +121,7 @@ void Chi2Function::setModel(const vector<const DoubleModel *> &modelVector)
{
LATAN_ERROR(Size, "model number of arguments and x-dimension mismatch");
}
model_[static_cast<unsigned int>(j)] = modelVector[j];
model_[static_cast<size_type>(j)] = modelVector[j];
if (modelVector[j]->getNPar() != modelVector[0]->getNPar())
{
LATAN_ERROR(Size, "model number of parameter mismatch");
@ -236,6 +240,8 @@ void Chi2Function::initBuffer(void) const
// function call ///////////////////////////////////////////////////////////////
double Chi2Function::operator()(const double *arg) const
{
typedef decltype(model_.size()) size_type;
if (!model_[0])
{
LATAN_ERROR(Memory, "null model");
@ -259,7 +265,7 @@ double Chi2Function::operator()(const double *arg) const
for (Index j = 0; j < yDim; ++j)
FOR_VEC(buffer_->dInd, k)
{
const DoubleModel *f = model_[static_cast<unsigned int>(j)];
const DoubleModel *f = model_[static_cast<size_type>(j)];
double f_jk, y_jk = data_.y(j, buffer_->dInd(k));
if (!f)

View File

@ -39,8 +39,6 @@ public:
// constructors
Dataset(void) = default;
Dataset(const Index size);
template <typename FileType>
Dataset(const std::string &listFileName, const std::string &dataName);
EIGEN_EXPR_CTOR(Dataset, Dataset<T>, StatArray<T>, ArrayExpr)
// destructor
virtual ~Dataset(void) = default;
@ -63,14 +61,6 @@ Dataset<T>::Dataset(const Index size)
: StatArray<T>(size)
{}
template <typename T>
template <typename FileType>
Dataset<T>::Dataset(const std::string &listFileName,
const std::string &dataName)
{
load<FileType>(listFileName, dataName);
}
// IO //////////////////////////////////////////////////////////////////////////
template <typename T>
template <typename FileType>

View File

@ -144,7 +144,7 @@ void Io::save(const IoT &data, const std::string &fileName,
FileType file(fileName, mode);
std::string realName = (name.empty()) ? fileName : name;
file.template save(data, realName);
file.save(data, realName);
}
END_LATAN_NAMESPACE

View File

@ -28,6 +28,10 @@
#include <iostream>
#include <LatAnalyze/MathInterpreter.hpp>
#include "MathParser.hpp"
#if (defined __INTEL_COMPILER)
#pragma warning disable 1682 2259
#elif (defined __GNUC__)||(defined __clang__)
#pragma GCC diagnostic ignored "-Wshorten-64-to-32"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
@ -35,6 +39,7 @@
#pragma GCC diagnostic ignored "-Wdeprecated-register"
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
using namespace std;
using namespace Latan;

View File

@ -24,9 +24,13 @@
#include <LatAnalyze/Global.hpp>
#include <LatAnalyze/MathInterpreter.hpp>
#if (defined __INTEL_COMPILER)
#pragma warning disable 1682 2259
#elif (defined __GNUC__)||(defined __clang__)
#pragma GCC diagnostic ignored "-Wshorten-64-to-32"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
using namespace std;
using namespace Latan;