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

Added var<mat> implementation of log_determinant_spd (Issue #2101) #2232

Merged
merged 10 commits into from
Dec 11, 2020

Conversation

bbbales2
Copy link
Member

@bbbales2 bbbales2 commented Dec 3, 2020

Summary

Added var<mat> implementation of log_determinant_spd

Release notes

Added var<mat> implementation of log_determinant_spd

Checklist

  • Math issue Make functions with custom autodiff var<mat> friendly #2101

  • Copyright holder: Columbia University

    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.49 3.58 0.97 -2.65% slower
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.02 0.02 0.98 -1.82% slower
eight_schools/eight_schools.stan 0.11 0.12 0.99 -1.26% slower
gp_regr/gp_regr.stan 0.16 0.17 0.96 -3.71% slower
irt_2pl/irt_2pl.stan 5.78 5.84 0.99 -0.91% slower
performance.compilation 86.85 85.77 1.01 1.25% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 8.45 8.43 1.0 0.29% faster
pkpd/one_comp_mm_elim_abs.stan 29.84 29.28 1.02 1.85% faster
sir/sir.stan 139.86 130.0 1.08 7.05% faster
gp_regr/gen_gp_data.stan 0.05 0.04 1.03 2.95% faster
low_dim_gauss_mix/low_dim_gauss_mix.stan 3.07 2.95 1.04 4.15% faster
pkpd/sim_one_comp_mm_elim_abs.stan 0.37 0.39 0.97 -3.42% slower
arK/arK.stan 1.8 1.78 1.01 1.23% faster
arma/arma.stan 0.74 0.73 1.01 0.83% faster
garch/garch.stan 0.61 0.61 1.0 -0.07% slower
Mean result: 1.00466028744

Jenkins Console Log
Blue Ocean
Commit hash: 6cf40a2


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

@bbbales2
Copy link
Member Author

bbbales2 commented Dec 4, 2020

Ready for review

SteveBronder
SteveBronder previously approved these changes Dec 5, 2020
Copy link
Collaborator

@SteveBronder SteveBronder left a comment

Choose a reason for hiding this comment

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

Looks good! One optional suggestion but besides that lgtm!

Comment on lines 102 to 105
reverse_pass_callback([m, log_det, arena_m_inv_transpose]() mutable {
m.adj() += log_det.adj() * arena_m_inv_transpose;
});
return log_det;
Copy link
Collaborator

Choose a reason for hiding this comment

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

You could use make_callback_var/vari here but I'm also fine with reverse_pass_callback()

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
gp_pois_regr/gp_pois_regr.stan 3.7 3.57 1.04 3.54% faster
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.02 0.02 0.98 -1.87% slower
eight_schools/eight_schools.stan 0.11 0.11 1.0 0.3% faster
gp_regr/gp_regr.stan 0.17 0.16 1.01 0.96% faster
irt_2pl/irt_2pl.stan 5.76 5.79 0.99 -0.67% slower
performance.compilation 86.89 85.96 1.01 1.06% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 8.42 8.45 1.0 -0.36% slower
pkpd/one_comp_mm_elim_abs.stan 29.5 30.04 0.98 -1.85% slower
sir/sir.stan 133.82 132.51 1.01 0.98% faster
gp_regr/gen_gp_data.stan 0.04 0.04 1.0 -0.3% slower
low_dim_gauss_mix/low_dim_gauss_mix.stan 2.94 2.93 1.0 0.35% faster
pkpd/sim_one_comp_mm_elim_abs.stan 0.41 0.42 0.98 -2.47% slower
arK/arK.stan 1.77 1.79 0.99 -0.92% slower
arma/arma.stan 0.75 0.74 1.01 0.82% faster
garch/garch.stan 0.62 0.61 1.0 0.41% faster
Mean result: 1.00019847701

Jenkins Console Log
Blue Ocean
Commit hash: e66e95a


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

@bbbales2
Copy link
Member Author

bbbales2 commented Dec 8, 2020

@SteveBronder this is ready when tests passes. Took me two tries to get the make_callback_var right :/.

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
gp_pois_regr/gp_pois_regr.stan 3.48 3.43 1.01 1.22% faster
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.02 0.02 1.01 0.66% faster
eight_schools/eight_schools.stan 0.11 0.11 1.0 -0.3% slower
gp_regr/gp_regr.stan 0.16 0.16 1.05 5.0% faster
irt_2pl/irt_2pl.stan 5.8 5.86 0.99 -0.91% slower
performance.compilation 88.55 85.81 1.03 3.1% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 8.36 8.51 0.98 -1.78% slower
pkpd/one_comp_mm_elim_abs.stan 29.69 29.86 0.99 -0.59% slower
sir/sir.stan 129.57 141.65 0.91 -9.32% slower
gp_regr/gen_gp_data.stan 0.04 0.04 0.99 -1.35% slower
low_dim_gauss_mix/low_dim_gauss_mix.stan 2.94 2.91 1.01 1.15% faster
pkpd/sim_one_comp_mm_elim_abs.stan 0.39 0.39 0.99 -0.87% slower
arK/arK.stan 1.8 2.47 0.73 -36.64% slower
arma/arma.stan 0.59 0.59 1.0 0.37% faster
garch/garch.stan 0.59 0.6 0.97 -2.63% slower
Mean result: 0.978844858945

Jenkins Console Log
Blue Ocean
Commit hash: bcf11f9


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

@bbbales2
Copy link
Member Author

@SteveBronder this should be good to go. Only changes I did since your last review was swapping to make_callback_var

Copy link
Collaborator

@SteveBronder SteveBronder left a comment

Choose a reason for hiding this comment

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

Looks good!

@bbbales2 bbbales2 merged commit b207350 into develop Dec 11, 2020
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.

4 participants