Skip to content

Commit

Permalink
Merge branch 'master' into testbinom
Browse files Browse the repository at this point in the history
  • Loading branch information
mbaudin47 authored Sep 4, 2024
2 parents d6d6723 + 63a8fa4 commit 9870ae3
Show file tree
Hide file tree
Showing 180 changed files with 2,007 additions and 1,499 deletions.
1 change: 1 addition & 0 deletions .ci_support/run_docker_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ cmake -DCMAKE_INSTALL_PREFIX=~/.local \
-DCMAKE_C_FLAGS="--coverage" -DCMAKE_CXX_FLAGS="--coverage -fuse-ld=mold" \
-DSWIG_COMPILE_FLAGS="-O1" \
-DUSE_SPHINX=OFF \
-DUSE_HMAT=ON \
${source_dir}
make install
OPENTURNS_NUM_THREADS=1 ctest -R pyinstallcheck --output-on-failure --timeout 200 ${MAKEFLAGS} --repeat after-timeout:2 --schedule-random
Expand Down
5 changes: 2 additions & 3 deletions .circleci/run_docker_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ cmake -DCMAKE_INSTALL_PREFIX=~/.local \
-DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=32 \
-DCMAKE_C_FLAGS="-Wall -Wextra -Wpedantic -Werror" -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Wshadow -Werror -D_GLIBCXX_ASSERTIONS -fuse-ld=mold" \
-DSWIG_COMPILE_FLAGS="-O1 -Wno-unused-parameter -Wno-shadow" \
-DSPHINX_FLAGS="-W -T -j4" \
-DUSE_HMAT=ON \
-DUSE_SPHINX=ON -DSPHINX_FLAGS="-W -T -j4" \
${source_dir}
make install
OPENTURNS_NUM_THREADS=1 make install
if test -n "${uid}" -a -n "${gid}"
then
cp -r ~/.local/share/doc/openturns/html .
Expand Down
5 changes: 2 additions & 3 deletions .circleci/run_docker_mingw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@ fi

mkdir build && cd build

