1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2025-04-11 03:20:46 +01:00

now HDF5, Minuit and NLopt are really optional dependencies

This commit is contained in:
Antonin Portelli 2016-04-12 20:31:53 +01:00
parent 9bf538dfca
commit bd9e0262ca
6 changed files with 23 additions and 21 deletions

View File

@ -9,18 +9,17 @@ endif
noinst_PROGRAMS = \ noinst_PROGRAMS = \
exCompiledDoubleFunction\ exCompiledDoubleFunction\
exDerivative \ exDerivative \
exFit \
exFitSample \
exIntegrator \ exIntegrator \
exInterp \ exInterp \
exMat \ exMat \
exMathInterpreter \ exMathInterpreter \
exMin \
exPlot \ exPlot \
exRand \ exRand \
exRootFinder exRootFinder
if HAVE_MINUIT
noinst_PROGRAMS += exFit exFitSample exMin
endif
exCompiledDoubleFunction_SOURCES = exCompiledDoubleFunction.cpp exCompiledDoubleFunction_SOURCES = exCompiledDoubleFunction.cpp
exCompiledDoubleFunction_CXXFLAGS = $(COM_CXXFLAGS) exCompiledDoubleFunction_CXXFLAGS = $(COM_CXXFLAGS)
exCompiledDoubleFunction_LDFLAGS = -L../lib/.libs -lLatAnalyze exCompiledDoubleFunction_LDFLAGS = -L../lib/.libs -lLatAnalyze
@ -29,7 +28,6 @@ exDerivative_SOURCES = exDerivative.cpp
exDerivative_CXXFLAGS = $(COM_CXXFLAGS) exDerivative_CXXFLAGS = $(COM_CXXFLAGS)
exDerivative_LDFLAGS = -L../lib/.libs -lLatAnalyze exDerivative_LDFLAGS = -L../lib/.libs -lLatAnalyze
if HAVE_MINUIT
exFit_SOURCES = exFit.cpp exFit_SOURCES = exFit.cpp
exFit_CXXFLAGS = $(COM_CXXFLAGS) exFit_CXXFLAGS = $(COM_CXXFLAGS)
exFit_LDFLAGS = -L../lib/.libs -lLatAnalyze exFit_LDFLAGS = -L../lib/.libs -lLatAnalyze
@ -37,7 +35,6 @@ exFit_LDFLAGS = -L../lib/.libs -lLatAnalyze
exFitSample_SOURCES = exFitSample.cpp exFitSample_SOURCES = exFitSample.cpp
exFitSample_CXXFLAGS = $(COM_CXXFLAGS) exFitSample_CXXFLAGS = $(COM_CXXFLAGS)
exFitSample_LDFLAGS = -L../lib/.libs -lLatAnalyze exFitSample_LDFLAGS = -L../lib/.libs -lLatAnalyze
endif
exInterp_SOURCES = exInterp.cpp exInterp_SOURCES = exInterp.cpp
exInterp_CXXFLAGS = $(COM_CXXFLAGS) exInterp_CXXFLAGS = $(COM_CXXFLAGS)
@ -51,11 +48,9 @@ exMat_SOURCES = exMat.cpp
exMat_CXXFLAGS = $(COM_CXXFLAGS) exMat_CXXFLAGS = $(COM_CXXFLAGS)
exMat_LDFLAGS = -L../lib/.libs -lLatAnalyze exMat_LDFLAGS = -L../lib/.libs -lLatAnalyze
if HAVE_MINUIT
exMin_SOURCES = exMin.cpp exMin_SOURCES = exMin.cpp
exMin_CXXFLAGS = $(COM_CXXFLAGS) exMin_CXXFLAGS = $(COM_CXXFLAGS)
exMin_LDFLAGS = -L../lib/.libs -lLatAnalyze exMin_LDFLAGS = -L../lib/.libs -lLatAnalyze
endif
exMathInterpreter_SOURCES = exMathInterpreter.cpp exMathInterpreter_SOURCES = exMathInterpreter.cpp
exMathInterpreter_CXXFLAGS = $(COM_CXXFLAGS) exMathInterpreter_CXXFLAGS = $(COM_CXXFLAGS)

View File

