Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change boost::math defaults to avoid double to long double propagation #1348

Closed
wds15 opened this issue Sep 12, 2019 · 0 comments
Closed

Change boost::math defaults to avoid double to long double propagation #1348

wds15 opened this issue Sep 12, 2019 · 0 comments
Milestone

Comments

@wds15
Copy link
Contributor

wds15 commented Sep 12, 2019

Description

During the PR, #1255, the default policy boost_policy_t has been changed to avoid the propagation of input arguments from double to long double which is the default policy for boost::math. This boost_policy_t affects the boost::math functions in stan::math of

  • rising_factorial
  • falling_factorial
  • digamma
  • lgamma

The reason to avoid the propagation to long double is performance. Without the over-propagation the lgamma function runs significantly faster (~3x); the digamma function runs faster as well (2x). Negative binomial models, which use the digamma function, run now 2x faster while giving the same results. Thus, the slightly reduced precision due to avoiding the propagation does not seem to have noticeable speed precision impacts.

Moreover, the boost::math folks are considering themselves to change the default behaviour of boost::math to avoid the over propagation in future releases (see boostorg/math#241).

Therefore, we should consider to avoid the over-propagation for all boost math functions. This can be achieved by adding -DBOOST_MATH_PROMOTE_DOUBLE_POLICY=false to our makefiles.

Example

NA

Expected Output

Faster model inferences which involve boost::math functions

Current Version:

v2.20.0

@wds15 wds15 mentioned this issue Sep 12, 2019
5 tasks
@syclik syclik closed this as completed in 33d62b7 Sep 14, 2019
@serban-nicusor-toptal serban-nicusor-toptal added this to the 2.20.0++ milestone Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants