-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
Remove linear indexing requirements from functions #2205
Remove linear indexing requirements from functions #2205
Conversation
@t4c1 this revert has a math benchmark: #2147 This is the model from the July revert: https://discourse.mc-stan.org/t/cmdstan-2-24-release-candidate-now-available/16818/37 (timings further down) |
Also I'm not gonna complain if you implement all the functionality for #1982 :P. It would be convenient to have all these checks work on nested structures. |
…4.1 (tags/RELEASE_600/final)
…statcomp/math into no_linear_indexing_requirement
Thanks Ben. I ran those and fixed the code, so now it is as fast as develop. It turns out |
@@ -203,7 +196,7 @@ inline void elementwise_check(const F& is_good, const char* function, | |||
const Indexings&... indexings) { | |||
for (size_t j = 0; j < x.size(); j++) { | |||
elementwise_check(is_good, function, name, x[j], must_be, indexings..., "[", | |||
j, "]"); | |||
j + 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.
Why the + 1 here?
Does this have anything to do with Stan indexing by 1 or not? There's a variable for this here: https://github.com/stan-dev/math/blob/235090a31ccdabdd0d9d35bfb77ba3d4b984590f/stan/math/prim/meta/error_index.hpp
I think by default the Math library compiles as if it is indexing by 1, and you can optionally change this variable.
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.
Because I removed the +1 from internal::pipe_in
. Yeah I can change this to instead use + error_index::value.
Jenkins Console Log Machine informationProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010CPU: G++: Clang: |
This is ready for review. |
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.
Review!
Jenkins Console Log Machine informationProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010CPU: G++: Clang: |
Jenkins Console Log Machine informationProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010CPU: G++: Clang: |
@t4c1 looks good. Will approve when tests pass |
Jenkins Console Log Machine informationProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010CPU: G++: Clang: |
Summary
Modifies functions requiring linear indexing of their arguments to remove that requirement.
This reintroduces part of functionality reverted in #1982.
Tests
Expression tests are modified to use a block expression, which does not support linear indexing so the tests will fail for any function that still requires linear indexing.
Side Effects
None.
Release notes
Modified functions requiring linear indexing of their arguments to remove that requirement.
Checklist
Math issue Generalize matrix function signatures #1470
Copyright holder: Tadej Ciglarič
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