ARCH=i686
ARCH=x86_64
MINGW_PREFIX=/usr/${ARCH}-w64-mingw32
PYMAJMIN=310
PREFIX=${PWD}/install
CXXFLAGS="-Wall -Wextra -Wpedantic -Wshadow -Werror -D_GLIBCXX_ASSERTIONS" ${ARCH}-w64-mingw32-cmake \
CXXFLAGS="-Wall -Wextra -Wpedantic -Wshadow -Werror -D_GLIBCXX_ASSERTIONS -fuse-ld=lld" ${ARCH}-w64-mingw32-cmake \
-DSWIG_COMPILE_FLAGS="-O0 -Wno-unused-parameter -Wno-shadow" \
-DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_INSTALL_LIBDIR=${PREFIX}/lib \
-DPython_INCLUDE_DIR=${MINGW_PREFIX}/include/python${PYMAJMIN} \
-DPython_LIBRARY=${MINGW_PREFIX}/lib/libpython${PYMAJMIN}.dll.a \
-DPython_EXECUTABLE=/usr/bin/${ARCH}-w64-mingw32-python${PYMAJMIN}-bin \
-DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=32 \
-DUSE_TBB=OFF \
${source_dir}
make install
${ARCH}-w64-mingw32-strip --strip-unneeded ${PREFIX}/bin/*.dll ${PREFIX}/Lib/site-packages/openturns/*.pyd
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4
- run: |
brew install openblas swig boost python3 tbb nlopt cminpack ceres-solver bison flex hdf5 ipopt primesieve spectra pagmo cuba nanoflann
pip3 install matplotlib scipy chaospy pandas dill --break-system-packages
pip3 install matplotlib "numpy<2" scipy chaospy pandas dill --break-system-packages
- run: |
cmake \
-DCMAKE_INSTALL_PREFIX=~/.local \
Expand Down
31 changes: 15 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ option (USE_HDF5 "Use HDF5 for high volume storage"
option (USE_BOOST "Use Boost for distribution computation" ON)
option (USE_MPFR "Use MPFR for real valued special functions computation" ON)
option (USE_MPC "Use MPC for complex valued special functions computation" ON)
option (USE_SPHINX "Use sphinx for documentation" ON)
option (USE_SPHINX "Use sphinx for documentation" OFF)
option (USE_DOXYGEN "Use Doxygen for API documentation" ON)
option (USE_NLOPT "Use NLopt for additional optimization algorithms" ON)
option (USE_CERES "Use Ceres Solver for additional optimization algorithms" ON)
Expand Down Expand Up @@ -256,7 +256,16 @@ if (HDF5_FOUND)
endif ()

if (USE_BOOST)
find_package (Boost 1.46)
find_package (Boost CONFIG 1.46)
if (Boost_FOUND)
message(STATUS "Found Boost: ${Boost_DIR} (found suitable version \"${Boost_VERSION}\")")
endif ()

# fallback to FindBoost before its deprecation
if (CMAKE_VERSION VERSION_LESS 3.30 AND NOT Boost_FOUND)
find_package (Boost MODULE 1.46)
endif ()

if (Boost_FOUND)
if (CMAKE_VERSION VERSION_LESS 3.15)
# Boost_VERSION reports the integer BOOST_VERSION from boost/version.hpp instead of x.y.z format
Expand All @@ -281,7 +290,7 @@ if (USE_BOOST)
list (APPEND OPENTURNS_ENABLED_FEATURES "mpc")
endif ()
endif ()
list (APPEND OPENTURNS_PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
list (APPEND OPENTURNS_PRIVATE_LIBRARIES Boost::boost)
list (APPEND OPENTURNS_ENABLED_FEATURES "boost")
endif ()
endif ()
Expand Down Expand Up @@ -624,20 +633,10 @@ if (BUILD_PYTHON)
endif ()
endif ()

if (NOT DEFINED PYTHON_SITE_PACKAGES AND NOT CMAKE_CROSSCOMPILING)
execute_process (COMMAND ${Python_EXECUTABLE} -c "import sysconfig, os; print(sysconfig.get_path('platlib').replace(sysconfig.get_path('data'), '').lstrip(os.path.sep))"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE)
file (TO_CMAKE_PATH "${PYTHON_SITE_PACKAGES}" PYTHON_SITE_PACKAGES)
endif ()

if (DEFINED PYTHON_SITE_PACKAGES)
set (OPENTURNS_PYTHON_MODULE_PATH "${PYTHON_SITE_PACKAGES}")
if (WIN32)
set (OPENTURNS_PYTHON_MODULE_PATH Lib/site-packages CACHE PATH "site-packages dir")
else ()
if (WIN32)
set (OPENTURNS_PYTHON_MODULE_PATH Lib/site-packages)
else ()
set (OPENTURNS_PYTHON_MODULE_PATH ${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages)
endif ()
set (OPENTURNS_PYTHON_MODULE_PATH ${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages CACHE PATH "site-packages dir")
endif ()
endif ()
endif ()
Expand Down
1 change: 0 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"binaryDir": "${sourceDir}/build",
"generator": "Unix Makefiles",
"cacheVariables": {
"USE_SPHINX": "OFF",
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_C_FLAGS": "-Wall -Wextra -Wpedantic -Wshadow",
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -Wshadow -D_GLIBCXX_ASSERTIONS -fno-inline",
Expand Down
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
=== Library ===

==== Major changes ====
* Swapped InverseGamma shape/scale parameters: InverseGamma(k, lambda)

==== New classes ====

Expand Down
1 change: 0 additions & 1 deletion distro/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ override_dh_auto_configure:
dh_auto_configure -Bbuilddir -- \
$(with_tbb) \
-Dot_configure_date:STRING='$(BUILD_DATE)' \
-DUSE_SPHINX:BOOL=OFF \
-DCMAKE_SKIP_INSTALL_RPATH:BOOL=ON \
-DCMAKE_INSTALL_PREFIX:PATH=/usr \
-DCMAKE_INSTALL_LIBDIR:PATH="/usr/lib/$(DEB_HOST_MULTIARCH)" \
Expand Down
26 changes: 14 additions & 12 deletions lib/etc/openturns.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,14 @@
<!DOCTYPE configuration>
<openturns-configuration version="1" >

<Path-TemporaryDirectory value_str="@TEMPDIR@" />
<!-- TBB-ThreadsNumber is set by default to the number of cores of the machine.
To set manually the number of threads used for parallel computing, uncomment the following line:
-->
<!--<TBB-ThreadsNumber value_int="1" />-->
<Cache-MaxSize value_int="1024" />
<Cache-MaxSize value_int="65536" />

<!-- OT::Os parameters -->
<Os-CreateProcess value_bool="false" />
<Os-RemoveFiles value_bool="true" />
<Os-DeleteTimeout value_int="2" />

<!-- OT::XMLStorageManager parameters -->
<XMLStorageManager-DefaultCompressionLevel value_int="0" />
Expand Down Expand Up @@ -556,7 +553,7 @@
<GeneralizedParetoFactory-MaximumRelativeError value_float="1.0e-10" />
<GeneralizedParetoFactory-MeanResidualLifeConfidenceLevel value_float="0.95" />
<GeneralizedParetoFactory-ThresholdStabilityConfidenceLevel value_float="0.95" />
<GeneralizedParetoFactory-MaximumEvaluationNumber value_int="1000" />
<GeneralizedParetoFactory-MaximumCallsNumber value_int="1000" />
<GeneralizedParetoFactory-MeanResidualLifePointNumber value_int="100" />
<GeneralizedParetoFactory-ThresholdStabilityPointNumber value_int="100" />
<GeneralizedParetoFactory-SmallSize value_int="20" />
Expand All @@ -579,13 +576,14 @@
<KernelMixture-SmallSize value_int="50" />

<!-- OT::KernelSmoothing parameters -->
<KernelSmoothing-AbsolutePrecision value_float="0.0" />
<KernelSmoothing-CutOffPlugin value_float="5.0" />
<KernelSmoothing-RelativePrecision value_float="1.0e-5" />
<KernelSmoothing-ResidualPrecision value_float="1.0e-10" />
<KernelSmoothing-BinNumber value_int="1024" />
<KernelSmoothing-MaximumIteration value_int="50" />
<KernelSmoothing-SmallSize value_int="250" />
<KernelSmoothing-AbsolutePrecision value_float="0.0" />
<KernelSmoothing-CutOffPlugin value_float="5.0" />
<KernelSmoothing-RelativePrecision value_float="1.0e-5" />
<KernelSmoothing-ResidualPrecision value_float="1.0e-10" />
<KernelSmoothing-DefaultShiftScale value_float="1.0e-5" />
<KernelSmoothing-BinNumber value_int="1024" />
<KernelSmoothing-MaximumIteration value_int="50" />
<KernelSmoothing-SmallSize value_int="250" />

<!-- OT::LogNormal parameters -->
<LogNormal-CharacteristicFunctionSmallSigmaThreshold value_float="0.2" />
Expand All @@ -604,6 +602,9 @@
<MarginalDistribution-MaximumSubIntervals value_int="128" />
<MarginalDistribution-Rule value_str="G15K31" />

<!-- MarginalUniformOrderStatistics parameters -->
<MarginalUniformOrderStatistics-LargeCaseCDF value_int="1000" />

<!-- Meixner parameters -->
<MeixnerDistribution-MaximumAbsoluteError value_float="1.0e-12" />
<MeixnerDistribution-MaximumConstraintError value_float="1.0e-12" />
Expand Down Expand Up @@ -1100,6 +1101,7 @@
<SimplicialCubature-DefaultMaximumRelativeError value_float="1.0e-5" />
<SimplicialCubature-DefaultMaximumCallsNumber value_int="10000" />
<SimplicialCubature-DefaultRule value_int="3" />
<SimplicialCubature-MarginalDiscretizationIntervalsNumber value_int="1" />

<!-- OT::SparseMethod parameters -->
<SparseMethod-ErrorThreshold value_float="1.0e-3" />
Expand Down
17 changes: 15 additions & 2 deletions lib/src/Base/Algo/EnclosingSimplexMonotonic1D.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@ static const Factory<EnclosingSimplexMonotonic1D> Factory_EnclosingSimplexMonoto
/* Constructor without parameters */
EnclosingSimplexMonotonic1D::EnclosingSimplexMonotonic1D()
: EnclosingSimplexAlgorithmImplementation()
, increasing_(true)
{
// Nothing to do
}

