From 00b52c752c17505b066262bba3b032966af44852 Mon Sep 17 00:00:00 2001 From: Vanya Belyaev Date: Sat, 17 Dec 2022 16:56:41 +0100 Subject: [PATCH] prepare v1.9.5.4 --- CMakeLists.txt | 2 +- ReleaseNotes/release_notes.md | 2 + ReleaseNotes/v1.9.5.4,md | 23 +++++++ ostap/math/tests/test_math_ve2.py | 109 ++++++++++++++++++++++++------ source/include/Ostap/MoreMath.h | 17 ++--- 5 files changed, 124 insertions(+), 29 deletions(-) create mode 100644 ReleaseNotes/v1.9.5.4,md diff --git a/CMakeLists.txt b/CMakeLists.txt index 39d37289..82f3c250 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ include(CTest) set(OSTAP_VERSION_MAJOR 1) set(OSTAP_VERSION_MINOR 9) set(OSTAP_VERSION_PATCH 5) -set(OSTAP_VERSION_TWEAK 3) +set(OSTAP_VERSION_TWEAK 4) set(OSTAP_VERSION ${OSTAP_VERSION_MAJOR}.${OSTAP_VERSION_MINOR}.${OSTAP_VERSION_PATCH}.${OSTAP_VERSION_TWEAK}) diff --git a/ReleaseNotes/release_notes.md b/ReleaseNotes/release_notes.md index 1ebfe87e..bf477876 100644 --- a/ReleaseNotes/release_notes.md +++ b/ReleaseNotes/release_notes.md @@ -1,3 +1,5 @@ +# v1.9.5.4 + ## New features: 1. add an explicit ouble-adaptive CQUAD integrator for `Integrator1D` and `Ostap::Math::Integrator` diff --git a/ReleaseNotes/v1.9.5.4,md b/ReleaseNotes/v1.9.5.4,md new file mode 100644 index 00000000..1b83567f --- /dev/null +++ b/ReleaseNotes/v1.9.5.4,md @@ -0,0 +1,23 @@ +# v1.9.5.4 + +## New features: + + 1. add an explicit ouble-adaptive CQUAD integrator for `Integrator1D` and `Ostap::Math::Integrator` + 1. add an explicit Romberg integrator for `Integrator1D` and `Ostap::Math::Integrator` + 1. add a new test for `Ostap::Math::Integrator` + 1. extend and impove `Ostap::Math::Integrator` + 1. backport functinality for the older versions of ROOT/PyROOT + 1. fix the test for ROOT<6.18 + 1. add ROOT-version dependent switch in `add_new_branch` + 1. some improvements for frame progress bar + 1. some improvements for frame-based `tree_reduce` + 1. disable new frame-test for old ROOT + 1. add treatment of new `ROOT.RooFit.MaxCalls` agrument + + +## Backward incompatible: + + 1. rename some methods for `Ostap::Math::Integrator` + +## Bug fixes: + diff --git a/ostap/math/tests/test_math_ve2.py b/ostap/math/tests/test_math_ve2.py index 9b556d41..fd4d1b59 100755 --- a/ostap/math/tests/test_math_ve2.py +++ b/ostap/math/tests/test_math_ve2.py @@ -9,10 +9,11 @@ """ Test module for ostap/math/math_ve.py """ # ============================================================================= -import math -from ostap.math.ve import VE -from ostap.math.base import cpp, iszero, isequal -from ostap.math.math_ve import * +import math, random +from ostap.math.ve import VE +from ostap.math.base import cpp, iszero, isequal +import ostap.logger.table as T +from ostap.math.math_ve import * # ============================================================================= from ostap.logger.logger import getLogger if '__main__' == __name__ : logger = getLogger ( 'test_math_ve2' ) @@ -22,34 +23,102 @@ vars = [ VE ( 0.001 , 0.0001**2 ) , VE(1,0) , VE(1,0.1**2) , VE(10,0.01**2) ] -funcs = [ exp , expm1 , - log , log10 , log1p , - sqrt , cbrt , - sin , cos , tan , - sinh , cosh , tanh , sech , - asin , acos , atan , - asinh , acosh , atanh , - erf , erfc , erfi , erfcx , - probit , - gamma , tgamma , lgamma , igamma ] +funcs = [ exp , expm1 , + log , log10 , log1p , + sqrt , cbrt , + sin , cos , tan , + sinh , cosh , tanh , sech , + asin , acos , atan , + asinh , acosh , atanh , + erf , erfc , erfi , erfcx , + sinc , + probit , + gamma , tgamma , lgamma , igamma , + psi , digamma , trigamma , + ] ## use helper object: from ostap.math.derivative import EvalVE funcs += [ EvalVE ( math.sin , math.cos ) , EvalVE ( math.sin ) ] -def test_math_ve(): +# ============================================================================= +def test_math_ve1 (): + + logger = getLogger("test_math_ve1") + + rows = [ ( 'Function' , 'argument' , 'value' ) ] + for v in vars : - logger.info ( 'Var = %s ' % v ) for f in funcs : - logger.info ( "\t%s\t%s = %s " % ( f.__name__ , v , f(v) ) ) + row = f.__name__ , str ( v ) , str ( f ( v ) ) + rows.append ( row ) + + title = 'Functions' + table = T.table ( rows, title = title , prefix = '# ' , alignment = 'lcc' ) + logger.info ( '%s\n%s' % ( title , table ) ) + + +# ============================================================================= +def test_math_ve2 (): - + logger = getLogger("test_math_ve2") + + + funcs = [ ( exp , -1 , 1 ) , + ( expm1 , -1 , 1 ) , + ( log , 1 , 2 ) , + ( log10 , 1 , 2 ) , + ( log1p , 1 , 2 ) , + ( sqrt , 1 , 2 ) , + ( cbrt , 1 , 2 ) , + ( sin , -1 , 1 ) , + ( cos , -1 , 1 ) , + ( tan , -1 , 1 ) , + ( sinh , -1 , 1 ) , + ( cosh , -1 , 1 ) , + ( tanh , -1 , 1 ) , + ( sech , -1 , 1 ) , + ( asin , -1 , 1 ) , + ( acos , -1 , 1 ) , + ( atan , -1 , 1 ) , + ( asinh , -1 , 1 ) , + ( acosh , 1 , 2 ) , + ( atanh , -1 , 1 ) , + ( erf , -1 , 1 ) , + ( erfc , -1 , 1 ) , + ( erfi , -1 , 1 ) , + ( erfcx , -1 , 1 ) , + ( sinc , -1 , 1 ) , + ( probit , -1 , 1 ) , + ( gamma , 1 , 2 ) , + ( tgamma , 1 , 2 ) , + ( lgamma , 1 , 2 ) , + ( igamma , 1 , 2 ) , + ( psi , 1 , 2 ) , + ( digamma , 1 , 2 ) , + ( trigamma , 1 , 2 ) ] + + rows = [ ( 'Function' , 'argument' , 'value' ) ] + + for f,a,b in funcs : + + x = random.uniform ( a , b ) + row = f.__name__ , '%s' % x , '%s' % f ( x ) + ## row = f.__name__ , '%+5.3f' % x , '+.3g' % f ( x ) ) + rows.append ( row ) + + title = 'Functions' + table = T.table ( rows, title = title , prefix = '# ' , alignment = 'lcc' ) + logger.info ( '%s\n%s' % ( title , table ) ) + + # ============================================================================= if '__main__' == __name__ : - test_math_ve() + test_math_ve1 () + test_math_ve2 () # ============================================================================= -# The END +## The END # ============================================================================= diff --git a/source/include/Ostap/MoreMath.h b/source/include/Ostap/MoreMath.h index b85d1e4b..9adc68ef 100644 --- a/source/include/Ostap/MoreMath.h +++ b/source/include/Ostap/MoreMath.h @@ -245,7 +245,7 @@ namespace Ostap * @see http://ab-initio.mit.edu/Faddeeva * @see https://en.wikipedia.org/wiki/Error_function */ - double erfi ( const double x ) ; + double erfi ( const double x ) ; // ======================================================================== /** Dowson function * \f[ f(x) = \frac{\sqrt{\pi}}{2} * e^{-z^2} * erfi(z) \f] @@ -255,7 +255,7 @@ namespace Ostap * @see https://en.wikipedia.org/wiki/Error_function * @see https://en.wikipedia.org/wiki/Dowson_function */ - double dowson ( const double x ) ; + double dowson ( const double x ) ; // ======================================================================== /** Mill's ratio for normal distribution * - \f$ m (x) = \frac{1 - \Phi(x)}{\phi(x)}\f$ @@ -264,7 +264,7 @@ namespace Ostap * @see https://en.wikipedia.org/wiki/Mills_ratio * @see Ostap::Math::erfcx */ - double mills_normal ( const double x ) ; + double mills_normal ( const double x ) ; // ======================================================================== /** Product of the Gaussian PDF and Millt's ratio * \f$ f(a,b) = \phi(a) R(b) \f$ @@ -272,21 +272,22 @@ namespace Ostap * @see Ostap::Math::ExGauss * @see Ostap::Math::NormalLaplace */ - double gauss_mills ( const double a , const double b ) ; + double gauss_mills ( const double a , const double b ) ; // ======================================================================== - /** Compute sech function + /** \overload Compute sech function * \f[ f(x) = \frac{1}{\cosh x} = \frac{2}{ e^{x}+e^{-x} }\f] * @return the value of sech function */ - double sech ( const double x ) ; + std::complex sech ( const std::complex& x ) ; // ======================================================================== - /** \overload Compute sech function + /** Compute sech function * \f[ f(x) = \frac{1}{\cosh x} = \frac{2}{ e^{x}+e^{-x} }\f] * @return the value of sech function */ - std::complex sech ( const std::complex& x ) ; + double sech ( const double x ) ; // ======================================================================== + // ======================================================================== // Gamma function and fiends // ========================================================================