Add vectorized versions of the free functions#2574
Conversation
bob-carpenter
left a comment
There was a problem hiding this comment.
Thanks. This looks good.
I have a question about whether this will work for size 0 vectors as I don't know enough about decltype actually works. Assuming that's OK, this is OK to merge.
I made a suggestion for eliminating boilerplate, but it should be considered optional. It also contains a suggestion for solving the x[0] not existing problem brought up in the first comment.
Jenkins Console Log Machine informationProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010CPU: G++: Clang: |
bob-carpenter
left a comment
There was a problem hiding this comment.
Thanks! So glad you could get rid of all that boilerplate and use an existing framework. Feel free to merge if tests pass.
Jenkins Console Log Machine informationProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010CPU: G++: Clang: |
Summary
This is for stan-dev/stanc3#947 and allows the compiler to simply call the free functions for standard vectors holding containers instead of generating a for loop and iterating over them.
All the functions here are pretty much the same with the scheme being
Tests
Tests are added in each
*_constrain_test.cppto run the standard test to check input/output but instead uses a standard vector of eigen types. Change tests can be run usingSide Effects
Nope!
Release notes
Vectorize unconstrain functions
Checklist
Math issue #(issue number)
Copyright holder: Steve Bronder
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