/* Parameter constructor */
EnclosingSimplexMonotonic1D::EnclosingSimplexMonotonic1D(const Sample & vertices)
: EnclosingSimplexAlgorithmImplementation()
, increasing_(true)
{
IndicesCollection simplices;
setVerticesAndSimplices(vertices, simplices);
Expand Down Expand Up @@ -161,4 +159,19 @@ String EnclosingSimplexMonotonic1D::__str__(const String & ) const
return OSS(false) << "class=" << EnclosingSimplexMonotonic1D::GetClassName();
}

/* Method save() stores the object through the StorageManager */
void EnclosingSimplexMonotonic1D::save(Advocate & adv) const
{
EnclosingSimplexAlgorithmImplementation::save(adv);
adv.saveAttribute("increasing_", increasing_);
}


/* Method load() reloads the object from the StorageManager */
void EnclosingSimplexMonotonic1D::load(Advocate & adv)
{
EnclosingSimplexAlgorithmImplementation::load(adv);
adv.loadAttribute("increasing_", increasing_);
}

END_NAMESPACE_OPENTURNS
42 changes: 34 additions & 8 deletions lib/src/Base/Algo/RegularGridEnclosingSimplex.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ static const Factory<RegularGridEnclosingSimplex> Factory_RegularGridEnclosingSi
/* Constructor without parameters */
RegularGridEnclosingSimplex::RegularGridEnclosingSimplex()
: EnclosingSimplexAlgorithmImplementation()
, start_(0)
, N_(0)
, step_(0)
{
// Nothing to do
}
Expand Down Expand Up @@ -68,11 +65,21 @@ RegularGridEnclosingSimplex * RegularGridEnclosingSimplex::emptyClone() const
void RegularGridEnclosingSimplex::setVerticesAndSimplices(const Sample & vertices, const IndicesCollection & simplices)
{
EnclosingSimplexAlgorithmImplementation::setVerticesAndSimplices(vertices, simplices);
// Check that sample can be converted to a RegularGrid, and get N, start, step
RegularGrid newGrid = Mesh(vertices);
start_ = newGrid.getStart();
N_ = newGrid.getN();
step_ = newGrid.getStep();
if (vertices.getSize())
{
// Check that sample can be converted to a RegularGrid, and get N, start, step
RegularGrid newGrid = Mesh(vertices);
start_ = newGrid.getStart();
N_ = newGrid.getN();
step_ = newGrid.getStep();
}
else
{
// allow one to reset it
start_ = 0.0;
N_ = 0.0;
step_ = 0.0;
}
}

