mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2024-11-10 00:45:36 +00:00
portability fixes
This commit is contained in:
parent
7f2c8b6742
commit
389a52374c
@ -28,6 +28,10 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <LatAnalyze/AsciiFile.hpp>
|
#include <LatAnalyze/AsciiFile.hpp>
|
||||||
#include "AsciiParser.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 "-Wshorten-64-to-32"
|
||||||
#pragma GCC diagnostic ignored "-Wconversion"
|
#pragma GCC diagnostic ignored "-Wconversion"
|
||||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||||
@ -35,6 +39,7 @@
|
|||||||
#pragma GCC diagnostic ignored "-Wdeprecated-register"
|
#pragma GCC diagnostic ignored "-Wdeprecated-register"
|
||||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Latan;
|
using namespace Latan;
|
||||||
|
@ -28,9 +28,13 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <cstring>
|
#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 "-Wshorten-64-to-32"
|
||||||
#pragma GCC diagnostic ignored "-Wconversion"
|
#pragma GCC diagnostic ignored "-Wconversion"
|
||||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Latan;
|
using namespace Latan;
|
||||||
|
@ -75,9 +75,11 @@ Index Chi2Function::getNPar(void) const
|
|||||||
|
|
||||||
void Chi2Function::setModel(const DoubleModel &model, const Index j)
|
void Chi2Function::setModel(const DoubleModel &model, const Index j)
|
||||||
{
|
{
|
||||||
|
typedef decltype(model_.size()) size_type;
|
||||||
|
|
||||||
if (static_cast<Index>(model_.size()) != data_.getYDim())
|
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())
|
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();
|
nPar_ = model.getNPar();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Chi2Function::setModel(const vector<const DoubleModel *> &modelVector)
|
void Chi2Function::setModel(const vector<const DoubleModel *> &modelVector)
|
||||||
{
|
{
|
||||||
|
typedef decltype(model_.size()) size_type;
|
||||||
|
|
||||||
if (static_cast<Index>(model_.size()) != data_.getYDim())
|
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");
|
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");
|
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())
|
if (modelVector[j]->getNPar() != modelVector[0]->getNPar())
|
||||||
{
|
{
|
||||||
LATAN_ERROR(Size, "model number of parameter mismatch");
|
LATAN_ERROR(Size, "model number of parameter mismatch");
|
||||||
@ -236,6 +240,8 @@ void Chi2Function::initBuffer(void) const
|
|||||||
// function call ///////////////////////////////////////////////////////////////
|
// function call ///////////////////////////////////////////////////////////////
|
||||||
double Chi2Function::operator()(const double *arg) const
|
double Chi2Function::operator()(const double *arg) const
|
||||||
{
|
{
|
||||||
|
typedef decltype(model_.size()) size_type;
|
||||||
|
|
||||||
if (!model_[0])
|
if (!model_[0])
|
||||||
{
|
{
|
||||||
LATAN_ERROR(Memory, "null model");
|
LATAN_ERROR(Memory, "null model");
|
||||||
@ -259,7 +265,7 @@ double Chi2Function::operator()(const double *arg) const
|
|||||||
for (Index j = 0; j < yDim; ++j)
|
for (Index j = 0; j < yDim; ++j)
|
||||||
FOR_VEC(buffer_->dInd, k)
|
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));
|
double f_jk, y_jk = data_.y(j, buffer_->dInd(k));
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
|
@ -39,8 +39,6 @@ public:
|
|||||||
// constructors
|
// constructors
|
||||||
Dataset(void) = default;
|
Dataset(void) = default;
|
||||||
Dataset(const Index size);
|
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)
|
EIGEN_EXPR_CTOR(Dataset, Dataset<T>, StatArray<T>, ArrayExpr)
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~Dataset(void) = default;
|
virtual ~Dataset(void) = default;
|
||||||
@ -62,14 +60,6 @@ template <typename T>
|
|||||||
Dataset<T>::Dataset(const Index size)
|
Dataset<T>::Dataset(const Index size)
|
||||||
: StatArray<T>(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 //////////////////////////////////////////////////////////////////////////
|
// IO //////////////////////////////////////////////////////////////////////////
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -144,7 +144,7 @@ void Io::save(const IoT &data, const std::string &fileName,
|
|||||||
FileType file(fileName, mode);
|
FileType file(fileName, mode);
|
||||||
std::string realName = (name.empty()) ? fileName : name;
|
std::string realName = (name.empty()) ? fileName : name;
|
||||||
|
|
||||||
file.template save(data, realName);
|
file.save(data, realName);
|
||||||
}
|
}
|
||||||
|
|
||||||
END_LATAN_NAMESPACE
|
END_LATAN_NAMESPACE
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <LatAnalyze/MathInterpreter.hpp>
|
#include <LatAnalyze/MathInterpreter.hpp>
|
||||||
#include "MathParser.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 "-Wshorten-64-to-32"
|
||||||
#pragma GCC diagnostic ignored "-Wconversion"
|
#pragma GCC diagnostic ignored "-Wconversion"
|
||||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||||
@ -35,6 +39,7 @@
|
|||||||
#pragma GCC diagnostic ignored "-Wdeprecated-register"
|
#pragma GCC diagnostic ignored "-Wdeprecated-register"
|
||||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Latan;
|
using namespace Latan;
|
||||||
|
@ -24,9 +24,13 @@
|
|||||||
#include <LatAnalyze/Global.hpp>
|
#include <LatAnalyze/Global.hpp>
|
||||||
#include <LatAnalyze/MathInterpreter.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 "-Wshorten-64-to-32"
|
||||||
#pragma GCC diagnostic ignored "-Wconversion"
|
#pragma GCC diagnostic ignored "-Wconversion"
|
||||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Latan;
|
using namespace Latan;
|
||||||
|
Loading…
Reference in New Issue
Block a user