mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2026-10-23 11:33:18 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e72d8669b1 | ||
|
|
b0782552d1 | ||
|
|
fef0f3704c | ||
|
|
e4861e7b50 | ||
|
|
ee60d083c8 | ||
|
|
9a27a58bf2 | ||
|
|
e24db46f76 | ||
|
|
317f8b973b | ||
|
|
9a01f33983 | ||
|
|
f4741c6298 | ||
|
|
4988f351f2 | ||
|
|
89b540d074 | ||
|
|
bdfbaa80b9 | ||
|
|
6fbb0f70ef | ||
|
|
f4dff86ce6 | ||
|
|
c3cf22532e | ||
|
|
d0ca6493bd | ||
|
|
febaa059c2 | ||
|
|
79803007ff | ||
|
|
3bf3e15def | ||
|
|
79ca0069c5 | ||
|
|
442624912e | ||
|
|
e8b0565164 | ||
|
|
c93cdf5c5a | ||
|
|
81c4dc1248 | ||
|
|
f5b3e33fc8 | ||
|
|
a0c654003d | ||
|
|
ccdc54243e | ||
|
|
7d55fc30b5 | ||
|
|
f4dcadd3bb | ||
|
|
656ae91fe5 | ||
|
|
341b4bc73b | ||
|
|
cc0154f58c | ||
|
|
d786524508 | ||
|
|
534013fd87 | ||
|
|
1c8add56ef | ||
|
|
cce9faaba6 | ||
|
|
4419139bd1 | ||
|
|
0b5c6e851c | ||
|
|
0b5da3866e | ||
|
|
4823426d55 | ||
|
|
a620ff7b1c | ||
|
|
00cf854408 | ||
|
|
b938a855e3 | ||
|
|
83e09b82fc | ||
|
|
fde57d79f3 | ||
|
|
145155f733 | ||
|
|
6739019c83 | ||
|
|
13fddf4947 | ||
|
|
1604b4712f | ||
|
|
c73b609ac5 | ||
|
|
05138baa08 | ||
|
|
a0bdbfd9dd |
No files matched your search
@@ -1,11 +1,11 @@
|
|||||||
name: Build macOS
|
name: Build macOS
|
||||||
|
|
||||||
on: [push]
|
on: [push, workflow_dispatch]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
runs-on: macos-11
|
runs-on: macos-15
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ on: [push]
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-24.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|||||||
+5
-22
@@ -1,7 +1,5 @@
|
|||||||
# builds
|
# builds
|
||||||
build/*
|
build
|
||||||
build_debug/*
|
|
||||||
sandbox/*
|
|
||||||
|
|
||||||
# Apple stuff
|
# Apple stuff
|
||||||
*.xcodeproj
|
*.xcodeproj
|
||||||
@@ -10,27 +8,12 @@ sandbox/*
|
|||||||
# VIM
|
# VIM
|
||||||
*.swp
|
*.swp
|
||||||
|
|
||||||
# autotools
|
# Eigen headers and archives
|
||||||
autom4te.cache/*
|
/lib/LatAnalyze/Eigen
|
||||||
*.in
|
eigen-*.tar.bz2
|
||||||
*.in~
|
|
||||||
config.h*
|
|
||||||
configure
|
|
||||||
configure~
|
|
||||||
.buildutils/*
|
|
||||||
aclocal.m4
|
|
||||||
|
|
||||||
# bison/flex generated sources
|
|
||||||
lib/*Lexer.cpp
|
|
||||||
lib/*Parser.cpp
|
|
||||||
lib/*Parser.hpp
|
|
||||||
|
|
||||||
# Eigen headers
|
|
||||||
lib/Eigen/*
|
|
||||||
lib/eigen_files.mk
|
|
||||||
|
|
||||||
# CI builds
|
# CI builds
|
||||||
ci-scripts/local/*
|
/ci-scripts/local
|
||||||
|
|
||||||
# VS Code Studio stuff
|
# VS Code Studio stuff
|
||||||
.vscode
|
.vscode
|
||||||
|
|||||||
-63
@@ -1,63 +0,0 @@
|
|||||||
language: cpp
|
|
||||||
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- ci-scripts/local
|
|
||||||
- ci-scripts/clang
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- os: osx
|
|
||||||
osx_image: xcode10.1
|
|
||||||
compiler: clang
|
|
||||||
- os: osx
|
|
||||||
osx_image: xcode10.1
|
|
||||||
compiler: gcc
|
|
||||||
env: VERSION=-7
|
|
||||||
- compiler: gcc
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-7
|
|
||||||
- flex
|
|
||||||
- bison
|
|
||||||
env: VERSION=-7
|
|
||||||
- compiler: clang
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-7
|
|
||||||
- flex
|
|
||||||
- bison
|
|
||||||
env: CLANG_LINK=http://releases.llvm.org/7.0.1/clang+llvm-7.0.1-x86_64-linux-gnu-ubuntu-14.04.tar.xz
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- export LATDIR=`pwd`
|
|
||||||
- cd ci-scripts
|
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$CC" == "clang" ]] && [ ! -e clang/bin ]; then wget $CLANG_LINK; tar -xf `basename $CLANG_LINK`; mkdir clang; mv clang+*/* clang/; fi
|
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$CC" == "clang" ]]; then export PATH="${LATDIR}/ci-scripts/clang/bin:${PATH}"; fi
|
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$CC" == "clang" ]]; then export LD_LIBRARY_PATH="${LATDIR}/ci-scripts/clang/lib:${LD_LIBRARY_PATH}"; fi
|
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
|
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install bison flex cmake; export PATH="/usr/local/opt/flex/bin:/usr/local/opt/bison/bin:$PATH"; fi
|
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ "$CC" == "gcc" ]]; then brew install gcc@${VERSION#-}; fi
|
|
||||||
|
|
||||||
install:
|
|
||||||
- export CC=$CC$VERSION
|
|
||||||
- export CXX=$CXX$VERSION
|
|
||||||
- echo $PATH
|
|
||||||
- which $CC
|
|
||||||
- $CC --version
|
|
||||||
- which $CXX
|
|
||||||
- $CXX --version
|
|
||||||
- ./install-deps.sh `pwd`/local
|
|
||||||
- cd ..
|
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export LD_LIBRARY_PATH=${LATDIR}/ci-scripts/local/lib:$LD_LIBRARY_PATH; fi
|
|
||||||
- if [[ "$CC" == "gcc-7" ]]; then export CXXFLAGS='-Wno-int-in-bool-context'; fi
|
|
||||||
|
|
||||||
script:
|
|
||||||
- cd ci-scripts
|
|
||||||
- ./install-latan.sh `pwd`/local
|
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
# package config
|
||||||
|
cmake_minimum_required(VERSION 3.24.0)
|
||||||
|
project(
|
||||||
|
LatAnalyze
|
||||||
|
VERSION 3.6
|
||||||
|
LANGUAGES C CXX)
|
||||||
|
|
||||||
|
# includes
|
||||||
|
include(CheckCXXCompilerFlag)
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
include(FetchContent)
|
||||||
|
include(FindPackageMessage)
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
# C++ compile flags
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||||
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
check_cxx_compiler_flag("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||||
|
if(COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||||
|
set(MARCH_FLAG "-march=native")
|
||||||
|
endif()
|
||||||
|
check_cxx_compiler_flag("-mtune=native" COMPILER_SUPPORTS_MTUNE_NATIVE)
|
||||||
|
if(COMPILER_SUPPORTS_MTUNE_NATIVE)
|
||||||
|
set(MTUNE_FLAG "-mtune=native")
|
||||||
|
endif()
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG ${MARCH_FLAG} ${MTUNE_FLAG}")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||||
|
"-O3 -g -DNDEBUG ${MARCH_FLAG} ${MTUNE_FLAG}")
|
||||||
|
set(gcc_like_cxx "$<COMPILE_LANG_AND_ID:CXX,ARMClang,AppleClang,Clang,GNU,LCC>")
|
||||||
|
add_library(compiler_flags INTERFACE)
|
||||||
|
target_compile_features(compiler_flags INTERFACE cxx_std_17)
|
||||||
|
target_compile_options(
|
||||||
|
compiler_flags
|
||||||
|
INTERFACE "$<${gcc_like_cxx}:-Wall;-Wextra;-Wshadow;-Wformat=2;-Wunused>")
|
||||||
|
|
||||||
|
# position idependent code
|
||||||
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|
||||||
|
# installation rpath setup
|
||||||
|
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
||||||
|
|
||||||
|
# fetch and create symbolic link to Eigen headers
|
||||||
|
set(EIGEN_URL "https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz")
|
||||||
|
set(EIGEN_TGZ "${CMAKE_BINARY_DIR}/eigen-3.4.0.tar.gz")
|
||||||
|
set(EIGEN_DIR "${CMAKE_BINARY_DIR}/deps/eigen-src")
|
||||||
|
if(NOT EXISTS "${EIGEN_DIR}/Eigen/Dense")
|
||||||
|
file(DOWNLOAD "${EIGEN_URL}" "${EIGEN_TGZ}" SHOW_PROGRESS)
|
||||||
|
file(ARCHIVE_EXTRACT INPUT "${EIGEN_TGZ}" DESTINATION "${CMAKE_BINARY_DIR}/deps")
|
||||||
|
file(GLOB EIGEN_EXTRACTED_DIR "${CMAKE_BINARY_DIR}/deps/eigen-*")
|
||||||
|
file(RENAME "${EIGEN_EXTRACTED_DIR}" "${EIGEN_DIR}")
|
||||||
|
message(STATUS "Eigen3 fetched")
|
||||||
|
endif()
|
||||||
|
file(CREATE_LINK ${EIGEN_DIR}/Eigen ${CMAKE_SOURCE_DIR}/lib/LatAnalyze/Eigen SYMBOLIC)
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
find_package(GSL REQUIRED)
|
||||||
|
find_package(HDF5 REQUIRED COMPONENTS C CXX)
|
||||||
|
find_package(Minuit2 QUIET)
|
||||||
|
if(Minuit2_FOUND)
|
||||||
|
set(Minuit2_MSG "yes")
|
||||||
|
find_package_message(
|
||||||
|
Minuit2
|
||||||
|
"Found Minuit2: ${Minuit2_DIR} (found version \"${Minuit2_VERSION}\")" " ")
|
||||||
|
else()
|
||||||
|
set(Minuit2_MSG "no")
|
||||||
|
message(STATUS "Minuit2 not found")
|
||||||
|
endif()
|
||||||
|
find_package(NLopt QUIET)
|
||||||
|
if(NLopt_FOUND)
|
||||||
|
set(NLopt_MSG "yes")
|
||||||
|
find_package_message(
|
||||||
|
NLopt "Found NLopt: ${NLopt_DIR} (found version \"${NLopt_VERSION}\")" " ")
|
||||||
|
else()
|
||||||
|
set(NLopt_MSG "no")
|
||||||
|
message(STATUS "NLopt not found")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# subdirectories
|
||||||
|
add_subdirectory(lib)
|
||||||
|
add_subdirectory(examples)
|
||||||
|
add_subdirectory(physics)
|
||||||
|
add_subdirectory(utils)
|
||||||
|
|
||||||
|
# summary
|
||||||
|
message(STATUS "---------------------------")
|
||||||
|
message(STATUS "LatAnalyze v${PROJECT_VERSION} configured")
|
||||||
|
message(STATUS "---------------------------")
|
||||||
|
message(STATUS " install prefix: ${CMAKE_INSTALL_PREFIX}")
|
||||||
|
message(STATUS "Minuit2 minimisers: ${Minuit2_MSG}")
|
||||||
|
message(STATUS " NLopt minimisers: ${NLopt_MSG}")
|
||||||
|
message(STATUS "---------------------------")
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
SUBDIRS = lib utils physics examples
|
|
||||||
|
|
||||||
bin_SCRIPTS=latan-config
|
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I .buildutils/m4
|
|
||||||
@@ -3,19 +3,19 @@
|
|||||||
[](https://www.gnu.org/licenses/gpl-3.0) [](https://zenodo.org/badge/latestdoi/10201777) [](https://github.com/aportelli/LatAnalyze/actions/workflows/build-ubuntu.yml) [](https://github.com/aportelli/LatAnalyze/actions/workflows/build-macos.yml)
|
[](https://www.gnu.org/licenses/gpl-3.0) [](https://zenodo.org/badge/latestdoi/10201777) [](https://github.com/aportelli/LatAnalyze/actions/workflows/build-ubuntu.yml) [](https://github.com/aportelli/LatAnalyze/actions/workflows/build-macos.yml)
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
LatAnalyze is a C++11 library for statistical data analysis based on bootstrap
|
LatAnalyze is a C++14 library for statistical data analysis based on bootstrap
|
||||||
resampling. It has been written with lattice QCD data analysis in mind (hence
|
resampling. It has been written with lattice QCD data analysis in mind (hence
|
||||||
the name), but its features are not lattice specific and can be used more general statistical context.
|
the name), but its features are not lattice specific and can be used more general statistical context.
|
||||||
|
|
||||||
Sadly a proper documentation was never written, but some comprehensive examples covering most features can be found in the `examples` directory.
|
Sadly a proper documentation was never written, but some comprehensive examples covering several key features can be found in the `examples` directory.
|
||||||
|
|
||||||
The main features are the following:
|
The main features are the following:
|
||||||
|
|
||||||
* Array and matrix types with fast arithmetic operations based on [Eigen](http://eigen.tuxfamily.org).
|
* Array and matrix types with fast arithmetic operations based on [Eigen](http://eigen.tuxfamily.org).
|
||||||
* High-level types for bootstrap sample manipulation (including various statistical estimators and histogramming).
|
* High-level types for bootstrap sample manipulation (including various statistical estimators and histogramming).
|
||||||
* Mathematical expression parser for runtime defined functions.
|
* Mathematical expression parser for runtime defined functions.
|
||||||
* Data I/O in ASCII and HDF5 (optional).
|
* Data I/O in ASCII, XML, and HDF5.
|
||||||
* High-level wrappers to minimisation routines from the [GSL](http://www.gnu.org/software/gsl/), [Minuit](http://seal.web.cern.ch/seal/snapshot/work-packages/mathlibs/minuit/) (optional) and [NLopt](http://ab-initio.mit.edu/wiki/index.php/NLopt).
|
* High-level wrappers to minimisation routines from the [GSL](http://www.gnu.org/software/gsl/), [Minuit 2](https://github.com/root-project/root/tree/master/math/minuit2) (optional) and [NLopt](http://ab-initio.mit.edu/wiki/index.php/NLopt).
|
||||||
* Non-linear regression with error on independent variables (through total least squares).
|
* Non-linear regression with error on independent variables (through total least squares).
|
||||||
* High-level wrappers to numerical integrator and non-linear solver from the [GSL](http://www.gnu.org/software/gsl/).
|
* High-level wrappers to numerical integrator and non-linear solver from the [GSL](http://www.gnu.org/software/gsl/).
|
||||||
* High-level functional types for function of model. General functions can be defined from C pointers, C++ objects, strings of mathematical expressions or tabulated data.
|
* High-level functional types for function of model. General functions can be defined from C pointers, C++ objects, strings of mathematical expressions or tabulated data.
|
||||||
@@ -24,14 +24,14 @@ The main features are the following:
|
|||||||
## Installation
|
## Installation
|
||||||
The head of the `master` branch always points to the latest stable release. The `develop` branch is the main unstable branch of LatAnalyze.
|
The head of the `master` branch always points to the latest stable release. The `develop` branch is the main unstable branch of LatAnalyze.
|
||||||
|
|
||||||
LatAnalyze is written in C++11 and requires a rather recent C++ compiler to be built. It has been successfully built on various Linux and OS X platforms using clang (from 3.7), GCC (from 4.9) and the Intel C++ compiler (2016).
|
LatAnalyze is written in C++14. It has been successfully built on various Unix platform using reasonably recent versions of Clang or GCC.
|
||||||
The only strict dependencies is the [GSL](http://www.gnu.org/software/gsl/).
|
The only strict dependencies are the [GSL](http://www.gnu.org/software/gsl/) and [HDF5](https://www.hdfgroup.org/HDF5/) (built with C++ support).
|
||||||
Additionally, autoconf, automake (from 1.11), libtool, bison (from 3.0) and flex are necessary to build the library. Unless you use a very exotic system, these tools are standard on any Unix platform and should be already present or easy to install through a package manager.
|
Additionally, cmake (from 3.11), bison (from 3.0) and flex are necessary to build the library. Unless you use a very exotic system, these tools are standard on any Unix platform and should be already present or easy to install through a package manager.
|
||||||
Optional dependencies are [HDF5](https://www.hdfgroup.org/HDF5/) (built with C++ support), [Minuit](http://seal.web.cern.ch/seal/snapshot/work-packages/mathlibs/minuit/) and [NLopt](http://ab-initio.mit.edu/wiki/index.php/NLopt).
|
Optional dependencies are [Minuit 2](https://github.com/root-project/root/tree/master/math/minuit2) and [NLopt](http://ab-initio.mit.edu/wiki/index.php/NLopt).
|
||||||
|
|
||||||
Below are instructions for a quick installation. 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`.
|
LatAnalyze is built through CMake. Below are example instructions for compiling and installing LatAnalyze.
|
||||||
|
|
||||||
### General quick installation
|
### Portable quick installation
|
||||||
For a quick installation with all possible extensions execute:
|
For a quick installation with all possible extensions execute:
|
||||||
```
|
```
|
||||||
./install-latan.sh <prefix>
|
./install-latan.sh <prefix>
|
||||||
@@ -43,19 +43,53 @@ All the dependencies of LatAnalyze can be installed through the [Homebrew](https
|
|||||||
```
|
```
|
||||||
brew install automake autoconf libtool bison flex gsl minuit2 nlopt hdf5
|
brew install automake autoconf libtool bison flex gsl minuit2 nlopt hdf5
|
||||||
```
|
```
|
||||||
Then generate the build system in LatAnalyze main directory by running the `./bootstrap.sh` script. Finally, build the library
|
Then build the library with `cmake`
|
||||||
```
|
```
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
../configure --prefix=<prefix> --with-minuit=/usr/local --with-nlopt=/usr/local \
|
cmake -DCMAKE_INSTALL_PREFIX=<prefix> -DCMAKE_BUILD_TYPE=Release ..
|
||||||
--with-hdf5=/usr/local --with-gsl=/usr/local \
|
|
||||||
CXXFLAGS='-g -O3 -march=native -mtune=native'
|
|
||||||
make -j <n>
|
make -j <n>
|
||||||
make install
|
make install
|
||||||
```
|
```
|
||||||
where `<prefix>` should be replaced by the desired prefix for LatAnalyze installation, and `<n>` is the number of parallel build processes (typically twice your number of cores).
|
where `<prefix>` should be replaced by the desired prefix for LatAnalyze installation, and `<n>` is the number of parallel build processes.
|
||||||
|
|
||||||
|
### Dependencies through Homebrew/Linuxbrew
|
||||||
|
If you use Homebrew/Linuxbrew to manage packages, the following command can install all the dependencies of LatAnalyze (including optional ones)
|
||||||
|
|
||||||
|
## Using LatAnalyze in CMake projects
|
||||||
|
When LatAnalyze is installed, the necessary CMake module configuration files to link against the library are available in the installation prefix.
|
||||||
|
|
||||||
|
To link against LatAnalyze in a downstream CMake project, simply use
|
||||||
|
```cmake
|
||||||
|
find_package(LatAnalyze)
|
||||||
|
target_link_libraries(<my_app> LatAnalyze::LatAnalyze)
|
||||||
|
```
|
||||||
|
where `<my_app>` is a CMake target. If LatAnalyze was installed in a non-standard prefix, you might have to set `CMAKE_PREFIX_PATH` accordingly for `find_package` to be successful.
|
||||||
|
|
||||||
|
You can additionally modify the `find_package` to ensure specific components are supported
|
||||||
|
```cmake
|
||||||
|
find_package(LatAnalyze REQUIRED COMPONENTS <...>)
|
||||||
|
```
|
||||||
|
where `<...>` is a space separated list of components. Currently available components are
|
||||||
|
- `MINUIT2`: Minuit 2 minimisers
|
||||||
|
- `NLOPT`: NLopt minimisers
|
||||||
|
|
||||||
## History
|
## History
|
||||||
|
#### v3.6
|
||||||
|
Build system:
|
||||||
|
* automake build discontinued, now using CMake
|
||||||
|
* CI through GitHub Actions
|
||||||
|
|
||||||
|
Additions:
|
||||||
|
* Discrete wavelet transform
|
||||||
|
* Thread pools
|
||||||
|
* Correlation dynamic range (CDR) calculation
|
||||||
|
* Data filtering and CDR optimisation
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
* Significant optimisation of covariance matrix calculation
|
||||||
|
* Covariance matrix available for any `StatArray` (not only resampled arrays)
|
||||||
|
|
||||||
#### v3.5.1
|
#### v3.5.1
|
||||||
Various fixes and cleaning of outdated code.
|
Various fixes and cleaning of outdated code.
|
||||||
|
|
||||||
|
|||||||
-542
@@ -1,542 +0,0 @@
|
|||||||
AC_DEFUN([AX_GCC_OPTION], [
|
|
||||||
AC_REQUIRE([AC_PROG_CC])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([if gcc accepts $1 option])
|
|
||||||
|
|
||||||
AS_IF([ test "x$GCC" = "xyes" ],[
|
|
||||||
AS_IF([ test -z "$3" ],[
|
|
||||||
ax_gcc_option_test="int main()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}"
|
|
||||||
],[
|
|
||||||
ax_gcc_option_test="$3"
|
|
||||||
])
|
|
||||||
|
|
||||||
# Dump the test program to file
|
|
||||||
cat <<EOF > conftest.c
|
|
||||||
$ax_gcc_option_test
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Dump back the file to the log, useful for debugging purposes
|
|
||||||
AC_TRY_COMMAND(cat conftest.c 1>&AS_MESSAGE_LOG_FD)
|
|
||||||
|
|
||||||
AS_IF([ AC_TRY_COMMAND($CC $2 $1 -c conftest.c 1>&AS_MESSAGE_LOG_FD) ],[
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
$4
|
|
||||||
],[
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
$5
|
|
||||||
])
|
|
||||||
],[
|
|
||||||
AC_MSG_RESULT([no gcc available])
|
|
||||||
])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([AX_GCC_VERSION], [
|
|
||||||
GCC_VERSION=""
|
|
||||||
AX_GCC_OPTION([-dumpversion],[],[],[
|
|
||||||
ax_gcc_version_option=yes
|
|
||||||
],[
|
|
||||||
ax_gcc_version_option=no
|
|
||||||
])
|
|
||||||
AS_IF([test "x$GCC" = "xyes"],[
|
|
||||||
AS_IF([test "x$ax_gcc_version_option" != "xno"],[
|
|
||||||
AC_CACHE_CHECK([gcc version],[ax_cv_gcc_version],[
|
|
||||||
ax_cv_gcc_version="`$CC -dumpversion`"
|
|
||||||
AS_IF([test "x$ax_cv_gcc_version" = "x"],[
|
|
||||||
ax_cv_gcc_version=""
|
|
||||||
])
|
|
||||||
])
|
|
||||||
GCC_VERSION=$ax_cv_gcc_version
|
|
||||||
])
|
|
||||||
])
|
|
||||||
AC_SUBST([GCC_VERSION])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([AX_GXX_VERSION], [
|
|
||||||
GXX_VERSION=""
|
|
||||||
AX_GCC_OPTION([-dumpversion],[],[],[
|
|
||||||
ax_gcc_version_option=yes
|
|
||||||
],[
|
|
||||||
ax_gcc_version_option=no
|
|
||||||
])
|
|
||||||
AS_IF([test "x$GXX" = "xyes"],[
|
|
||||||
AS_IF([test "x$ax_gxx_version_option" != "no"],[
|
|
||||||
AC_CACHE_CHECK([gxx version],[ax_cv_gxx_version],[
|
|
||||||
ax_cv_gxx_version="`$CXX -dumpversion`"
|
|
||||||
AS_IF([test "x$ax_cv_gxx_version" = "x"],[
|
|
||||||
ax_cv_gxx_version=""
|
|
||||||
])
|
|
||||||
])
|
|
||||||
GXX_VERSION=$ax_cv_gxx_version
|
|
||||||
])
|
|
||||||
])
|
|
||||||
AC_SUBST([GXX_VERSION])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([AX_COMPILER_VENDOR],
|
|
||||||
[
|
|
||||||
AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
|
|
||||||
[ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown
|
|
||||||
# note: don't check for gcc first since some other compilers define __GNUC__
|
|
||||||
for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ pathscale:__PATHCC__,__PATHSCALE__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do
|
|
||||||
vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")"
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
|
|
||||||
#if !($vencpp)
|
|
||||||
thisisanerror;
|
|
||||||
#endif
|
|
||||||
])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break])
|
|
||||||
done
|
|
||||||
])
|
|
||||||
])
|
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
|
|
||||||
# ============================================================================
|
|
||||||
#
|
|
||||||
# SYNOPSIS
|
|
||||||
#
|
|
||||||
# AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional])
|
|
||||||
#
|
|
||||||
# DESCRIPTION
|
|
||||||
#
|
|
||||||
# Check for baseline language coverage in the compiler for the C++11
|
|
||||||
# standard; if necessary, add switches to CXXFLAGS to enable support.
|
|
||||||
#
|
|
||||||
# The first argument, if specified, indicates whether you insist on an
|
|
||||||
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
|
|
||||||
# -std=c++11). If neither is specified, you get whatever works, with
|
|
||||||
# preference for an extended mode.
|
|
||||||
#
|
|
||||||
# The second argument, if specified 'mandatory' or if left unspecified,
|
|
||||||
# indicates that baseline C++11 support is required and that the macro
|
|
||||||
# should error out if no mode with that support is found. If specified
|
|
||||||
# 'optional', then configuration proceeds regardless, after defining
|
|
||||||
# HAVE_CXX11 if and only if a supporting mode is found.
|
|
||||||
#
|
|
||||||
# LICENSE
|
|
||||||
#
|
|
||||||
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
|
|
||||||
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
|
|
||||||
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
|
|
||||||
# Copyright (c) 2014 Alexey Sokolov <sokolov@google.com>
|
|
||||||
#
|
|
||||||
# Copying and distribution of this file, with or without modification, are
|
|
||||||
# permitted in any medium without royalty provided the copyright notice
|
|
||||||
# and this notice are preserved. This file is offered as-is, without any
|
|
||||||
# warranty.
|
|
||||||
|
|
||||||
m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[
|
|
||||||
template <typename T>
|
|
||||||
struct check
|
|
||||||
{
|
|
||||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Base {
|
|
||||||
virtual void f() {}
|
|
||||||
};
|
|
||||||
struct Child : public Base {
|
|
||||||
virtual void f() override {}
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef check<check<bool>> right_angle_brackets;
|
|
||||||
|
|
||||||
int a;
|
|
||||||
decltype(a) b;
|
|
||||||
|
|
||||||
typedef check<int> check_type;
|
|
||||||
check_type c;
|
|
||||||
check_type&& cr = static_cast<check_type&&>(c);
|
|
||||||
|
|
||||||
auto d = a;
|
|
||||||
auto l = [](){};
|
|
||||||
]])
|
|
||||||
|
|
||||||
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
|
|
||||||
m4_if([$1], [], [],
|
|
||||||
[$1], [ext], [],
|
|
||||||
[$1], [noext], [],
|
|
||||||
[m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
|
|
||||||
m4_if([$2], [], [ax_cxx_compile_cxx11_required=true],
|
|
||||||
[$2], [mandatory], [ax_cxx_compile_cxx11_required=true],
|
|
||||||
[$2], [optional], [ax_cxx_compile_cxx11_required=false],
|
|
||||||
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])
|
|
||||||
AC_LANG_PUSH([C++])dnl
|
|
||||||
ac_success=no
|
|
||||||
AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
|
|
||||||
ax_cv_cxx_compile_cxx11,
|
|
||||||
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
|
|
||||||
[ax_cv_cxx_compile_cxx11=yes],
|
|
||||||
[ax_cv_cxx_compile_cxx11=no])])
|
|
||||||
if test x$ax_cv_cxx_compile_cxx11 = xyes; then
|
|
||||||
ac_success=yes
|
|
||||||
fi
|
|
||||||
|
|
||||||
m4_if([$1], [noext], [], [dnl
|
|
||||||
if test x$ac_success = xno; then
|
|
||||||
for switch in -std=gnu++11 -std=gnu++0x; do
|
|
||||||
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
|
|
||||||
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
|
|
||||||
$cachevar,
|
|
||||||
[ac_save_CXXFLAGS="$CXXFLAGS"
|
|
||||||
CXXFLAGS="$CXXFLAGS $switch"
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
|
|
||||||
[eval $cachevar=yes],
|
|
||||||
[eval $cachevar=no])
|
|
||||||
CXXFLAGS="$ac_save_CXXFLAGS"])
|
|
||||||
if eval test x\$$cachevar = xyes; then
|
|
||||||
CXXFLAGS="$CXXFLAGS $switch"
|
|
||||||
ac_success=yes
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi])
|
|
||||||
|
|
||||||
m4_if([$1], [ext], [], [dnl
|
|
||||||
if test x$ac_success = xno; then
|
|
||||||
for switch in -std=c++11 -std=c++0x; do
|
|
||||||
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
|
|
||||||
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
|
|
||||||
$cachevar,
|
|
||||||
[ac_save_CXXFLAGS="$CXXFLAGS"
|
|
||||||
CXXFLAGS="$CXXFLAGS $switch"
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
|
|
||||||
[eval $cachevar=yes],
|
|
||||||
[eval $cachevar=no])
|
|
||||||
CXXFLAGS="$ac_save_CXXFLAGS"])
|
|
||||||
if eval test x\$$cachevar = xyes; then
|
|
||||||
CXXFLAGS="$CXXFLAGS $switch"
|
|
||||||
ac_success=yes
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi])
|
|
||||||
AC_LANG_POP([C++])
|
|
||||||
if test x$ax_cxx_compile_cxx11_required = xtrue; then
|
|
||||||
if test x$ac_success = xno; then
|
|
||||||
AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if test x$ac_success = xno; then
|
|
||||||
HAVE_CXX11=0
|
|
||||||
AC_MSG_NOTICE([No compiler with C++11 support was found])
|
|
||||||
else
|
|
||||||
HAVE_CXX11=1
|
|
||||||
AC_DEFINE(HAVE_CXX11,1,
|
|
||||||
[define if the compiler supports basic C++11 syntax])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_SUBST(HAVE_CXX11)
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
# ===========================================================================
|
|
||||||
# http://www.gnu.org/software/autoconf-archive/ax_lib_hdf5.html
|
|
||||||
# ===========================================================================
|
|
||||||
#
|
|
||||||
# SYNOPSIS
|
|
||||||
#
|
|
||||||
# AX_LIB_HDF5([serial/parallel])
|
|
||||||
#
|
|
||||||
# DESCRIPTION
|
|
||||||
#
|
|
||||||
# This macro provides tests of the availability of HDF5 library.
|
|
||||||
#
|
|
||||||
# The optional macro argument should be either 'serial' or 'parallel'. The
|
|
||||||
# former only looks for serial HDF5 installations via h5cc. The latter
|
|
||||||
# only looks for parallel HDF5 installations via h5pcc. If the optional
|
|
||||||
# argument is omitted, serial installations will be preferred over
|
|
||||||
# parallel ones.
|
|
||||||
#
|
|
||||||
# The macro adds a --with-hdf5 option accepting one of three values:
|
|
||||||
#
|
|
||||||
# no - do not check for the HDF5 library.
|
|
||||||
# yes - do check for HDF5 library in standard locations.
|
|
||||||
# path - complete path to the HDF5 helper script h5cc or h5pcc.
|
|
||||||
#
|
|
||||||
# If HDF5 is successfully found, this macro calls
|
|
||||||
#
|
|
||||||
# AC_SUBST(HDF5_VERSION)
|
|
||||||
# AC_SUBST(HDF5_CC)
|
|
||||||
# AC_SUBST(HDF5_CFLAGS)
|
|
||||||
# AC_SUBST(HDF5_CPPFLAGS)
|
|
||||||
# AC_SUBST(HDF5_LDFLAGS)
|
|
||||||
# AC_SUBST(HDF5_LIBS)
|
|
||||||
# AC_SUBST(HDF5_FC)
|
|
||||||
# AC_SUBST(HDF5_FFLAGS)
|
|
||||||
# AC_SUBST(HDF5_FLIBS)
|
|
||||||
# AC_DEFINE(HAVE_HDF5)
|
|
||||||
#
|
|
||||||
# and sets with_hdf5="yes". Additionally, the macro sets
|
|
||||||
# with_hdf5_fortran="yes" if a matching Fortran wrapper script is found.
|
|
||||||
# Note that Autconf's Fortran support is not used to perform this check.
|
|
||||||
# H5CC and H5FC will contain the appropriate serial or parallel HDF5
|
|
||||||
# wrapper script locations.
|
|
||||||
#
|
|
||||||
# If HDF5 is disabled or not found, this macros sets with_hdf5="no" and
|
|
||||||
# with_hdf5_fortran="no".
|
|
||||||
#
|
|
||||||
# Your configuration script can test $with_hdf to take any further
|
|
||||||
# actions. HDF5_{C,CPP,LD}FLAGS may be used when building with C or C++.
|
|
||||||
# HDF5_F{FLAGS,LIBS} should be used when building Fortran applications.
|
|
||||||
#
|
|
||||||
# To use the macro, one would code one of the following in "configure.ac"
|
|
||||||
# before AC_OUTPUT:
|
|
||||||
#
|
|
||||||
# 1) dnl Check for HDF5 support
|
|
||||||
# AX_LIB_HDF5()
|
|
||||||
#
|
|
||||||
# 2) dnl Check for serial HDF5 support
|
|
||||||
# AX_LIB_HDF5([serial])
|
|
||||||
#
|
|
||||||
# 3) dnl Check for parallel HDF5 support
|
|
||||||
# AX_LIB_HDF5([parallel])
|
|
||||||
#
|
|
||||||
# One could test $with_hdf5 for the outcome or display it as follows
|
|
||||||
#
|
|
||||||
# echo "HDF5 support: $with_hdf5"
|
|
||||||
#
|
|
||||||
# You could also for example, override the default CC in "configure.ac" to
|
|
||||||
# enforce compilation with the compiler that HDF5 uses:
|
|
||||||
#
|
|
||||||
# AX_LIB_HDF5([parallel])
|
|
||||||
# if test "$with_hdf5" = "yes"; then
|
|
||||||
# CC="$HDF5_CC"
|
|
||||||
# else
|
|
||||||
# AC_MSG_ERROR([Unable to find HDF5, we need parallel HDF5.])
|
|
||||||
# fi
|
|
||||||
#
|
|
||||||
# LICENSE
|
|
||||||
#
|
|
||||||
# Copyright (c) 2009 Timothy Brown <tbrown@freeshell.org>
|
|
||||||
# Copyright (c) 2010 Rhys Ulerich <rhys.ulerich@gmail.com>
|
|
||||||
#
|
|
||||||
# Copying and distribution of this file, with or without modification, are
|
|
||||||
# permitted in any medium without royalty provided the copyright notice
|
|
||||||
# and this notice are preserved. This file is offered as-is, without any
|
|
||||||
# warranty.
|
|
||||||
|
|
||||||
AC_DEFUN([AX_LIB_HDF5], [
|
|
||||||
|
|
||||||
AC_REQUIRE([AC_PROG_SED])
|
|
||||||
AC_REQUIRE([AC_PROG_AWK])
|
|
||||||
AC_REQUIRE([AC_PROG_GREP])
|
|
||||||
|
|
||||||
dnl Check first argument is one of the recognized values.
|
|
||||||
dnl Fail eagerly if is incorrect as this simplifies case statements below.
|
|
||||||
if test "m4_normalize(m4_default([$1],[]))" = "" ; then
|
|
||||||
: # Recognized value
|
|
||||||
elif test "m4_normalize(m4_default([$1],[]))" = "serial" ; then
|
|
||||||
: # Recognized value
|
|
||||||
elif test "m4_normalize(m4_default([$1],[]))" = "parallel"; then
|
|
||||||
: # Recognized value
|
|
||||||
else
|
|
||||||
AC_MSG_ERROR([
|
|
||||||
Unrecognized value for AX[]_LIB_HDF5 within configure.ac.
|
|
||||||
If supplied, argument 1 must be either 'serial' or 'parallel'.
|
|
||||||
])
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl Add a default --with-hdf5 configuration option.
|
|
||||||
AC_ARG_WITH([hdf5],
|
|
||||||
AS_HELP_STRING(
|
|
||||||
[--with-hdf5=[yes/no/PATH]],
|
|
||||||
m4_case(m4_normalize([$1]),
|
|
||||||
[serial], [location of h5cc for serial HDF5 configuration],
|
|
||||||
[parallel], [location of h5pcc for parallel HDF5 configuration],
|
|
||||||
[location of h5cc or h5pcc for HDF5 configuration])
|
|
||||||
),
|
|
||||||
[if test "$withval" = "no"; then
|
|
||||||
with_hdf5="no"
|
|
||||||
elif test "$withval" = "yes"; then
|
|
||||||
with_hdf5="yes"
|
|
||||||
else
|
|
||||||
with_hdf5="yes"
|
|
||||||
H5CC="$withval"
|
|
||||||
fi],
|
|
||||||
[with_hdf5="yes"]
|
|
||||||
)
|
|
||||||
|
|
||||||
dnl Set defaults to blank
|
|
||||||
HDF5_CC=""
|
|
||||||
HDF5_VERSION=""
|
|
||||||
HDF5_CFLAGS=""
|
|
||||||
HDF5_CPPFLAGS=""
|
|
||||||
HDF5_LDFLAGS=""
|
|
||||||
HDF5_LIBS=""
|
|
||||||
HDF5_FC=""
|
|
||||||
HDF5_FFLAGS=""
|
|
||||||
HDF5_FLIBS=""
|
|
||||||
|
|
||||||
dnl Try and find hdf5 compiler tools and options.
|
|
||||||
if test "$with_hdf5" = "yes"; then
|
|
||||||
if test -z "$H5CC"; then
|
|
||||||
dnl Check to see if H5CC is in the path.
|
|
||||||
AC_PATH_PROGS(
|
|
||||||
[H5CC],
|
|
||||||
m4_case(m4_normalize([$1]),
|
|
||||||
[serial], [h5cc],
|
|
||||||
[parallel], [h5pcc],
|
|
||||||
[h5cc h5pcc]),
|
|
||||||
[])
|
|
||||||
else
|
|
||||||
AC_MSG_CHECKING([Using provided HDF5 C wrapper])
|
|
||||||
AC_MSG_RESULT([$H5CC])
|
|
||||||
fi
|
|
||||||
AC_MSG_CHECKING([for HDF5 libraries])
|
|
||||||
if test ! -f "$H5CC" || test ! -x "$H5CC"; then
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
AC_MSG_WARN(m4_case(m4_normalize([$1]),
|
|
||||||
[serial], [
|
|
||||||
Unable to locate serial HDF5 compilation helper script 'h5cc'.
|
|
||||||
Please specify --with-hdf5=<LOCATION> as the full path to h5cc.
|
|
||||||
HDF5 support is being disabled (equivalent to --with-hdf5=no).
|
|
||||||
], [parallel],[
|
|
||||||
Unable to locate parallel HDF5 compilation helper script 'h5pcc'.
|
|
||||||
Please specify --with-hdf5=<LOCATION> as the full path to h5pcc.
|
|
||||||
HDF5 support is being disabled (equivalent to --with-hdf5=no).
|
|
||||||
], [
|
|
||||||
Unable to locate HDF5 compilation helper scripts 'h5cc' or 'h5pcc'.
|
|
||||||
Please specify --with-hdf5=<LOCATION> as the full path to h5cc or h5pcc.
|
|
||||||
HDF5 support is being disabled (equivalent to --with-hdf5=no).
|
|
||||||
]))
|
|
||||||
with_hdf5="no"
|
|
||||||
with_hdf5_fortran="no"
|
|
||||||
else
|
|
||||||
dnl Get the h5cc output
|
|
||||||
HDF5_SHOW=$(eval $H5CC -show)
|
|
||||||
|
|
||||||
dnl Get the actual compiler used
|
|
||||||
HDF5_CC=$(eval $H5CC -show | $AWK '{print $[]1}')
|
|
||||||
if test "$HDF5_CC" = "ccache"; then
|
|
||||||
HDF5_CC=$(eval $H5CC -show | $AWK '{print $[]2}')
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl h5cc provides both AM_ and non-AM_ options
|
|
||||||
dnl depending on how it was compiled either one of
|
|
||||||
dnl these are empty. Lets roll them both into one.
|
|
||||||
|
|
||||||
dnl Look for "HDF5 Version: X.Y.Z"
|
|
||||||
HDF5_VERSION=$(eval $H5CC -showconfig | $GREP 'HDF5 Version:' \
|
|
||||||
| $AWK '{print $[]3}')
|
|
||||||
|
|
||||||
dnl A ideal situation would be where everything we needed was
|
|
||||||
dnl in the AM_* variables. However most systems are not like this
|
|
||||||
dnl and seem to have the values in the non-AM variables.
|
|
||||||
dnl
|
|
||||||
dnl We try the following to find the flags:
|
|
||||||
dnl (1) Look for "NAME:" tags
|
|
||||||
dnl (2) Look for "H5_NAME:" tags
|
|
||||||
dnl (3) Look for "AM_NAME:" tags
|
|
||||||
dnl
|
|
||||||
HDF5_tmp_flags=$(eval $H5CC -showconfig \
|
|
||||||
| $GREP 'FLAGS\|Extra libraries:' \
|
|
||||||
| $AWK -F: '{printf("%s "), $[]2}' )
|
|
||||||
|
|
||||||
dnl Find the installation directory and append include/
|
|
||||||
HDF5_tmp_inst=$(eval $H5CC -showconfig \
|
|
||||||
| $GREP 'Installation point:' \
|
|
||||||
| $AWK '{print $[]NF}' )
|
|
||||||
|
|
||||||
dnl Add this to the CPPFLAGS
|
|
||||||
HDF5_CPPFLAGS="-I${HDF5_tmp_inst}/include"
|
|
||||||
|
|
||||||
dnl Now sort the flags out based upon their prefixes
|
|
||||||
for arg in $HDF5_SHOW $HDF5_tmp_flags ; do
|
|
||||||
case "$arg" in
|
|
||||||
-I*) echo $HDF5_CPPFLAGS | $GREP -e "$arg" 2>&1 >/dev/null \
|
|
||||||
|| HDF5_CPPFLAGS="$arg $HDF5_CPPFLAGS"
|
|
||||||
;;
|
|
||||||
-L*) echo $HDF5_LDFLAGS | $GREP -e "$arg" 2>&1 >/dev/null \
|
|
||||||
|| HDF5_LDFLAGS="$arg $HDF5_LDFLAGS"
|
|
||||||
;;
|
|
||||||
-l*) echo $HDF5_LIBS | $GREP -e "$arg" 2>&1 >/dev/null \
|
|
||||||
|| HDF5_LIBS="$arg $HDF5_LIBS"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
HDF5_LIBS="$HDF5_LIBS -lhdf5"
|
|
||||||
AC_MSG_RESULT([yes (version $[HDF5_VERSION])])
|
|
||||||
|
|
||||||
dnl See if we can compile
|
|
||||||
ax_lib_hdf5_save_CC=$CC
|
|
||||||
ax_lib_hdf5_save_CPPFLAGS=$CPPFLAGS
|
|
||||||
ax_lib_hdf5_save_LIBS=$LIBS
|
|
||||||
ax_lib_hdf5_save_LDFLAGS=$LDFLAGS
|
|
||||||
CC=$HDF5_CC
|
|
||||||
CPPFLAGS=$HDF5_CPPFLAGS
|
|
||||||
LIBS=$HDF5_LIBS
|
|
||||||
LDFLAGS=$HDF5_LDFLAGS
|
|
||||||
AC_CHECK_HEADER([hdf5.h], [ac_cv_hadf5_h=yes], [ac_cv_hadf5_h=no])
|
|
||||||
AC_CHECK_LIB([hdf5], [H5Fcreate], [ac_cv_libhdf5=yes],
|
|
||||||
[ac_cv_libhdf5=no])
|
|
||||||
if test "$ac_cv_hadf5_h" = "no" && test "$ac_cv_libhdf5" = "no" ; then
|
|
||||||
AC_MSG_WARN([Unable to compile HDF5 test program])
|
|
||||||
fi
|
|
||||||
dnl Look for HDF5's high level library
|
|
||||||
AC_HAVE_LIBRARY([hdf5_hl], [HDF5_LIBS="$HDF5_LIBS -lhdf5_hl"], [], [])
|
|
||||||
|
|
||||||
CC=$ax_lib_hdf5_save_CC
|
|
||||||
CPPFLAGS=$ax_lib_hdf5_save_CPPFLAGS
|
|
||||||
LIBS=$ax_lib_hdf5_save_LIBS
|
|
||||||
LDFLAGS=$ax_lib_hdf5_save_LDFLAGS
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([for matching HDF5 Fortran wrapper])
|
|
||||||
dnl Presume HDF5 Fortran wrapper is just a name variant from H5CC
|
|
||||||
H5FC=$(eval echo -n $H5CC | $SED -n 's/cc$/fc/p')
|
|
||||||
if test -x "$H5FC"; then
|
|
||||||
AC_MSG_RESULT([$H5FC])
|
|
||||||
with_hdf5_fortran="yes"
|
|
||||||
AC_SUBST([H5FC])
|
|
||||||
|
|
||||||
dnl Again, pry any remaining -Idir/-Ldir from compiler wrapper
|
|
||||||
for arg in `$H5FC -show`
|
|
||||||
do
|
|
||||||
case "$arg" in #(
|
|
||||||
-I*) echo $HDF5_FFLAGS | $GREP -e "$arg" >/dev/null \
|
|
||||||
|| HDF5_FFLAGS="$arg $HDF5_FFLAGS"
|
|
||||||
;;#(
|
|
||||||
-L*) echo $HDF5_FFLAGS | $GREP -e "$arg" >/dev/null \
|
|
||||||
|| HDF5_FFLAGS="$arg $HDF5_FFLAGS"
|
|
||||||
dnl HDF5 installs .mod files in with libraries,
|
|
||||||
dnl but some compilers need to find them with -I
|
|
||||||
echo $HDF5_FFLAGS | $GREP -e "-I${arg#-L}" >/dev/null \
|
|
||||||
|| HDF5_FFLAGS="-I${arg#-L} $HDF5_FFLAGS"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
dnl Make Fortran link line by inserting Fortran libraries
|
|
||||||
for arg in $HDF5_LIBS
|
|
||||||
do
|
|
||||||
case "$arg" in #(
|
|
||||||
-lhdf5_hl) HDF5_FLIBS="$HDF5_FLIBS -lhdf5hl_fortran $arg"
|
|
||||||
;; #(
|
|
||||||
-lhdf5) HDF5_FLIBS="$HDF5_FLIBS -lhdf5_fortran $arg"
|
|
||||||
;; #(
|
|
||||||
*) HDF5_FLIBS="$HDF5_FLIBS $arg"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
with_hdf5_fortran="no"
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_SUBST([HDF5_VERSION])
|
|
||||||
AC_SUBST([HDF5_CC])
|
|
||||||
AC_SUBST([HDF5_CFLAGS])
|
|
||||||
AC_SUBST([HDF5_CPPFLAGS])
|
|
||||||
AC_SUBST([HDF5_LDFLAGS])
|
|
||||||
AC_SUBST([HDF5_LIBS])
|
|
||||||
AC_SUBST([HDF5_FC])
|
|
||||||
AC_SUBST([HDF5_FFLAGS])
|
|
||||||
AC_SUBST([HDF5_FLIBS])
|
|
||||||
AC_DEFINE([HAVE_HDF5], [1], [Defined if you have HDF5 support])
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
rm -rf .buildutils
|
|
||||||
mkdir -p .buildutils/m4
|
|
||||||
./update_eigen.sh eigen-3.3.8.tar.bz2
|
|
||||||
autoreconf -fvi
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
PREFIX=`cat Makefile | grep '^prefix =' | awk '{print $3}'`
|
|
||||||
case $1 in
|
|
||||||
'')
|
|
||||||
echo '-- building...'
|
|
||||||
make -j8
|
|
||||||
echo '-- installing...'
|
|
||||||
make uninstall 1>/dev/null
|
|
||||||
make install 1>/dev/null;;
|
|
||||||
# if [[ `basename \`pwd\`` == "lib" ]]
|
|
||||||
# then
|
|
||||||
# echo '-- creating debug symbols...'
|
|
||||||
# dsymutil .libs/libLatAnalyze.0.dylib -o ${PREFIX}/lib/libLatAnalyze.0.dylib.dSYM
|
|
||||||
# fi;;
|
|
||||||
'clean')
|
|
||||||
echo '-- cleaning...'
|
|
||||||
make -j8 clean;;
|
|
||||||
*)
|
|
||||||
echo 'error: unknown action' 1>&2
|
|
||||||
exit 1;;
|
|
||||||
esac
|
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if (( $# != 2 )); then
|
if (($# != 2)); then
|
||||||
echo "usage: `basename $0` <prefix> <ntasks>" 1>&2
|
echo "usage: $(basename "$0") <prefix> <ntasks>" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
PREFIX=$1
|
prefix=$1
|
||||||
NTASKS=$2
|
ntasks=$2
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
mkdir -p local/build
|
mkdir -p local/build
|
||||||
for d in gsl nlopt minuit hdf5; do
|
for d in gsl nlopt minuit hdf5; do
|
||||||
if [ ! -e local/.built.${d} ]; then
|
if [ ! -e local/.built.${d} ]; then
|
||||||
./install-${d}.sh ${PREFIX} ${NTASKS}
|
./install-${d}.sh "${prefix}" "${ntasks}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
+18
-18
@@ -1,27 +1,27 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
NAME='gsl-2.6'
|
name='gsl-2.8'
|
||||||
|
|
||||||
if (( $# != 2 )); then
|
if (($# != 2)); then
|
||||||
echo "usage: `basename $0` <prefix> <ntasks>" 1>&2
|
echo "usage: $(basename "$0") <prefix> <ntasks>" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
PREFIX=$1
|
prefix=$1
|
||||||
NTASKS=$2
|
ntasks=$2
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
INITDIR=$(pwd -P)
|
init_dir=$(pwd -P)
|
||||||
mkdir -p ${PREFIX}
|
mkdir -p "${prefix}"
|
||||||
cd ${PREFIX}
|
cd "${prefix}"
|
||||||
PREFIX=$(pwd -P)
|
prefix=$(pwd -P)
|
||||||
cd ${INITDIR}/local/build
|
cd "${init_dir}/local/build"
|
||||||
wget http://ftpmirror.gnu.org/gsl/${NAME}.tar.gz
|
wget https://mirror.ibcp.fr/pub/gnu/gsl/${name}.tar.gz
|
||||||
tar -xzvf ${NAME}.tar.gz
|
tar -xzvf ${name}.tar.gz
|
||||||
mkdir -p ${NAME}/build
|
mkdir -p ${name}/build
|
||||||
cd ${NAME}/build
|
cd ${name}/build
|
||||||
../configure --prefix=${PREFIX}
|
../configure --prefix="${prefix}"
|
||||||
make -j${NTASKS}
|
make -j"${ntasks}"
|
||||||
make install
|
make install
|
||||||
cd ${INITDIR}/local
|
cd "${init_dir}/local"
|
||||||
touch .built.gsl
|
touch .built.gsl
|
||||||
cd ${INITDIR}
|
cd "${init_dir}"
|
||||||
+18
-18
@@ -1,27 +1,27 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
NAME='hdf5-1.10.8'
|
name='hdf5-1.14.3'
|
||||||
|
|
||||||
if (( $# != 2 )); then
|
if (($# != 2)); then
|
||||||
echo "usage: `basename $0` <prefix> <ntasks>" 1>&2
|
echo "usage: $(basename "$0") <prefix> <ntasks>" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
PREFIX=$1
|
prefix=$1
|
||||||
NTASKS=$2
|
ntasks=$2
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
INITDIR=$(pwd -P)
|
init_dir=$(pwd -P)
|
||||||
mkdir -p ${PREFIX}
|
mkdir -p "${prefix}"
|
||||||
cd ${PREFIX}
|
cd "${prefix}"
|
||||||
PREFIX=$(pwd -P)
|
prefix=$(pwd -P)
|
||||||
cd ${INITDIR}/local/build
|
cd "${init_dir}/local/build"
|
||||||
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/${NAME}/src/${NAME}.tar.gz
|
wget "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.14/${name}/src/${name}.tar.gz"
|
||||||
tar -xzvf ${NAME}.tar.gz
|
tar -xzvf ${name}.tar.gz
|
||||||
mkdir ${NAME}/build
|
mkdir ${name}/build
|
||||||
cd ${NAME}/build
|
cd ${name}/build
|
||||||
../configure --prefix=${PREFIX} --enable-cxx
|
../configure --prefix="${prefix}" --enable-cxx
|
||||||
make -j${NTASKS}
|
make -j "${ntasks}"
|
||||||
make install
|
make install
|
||||||
cd ${INITDIR}/local
|
cd "${init_dir}/local"
|
||||||
touch .built.hdf5
|
touch .built.hdf5
|
||||||
cd ${INITDIR}
|
cd "${init_dir}"
|
||||||
+15
-16
@@ -1,23 +1,22 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if (( $# != 2 )); then
|
if (($# != 2)); then
|
||||||
echo "usage: `basename $0` <prefix> <ntasks>" 1>&2
|
echo "usage: $(basename "$0") <prefix> <ntasks>" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
PREFIX=$1
|
prefix=$1
|
||||||
NTASKS=$2
|
ntasks=$2
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
INITDIR=$(pwd -P)
|
init_dir=$(pwd -P)
|
||||||
mkdir -p ${PREFIX}
|
mkdir -p "${prefix}"
|
||||||
cd ${PREFIX}
|
cd "${prefix}"
|
||||||
PREFIX=$(pwd -P)
|
prefix=$(pwd -P)
|
||||||
cd ${INITDIR}
|
cd "${init_dir}"
|
||||||
./install-deps.sh ${PREFIX} ${NTASKS}
|
./install-deps.sh "${prefix}" "${ntasks}"
|
||||||
cd ..
|
mkdir -p "${init_dir}/local/build/latan"
|
||||||
./bootstrap.sh
|
cd "${init_dir}/local/build/latan"
|
||||||
mkdir -p build
|
cmake -DCMAKE_INSTALL_PREFIX="${prefix}" -DCMAKE_PREFIX_PATH="${prefix}" \
|
||||||
cd build
|
-DCMAKE_BUILD_TYPE="RelWithDebInfo" "${init_dir}/.."
|
||||||
../configure --prefix=${PREFIX} --with-minuit=${PREFIX} --with-nlopt=${PREFIX} --with-hdf5=${PREFIX} --with-gsl=${PREFIX} CXXFLAGS="${CXXFLAGS} -O3 -march=native -mtune=native"
|
make -j "${ntasks}"
|
||||||
make -j${NTASKS}
|
|
||||||
make install
|
make install
|
||||||
@@ -1,26 +1,26 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if (($# != 2)); then
|
||||||
if (( $# != 2 )); then
|
echo "usage: $(basename "$0") <prefix> <ntasks>" 1>&2
|
||||||
echo "usage: `basename $0` <prefix> <ntasks>" 1>&2
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
PREFIX=$1
|
prefix=$1
|
||||||
NTASKS=$2
|
ntasks=$2
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
INITDIR=$(pwd -P)
|
init_dir=$(pwd -P)
|
||||||
mkdir -p ${PREFIX}
|
mkdir -p "${prefix}"
|
||||||
cd ${PREFIX}
|
cd "${prefix}"
|
||||||
PREFIX=$(pwd -P)
|
prefix=$(pwd -P)
|
||||||
cd ${INITDIR}/local/build
|
cd "${init_dir}/local/build"
|
||||||
rm -rf root
|
rm -rf root
|
||||||
git clone https://github.com/root-project/root.git
|
git clone https://github.com/root-project/root.git
|
||||||
cd root/math/minuit2/
|
cd root/math/minuit2/
|
||||||
mkdir build; cd build
|
mkdir build
|
||||||
cmake .. -Dminuit2_standalone=ON -DCMAKE_INSTALL_PREFIX=${PREFIX}
|
cd build
|
||||||
make -j${NTASKS}
|
cmake .. -Dminuit2_standalone=ON -DCMAKE_INSTALL_PREFIX="${prefix}"
|
||||||
|
make -j "${ntasks}"
|
||||||
make install
|
make install
|
||||||
cd ${INITDIR}/local
|
cd "${init_dir}/local"
|
||||||
touch .built.minuit
|
touch .built.minuit
|
||||||
cd ${INITDIR}
|
cd "${init_dir}"
|
||||||
+21
-19
@@ -1,28 +1,30 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
NAME='2.6.1'
|
name='2.6.1'
|
||||||
|
|
||||||
if (( $# != 2 )); then
|
if (($# != 2)); then
|
||||||
echo "usage: `basename $0` <prefix> <ntasks>" 1>&2
|
echo "usage: $(basename "$0") <prefix> <ntasks>" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
PREFIX=$1
|
prefix=$1
|
||||||
NTASKS=$2
|
ntasks=$2
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
INITDIR=$(pwd -P)
|
init_dir=$(pwd -P)
|
||||||
mkdir -p ${PREFIX}
|
mkdir -p "${prefix}"
|
||||||
cd ${PREFIX}
|
cd "${prefix}"
|
||||||
PREFIX=$(pwd -P)
|
prefix=$(pwd -P)
|
||||||
cd ${INITDIR}/local/build
|
cd "${init_dir}/local/build"
|
||||||
wget https://github.com/stevengj/nlopt/archive/v${NAME}.tar.gz
|
wget "https://github.com/stevengj/nlopt/archive/v${name}.tar.gz"
|
||||||
tar -xzvf v${NAME}.tar.gz
|
tar -xzvf v${name}.tar.gz
|
||||||
NAME=nlopt-${NAME}
|
name=nlopt-${name}
|
||||||
mkdir -p ${NAME}/build
|
mkdir -p ${name}/build
|
||||||
cd ${NAME}/build
|
cd ${name}/build
|
||||||
cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=TRUE -DCMAKE_INSTALL_NAME_DIR="${PREFIX}/lib" ..
|
cmake -DCMAKE_INSTALL_PREFIX="${prefix}" -DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=TRUE \
|
||||||
make -j${NTASKS}
|
-DCMAKE_INSTALL_NAME_DIR="${prefix}/lib" -DNLOPT_PYTHON=OFF -DNLOPT_OCTAVE=OFF \
|
||||||
|
-DNLOPT_MATLAB=OFF -DNLOPT_GUILE=OFF -DNLOPT_SWIG=OFF ..
|
||||||
|
make -j "${ntasks}"
|
||||||
make install
|
make install
|
||||||
cd ${INITDIR}/local
|
cd "${init_dir}/local"
|
||||||
touch .built.nlopt
|
touch .built.nlopt
|
||||||
cd ${INITDIR}
|
cd "${init_dir}"
|
||||||
-167
@@ -1,167 +0,0 @@
|
|||||||
# Process this file with autoconf to produce a configure script.
|
|
||||||
|
|
||||||
# Initialization
|
|
||||||
AC_PREREQ([2.63])
|
|
||||||
AC_INIT([LatAnalyze],[3.5.1-dev],[antonin.portelli@me.com],[LatAnalyze])
|
|
||||||
AC_CONFIG_AUX_DIR([.buildutils])
|
|
||||||
AC_CONFIG_SRCDIR([lib/Global.cpp])
|
|
||||||
AC_CONFIG_SRCDIR([utils/sample_read.cpp])
|
|
||||||
AC_CONFIG_SRCDIR([examples/exMathInterpreter.cpp])
|
|
||||||
AC_CONFIG_MACRO_DIR([.buildutils/m4])
|
|
||||||
AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign subdir-objects])
|
|
||||||
AM_SILENT_RULES([yes])
|
|
||||||
AC_CONFIG_HEADERS([config.h])
|
|
||||||
AM_CONDITIONAL([HAVE_AM_MINOR_LE_11],
|
|
||||||
[test `automake --version | grep automake | awk -F '.' '{print $2}'` -le 11])
|
|
||||||
# Checks for programs
|
|
||||||
AC_PROG_CXX
|
|
||||||
AC_PROG_AWK
|
|
||||||
AC_PROG_CC
|
|
||||||
AC_PROG_CPP
|
|
||||||
AC_PROG_INSTALL
|
|
||||||
AC_PROG_LN_S
|
|
||||||
AC_PROG_MAKE_SET
|
|
||||||
AC_PROG_LEX
|
|
||||||
AC_PROG_YACC
|
|
||||||
m4_ifdef([AM_PROG_AR],[AM_PROG_AR])
|
|
||||||
|
|
||||||
LT_INIT
|
|
||||||
|
|
||||||
# Options
|
|
||||||
AC_ARG_WITH([gsl],
|
|
||||||
[AS_HELP_STRING([--with-gsl=prefix],
|
|
||||||
[try this for a non-standard install prefix of the GSL library])],
|
|
||||||
[AM_CXXFLAGS="$AM_CXXFLAGS -I$with_gsl/include"]
|
|
||||||
[AM_LDFLAGS="$AM_LDFLAGS -L$with_gsl/lib"])
|
|
||||||
AC_ARG_WITH([minuit],
|
|
||||||
[AS_HELP_STRING([--with-minuit=prefix],
|
|
||||||
[try this for a non-standard install prefix of the Minuit2 library])],
|
|
||||||
[AM_CXXFLAGS="$AM_CXXFLAGS -I$with_minuit/include -I$with_minuit/include/Minuit2 -I$with_minuit/include/Fit"]
|
|
||||||
[AM_LDFLAGS="$AM_LDFLAGS -L$with_minuit/lib"])
|
|
||||||
AC_ARG_WITH([nlopt],
|
|
||||||
[AS_HELP_STRING([--with-nlopt=prefix],
|
|
||||||
[try this for a non-standard install prefix of the NLopt library])],
|
|
||||||
[AM_CXXFLAGS="$AM_CXXFLAGS -I$with_nlopt/include"]
|
|
||||||
[AM_LDFLAGS="$AM_LDFLAGS -L$with_nlopt/lib"])
|
|
||||||
AC_ARG_WITH([hdf5],
|
|
||||||
[AS_HELP_STRING([--with-hdf5=prefix],
|
|
||||||
[try this for a non-standard install prefix of the HDF5 library])],
|
|
||||||
[AM_CXXFLAGS="$AM_CXXFLAGS -I$with_hdf5/include"]
|
|
||||||
[AM_LDFLAGS="$AM_LDFLAGS -L$with_hdf5/lib"])
|
|
||||||
|
|
||||||
# Get compilers informations
|
|
||||||
AX_COMPILER_VENDOR
|
|
||||||
AC_DEFINE_UNQUOTED([C_COMP_VENDOR],["$ax_cv_c_compiler_vendor"],
|
|
||||||
[vendor of C compiler that will compile the code])
|
|
||||||
AM_CONDITIONAL([CC_GNU],[test $ax_cv_c_compiler_vendor = "gnu"])
|
|
||||||
AM_CONDITIONAL([CC_INTEL],[test $ax_cv_c_compiler_vendor = "intel"])
|
|
||||||
AC_LANG([C++])
|
|
||||||
AX_CXX_COMPILE_STDCXX_11([noext],[mandatory])
|
|
||||||
AX_COMPILER_VENDOR
|
|
||||||
AC_DEFINE_UNQUOTED([CXX_COMP_VENDOR],["$ax_cv_cxx_compiler_vendor"],
|
|
||||||
[vendor of C++ compiler that will compile the code])
|
|
||||||
AM_CONDITIONAL([CXX_GNU],[test $ax_cv_cxx_compiler_vendor = "gnu"])
|
|
||||||
AM_CONDITIONAL([CXX_INTEL],[test $ax_cv_cxx_compiler_vendor = "intel"])
|
|
||||||
AX_GCC_VERSION
|
|
||||||
AC_DEFINE_UNQUOTED([GCC_VERSION],["$GCC_VERSION"],
|
|
||||||
[version of gcc that will compile the code])
|
|
||||||
AX_GXX_VERSION
|
|
||||||
AC_DEFINE_UNQUOTED([GXX_VERSION],["$GXX_VERSION"],
|
|
||||||
[version of g++ that will compile the code])
|
|
||||||
|
|
||||||
# Checks for libraries.
|
|
||||||
CXXFLAGS_CPY=$CXXFLAGS
|
|
||||||
LDFLAGS_CPY=$LDFLAGS
|
|
||||||
CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
|
|
||||||
LDFLAGS="$AM_LDFLAGS $LDFLAGS"
|
|
||||||
AC_CHECK_LIB([pthread],[pthread_create],[],[AC_MSG_ERROR([pthread library not found])])
|
|
||||||
AC_CHECK_LIB([m],[cos],[],[AC_MSG_ERROR([libm library not found])])
|
|
||||||
AC_CHECK_LIB([gslcblas],[cblas_dgemm],[],
|
|
||||||
[AC_MSG_ERROR([GSL CBLAS library not found])])
|
|
||||||
AC_CHECK_LIB([gsl],[gsl_blas_dgemm],[],[AC_MSG_ERROR([GSL library not found])])
|
|
||||||
AC_CHECK_LIB([nlopt],[nlopt_create],
|
|
||||||
[AC_DEFINE([HAVE_NLOPT],
|
|
||||||
[1],
|
|
||||||
[Define to 1 if you have the `NLopt' library (-lnlopt).])]
|
|
||||||
[have_nlopt=true]
|
|
||||||
[LIBS="$LIBS -lnlopt"],[])
|
|
||||||
AM_CONDITIONAL([HAVE_NLOPT], [test x$have_nlopt = xtrue])
|
|
||||||
AC_CHECK_LIB([hdf5_cpp],[H5Fopen],
|
|
||||||
[LIBS="$LIBS -lhdf5_cpp -lhdf5"],
|
|
||||||
[AC_MSG_ERROR([HDF5 library not found])], [-lhdf5])
|
|
||||||
SAVED_LDFLAGS=$LDFLAGS
|
|
||||||
LDFLAGS="$LDFLAGS -lMinuit2"
|
|
||||||
AC_MSG_CHECKING([for ROOT::Minuit2::VariableMetricMinimizer in -lMinuit2]);
|
|
||||||
AC_LINK_IFELSE(
|
|
||||||
[AC_LANG_PROGRAM([#include <Minuit2/VariableMetricMinimizer.h>],
|
|
||||||
[ROOT::Minuit2::VariableMetricMinimizer dummy()])],
|
|
||||||
[LIBS="$LIBS -lMinuit2"]
|
|
||||||
[AC_DEFINE([HAVE_MINUIT2],
|
|
||||||
[1],
|
|
||||||
[Define to 1 if you have the `Minuit2' library (-lMinuit2).])]
|
|
||||||
[have_minuit=true]
|
|
||||||
[AC_MSG_RESULT([yes])],
|
|
||||||
[have_minuit=false]
|
|
||||||
[AC_MSG_RESULT([no])])
|
|
||||||
AM_CONDITIONAL([HAVE_MINUIT], [test x$have_minuit = xtrue])
|
|
||||||
LDFLAGS="$LDFLAGS -lMinuit2Math"
|
|
||||||
AC_MSG_CHECKING([for ROOT::Math::MinimizerOptions in -lMinuit2Math]);
|
|
||||||
AC_LINK_IFELSE(
|
|
||||||
[AC_LANG_PROGRAM([#include <Minuit2/Math/MinimizerOptions.h>],
|
|
||||||
[ROOT::Math::MinimizerOptions dummy()])],
|
|
||||||
[LIBS="$LIBS -lMinuit2Math"]
|
|
||||||
[AC_DEFINE([HAVE_MINUIT2MATH],
|
|
||||||
[1],
|
|
||||||
[Define to 1 if you have the `Minuit2Math' library (-lMinuit2Math).])]
|
|
||||||
[have_minuitmath=true]
|
|
||||||
[AC_MSG_RESULT([yes])],
|
|
||||||
[have_minuitmath=false]
|
|
||||||
[AC_MSG_RESULT([no])])
|
|
||||||
AM_CONDITIONAL([HAVE_MINUITMATH], [test x$have_minuit = xtrue])
|
|
||||||
LDFLAGS=$SAVED_LDFLAGS
|
|
||||||
CXXFLAGS=$CXXFLAGS_CPY
|
|
||||||
LDFLAGS=$LDFLAGS_CPY
|
|
||||||
|
|
||||||
# Checks for header files.
|
|
||||||
AC_HEADER_STDC
|
|
||||||
|
|
||||||
cwd=`pwd -P`; cd ${srcdir}; abs_srcdir=`pwd -P`; cd ${cwd}
|
|
||||||
LATAN_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
|
|
||||||
LATAN_LDFLAGS="$AM_LDFLAGS $LDFLAGS"
|
|
||||||
LATAN_LIBS=$LIBS
|
|
||||||
LATAN_SHORT_SHA=`git rev-parse --short HEAD`
|
|
||||||
LATAN_SHA=`git rev-parse HEAD`
|
|
||||||
LATAN_BRANCH=`git rev-parse --abbrev-ref HEAD`
|
|
||||||
AM_CXXFLAGS="-I${abs_srcdir}/lib $AM_CXXFLAGS"
|
|
||||||
AM_CFLAGS="-I${abs_srcdir}/lib $AM_CFLAGS"
|
|
||||||
CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
|
|
||||||
LDFLAGS="$AM_LDFLAGS $LDFLAGS"
|
|
||||||
AC_SUBST([LIBS])
|
|
||||||
AC_SUBST([AM_CXXFLAGS])
|
|
||||||
AC_SUBST([AM_LDFLAGS])
|
|
||||||
AC_SUBST([LATAN_CXXFLAGS])
|
|
||||||
AC_SUBST([LATAN_LDFLAGS])
|
|
||||||
AC_SUBST([LATAN_LIBS])
|
|
||||||
AC_SUBST([LATAN_SHA])
|
|
||||||
AC_SUBST([LATAN_BRANCH])
|
|
||||||
|
|
||||||
AC_CONFIG_FILES([latan-config], [chmod +x latan-config])
|
|
||||||
AC_CONFIG_FILES([Makefile])
|
|
||||||
AC_CONFIG_FILES([lib/Makefile])
|
|
||||||
AC_CONFIG_FILES([utils/Makefile])
|
|
||||||
AC_CONFIG_FILES([physics/Makefile])
|
|
||||||
AC_CONFIG_FILES([examples/Makefile])
|
|
||||||
AC_OUTPUT
|
|
||||||
|
|
||||||
echo "*********************************************"
|
|
||||||
echo "* ${PACKAGE_NAME} v${VERSION}" build options
|
|
||||||
echo "*********************************************"
|
|
||||||
echo "* C++ compiler : $CXX"
|
|
||||||
echo "* Minuit minimizers: `test x$HAVE_MINUIT_TRUE = 'x' && echo yes \
|
|
||||||
|| echo no`"
|
|
||||||
echo "* NLopt minimizers : `test x$HAVE_NLOPT_TRUE = 'x' && echo yes \
|
|
||||||
|| echo no`"
|
|
||||||
echo "*********************************************"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Binary file not shown.
@@ -0,0 +1,21 @@
|
|||||||
|
set(EXAMPLES_STEM
|
||||||
|
exCompiledDoubleFunction
|
||||||
|
exDerivative
|
||||||
|
exDWT
|
||||||
|
exFit
|
||||||
|
exFitSample
|
||||||
|
exIntegrator
|
||||||
|
exInterp
|
||||||
|
exMat
|
||||||
|
exMathInterpreter
|
||||||
|
exMin
|
||||||
|
exPlot
|
||||||
|
exPValue
|
||||||
|
exRand
|
||||||
|
exRootFinder
|
||||||
|
exThreadPool)
|
||||||
|
|
||||||
|
foreach(_stem ${EXAMPLES_STEM})
|
||||||
|
add_executable(${_stem} ${_stem}.cpp)
|
||||||
|
target_link_libraries(${_stem} LatAnalyze compiler_flags)
|
||||||
|
endforeach()
|
||||||
@@ -1 +0,0 @@
|
|||||||
../lib
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
if CXX_GNU
|
|
||||||
COM_CXXFLAGS = -Wall -W -pedantic -Wno-deprecated-declarations
|
|
||||||
else
|
|
||||||
if CXX_INTEL
|
|
||||||
COM_CXXFLAGS = -wd1682 -Wall
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
noinst_PROGRAMS = \
|
|
||||||
exCompiledDoubleFunction\
|
|
||||||
exDerivative \
|
|
||||||
exDWT \
|
|
||||||
exFit \
|
|
||||||
exFitSample \
|
|
||||||
exIntegrator \
|
|
||||||
exInterp \
|
|
||||||
exMat \
|
|
||||||
exMathInterpreter \
|
|
||||||
exMin \
|
|
||||||
exPlot \
|
|
||||||
exPValue \
|
|
||||||
exRand \
|
|
||||||
exRootFinder \
|
|
||||||
exThreadPool
|
|
||||||
|
|
||||||
exCompiledDoubleFunction_SOURCES = exCompiledDoubleFunction.cpp
|
|
||||||
exCompiledDoubleFunction_CXXFLAGS = $(COM_CXXFLAGS)
|
|
||||||
exCompiledDoubleFunction_LDFLAGS = -L../lib/.libs -lLatAnalyze
|
|
||||||
|
|
||||||
exDerivative_SOURCES = exDerivative.cpp
|
|
||||||
exDerivative_CXXFLAGS = $(COM_CXXFLAGS)
|
|
||||||
exDerivative_LDFLAGS = -L../lib/.libs -lLatAnalyze
|
|
||||||
|
|
||||||
exDWT_SOURCES = exDWT.cpp
|
|
||||||
exDWT_CXXFLAGS = $(COM_CXXFLAGS)
|
|
||||||
exDWT_LDFLAGS = -L../lib/.libs -lLatAnalyze
|
|
||||||
|
|
||||||
exFit_SOURCES = exFit.cpp
|
|
||||||
exFit_CXXFLAGS = $(COM_CXXFLAGS)
|
|
||||||
exFit_LDFLAGS = -L../lib/.libs -lLatAnalyze
|
|
||||||
|
|
||||||
exFitSample_SOURCES = exFitSample.cpp
|
|
||||||
exFitSample_CXXFLAGS = $(COM_CXXFLAGS)
|
|
||||||
exFitSample_LDFLAGS = -L../lib/.libs -lLatAnalyze
|
|
||||||
|
|
||||||
exInterp_SOURCES = exInterp.cpp
|
|
||||||
exInterp_CXXFLAGS = $(COM_CXXFLAGS)
|
|
||||||
exInterp_LDFLAGS = -L../lib/.libs -lLatAnalyze
|
|
||||||
|
|
||||||
exIntegrator_SOURCES = exIntegrator.cpp
|
|
||||||
exIntegrator_CXXFLAGS = $(COM_CXXFLAGS)
|
|
||||||
exIntegrator_LDFLAGS = -L../lib/.libs -lLatAnalyze
|
|
||||||
|
|
||||||
exMat_SOURCES = exMat.cpp
|
|
||||||
exMat_CXXFLAGS = $(COM_CXXFLAGS)
|
|
||||||
exMat_LDFLAGS = -L../lib/.libs -lLatAnalyze
|
|
||||||
|
|
||||||
exMin_SOURCES = exMin.cpp
|
|
||||||
exMin_CXXFLAGS = $(COM_CXXFLAGS)
|
|
||||||
exMin_LDFLAGS = -L../lib/.libs -lLatAnalyze
|
|
||||||
|
|
||||||
exMathInterpreter_SOURCES = exMathInterpreter.cpp
|
|
||||||
exMathInterpreter_CXXFLAGS = $(COM_CXXFLAGS)
|
|
||||||
exMathInterpreter_LDFLAGS = -L../lib/.libs -lLatAnalyze
|
|
||||||
|
|
||||||
exPlot_SOURCES = exPlot.cpp
|
|
||||||
exPlot_CXXFLAGS = $(COM_CXXFLAGS)
|
|
||||||
exPlot_LDFLAGS = -L../lib/.libs -lLatAnalyze
|
|
||||||
|
|
||||||
exPValue_SOURCES = exPValue.cpp
|
|
||||||
exPValue_CXXFLAGS = $(COM_CXXFLAGS)
|
|
||||||
exPValue_LDFLAGS = -L../lib/.libs -lLatAnalyze
|
|
||||||
|
|
||||||
exRand_SOURCES = exRand.cpp
|
|
||||||
exRand_CXXFLAGS = $(COM_CXXFLAGS)
|
|
||||||
exRand_LDFLAGS = -L../lib/.libs -lLatAnalyze
|
|
||||||
|
|
||||||
exRootFinder_SOURCES = exRootFinder.cpp
|
|
||||||
exRootFinder_CXXFLAGS = $(COM_CXXFLAGS)
|
|
||||||
exRootFinder_LDFLAGS = -L../lib/.libs -lLatAnalyze
|
|
||||||
|
|
||||||
exThreadPool_SOURCES = exThreadPool.cpp
|
|
||||||
exThreadPool_CXXFLAGS = $(COM_CXXFLAGS)
|
|
||||||
exThreadPool_LDFLAGS = -L../lib/.libs -lLatAnalyze
|
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I .buildutils/m4
|
|
||||||
+7
-6
@@ -7,7 +7,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Latan;
|
using namespace Latan;
|
||||||
|
|
||||||
constexpr Index size = 8;
|
constexpr Index n = 8;
|
||||||
constexpr Index nDraw = 20000;
|
constexpr Index nDraw = 20000;
|
||||||
constexpr Index nSample = 2000;
|
constexpr Index nSample = 2000;
|
||||||
const string stateFileName = "exRand.seed";
|
const string stateFileName = "exRand.seed";
|
||||||
@@ -35,19 +35,20 @@ int main(void)
|
|||||||
|
|
||||||
cout << static_cast<int>(s) << " sigma(s) interval= [";
|
cout << static_cast<int>(s) << " sigma(s) interval= [";
|
||||||
cout << ci.first << ", " << ci.second << "]" << endl;
|
cout << ci.first << ", " << ci.second << "]" << endl;
|
||||||
|
cout << "P(X > " << s << ") = " << h.pValue(s) + 1. - h.pValue(-s) << endl;
|
||||||
}
|
}
|
||||||
p << PlotHistogram(h);
|
p << PlotHistogram(h);
|
||||||
p << PlotFunction(compile("return exp(-x_0^2/2)/sqrt(2*pi);", 1), -5., 5.);
|
p << PlotFunction(compile("return exp(-x_0^2/2)/sqrt(2*pi);", 1), -5., 5.);
|
||||||
p.display();
|
p.display();
|
||||||
|
|
||||||
DMat var(size, size);
|
DMat var(n, n);
|
||||||
DVec mean(size);
|
DVec mean(n);
|
||||||
DMatSample sample(nSample, size, 1);
|
DMatSample sample(nSample, n, 1);
|
||||||
|
|
||||||
cout << "-- generating " << nSample << " Gaussian random vectors..." << endl;
|
cout << "-- generating " << nSample << " Gaussian random vectors..." << endl;
|
||||||
var = DMat::Random(size, size);
|
var = DMat::Random(n, n);
|
||||||
var *= var.adjoint();
|
var *= var.adjoint();
|
||||||
mean = DVec::Random(size);
|
mean = DVec::Random(n);
|
||||||
RandomNormal mgauss(mean, var, rd());
|
RandomNormal mgauss(mean, var, rd());
|
||||||
sample[central] = mgauss();
|
sample[central] = mgauss();
|
||||||
FOR_STAT_ARRAY(sample, s)
|
FOR_STAT_ARRAY(sample, s)
|
||||||
|
|||||||
@@ -1,79 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
|
|
||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
includedir=@includedir@
|
|
||||||
|
|
||||||
usage()
|
|
||||||
{
|
|
||||||
cat <<EOF
|
|
||||||
Usage: latan-config [OPTION]
|
|
||||||
|
|
||||||
Known values for OPTION are:
|
|
||||||
|
|
||||||
--prefix show LatAnalyze installation prefix
|
|
||||||
--cxxflags print pre-processor and compiler flags
|
|
||||||
--ldflags print library linking flags
|
|
||||||
--libs print library linking information
|
|
||||||
--help display this help and exit
|
|
||||||
--version output version information
|
|
||||||
--git print git revision
|
|
||||||
|
|
||||||
EOF
|
|
||||||
|
|
||||||
exit $1
|
|
||||||
}
|
|
||||||
|
|
||||||
if test $# -eq 0; then
|
|
||||||
usage 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
cflags=false
|
|
||||||
libs=false
|
|
||||||
|
|
||||||
while test $# -gt 0; do
|
|
||||||
case "$1" in
|
|
||||||
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
|
||||||
*) optarg= ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
--prefix)
|
|
||||||
echo $prefix
|
|
||||||
;;
|
|
||||||
|
|
||||||
--version)
|
|
||||||
echo @VERSION@
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
|
|
||||||
--git)
|
|
||||||
echo "@LATAN_BRANCH@ @LATAN_SHA@"
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
|
|
||||||
--help)
|
|
||||||
usage 0
|
|
||||||
;;
|
|
||||||
|
|
||||||
--cxxflags)
|
|
||||||
echo @LATAN_CXXFLAGS@
|
|
||||||
;;
|
|
||||||
|
|
||||||
--ldflags)
|
|
||||||
echo @LATAN_LDFLAGS@
|
|
||||||
;;
|
|
||||||
|
|
||||||
--libs)
|
|
||||||
echo @LIBS@
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
# config.h header for package version and name
|
||||||
|
execute_process(
|
||||||
|
COMMAND git rev-parse --short HEAD
|
||||||
|
OUTPUT_VARIABLE LATAN_SHORT_SHA
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
execute_process(
|
||||||
|
COMMAND git rev-parse HEAD
|
||||||
|
OUTPUT_VARIABLE LATAN_SHA
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
execute_process(
|
||||||
|
COMMAND git rev-parse --abbrev-ref HEAD
|
||||||
|
OUTPUT_VARIABLE LATAN_BRANCH
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
|
||||||
|
|
||||||
|
# find bison & flex
|
||||||
|
find_package(BISON REQUIRED)
|
||||||
|
find_package(FLEX REQUIRED)
|
||||||
|
|
||||||
|
# ASCII parser
|
||||||
|
bison_target(
|
||||||
|
AsciiParser LatAnalyze/Io/AsciiParser.ypp
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/AsciiParser.cpp COMPILE_FLAGS "-Wno-deprecated")
|
||||||
|
flex_target(AsciiLexer LatAnalyze/Io/AsciiLexer.lpp
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/AsciiLexer.cpp)
|
||||||
|
add_flex_bison_dependency(AsciiLexer AsciiParser)
|
||||||
|
|
||||||
|
# math parser
|
||||||
|
bison_target(
|
||||||
|
MathParser LatAnalyze/Core/MathParser.ypp
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/MathParser.cpp COMPILE_FLAGS "-Wno-deprecated")
|
||||||
|
flex_target(MathLexer LatAnalyze/Core/MathLexer.lpp
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/MathLexer.cpp)
|
||||||
|
add_flex_bison_dependency(MathLexer MathParser)
|
||||||
|
|
||||||
|
# intermediate libraries
|
||||||
|
add_library(parsers STATIC)
|
||||||
|
target_include_directories(parsers PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
target_sources(
|
||||||
|
parsers PRIVATE ${BISON_AsciiParser_OUTPUTS} ${FLEX_AsciiLexer_OUTPUTS}
|
||||||
|
${BISON_MathParser_OUTPUTS} ${FLEX_MathLexer_OUTPUTS})
|
||||||
|
|
||||||
|
add_library(tinyxml2 STATIC)
|
||||||
|
target_include_directories(parsers PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
target_sources(tinyxml2 PRIVATE LatAnalyze/Io/Xml/tinyxml2.hpp
|
||||||
|
LatAnalyze/Io/Xml/tinyxml2.cpp)
|
||||||
|
|
||||||
|
# library target
|
||||||
|
add_library(LatAnalyze SHARED)
|
||||||
|
file(GLOB_RECURSE EIGEN_HEADERS LatAnalyze/Eigen/*)
|
||||||
|
target_include_directories(LatAnalyze PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
include(source-list.cmake)
|
||||||
|
target_sources(
|
||||||
|
LatAnalyze
|
||||||
|
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/config.h ${LATAN_SOURCES}
|
||||||
|
PUBLIC FILE_SET
|
||||||
|
public_headers
|
||||||
|
TYPE
|
||||||
|
HEADERS
|
||||||
|
FILES
|
||||||
|
${EIGEN_HEADERS}
|
||||||
|
${LATAN_HEADERS})
|
||||||
|
target_link_libraries(LatAnalyze PRIVATE compiler_flags parsers tinyxml2)
|
||||||
|
target_link_libraries(LatAnalyze PUBLIC GSL::gsl hdf5::hdf5 hdf5::hdf5_cpp
|
||||||
|
${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
if(Minuit2_FOUND)
|
||||||
|
target_link_libraries(LatAnalyze PUBLIC Minuit2::Minuit2)
|
||||||
|
endif()
|
||||||
|
if(NLopt_FOUND)
|
||||||
|
target_link_libraries(LatAnalyze PUBLIC NLopt::nlopt)
|
||||||
|
endif()
|
||||||
|
set_target_properties(LatAnalyze PROPERTIES VERSION ${PROJECT_VERSION})
|
||||||
|
target_include_directories(
|
||||||
|
LatAnalyze PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||||
|
|
||||||
|
# installation
|
||||||
|
install(
|
||||||
|
TARGETS LatAnalyze
|
||||||
|
EXPORT LatAnalyzeTargets
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
FILE_SET public_headers
|
||||||
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
|
install(
|
||||||
|
EXPORT LatAnalyzeTargets
|
||||||
|
FILE LatAnalyzeTargets.cmake
|
||||||
|
NAMESPACE LatAnalyze::
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LatAnalyze)
|
||||||
|
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
|
configure_package_config_file(
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/LatAnalyzeConfig.cmake"
|
||||||
|
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LatAnalyze
|
||||||
|
PATH_VARS INCLUDE_INSTALL_DIR)
|
||||||
|
write_basic_package_version_file(
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/LatAnalyzeConfigVersion.cmake"
|
||||||
|
VERSION "${PROJECT_VERSION}"
|
||||||
|
COMPATIBILITY AnyNewerVersion)
|
||||||
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/LatAnalyzeConfig.cmake"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/LatAnalyzeConfigVersion.cmake"
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LatAnalyze)
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
|
include(CMakeFindDependencyMacro)
|
||||||
|
|
||||||
|
find_dependency(GSL REQUIRED)
|
||||||
|
find_dependency(HDF5 REQUIRED COMPONENTS C CXX)
|
||||||
|
set(HAVE_Minuit2 @Minuit2_FOUND@)
|
||||||
|
set(HAVE_NLopt @NLopt_FOUND@)
|
||||||
|
if(HAVE_Minuit2)
|
||||||
|
find_dependency(Minuit2 REQUIRED)
|
||||||
|
list(APPEND _LatAnalyze_supported_components MINUIT2)
|
||||||
|
set(LatAnalyze_MINUIT2_FOUND True)
|
||||||
|
endif()
|
||||||
|
if(HAVE_NLopt)
|
||||||
|
find_dependency(NLopt REQUIRED)
|
||||||
|
list(APPEND _LatAnalyze_supported_components NLOPT)
|
||||||
|
set(LatAnalyze_NLOPT_FOUND True)
|
||||||
|
endif()
|
||||||
|
foreach(_comp ${LatAnalyze_FIND_COMPONENTS})
|
||||||
|
if (NOT ";${_LatAnalyze_supported_components};" MATCHES ";${_comp};")
|
||||||
|
set(LatAnalyze_FOUND False)
|
||||||
|
set(LatAnalyze_NOT_FOUND_MESSAGE "Unsupported LatAnalyze component: ${_comp}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/LatAnalyzeTargets.cmake")
|
||||||
|
|
||||||
|
set(@PROJECT_NAME@_INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIR@")
|
||||||
|
|
||||||
|
check_required_components(LatAnalyze)
|
||||||
@@ -1 +0,0 @@
|
|||||||
.
|
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LatAnalyze/Core/Math.hpp>
|
#include <LatAnalyze/Core/Math.hpp>
|
||||||
|
#include <LatAnalyze/Numerical/GslFFT.hpp>
|
||||||
#include <LatAnalyze/includes.hpp>
|
#include <LatAnalyze/includes.hpp>
|
||||||
#include <gsl/gsl_cdf.h>
|
#include <gsl/gsl_cdf.h>
|
||||||
|
|
||||||
@@ -48,16 +49,42 @@ DMat MATH_NAMESPACE::corrToVar(const DMat &corr, const DVec &varDiag)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
double MATH_NAMESPACE::svdDynamicRange(const DMat &mat)
|
double MATH_NAMESPACE::conditionNumber(const DMat &mat)
|
||||||
{
|
{
|
||||||
DVec s = mat.singularValues();
|
DVec s = mat.singularValues();
|
||||||
|
|
||||||
return s.maxCoeff()/s.minCoeff();
|
return s.maxCoeff()/s.minCoeff();
|
||||||
}
|
}
|
||||||
|
|
||||||
double MATH_NAMESPACE::svdDynamicRangeDb(const DMat &mat)
|
double MATH_NAMESPACE::cdr(const DMat &mat)
|
||||||
{
|
{
|
||||||
return 10.*log10(svdDynamicRange(mat));
|
return 10.*log10(conditionNumber(mat));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename FFT>
|
||||||
|
double nsdr(const DMat &m)
|
||||||
|
{
|
||||||
|
Index n = m.rows();
|
||||||
|
FFT fft(n);
|
||||||
|
CMat buf(n, 1);
|
||||||
|
|
||||||
|
FOR_VEC(buf, i)
|
||||||
|
{
|
||||||
|
buf(i) = 0.;
|
||||||
|
for (Index j = 0; j < n; ++j)
|
||||||
|
{
|
||||||
|
buf(i) += m(j, (i+j) % n);
|
||||||
|
}
|
||||||
|
buf(i) /= n;
|
||||||
|
}
|
||||||
|
fft(buf, FFT::Forward);
|
||||||
|
|
||||||
|
return 10.*log10(buf.real().maxCoeff()/buf.real().minCoeff());
|
||||||
|
}
|
||||||
|
|
||||||
|
double MATH_NAMESPACE::nsdr(const DMat &mat)
|
||||||
|
{
|
||||||
|
return ::nsdr<GslFFT>(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -139,5 +166,17 @@ auto chi2CcdfVecFunc = [](const double arg[2])
|
|||||||
return gsl_cdf_chisq_Q(arg[0], arg[1]);
|
return gsl_cdf_chisq_Q(arg[0], arg[1]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto hotellingT2PValueVecFunc = [](const double arg[3])
|
||||||
|
{
|
||||||
|
double T2 = arg[0];
|
||||||
|
double n = arg[1];
|
||||||
|
double p = arg[2];
|
||||||
|
double F = (n - p) / (p * (n - 1)) * T2;
|
||||||
|
double p_value = 1.0 - gsl_cdf_fdist_P(F, p, n - p);
|
||||||
|
|
||||||
|
return p_value;
|
||||||
|
};
|
||||||
|
|
||||||
DoubleFunction MATH_NAMESPACE::chi2PValue(chi2PValueVecFunc, 2);
|
DoubleFunction MATH_NAMESPACE::chi2PValue(chi2PValueVecFunc, 2);
|
||||||
DoubleFunction MATH_NAMESPACE::chi2Ccdf(chi2CcdfVecFunc, 2);
|
DoubleFunction MATH_NAMESPACE::chi2Ccdf(chi2CcdfVecFunc, 2);
|
||||||
|
DoubleFunction MATH_NAMESPACE::hotellingT2PValue(hotellingT2PValueVecFunc, 3);
|
||||||
@@ -73,8 +73,9 @@ namespace MATH_NAMESPACE
|
|||||||
DMat corrToVar(const DMat &corr, const DVec &varDiag);
|
DMat corrToVar(const DMat &corr, const DVec &varDiag);
|
||||||
|
|
||||||
// matrix SVD dynamic range
|
// matrix SVD dynamic range
|
||||||
double svdDynamicRange(const DMat &mat);
|
double conditionNumber(const DMat &mat);
|
||||||
double svdDynamicRangeDb(const DMat &mat);
|
double cdr(const DMat &mat);
|
||||||
|
double nsdr(const DMat &mat);
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
constexpr double pi = 3.1415926535897932384626433832795028841970;
|
constexpr double pi = 3.1415926535897932384626433832795028841970;
|
||||||
@@ -159,6 +160,7 @@ namespace MATH_NAMESPACE
|
|||||||
{
|
{
|
||||||
extern DoubleFunction chi2PValue;
|
extern DoubleFunction chi2PValue;
|
||||||
extern DoubleFunction chi2Ccdf;
|
extern DoubleFunction chi2Ccdf;
|
||||||
|
extern DoubleFunction hotellingT2PValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
END_LATAN_NAMESPACE
|
END_LATAN_NAMESPACE
|
||||||
@@ -36,7 +36,7 @@ unsigned int RunContext::addFunction(const string &name, DoubleFunction *init)
|
|||||||
|
|
||||||
return getFunctionAddress(name);
|
return getFunctionAddress(name);
|
||||||
}
|
}
|
||||||
catch (Exceptions::Definition)
|
catch (Exceptions::Definition &)
|
||||||
{
|
{
|
||||||
unsigned int address = fTable_.size();
|
unsigned int address = fTable_.size();
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ unsigned int RunContext::addVariable(const string &name, double init)
|
|||||||
|
|
||||||
return getVariableAddress(name);
|
return getVariableAddress(name);
|
||||||
}
|
}
|
||||||
catch (Exceptions::Definition)
|
catch (Exceptions::Definition &)
|
||||||
{
|
{
|
||||||
unsigned int address = vTable_.size();
|
unsigned int address = vTable_.size();
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ unsigned int RunContext::getFunctionAddress(const string &name) const
|
|||||||
{
|
{
|
||||||
return fTable_.at(name);
|
return fTable_.at(name);
|
||||||
}
|
}
|
||||||
catch (out_of_range)
|
catch (out_of_range &)
|
||||||
{
|
{
|
||||||
LATAN_ERROR(Definition, "undefined function '" + name + "'");
|
LATAN_ERROR(Definition, "undefined function '" + name + "'");
|
||||||
}
|
}
|
||||||
@@ -139,7 +139,7 @@ unsigned int RunContext::getVariableAddress(const string &name) const
|
|||||||
{
|
{
|
||||||
return vTable_.at(name);
|
return vTable_.at(name);
|
||||||
}
|
}
|
||||||
catch (out_of_range)
|
catch (out_of_range &)
|
||||||
{
|
{
|
||||||
LATAN_ERROR(Definition, "undefined variable '" + name + "'");
|
LATAN_ERROR(Definition, "undefined variable '" + name + "'");
|
||||||
}
|
}
|
||||||
@@ -449,7 +449,7 @@ try\
|
|||||||
{\
|
{\
|
||||||
address = (table).at(name);\
|
address = (table).at(name);\
|
||||||
}\
|
}\
|
||||||
catch (out_of_range)\
|
catch (out_of_range &)\
|
||||||
{\
|
{\
|
||||||
address = (table).size();\
|
address = (table).size();\
|
||||||
(table)[(name)] = address;\
|
(table)[(name)] = address;\
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -72,7 +72,7 @@ string PlotObject::dumpToTmpFile(const DMat &m)
|
|||||||
for (Index j = 0; j < m.cols(); ++j)
|
for (Index j = 0; j < m.cols(); ++j)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
sprintf(tmpFileName, "%s/latan_plot_tmp.XXXXXX.dat", P_tmpdir);
|
snprintf(tmpFileName, sizeof(tmpFileName), "%s/latan_plot_tmp.XXXXXX.dat", P_tmpdir);
|
||||||
fd = mkstemps(tmpFileName, 4);
|
fd = mkstemps(tmpFileName, 4);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
{
|
{
|
||||||
@@ -112,20 +112,28 @@ PlotHeadCommand::PlotHeadCommand(const string &command)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PlotData constructor ////////////////////////////////////////////////////////
|
// PlotData constructor ////////////////////////////////////////////////////////
|
||||||
PlotData::PlotData(const DMatSample &x, const DMatSample &y, const bool abs)
|
PlotData::PlotData(const DVecPair &x, const DVecPair &y, const bool abs)
|
||||||
{
|
{
|
||||||
if (x[central].rows() != y[central].rows())
|
if (x.first.rows() != y.first.rows())
|
||||||
{
|
{
|
||||||
LATAN_ERROR(Size, "x and y vectors do not have the same size");
|
LATAN_ERROR(Size, "x and y vectors do not have the same size");
|
||||||
}
|
}
|
||||||
|
if (x.first.rows() != x.second.rows())
|
||||||
|
{
|
||||||
|
LATAN_ERROR(Size, "x and error vectors do not have the same size");
|
||||||
|
}
|
||||||
|
if (y.first.rows() != y.second.rows())
|
||||||
|
{
|
||||||
|
LATAN_ERROR(Size, "y and error vectors do not have the same size");
|
||||||
|
}
|
||||||
|
|
||||||
DMat d(x[central].rows(), 4);
|
DMat d(x.first.rows(), 4);
|
||||||
string usingCmd, tmpFileName;
|
string usingCmd, tmpFileName;
|
||||||
|
|
||||||
d.col(0) = x[central].col(0);
|
d.col(0) = x.first.col(0);
|
||||||
d.col(2) = y[central].col(0);
|
d.col(2) = y.first.col(0);
|
||||||
d.col(1) = x.variance().cwiseSqrt().col(0);
|
d.col(1) = x.second.col(0);
|
||||||
d.col(3) = y.variance().cwiseSqrt().col(0);
|
d.col(3) = y.second.col(0);
|
||||||
tmpFileName = dumpToTmpFile(d);
|
tmpFileName = dumpToTmpFile(d);
|
||||||
pushTmpFile(tmpFileName);
|
pushTmpFile(tmpFileName);
|
||||||
if (!abs)
|
if (!abs)
|
||||||
@@ -138,19 +146,23 @@ PlotData::PlotData(const DMatSample &x, const DMatSample &y, const bool abs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlotData::PlotData(const DVec &x, const DMatSample &y, const bool abs)
|
PlotData::PlotData(const DVec &x, const DVecPair &y, const bool abs)
|
||||||
{
|
{
|
||||||
if (x.rows() != y[central].rows())
|
if (x.rows() != y.first.rows())
|
||||||
{
|
{
|
||||||
LATAN_ERROR(Size, "x and y vector does not have the same size");
|
LATAN_ERROR(Size, "x and y vectors do not have the same size");
|
||||||
|
}
|
||||||
|
if (y.first.rows() != y.second.rows())
|
||||||
|
{
|
||||||
|
LATAN_ERROR(Size, "y and error vectors do not have the same size");
|
||||||
}
|
}
|
||||||
|
|
||||||
DMat d(x.rows(), 3);
|
DMat d(x.rows(), 3);
|
||||||
string usingCmd, tmpFileName;
|
string usingCmd, tmpFileName;
|
||||||
|
|
||||||
d.col(0) = x;
|
d.col(0) = x;
|
||||||
d.col(1) = y[central].col(0);
|
d.col(1) = y.first.col(0);
|
||||||
d.col(2) = y.variance().cwiseSqrt().col(0);
|
d.col(2) = y.second.col(0);
|
||||||
tmpFileName = dumpToTmpFile(d);
|
tmpFileName = dumpToTmpFile(d);
|
||||||
pushTmpFile(tmpFileName);
|
pushTmpFile(tmpFileName);
|
||||||
if (!abs)
|
if (!abs)
|
||||||
@@ -163,19 +175,23 @@ PlotData::PlotData(const DVec &x, const DMatSample &y, const bool abs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlotData::PlotData(const DMatSample &x, const DVec &y, const bool abs)
|
PlotData::PlotData(const DVecPair &x, const DVec &y, const bool abs)
|
||||||
{
|
{
|
||||||
if (x[central].rows() != y.rows())
|
if (x.first.rows() != y.rows())
|
||||||
{
|
{
|
||||||
LATAN_ERROR(Size, "x and y vectors do not have the same size");
|
LATAN_ERROR(Size, "x and y vectors do not have the same size");
|
||||||
}
|
}
|
||||||
|
if (x.first.rows() != x.second.rows())
|
||||||
|
{
|
||||||
|
LATAN_ERROR(Size, "x and error vectors do not have the same size");
|
||||||
|
}
|
||||||
|
|
||||||
DMat d(x[central].rows(), 3), xerr, yerr;
|
DMat d(x.first.rows(), 3), xerr, yerr;
|
||||||
string usingCmd, tmpFileName;
|
string usingCmd, tmpFileName;
|
||||||
|
|
||||||
d.col(0) = x[central].col(0);
|
d.col(0) = x.first.col(0);
|
||||||
d.col(2) = y;
|
d.col(2) = y;
|
||||||
d.col(1) = x.variance().cwiseSqrt().col(0);
|
d.col(1) = x.second.col(0);
|
||||||
tmpFileName = dumpToTmpFile(d);
|
tmpFileName = dumpToTmpFile(d);
|
||||||
pushTmpFile(tmpFileName);
|
pushTmpFile(tmpFileName);
|
||||||
if (!abs)
|
if (!abs)
|
||||||
@@ -188,6 +204,19 @@ PlotData::PlotData(const DMatSample &x, const DVec &y, const bool abs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlotData::PlotData(const DMatSample &x, const DMatSample &y, const bool abs)
|
||||||
|
: PlotData(DVecPair(x[central], x.variance().cwiseSqrt()),
|
||||||
|
DVecPair(y[central], y.variance().cwiseSqrt()), abs)
|
||||||
|
{}
|
||||||
|
|
||||||
|
PlotData::PlotData(const DVec &x, const DMatSample &y, const bool abs)
|
||||||
|
: PlotData(x, DVecPair(y[central], y.variance().cwiseSqrt()), abs)
|
||||||
|
{}
|
||||||
|
|
||||||
|
PlotData::PlotData(const DMatSample &x, const DVec &y, const bool abs)
|
||||||
|
: PlotData(DVecPair(x[central], x.variance().cwiseSqrt()), y, abs)
|
||||||
|
{}
|
||||||
|
|
||||||
PlotData::PlotData(const XYStatData &data, const Index i, const Index j, const bool abs)
|
PlotData::PlotData(const XYStatData &data, const Index i, const Index j, const bool abs)
|
||||||
{
|
{
|
||||||
string usingCmd, tmpFileName;
|
string usingCmd, tmpFileName;
|
||||||
@@ -206,6 +235,42 @@ PlotData::PlotData(const XYStatData &data, const Index i, const Index j, const b
|
|||||||
setCommand("'" + tmpFileName + "' " + usingCmd);
|
setCommand("'" + tmpFileName + "' " + usingCmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlotData::PlotData(const XYStatData & data, XYStatData::CoordFilter f, Index i, const Index j, const bool abs)
|
||||||
|
{
|
||||||
|
string usingCmd, tmpFileName;
|
||||||
|
|
||||||
|
if (!abs)
|
||||||
|
{
|
||||||
|
usingCmd = (data.isXExact(i)) ? "u 1:3:4 w yerr" : "u 1:3:2:4 w xyerr";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
usingCmd = (data.isXExact(i)) ? "u 1:(abs($3)):4 w yerr" : "u 1:(abs($3)):2:4 w xyerr";
|
||||||
|
}
|
||||||
|
|
||||||
|
tmpFileName = dumpToTmpFile(data.getTable(i, j, f));
|
||||||
|
pushTmpFile(tmpFileName);
|
||||||
|
setCommand("'" + tmpFileName + "' " + usingCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
PlotData::PlotData(const XYStatData & data, XYStatData::PointFilter f, Index i, const Index j, const bool abs)
|
||||||
|
{
|
||||||
|
string usingCmd, tmpFileName;
|
||||||
|
|
||||||
|
if (!abs)
|
||||||
|
{
|
||||||
|
usingCmd = (data.isXExact(i)) ? "u 1:3:4 w yerr" : "u 1:3:2:4 w xyerr";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
usingCmd = (data.isXExact(i)) ? "u 1:(abs($3)):4 w yerr" : "u 1:(abs($3)):2:4 w xyerr";
|
||||||
|
}
|
||||||
|
|
||||||
|
tmpFileName = dumpToTmpFile(data.getTable(i, j, f));
|
||||||
|
pushTmpFile(tmpFileName);
|
||||||
|
setCommand("'" + tmpFileName + "' " + usingCmd);
|
||||||
|
}
|
||||||
|
|
||||||
// PlotPoint constructor ///////////////////////////////////////////////////////
|
// PlotPoint constructor ///////////////////////////////////////////////////////
|
||||||
PlotPoint::PlotPoint(const double x, const double y)
|
PlotPoint::PlotPoint(const double x, const double y)
|
||||||
{
|
{
|
||||||
@@ -446,6 +511,57 @@ PlotImpulses::PlotImpulses(const DVec &x, const DVec &y)
|
|||||||
setCommand("'" + tmpFileName + "' u 1:2 w impulses");
|
setCommand("'" + tmpFileName + "' u 1:2 w impulses");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PlotSteps constructor ////////////////////////////////////////////////////
|
||||||
|
PlotSteps::PlotSteps(const DVec &x, const DVec &y)
|
||||||
|
{
|
||||||
|
if (x.rows() != y.rows())
|
||||||
|
{
|
||||||
|
LATAN_ERROR(Size, "x and y vector does not have the same size");
|
||||||
|
}
|
||||||
|
|
||||||
|
DMat d(x.rows(), 2);
|
||||||
|
string tmpFileName;
|
||||||
|
|
||||||
|
for (Index i = 0; i < x.rows(); ++i)
|
||||||
|
{
|
||||||
|
d(i, 0) = x(i);
|
||||||
|
d(i, 1) = y(i);
|
||||||
|
}
|
||||||
|
tmpFileName = dumpToTmpFile(d);
|
||||||
|
pushTmpFile(tmpFileName);
|
||||||
|
setCommand("'" + tmpFileName + "' u 1:2 w steps");
|
||||||
|
}
|
||||||
|
|
||||||
|
// PlotGrid constructor ////////////////////////////////////////////////////////
|
||||||
|
PlotGrid::PlotGrid(const DVec &x, const DVec &y, const DMat &value)
|
||||||
|
{
|
||||||
|
if (x.size() != value.rows())
|
||||||
|
{
|
||||||
|
LATAN_ERROR(Size, "x vector does not have the same size as value matrix rows");
|
||||||
|
}
|
||||||
|
if (y.size() != value.cols())
|
||||||
|
{
|
||||||
|
LATAN_ERROR(Size, "y vector does not have the same size as value matrix columns");
|
||||||
|
}
|
||||||
|
if (value.rows() < 2 || value.cols() < 2)
|
||||||
|
{
|
||||||
|
LATAN_ERROR(Size, "value matrix must have at least 2 rows and 2 columns");
|
||||||
|
}
|
||||||
|
DMat d(value.cols()+1, value.rows()+1);
|
||||||
|
string tmpFileName;
|
||||||
|
d(0,0) = value.cols();
|
||||||
|
d.row(0).tail(value.cols()) = x;
|
||||||
|
d.col(0).tail(value.rows()) = y;
|
||||||
|
for (Index i = 0; i < value.rows(); ++i)
|
||||||
|
for (Index j = 0; j < value.cols(); ++j)
|
||||||
|
{
|
||||||
|
d(i+1, j+1) = value(j, i);
|
||||||
|
}
|
||||||
|
tmpFileName = dumpToTmpFile(d);
|
||||||
|
pushTmpFile(tmpFileName);
|
||||||
|
setCommand("'" + tmpFileName + "' nonuniform matrix w image");
|
||||||
|
}
|
||||||
|
|
||||||
// PlotMatrixNoRange constructor ///////////////////////////////////////////////
|
// PlotMatrixNoRange constructor ///////////////////////////////////////////////
|
||||||
PlotMatrixNoRange::PlotMatrixNoRange(const DMat &m)
|
PlotMatrixNoRange::PlotMatrixNoRange(const DMat &m)
|
||||||
{
|
{
|
||||||
@@ -515,14 +631,16 @@ void Dash::operator()(PlotOptions &option) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LogScale constructor ////////////////////////////////////////////////////////
|
// LogScale constructor ////////////////////////////////////////////////////////
|
||||||
LogScale::LogScale(const Axis axis)
|
LogScale::LogScale(const Axis axis, const double basis)
|
||||||
: axis_(axis)
|
: axis_(axis)
|
||||||
|
, basis_(basis)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// Logscale modifier ///////////////////////////////////////////////////////////
|
// Logscale modifier ///////////////////////////////////////////////////////////
|
||||||
void LogScale::operator()(PlotOptions &option) const
|
void LogScale::operator()(PlotOptions &option) const
|
||||||
{
|
{
|
||||||
option.scaleMode[static_cast<int>(axis_)] |= Plot::Scale::log;
|
option.scaleMode[static_cast<int>(axis_)] |= Plot::Scale::log;
|
||||||
|
option.logScaleBasis[static_cast<int>(axis_)] = basis_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PlotRange constructors //////////////////////////////////////////////////////
|
// PlotRange constructors //////////////////////////////////////////////////////
|
||||||
@@ -697,7 +815,7 @@ Plot & Plot::operator<<(PlotModifier &&modifier)
|
|||||||
|
|
||||||
// find gnuplot ////////////////////////////////////////////////////////////////
|
// find gnuplot ////////////////////////////////////////////////////////////////
|
||||||
#define SEARCH_DIR(dir) \
|
#define SEARCH_DIR(dir) \
|
||||||
sprintf(buf, "%s/%s", dir, gnuplotBin_.c_str());\
|
snprintf(buf, sizeof(buf), "%s/%s", dir, gnuplotBin_.c_str());\
|
||||||
if (access(buf, X_OK) == 0)\
|
if (access(buf, X_OK) == 0)\
|
||||||
{\
|
{\
|
||||||
return dir;\
|
return dir;\
|
||||||
@@ -773,7 +891,7 @@ void Plot::display(void)
|
|||||||
ostringstream scriptBuf;
|
ostringstream scriptBuf;
|
||||||
|
|
||||||
getProgramPath();
|
getProgramPath();
|
||||||
command = gnuplotPath_ + "/" + gnuplotBin_ + " 2>/dev/null";
|
command = gnuplotPath_ + "/" + gnuplotBin_;
|
||||||
gnuplotPipe = popen(command.c_str(), "w");
|
gnuplotPipe = popen(command.c_str(), "w");
|
||||||
if (!gnuplotPipe)
|
if (!gnuplotPipe)
|
||||||
{
|
{
|
||||||
@@ -875,6 +993,7 @@ ostream & Latan::operator<<(ostream &out, const Plot &plot)
|
|||||||
if (!plot.options_.terminal.empty())
|
if (!plot.options_.terminal.empty())
|
||||||
{
|
{
|
||||||
out << "set term " << plot.options_.terminal << endl;
|
out << "set term " << plot.options_.terminal << endl;
|
||||||
|
out << "set pointintervalbox 0" << endl;
|
||||||
}
|
}
|
||||||
if (!plot.options_.output.empty())
|
if (!plot.options_.output.empty())
|
||||||
{
|
{
|
||||||
@@ -915,11 +1034,11 @@ ostream & Latan::operator<<(ostream &out, const Plot &plot)
|
|||||||
out << "unset log" << endl;
|
out << "unset log" << endl;
|
||||||
if (plot.options_.scaleMode[x] & Plot::Scale::log)
|
if (plot.options_.scaleMode[x] & Plot::Scale::log)
|
||||||
{
|
{
|
||||||
out << "set log x" << endl;
|
out << "set log x " << plot.options_.logScaleBasis[x] << endl;;
|
||||||
}
|
}
|
||||||
if (plot.options_.scaleMode[y] & Plot::Scale::log)
|
if (plot.options_.scaleMode[y] & Plot::Scale::log)
|
||||||
{
|
{
|
||||||
out << "set log y" << endl;
|
out << "set log y " << plot.options_.logScaleBasis[y] << endl;
|
||||||
}
|
}
|
||||||
if (!plot.options_.label[x].empty())
|
if (!plot.options_.label[x].empty())
|
||||||
{
|
{
|
||||||
@@ -87,13 +87,22 @@ public:
|
|||||||
|
|
||||||
class PlotData: public PlotObject
|
class PlotData: public PlotObject
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
typedef std::pair<DVec, DVec> DVecPair;
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
|
PlotData(const DVecPair &x, const DVecPair &y, const bool abs = false);
|
||||||
|
PlotData(const DVec &x, const DVecPair &y, const bool abs = false);
|
||||||
|
PlotData(const DVecPair &x, const DVec &y, const bool abs = false);
|
||||||
PlotData(const DMatSample &x, const DMatSample &y, const bool abs = false);
|
PlotData(const DMatSample &x, const DMatSample &y, const bool abs = false);
|
||||||
PlotData(const DVec &x, const DMatSample &y, const bool abs = false);
|
PlotData(const DVec &x, const DMatSample &y, const bool abs = false);
|
||||||
PlotData(const DMatSample &x, const DVec &y, const bool abs = false);
|
PlotData(const DMatSample &x, const DVec &y, const bool abs = false);
|
||||||
PlotData(const XYStatData &data, const Index i = 0, const Index j = 0,
|
PlotData(const XYStatData &data, const Index i = 0, const Index j = 0,
|
||||||
const bool abs = false);
|
const bool abs = false);
|
||||||
|
PlotData(const XYStatData &data, XYStatData::CoordFilter f, Index i = 0,
|
||||||
|
const Index j = 0, const bool abs = false);
|
||||||
|
PlotData(const XYStatData &data, XYStatData::PointFilter f, Index i = 0,
|
||||||
|
const Index j = 0, const bool abs = false);
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~PlotData(void) = default;
|
virtual ~PlotData(void) = default;
|
||||||
};
|
};
|
||||||
@@ -182,6 +191,15 @@ public:
|
|||||||
virtual ~PlotHistogram(void) = default;
|
virtual ~PlotHistogram(void) = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class PlotSteps: public PlotObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// constructor
|
||||||
|
PlotSteps(const DVec &x, const DVec &y);
|
||||||
|
// destructor
|
||||||
|
virtual ~PlotSteps(void) = default;
|
||||||
|
};
|
||||||
|
|
||||||
class PlotImpulses: public PlotObject
|
class PlotImpulses: public PlotObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -191,6 +209,15 @@ public:
|
|||||||
virtual ~PlotImpulses(void) = default;
|
virtual ~PlotImpulses(void) = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class PlotGrid: public PlotObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// constructor
|
||||||
|
PlotGrid(const DVec &x, const DVec &y, const DMat &value);
|
||||||
|
// destructor
|
||||||
|
virtual ~PlotGrid(void) = default;
|
||||||
|
};
|
||||||
|
|
||||||
class PlotMatrixNoRange: public PlotObject
|
class PlotMatrixNoRange: public PlotObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -227,6 +254,7 @@ struct PlotOptions
|
|||||||
std::string caption;
|
std::string caption;
|
||||||
std::string title;
|
std::string title;
|
||||||
unsigned int scaleMode[2];
|
unsigned int scaleMode[2];
|
||||||
|
double logScaleBasis[2];
|
||||||
Range scale[2];
|
Range scale[2];
|
||||||
std::string label[2];
|
std::string label[2];
|
||||||
std::string lineColor;
|
std::string lineColor;
|
||||||
@@ -314,13 +342,14 @@ class LogScale: public PlotModifier
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
explicit LogScale(const Axis axis);
|
explicit LogScale(const Axis axis, const double basis = 10);
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~LogScale(void) = default;
|
virtual ~LogScale(void) = default;
|
||||||
// modifier
|
// modifier
|
||||||
virtual void operator()(PlotOptions &option) const;
|
virtual void operator()(PlotOptions &option) const;
|
||||||
private:
|
private:
|
||||||
const Axis axis_;
|
const Axis axis_;
|
||||||
|
const double basis_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PlotRange: public PlotModifier
|
class PlotRange: public PlotModifier
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -25,11 +25,13 @@ using namespace Latan;
|
|||||||
|
|
||||||
PlaceHolder Latan::_;
|
PlaceHolder Latan::_;
|
||||||
|
|
||||||
const string Env::fullName = PACKAGE_STRING;
|
const string Env::fullName = strFrom(PROJECT_NAME) + " " + strFrom(LATAN_SHORT_SHA) + " (v" + strFrom(PROJECT_VERSION) + ")";
|
||||||
const string Env::name = PACKAGE_NAME;
|
const string Env::name = PROJECT_NAME;
|
||||||
const string Env::version = PACKAGE_VERSION;
|
const string Env::version = PROJECT_VERSION;
|
||||||
const string Env::msgPrefix = "[" + strFrom(PACKAGE_NAME) + " v"
|
const string Env::gitShortSha = LATAN_SHORT_SHA;
|
||||||
+ strFrom(PACKAGE_VERSION) + "] ";
|
const string Env::gitSha = LATAN_SHA;
|
||||||
|
const string Env::gitBranch = LATAN_BRANCH;
|
||||||
|
const string Env::msgPrefix = "[" + Env::fullName + "] ";
|
||||||
|
|
||||||
void Env::function(void)
|
void Env::function(void)
|
||||||
{}
|
{}
|
||||||
@@ -54,6 +54,9 @@ namespace Env
|
|||||||
extern const std::string fullName;
|
extern const std::string fullName;
|
||||||
extern const std::string name;
|
extern const std::string name;
|
||||||
extern const std::string version;
|
extern const std::string version;
|
||||||
|
extern const std::string gitShortSha;
|
||||||
|
extern const std::string gitSha;
|
||||||
|
extern const std::string gitBranch;
|
||||||
extern const std::string msgPrefix;
|
extern const std::string msgPrefix;
|
||||||
// empty function for library test
|
// empty function for library test
|
||||||
void function(void);
|
void function(void);
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -105,12 +105,12 @@ const IoT& File::getData(const std::string &name) const
|
|||||||
{
|
{
|
||||||
return dynamic_cast<const IoT &>(*(data_.at(name)));
|
return dynamic_cast<const IoT &>(*(data_.at(name)));
|
||||||
}
|
}
|
||||||
catch(std::out_of_range)
|
catch (std::out_of_range &)
|
||||||
{
|
{
|
||||||
LATAN_ERROR(Definition, "no data with name '" + name + "' in file "
|
LATAN_ERROR(Definition, "no data with name '" + name + "' in file "
|
||||||
+ name_);
|
+ name_);
|
||||||
}
|
}
|
||||||
catch(std::bad_cast)
|
catch (std::bad_cast &)
|
||||||
{
|
{
|
||||||
LATAN_ERROR(Definition, "data with name '" + name + "' in file "
|
LATAN_ERROR(Definition, "data with name '" + name + "' in file "
|
||||||
+ name_ + " does not have type '" + typeid(IoT).name()
|
+ name_ + " does not have type '" + typeid(IoT).name()
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -58,6 +58,7 @@ libLatAnalyze_la_SOURCES = \
|
|||||||
Numerical/RootFinder.cpp \
|
Numerical/RootFinder.cpp \
|
||||||
Numerical/Solver.cpp \
|
Numerical/Solver.cpp \
|
||||||
Physics/CorrelatorFitter.cpp \
|
Physics/CorrelatorFitter.cpp \
|
||||||
|
Physics/DataFilter.cpp \
|
||||||
Physics/EffectiveMass.cpp \
|
Physics/EffectiveMass.cpp \
|
||||||
Statistics/FitInterface.cpp \
|
Statistics/FitInterface.cpp \
|
||||||
Statistics/Histogram.cpp \
|
Statistics/Histogram.cpp \
|
||||||
@@ -106,6 +107,7 @@ HPPFILES = \
|
|||||||
Numerical/RootFinder.hpp \
|
Numerical/RootFinder.hpp \
|
||||||
Numerical/Solver.hpp \
|
Numerical/Solver.hpp \
|
||||||
Physics/CorrelatorFitter.hpp \
|
Physics/CorrelatorFitter.hpp \
|
||||||
|
Physics/DataFilter.hpp \
|
||||||
Physics/EffectiveMass.hpp \
|
Physics/EffectiveMass.hpp \
|
||||||
Statistics/Dataset.hpp \
|
Statistics/Dataset.hpp \
|
||||||
Statistics/FitInterface.hpp \
|
Statistics/FitInterface.hpp \
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* CompositeMinimizer.cpp, part of LatAnalyze 3
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013 - 2024 Antonin Portelli
|
||||||
|
*
|
||||||
|
* LatAnalyze 3 is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* LatAnalyze 3 is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with LatAnalyze 3. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <LatAnalyze/Numerical/CompositeMinimizer.hpp>
|
||||||
|
#include <LatAnalyze/includes.hpp>
|
||||||
|
#include "CompositeMinimizer.hpp"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace Latan;
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* CompositeMinimizer implementation *
|
||||||
|
******************************************************************************/
|
||||||
|
// constructor ////////////////////////////////////////////////////////////////
|
||||||
|
CompositeMinimizer::CompositeMinimizer(const std::vector<Minimizer *> &minimizer)
|
||||||
|
: minVec_(minimizer)
|
||||||
|
{
|
||||||
|
if (minVec_.size() == 0)
|
||||||
|
{
|
||||||
|
LATAN_ERROR(Size, "minimizer vector has size 0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// access /////////////////////////////////////////////////////////////////////
|
||||||
|
bool CompositeMinimizer::supportLimits(void) const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// minimization ///////////////////////////////////////////////////////////////
|
||||||
|
const DVec &CompositeMinimizer::operator()(const DoubleFunction &f)
|
||||||
|
{
|
||||||
|
DVec &x = getState();
|
||||||
|
DVec tmp;
|
||||||
|
unsigned int i = 1, nMin = minVec_.size();
|
||||||
|
|
||||||
|
// resize minimizer state to match function number of arguments
|
||||||
|
if (f.getNArg() != x.size())
|
||||||
|
{
|
||||||
|
resize(f.getNArg());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto &m: minVec_)
|
||||||
|
{
|
||||||
|
if (getVerbosity() >= Verbosity::Normal)
|
||||||
|
{
|
||||||
|
cout << "********** Composite minimizer step " << i << "/" << nMin << endl;
|
||||||
|
}
|
||||||
|
m->setInit(x);
|
||||||
|
x = (*m)(f);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return x;
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* CompositeMinimizer.hpp, part of LatAnalyze 3
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013 - 2024 Antonin Portelli
|
||||||
|
*
|
||||||
|
* LatAnalyze 3 is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* LatAnalyze 3 is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with LatAnalyze 3. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef Latan_CompositeMinimizer_hpp_
|
||||||
|
#define Latan_CompositeMinimizer_hpp_
|
||||||
|
|
||||||
|
#include <LatAnalyze/Global.hpp>
|
||||||
|
#include <LatAnalyze/Functional/Function.hpp>
|
||||||
|
#include <LatAnalyze/Numerical/Minimizer.hpp>
|
||||||
|
|
||||||
|
BEGIN_LATAN_NAMESPACE
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Class for chaining minimizers *
|
||||||
|
******************************************************************************/
|
||||||
|
class CompositeMinimizer: public Minimizer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// constructors
|
||||||
|
explicit CompositeMinimizer(const std::vector<Minimizer *> &minimizer);
|
||||||
|
template <typename... Ts>
|
||||||
|
CompositeMinimizer(Minimizer &min, Ts & ... minimisers);
|
||||||
|
// destructor
|
||||||
|
virtual ~CompositeMinimizer(void) = default;
|
||||||
|
// access
|
||||||
|
virtual bool supportLimits(void) const;
|
||||||
|
// minimization
|
||||||
|
virtual const DVec & operator()(const DoubleFunction &f);
|
||||||
|
private:
|
||||||
|
std::vector<Minimizer *> minVec_;
|
||||||
|
};
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* CompositeMinimizer template implementation *
|
||||||
|
******************************************************************************/
|
||||||
|
template <typename... Ts>
|
||||||
|
CompositeMinimizer::CompositeMinimizer(Minimizer &min, Ts & ... minimisers)
|
||||||
|
{
|
||||||
|
static_assert(static_or<std::is_assignable<Minimizer &, Ts>::value...>::value,
|
||||||
|
"model arguments are not compatible with Minimizer");
|
||||||
|
|
||||||
|
|
||||||
|
minVec_ = {&min, &minimisers...};
|
||||||
|
if (minVec_.size() == 0)
|
||||||
|
{
|
||||||
|
LATAN_ERROR(Size, "minimizer vector has size 0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
END_LATAN_NAMESPACE
|
||||||
|
|
||||||
|
#endif // Latan_CompositeMinimizer_hpp_
|
||||||
@@ -32,46 +32,95 @@ DWT::DWT(const DWTFilter &filter)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
// convolution primitive ///////////////////////////////////////////////////////
|
// convolution primitive ///////////////////////////////////////////////////////
|
||||||
void DWT::filterConvolution(DVec &out, const DVec &data,
|
template <typename MatType>
|
||||||
|
void filterConvolution(MatType &out, const MatType &data,
|
||||||
const std::vector<double> &filter, const Index offset)
|
const std::vector<double> &filter, const Index offset)
|
||||||
{
|
{
|
||||||
Index n = data.size(), nf = n*filter.size();
|
Index n = data.rows(), nf = n*filter.size();
|
||||||
|
|
||||||
out.resize(n);
|
if (&out == &data)
|
||||||
|
{
|
||||||
|
LATAN_ERROR(Argument, "filter convolution does not support in-place operation");
|
||||||
|
}
|
||||||
|
out.resizeLike(data);
|
||||||
out.fill(0.);
|
out.fill(0.);
|
||||||
for (unsigned int i = 0; i < filter.size(); ++i)
|
for (unsigned int i = 0; i < filter.size(); ++i)
|
||||||
{
|
{
|
||||||
FOR_VEC(out, j)
|
FOR_MAT(out, j, k)
|
||||||
{
|
{
|
||||||
out(j) += filter[i]*data((j + i + nf - offset) % n);
|
out(j, k) += filter[i]*data((j + i + nf - offset) % n, k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DWT::filterConvolution(DVec &out, const DVec &data,
|
||||||
|
const std::vector<double> &filter, const Index offset)
|
||||||
|
{
|
||||||
|
::filterConvolution(out, data, filter, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DWT::filterConvolution(DMat &out, const DMat &data,
|
||||||
|
const std::vector<double> &filter, const Index offset)
|
||||||
|
{
|
||||||
|
::filterConvolution(out, data, filter, offset);
|
||||||
|
}
|
||||||
|
|
||||||
// downsampling/upsampling primitives //////////////////////////////////////////
|
// downsampling/upsampling primitives //////////////////////////////////////////
|
||||||
|
template <typename MatType>
|
||||||
|
void downsample(MatType &out, const MatType &in)
|
||||||
|
{
|
||||||
|
if (out.rows() < in.rows()/2)
|
||||||
|
{
|
||||||
|
LATAN_ERROR(Size, "output rows smaller than half the input vector rows");
|
||||||
|
}
|
||||||
|
if (out.cols() != in.cols())
|
||||||
|
{
|
||||||
|
LATAN_ERROR(Size, "output and input number of columns mismatch");
|
||||||
|
}
|
||||||
|
for (Index j = 0; j < in.cols(); j++)
|
||||||
|
for (Index i = 0; i < in.rows(); i += 2)
|
||||||
|
{
|
||||||
|
out(i/2, j) = in(i, j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DWT::downsample(DVec &out, const DVec &in)
|
void DWT::downsample(DVec &out, const DVec &in)
|
||||||
{
|
{
|
||||||
if (out.size() < in.size()/2)
|
::downsample(out, in);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DWT::downsample(DMat &out, const DMat &in)
|
||||||
|
{
|
||||||
|
::downsample(out, in);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename MatType>
|
||||||
|
void upsample(MatType &out, const MatType &in)
|
||||||
|
{
|
||||||
|
if (out.size() < 2*in.size())
|
||||||
{
|
{
|
||||||
LATAN_ERROR(Size, "output vector smaller than half the input vector size");
|
LATAN_ERROR(Size, "output rows smaller than twice the input rows");
|
||||||
}
|
}
|
||||||
for (Index i = 0; i < in.size(); i += 2)
|
if (out.cols() != in.cols())
|
||||||
{
|
{
|
||||||
out(i/2) = in(i);
|
LATAN_ERROR(Size, "output and input number of columns mismatch");
|
||||||
|
}
|
||||||
|
out.block(0, 0, 2*in.size(), out.cols()).fill(0.);
|
||||||
|
for (Index j = 0; j < in.cols(); j++)
|
||||||
|
for (Index i = 0; i < in.size(); i ++)
|
||||||
|
{
|
||||||
|
out(2*i, j) = in(i, j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DWT::upsample(DVec &out, const DVec &in)
|
void DWT::upsample(DVec &out, const DVec &in)
|
||||||
{
|
{
|
||||||
if (out.size() < 2*in.size())
|
::upsample(out, in);
|
||||||
{
|
}
|
||||||
LATAN_ERROR(Size, "output vector smaller than twice the input vector size");
|
|
||||||
}
|
void DWT::upsample(DMat &out, const DMat &in)
|
||||||
out.segment(0, 2*in.size()).fill(0.);
|
{
|
||||||
for (Index i = 0; i < in.size(); i ++)
|
::upsample(out, in);
|
||||||
{
|
|
||||||
out(2*i) = in(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DWT /////////////////////////////////////////////////////////////////////////
|
// DWT /////////////////////////////////////////////////////////////////////////
|
||||||
@@ -135,3 +184,26 @@ DVec DWT::backward(const std::vector<DWTLevel>& dwt) const
|
|||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// concatenate levels //////////////////////////////////////////////////////////
|
||||||
|
DVec DWT::concat(const std::vector<DWTLevel> &dwt, const int maxLevel, const bool dropLow)
|
||||||
|
{
|
||||||
|
unsigned int level = ((maxLevel >= 0) ? (maxLevel + 1) : dwt.size());
|
||||||
|
Index nlast = dwt[level - 1].first.size();
|
||||||
|
Index n = 2*dwt.front().first.size() - ((dropLow) ? nlast : 0);
|
||||||
|
Index pt = n, nl;
|
||||||
|
DVec res(n);
|
||||||
|
|
||||||
|
for (unsigned int l = 0; l < level; ++l)
|
||||||
|
{
|
||||||
|
nl = dwt[l].second.size();
|
||||||
|
pt -= nl;
|
||||||
|
res.segment(pt, nl) = dwt[l].second;
|
||||||
|
}
|
||||||
|
if (!dropLow)
|
||||||
|
{
|
||||||
|
res.segment(0, nl) = dwt[level-1].first;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <LatAnalyze/Global.hpp>
|
#include <LatAnalyze/Global.hpp>
|
||||||
#include <LatAnalyze/Numerical/DWTFilters.hpp>
|
#include <LatAnalyze/Numerical/DWTFilters.hpp>
|
||||||
|
#include <LatAnalyze/Core/Mat.hpp>
|
||||||
|
|
||||||
BEGIN_LATAN_NAMESPACE
|
BEGIN_LATAN_NAMESPACE
|
||||||
|
|
||||||
@@ -40,12 +41,18 @@ public:
|
|||||||
// convolution primitive
|
// convolution primitive
|
||||||
static void filterConvolution(DVec &out, const DVec &data,
|
static void filterConvolution(DVec &out, const DVec &data,
|
||||||
const std::vector<double> &filter, const Index offset);
|
const std::vector<double> &filter, const Index offset);
|
||||||
|
static void filterConvolution(DMat &out, const DMat &data,
|
||||||
|
const std::vector<double> &filter, const Index offset);
|
||||||
// downsampling/upsampling primitives
|
// downsampling/upsampling primitives
|
||||||
static void downsample(DVec &out, const DVec &in);
|
static void downsample(DVec &out, const DVec &in);
|
||||||
|
static void downsample(DMat &out, const DMat &in);
|
||||||
static void upsample(DVec &out, const DVec &in);
|
static void upsample(DVec &out, const DVec &in);
|
||||||
|
static void upsample(DMat &out, const DMat &in);
|
||||||
// DWT
|
// DWT
|
||||||
std::vector<DWTLevel> forward(const DVec &data, const unsigned int level) const;
|
std::vector<DWTLevel> forward(const DVec &data, const unsigned int level) const;
|
||||||
DVec backward(const std::vector<DWTLevel>& dwt) const;
|
DVec backward(const std::vector<DWTLevel>& dwt) const;
|
||||||
|
// concatenate levels
|
||||||
|
static DVec concat(const std::vector<DWTLevel>& dwt, const int maxLevel = -1, const bool dropLow = false);
|
||||||
private:
|
private:
|
||||||
DWTFilter filter_;
|
DWTFilter filter_;
|
||||||
};
|
};
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -30,8 +30,12 @@ namespace ROOT
|
|||||||
};
|
};
|
||||||
|
|
||||||
// macros necessary in the ROOT-based version of Minuit2
|
// macros necessary in the ROOT-based version of Minuit2
|
||||||
|
#ifndef ROOT_Math_VecTypes
|
||||||
#define ROOT_Math_VecTypes
|
#define ROOT_Math_VecTypes
|
||||||
|
#endif
|
||||||
|
#ifndef MATHCORE_STANDALONE
|
||||||
#define MATHCORE_STANDALONE
|
#define MATHCORE_STANDALONE
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <Minuit2/Minuit2Minimizer.h>
|
#include <Minuit2/Minuit2Minimizer.h>
|
||||||
#include <Math/Functor.h>
|
#include <Math/Functor.h>
|
||||||
@@ -160,8 +164,7 @@ const DVec & MinuitMinimizer::operator()(const DoubleFunction &f)
|
|||||||
{
|
{
|
||||||
if (getVerbosity() >= Verbosity::Normal)
|
if (getVerbosity() >= Verbosity::Normal)
|
||||||
{
|
{
|
||||||
cout << "========== Minuit minimization, pass #" << n + 1;
|
cout << "========== Minuit minimization, pass #" << n + 1 << endl;
|
||||||
cout << " =========" << endl;
|
|
||||||
}
|
}
|
||||||
min.Minimize();
|
min.Minimize();
|
||||||
status = min.Status();
|
status = min.Status();
|
||||||
File renamed without changes.
Loaded 100 of 142 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user