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

Adds vectorized versions of the constrain functions #2580

Merged
merged 3 commits into from
Sep 15, 2021

Conversation

SteveBronder
Copy link
Collaborator

Summary

Adds vectorized versions of the constrain functions that can take in containers of containers. This uses the same pattern as #2578 's *_free functions but with the *_constrain functions

Tests

Tests were added to check that going from untransformed -> constrained -> free'd of containers gives back the original values. Tests can be run with

./runTests.py -j4 test/unit/math/prim/fun/cholesky_corr_transform_test.cpp \
test/unit/math/prim/fun/cholesky_factor_transform_test.cpp \
test/unit/math/prim/fun/corr_matrix_transform_test.cpp \
test/unit/math/prim/fun/cov_matrix_transform_test.cpp \
test/unit/math/prim/fun/ordered_transform_test.cpp \
test/unit/math/prim/fun/positive_ordered_transform_test.cpp \
test/unit/math/prim/fun/simplex_transform_test.cpp \
test/unit/math/prim/fun/unit_vector_transform_test.cpp

Side Effects

Nope!

Release notes

Adds vectorized versions of the *_constrain 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

    • unit tests pass (to run, use: ./runTests.py test/unit)
    • header checks pass, (make test-headers)
    • dependencies checks pass, (make test-math-dependencies)
    • docs build, (make doxygen)
    • code passes the built in C++ standards checks (make cpplint)
  • the code is written in idiomatic C++ and changes are documented in the doxygen

  • the new changes are tested

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
gp_pois_regr/gp_pois_regr.stan 3.41 3.46 0.99 -1.27% slower
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.02 0.02 0.99 -1.09% slower
eight_schools/eight_schools.stan 0.09 0.1 0.97 -2.94% slower
gp_regr/gp_regr.stan 0.14 0.14 0.99 -1.02% slower
irt_2pl/irt_2pl.stan 5.07 5.1 0.99 -0.61% slower
performance.compilation 91.49 88.99 1.03 2.74% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 8.15 8.19 0.99 -0.55% slower
pkpd/one_comp_mm_elim_abs.stan 31.11 30.0 1.04 3.56% faster
sir/sir.stan 118.8 122.99 0.97 -3.53% slower
gp_regr/gen_gp_data.stan 0.03 0.03 0.99 -0.54% slower
low_dim_gauss_mix/low_dim_gauss_mix.stan 3.03 3.03 1.0 0.07% faster
pkpd/sim_one_comp_mm_elim_abs.stan 0.37 0.4 0.94 -6.29% slower
arK/arK.stan 2.07 2.07 1.0 -0.25% slower
arma/arma.stan 0.25 0.25 0.99 -0.63% slower
garch/garch.stan 0.61 0.61 1.0 -0.02% slower
Mean result: 0.992314499557

Jenkins Console Log
Blue Ocean
Commit hash: 1b909ee


Machine information ProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010

CPU:
Intel(R) Xeon(R) CPU E5-1680 v2 @ 3.00GHz

G++:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

Clang:
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

Copy link
Contributor

@bob-carpenter bob-carpenter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful. Thanks!

@bob-carpenter bob-carpenter merged commit 8920da4 into develop Sep 15, 2021
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

Successfully merging this pull request may close these issues.

None yet

3 participants