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

Merge branch 'hotfix/3.1.1'

This commit is contained in:
Antonin Portelli 2016-04-19 19:25:36 -07:00
commit bda9135a44
18 changed files with 47 additions and 29 deletions

View File

@ -55,6 +55,11 @@ in the `ci-scripts` directory where `<prefix>` is where you want LatAnalyze (and
For a more customised installation, one first needs to generate the build system by running `./bootstrap.sh` in the root directory. Then the library can be built and installed through the usual GNU mantra `./configure <options> && make && make install`. Use `./configure --help` to obtain a list of possible options for `./configure`. Because Eigen expressions rely a lot on inlining and compiler optimisations it is strongly recommended to set the `CXXFLAGS` variable to `-O3 -march=native -mtune=native`.
## History
#### v3.1.1
Fixes:
* Minuit precision fixed
* Minor fit interface fixes
#### v3.1
Additions:
* Wrappers to NLopt and GSL minimisers.

View File

@ -2,7 +2,7 @@
# Initialization
AC_PREREQ([2.63])
AC_INIT([LatAnalyze],[3.1],[antonin.portelli@me.com],[LatAnalyze])
AC_INIT([LatAnalyze],[3.1.1],[antonin.portelli@me.com],[LatAnalyze])
AC_CONFIG_AUX_DIR([.buildutils])
AC_CONFIG_SRCDIR([lib/Global.cpp])
AC_CONFIG_SRCDIR([utils/sample_read.cpp])

View File

@ -170,7 +170,7 @@ void AsciiFile::open(const string &name, const unsigned int mode)
std::string AsciiFile::load(const string &name)
{
if ((mode_ & Mode::read)&&(isOpen()))
if ((mode_ & Mode::read) and (isOpen()))
{
if (!isParsed_)
{

View File

@ -57,7 +57,7 @@ void File::deleteData(void)
void File::checkWritability(void)
{
if (!((mode_ & Mode::write)||(mode_ & Mode::append))||!isOpen())
if (!((mode_ & Mode::write) or (mode_ & Mode::append)) or !isOpen())
{
LATAN_ERROR(Io, "file '" + name_ + "' is not writable");
}

View File

@ -110,6 +110,12 @@ const IoT& File::getData(const std::string &name) const
LATAN_ERROR(Definition, "no data with name '" + name + "' in file "
+ name_);
}
catch(std::bad_cast)
{
LATAN_ERROR(Definition, "data with name '" + name + "' in file "
+ name_ + " does not have type '" + typeid(IoT).name()
+ "'");
}
}
END_LATAN_NAMESPACE

View File

@ -58,7 +58,7 @@ void FitInterface::addXDim(const Index nData, const string name,
scheduleDataCoordInit();
if (!name.empty())
{
xName().setName(getNXDim(), name);
xName().setName(getNXDim() - 1, name);
}
}
}
@ -70,7 +70,7 @@ void FitInterface::addYDim(const string name)
scheduleLayoutInit();
if (!name.empty())
{
yName().setName(getNYDim(), name);
yName().setName(getNYDim() - 1, name);
}
}

View File

@ -183,7 +183,7 @@ DoubleFunction & DoubleFunction::operator op##=(const DoubleFunction &f)\
setFunction(res, getNArg());\
return *this;\
}\
DoubleFunction & DoubleFunction::operator op##=(const DoubleFunction &&f)\
DoubleFunction & DoubleFunction::operator op##=(const DoubleFunction and f)\
{\
*this op##= f;\
return *this;\

View File

@ -122,7 +122,7 @@ GslHybridRootFinder::operator()(const vector<DoubleFunction *> &func)
break;
}
status = gsl_multiroot_test_residual(solver_->f, getPrecision());
} while ((status == GSL_CONTINUE)&&(iter < getMaxIteration()));
} while ((status == GSL_CONTINUE) and (iter < getMaxIteration()));
if (verbosity >= Verbosity::Debug)
{
cout << "--- done" << endl;

View File

@ -207,14 +207,14 @@ string Hdf5File::getFirstGroupName(void)
{
string res;
if ((mode_ & Mode::read)&&(isOpen()))
if ((mode_ & Mode::read) and (isOpen()))
{
auto firstGroupName = [](hid_t loc_id, const char *name, void *fname)
{
H5G_stat_t statbuf;
H5Gget_objinfo(loc_id, name, 0, &statbuf);
if ((statbuf.type == H5G_GROUP) && (strlen((char *)fname) == 0))
if ((statbuf.type == H5G_GROUP) and (strlen((char *)fname) == 0))
{
strncpy((char *)fname, name, maxGroupNameSize);
}
@ -268,7 +268,7 @@ void Hdf5File::load(DSample &ds, const DataSet &d)
string Hdf5File::load(const string &name)
{
if ((mode_ & Mode::read)&&(isOpen()))
if ((mode_ & Mode::read) and (isOpen()))
{
string groupName;
Group group;

View File

@ -165,7 +165,7 @@ double Histogram::operator()(const double x) const
// percentiles & confidence interval ///////////////////////////////////////////
double Histogram::percentile(const double p) const
{
if ((p < 0.0)||(p > 100.0))
if ((p < 0.0) or (p > 100.0))
{
LATAN_ERROR(Range, "percentile (" + strFrom(p) + ")"
" is outside the [0, 100] range");

View File

@ -38,7 +38,7 @@ unique_ptr<File> Io::open(const std::string &fileName, const unsigned int mode)
{
string ext = extension(fileName);
if ((ext == "dat")||(ext == "sample")||(ext == "seed"))
if ((ext == "dat") or (ext == "sample") or (ext == "seed"))
{
return unique_ptr<File>(new AsciiFile(fileName, mode));
}

View File

@ -478,7 +478,7 @@ void SemicolonNode::compile(Program &program, RunContext &context) const
bool isSemiColumn = isDerivedFrom<SemicolonNode>(&n[i]);
bool isKeyword = isDerivedFrom<KeywordNode>(&n[i]);
if (isAssign||isSemiColumn||isKeyword)
if (isAssign or isSemiColumn or isKeyword)
{
n[i].compile(program, context);
}
@ -513,7 +513,7 @@ void AssignNode::compile(Program &program, RunContext &context) const
}
// MathOpNode compile //////////////////////////////////////////////////////////
#define IFNODE(name, nArg) if ((n.getName() == (name))&&(n.getNArg() == nArg))
#define IFNODE(name, nArg) if ((n.getName() == (name)) and (n.getNArg() == nArg))
#define ELIFNODE(name, nArg) else IFNODE(name, nArg)
#define ELSE else
@ -703,7 +703,7 @@ void MathInterpreter::compile(RunContext &context)
}
}
}
if (!root_||!gotReturn)
if (!root_ or !gotReturn)
{
LATAN_ERROR(Syntax, "expected 'return' in program '" + codeName_
+ "'");

View File

@ -58,9 +58,10 @@ const DVec & MinuitMinimizer::operator()(const DoubleFunction &f)
using namespace ROOT;
using namespace Minuit2;
DVec &x = getState();
int printLevel = 0;
EMinimizerType minuitAlg = kCombined;
DVec &x = getState();
int printLevel = 0;
EMinimizerType minuitAlg = kCombined;
double prec = getPrecision();
// convert Latan parameters to Minuit parameters
switch (getVerbosity())
@ -75,16 +76,21 @@ const DVec & MinuitMinimizer::operator()(const DoubleFunction &f)
printLevel = 3;
break;
}
// The factor of 0.002 here is to compensate the dirty hack in Minuit
// source used to match the C++ and F77 versions
// (cf. VariableMetricBuilder.cxx)
switch (getAlgorithm())
{
case Algorithm::migrad:
minuitAlg = kMigrad;
minuitAlg = kMigrad;
prec /= 0.002;
break;
case Algorithm::simplex:
minuitAlg = kSimplex;
break;
case Algorithm::combined:
minuitAlg = kCombined;
minuitAlg = kCombined;
prec /= 0.002;
break;
}
@ -99,7 +105,7 @@ const DVec & MinuitMinimizer::operator()(const DoubleFunction &f)
min.SetStrategy(2);
min.SetMaxFunctionCalls(getMaxIteration());
min.SetTolerance(getPrecision());
min.SetTolerance(prec);
min.SetPrintLevel(printLevel);
// set function and variables
@ -146,7 +152,7 @@ const DVec & MinuitMinimizer::operator()(const DoubleFunction &f)
min.Minimize();
status = min.Status();
n++;
} while (status and (n < getMaxPass()));
} while ((status >= 2) and (n < getMaxPass()));
if (getVerbosity() >= Verbosity::Normal)
{
cout << "=================================================" << endl;
@ -154,7 +160,8 @@ const DVec & MinuitMinimizer::operator()(const DoubleFunction &f)
switch (status)
{
case 1:
LATAN_WARNING("invalid minimum: covariance matrix was made positive");
// covariance matrix was made positive, the minimum is still good
// it just means that Minuit error analysis is inaccurate
break;
case 2:
LATAN_WARNING("invalid minimum: Hesse analysis is not valid");

View File

@ -458,7 +458,7 @@ void Plot::getProgramPath(void)
{
for (i=0;path[i];)
{
for (j=i;(path[j])&&(path[j]!=':');j++);
for (j=i;(path[j]) and (path[j]!=':');j++);
lg = j - i;
strncpy(buf,path + i,(size_t)(lg));
if (lg == 0)

View File

@ -262,7 +262,7 @@ namespace ReducOp
inline Mat<double> tensProd(const Mat<double> &v1,
const Mat<double> &v2)
{
if ((v1.cols() != 1)||(v2.cols() != 1))
if ((v1.cols() != 1) or (v2.cols() != 1))
{
LATAN_ERROR(Size,
"tensorial product is only valid with column vectors");

View File

@ -65,7 +65,7 @@ double TabFunction::operator()(const double *arg) const
double result = 0.0, x = arg[0];
if ((x < value_.begin()->first) || (x >= value_.rbegin()->first)) {
if ((x < value_.begin()->first) or (x >= value_.rbegin()->first)) {
LATAN_ERROR(Range, "tabulated function variable out of range "
"(x= " + strFrom(x) + " not in ["
+ strFrom(value_.begin()->first) + ", "

View File

@ -187,7 +187,7 @@ int main(int argc, char *argv[])
{
process<DSample>(outFileName, fileName, code);
}
catch (bad_cast &e)
catch (Exceptions::Definition)
{
process<DMatSample>(outFileName, fileName, code);
}

View File

@ -24,7 +24,7 @@ using namespace Latan;
int main(int argc, char *argv[])
{
if ((argc < 2) || (argc > 3))
if ((argc < 2) or (argc > 3))
{
cerr << "usage: " << argv[0] << " <file> [<copy>]" << endl;
@ -46,7 +46,7 @@ int main(int argc, char *argv[])
Io::save(s, copy, File::Mode::write, name);
}
}
catch (bad_cast &e)
catch (Exceptions::Definition)
{
DSample s = Io::load<DSample>(fileName);
string name = Io::getFirstName(fileName);