@ -8,7 +8,7 @@ using namespace Latan;
int main(void) int main(void)
{ {
DMat A(2, 3), B(3, 2), C = DMat::Random(6, 6); DMat A(2, 3), B(3, 2), C = DMat::Random(6, 6);
const string fileName = "exMat.h5"; const string fileName = "exMat.dat";
A << 1, 2, 3, A << 1, 2, 3,
4, 5, 6; 4, 5, 6;

View File

@ -1,5 +1,5 @@
#include <LatAnalyze/CompiledFunction.hpp> #include <LatAnalyze/CompiledFunction.hpp>
#include <LatAnalyze/MinuitMinimizer.hpp> #include <LatAnalyze/GslMinimizer.hpp>
using namespace std; using namespace std;
using namespace Latan; using namespace Latan;
@ -16,8 +16,8 @@ int main(int argc, char* argv[])
} }
source = argv[1]; source = argv[1];
DoubleFunction f = compile(source, 1); DoubleFunction f = compile(source, 1);
MinuitMinimizer minimize; GslMinimizer minimize;
DVec init(1); DVec init(1);
double min; double min;

View File

@ -19,6 +19,10 @@
#include <LatAnalyze/Io.hpp> #include <LatAnalyze/Io.hpp>
#include <LatAnalyze/includes.hpp> #include <LatAnalyze/includes.hpp>
#include <LatAnalyze/AsciiFile.hpp>
#ifdef HAVE_HDF5
#include <LatAnalyze/Hdf5File.hpp>
#endif
using namespace std; using namespace std;
using namespace Latan; using namespace Latan;
@ -34,14 +38,16 @@ unique_ptr<File> Io::open(const std::string &fileName, const unsigned int mode)
{ {
string ext = extension(fileName); string ext = extension(fileName);
if (ext == "h5") if ((ext == "dat")||(ext == "sample")||(ext == "seed"))
{
return unique_ptr<File>(new Hdf5File(fileName, mode));
}
else if ((ext == "dat")||(ext == "sample")||(ext == "seed"))
{ {
return unique_ptr<File>(new AsciiFile(fileName, mode)); return unique_ptr<File>(new AsciiFile(fileName, mode));
} }
#ifdef HAVE_HDF5
else if (ext == "h5")
{
return unique_ptr<File>(new Hdf5File(fileName, mode));
}
#endif
else else
{ {
LATAN_ERROR(Io, "unknown file extension '" + ext + "'"); LATAN_ERROR(Io, "unknown file extension '" + ext + "'");

View File

@ -21,8 +21,7 @@
#define Latan_Io_hpp_ #define Latan_Io_hpp_
#include <LatAnalyze/Global.hpp> #include <LatAnalyze/Global.hpp>
#include <LatAnalyze/AsciiFile.hpp> #include <LatAnalyze/File.hpp>
#include <LatAnalyze/Hdf5File.hpp>
BEGIN_LATAN_NAMESPACE BEGIN_LATAN_NAMESPACE

View File

@ -34,7 +34,6 @@ libLatAnalyze_la_SOURCES = \
GslHybridRootFinder.cpp\ GslHybridRootFinder.cpp\
GslMinimizer.cpp \ GslMinimizer.cpp \
GslQagsIntegrator.cpp \ GslQagsIntegrator.cpp \
Hdf5File.cpp \
Histogram.cpp \ Histogram.cpp \
includes.hpp \ includes.hpp \
Io.cpp \ Io.cpp \
@ -67,7 +66,6 @@ libLatAnalyze_la_HEADERS = \
GslHybridRootFinder.hpp\ GslHybridRootFinder.hpp\
GslMinimizer.hpp \ GslMinimizer.hpp \
GslQagsIntegrator.hpp \ GslQagsIntegrator.hpp \
Hdf5File.hpp \
Histogram.hpp \ Histogram.hpp \
Integrator.hpp \ Integrator.hpp \
Io.hpp \ Io.hpp \
@ -86,6 +84,10 @@ libLatAnalyze_la_HEADERS = \
StatArray.hpp \ StatArray.hpp \
XYSampleData.hpp \ XYSampleData.hpp \
XYStatData.hpp XYStatData.hpp
if HAVE_HDF5
libLatAnalyze_la_SOURCES += Hdf5File.cpp
libLatAnalyze_la_HEADERS += Hdf5File.hpp
endif
if HAVE_MINUIT if HAVE_MINUIT
libLatAnalyze_la_SOURCES += MinuitMinimizer.cpp libLatAnalyze_la_SOURCES += MinuitMinimizer.cpp
libLatAnalyze_la_HEADERS += MinuitMinimizer.hpp libLatAnalyze_la_HEADERS += MinuitMinimizer.hpp