/* Get the index of the enclosing simplex of the given point */
Expand Down Expand Up @@ -109,4 +116,23 @@ String RegularGridEnclosingSimplex::__str__(const String & ) const
return OSS(false) << "class=" << RegularGridEnclosingSimplex::GetClassName();
}

/* Method save() stores the object through the StorageManager */
void RegularGridEnclosingSimplex::save(Advocate & adv) const
{
EnclosingSimplexAlgorithmImplementation::save(adv);
adv.saveAttribute("start_", start_);
adv.saveAttribute("N_", N_);
adv.saveAttribute("step_", step_);
}


/* Method load() reloads the object from the StorageManager */
void RegularGridEnclosingSimplex::load(Advocate & adv)
{
EnclosingSimplexAlgorithmImplementation::load(adv);
adv.loadAttribute("start_", start_);
adv.loadAttribute("N_", N_);
adv.loadAttribute("step_", step_);
}

END_NAMESPACE_OPENTURNS
17 changes: 14 additions & 3 deletions lib/src/Base/Algo/SimplicialCubature.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "openturns/SimplicialCubature.hxx"
#include "openturns/PersistentObjectFactory.hxx"
#include "openturns/ResourceMap.hxx"
#include "openturns/IntervalMesher.hxx"

BEGIN_NAMESPACE_OPENTURNS

