-
-
Notifications
You must be signed in to change notification settings - Fork 193
Cleanup unnecessary prim/fun signatures and checks (redundant as of C++11) #1702
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
Conversation
#ifdef _WIN32 | ||
if (is_inf(x)) | ||
return x; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This worked fine on my Windows box, but will let Jenkins give the final verdict. Will just revert back if Jenkins flags this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this what made the test fail on Jenkins?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, will remove once I update the PR. Was hoping it could go away :)
#endif | ||
return std::acosh(x); | ||
} | ||
check_greater_or_equal("acosh", "x", x, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think is_nan for integer inputs is redundant, isnt it?
Closing this for now as there are some additional question that need to be solved. |
Summary
C++11 added overloads for integers for some of the base functions. Previously Stan Math had its own overloads for these to avoid ambiguity with (var) overloads as it wasnt clear whether to promote to double or var.
This PR removes the following:
- asinh(double) and asinh(int)
- cbrt(double), cbrt(int)
- erf(double), erf(int)
- erfc(double), erf(int)
- exp(int)
- expm1(int)
- log(int)
- sqrt(int)
- round(double), round(int)
- trunc(double), trunc(int)
The following integer overloads will stay in:
Due to removing some signatures I had to fix the functions to now use std for double/int inputs. And that then led to a minor code cleanup in gp_matern* files.
This now also fixes #1704 by including
cmath
and adding usingstd::log
statements in lgamma_stirling and lbeta.Tests
No new tests, existing tests cover all the cases.
Side Effects
Hopefully none.
Checklist
Math issue Investigate which int overloads are still needed (exp, pow, ...) #1692
Copyright holder: Rok Češnovar
The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
- Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
the basic tests are passing
./runTests.py test/unit
)make test-headers
)make test-math-dependencies
)make doxygen
)make cpplint
)the code is written in idiomatic C++ and changes are documented in the doxygen
the new changes are tested