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

csr_matrix_time_vector data * var specialization #2462

Merged
merged 2 commits into from
Apr 23, 2021

Conversation

SteveBronder
Copy link
Collaborator

Summary

This adds a SparseMatrix<data> * Vector<var> specialization in rev. I think this is a pretty common case. For instance in brms for random effects models this can optionally be used. I think the pattern here should be faster than the alternative of doing a multi-index

Tests

Tests were added in mix for the csr matrix times vector

./runTests.py ./test/unit/math/mix/fun/csr_matrix_times_vector_test

Side Effects

I can also do this for sparse var on the lhs, though I think it requires a little extra fiddling and that would be a bit more of an involved PR

Release notes

Adds reverse mode specialization for `csr_matrix_times_vector(sparse data, dense parameter)

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.38 3.41 0.99 -0.81% slower
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.02 0.02 0.97 -3.58% slower
eight_schools/eight_schools.stan 0.11 0.12 0.95 -4.88% slower
gp_regr/gp_regr.stan 0.16 0.16 1.04 3.7% faster
irt_2pl/irt_2pl.stan 6.02 6.12 0.98 -1.68% slower
performance.compilation 92.29 89.15 1.04 3.4% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 8.6 8.75 0.98 -1.75% slower
pkpd/one_comp_mm_elim_abs.stan 28.46 29.96 0.95 -5.28% slower
sir/sir.stan 128.58 133.86 0.96 -4.11% slower
gp_regr/gen_gp_data.stan 0.04 0.04 1.03 2.92% faster
low_dim_gauss_mix/low_dim_gauss_mix.stan 3.08 3.01 1.02 2.17% faster
pkpd/sim_one_comp_mm_elim_abs.stan 0.4 0.38 1.06 5.33% faster
arK/arK.stan 1.86 1.87 1.0 -0.48% slower
arma/arma.stan 0.76 0.77 0.99 -0.9% slower
garch/garch.stan 0.56 0.59 0.95 -5.41% slower
Mean result: 0.993637150405

Jenkins Console Log
Blue Ocean
Commit hash: 2a39e03


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

@SteveBronder
Copy link
Collaborator Author

@t4c1 do you have time to take a look at this?

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