Expand All @@ -34,7 +35,7 @@ static const Factory<SimplicialCubature> Factory_SimplicialCubature;

/* Default constructor */
SimplicialCubature::SimplicialCubature()
: PersistentObject()
: IntegrationAlgorithmImplementation()
, rule_(ResourceMap::GetAsUnsignedInteger("SimplicialCubature-DefaultRule"))
, maximumAbsoluteError_(ResourceMap::GetAsScalar("SimplicialCubature-DefaultMaximumAbsoluteError"))
, maximumRelativeError_(ResourceMap::GetAsScalar("SimplicialCubature-DefaultMaximumRelativeError"))
Expand Down Expand Up @@ -116,14 +117,14 @@ String SimplicialCubature::__str__(const String & ) const
/* Method save() stores the object through the StorageManager */
void SimplicialCubature::save(Advocate & adv) const
{
PersistentObject::save(adv);
IntegrationAlgorithmImplementation::save(adv);
adv.saveAttribute("rule_", rule_);
}

/* Method load() reloads the object from the StorageManager */
void SimplicialCubature::load(Advocate & adv)
{
PersistentObject::load(adv);
IntegrationAlgorithmImplementation::load(adv);
adv.loadAttribute("rule_", rule_);
}

Expand Down Expand Up @@ -151,6 +152,16 @@ UnsignedInteger SimplicialCubature::getNodeNumber(const UnsignedInteger dimensio
}


Point SimplicialCubature::integrate(const Function & function,
const Interval & interval) const
{
const UnsignedInteger intervalsNumber = ResourceMap::GetAsUnsignedInteger("SimplicialCubature-MarginalDiscretizationIntervalsNumber");
const Indices discretization(interval.getDimension(), intervalsNumber);
const IntervalMesher mesher(discretization);
const Mesh mesh(mesher.build(interval));
return integrate(function, mesh);
}

/* Compute an approximation of \int_a^b f(x_1,\dots,x_n)dx_1\dotsdx_n, where [a,b] is an n-D interval.
*/
Point SimplicialCubature::integrate(const Function & F, const Mesh & mesh) const
Expand Down
8 changes: 7 additions & 1 deletion lib/src/Base/Algo/openturns/EnclosingSimplexMonotonic1D.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,16 @@ public:
/** String converter */
String __str__(const String & offset = "") const override;

/** Method save() stores the object through the StorageManager */
void save(Advocate & adv) const override;

/** Method load() reloads the object from the StorageManager */
void load(Advocate & adv) override;

private:

/** Flag telling whether vertices are sorted in ascending or descending order */
Bool increasing_;
Bool increasing_ = true;

} ; /* class EnclosingSimplexMonotonic1D */

Expand Down
12 changes: 9 additions & 3 deletions lib/src/Base/Algo/openturns/RegularGridEnclosingSimplex.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,18 @@ public:
/** String converter */
String __str__(const String & offset = "") const override;

/** Method save() stores the object through the StorageManager */
void save(Advocate & adv) const override;

/** Method load() reloads the object from the StorageManager */
void load(Advocate & adv) override;

private:

/** Cached values taken from grid_ */
Scalar start_;
UnsignedInteger N_;
Scalar step_;
Scalar start_ = 0.0;
UnsignedInteger N_ = 0.0;
Scalar step_ = 0.0;

} ; /* class RegularGridEnclosingSimplex */

Expand Down
Loading

0 comments on commit 9870ae3

Please sign in to comment.