Skip to content

Generalize view and size functions #1660

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

Merged
merged 6 commits into from
Feb 24, 2020

Conversation

t4c1
Copy link
Contributor

@t4c1 t4c1 commented Jan 30, 2020

Summary

Generalizes inputs to view and size functions (col, row, sub_col, sub_row, head, tail, diagonal, transpose, cols, rows, num_elements, dims).

Tests

This is a refactor so no new tests.

Side Effects

None.

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

    • 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

@t4c1
Copy link
Contributor Author

t4c1 commented Jan 30, 2020

I think this error will be gone once #1628 is merged in.

# Conflicts:
#	stan/math/prim/fun/cols.hpp
#	stan/math/prim/fun/transpose.hpp
@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
gp_pois_regr/gp_pois_regr.stan 5.06 5.12 0.99 -1.14% slower
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.02 0.02 0.99 -0.62% slower
eight_schools/eight_schools.stan 0.09 0.1 0.9 -10.98% slower
gp_regr/gp_regr.stan 0.22 0.22 1.0 -0.08% slower
irt_2pl/irt_2pl.stan 6.05 6.1 0.99 -0.79% slower
performance.compilation 89.45 87.2 1.03 2.52% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 7.49 7.47 1.0 0.2% faster
pkpd/one_comp_mm_elim_abs.stan 21.24 20.78 1.02 2.21% faster
sir/sir.stan 89.84 96.38 0.93 -7.28% slower
gp_regr/gen_gp_data.stan 0.05 0.05 0.99 -1.16% slower
low_dim_gauss_mix/low_dim_gauss_mix.stan 3.01 2.99 1.01 0.61% faster
pkpd/sim_one_comp_mm_elim_abs.stan 0.32 0.32 0.99 -1.46% slower
arK/arK.stan 1.74 1.74 1.0 -0.31% slower
arma/arma.stan 0.79 0.79 1.0 -0.04% slower
garch/garch.stan 0.58 0.59 0.99 -0.67% slower
Mean result: 0.98850650244

Jenkins Console Log
Blue Ocean
Commit hash: 59335f6


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

@t4c1
Copy link
Contributor Author

t4c1 commented Feb 18, 2020

This is now ready for a review.

Copy link
Member

@rok-cesnovar rok-cesnovar left a comment

Choose a reason for hiding this comment

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

This is missing some tests then its good to go. I flagged all functions that need them.

* @throw <code>std::out_of_range</code> if the index is out of range.
*/
template <typename T, typename = require_eigen_vector_t<T>>
inline void check_vector_index(const char* function, const char* name,
Copy link
Member

Choose a reason for hiding this comment

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

This function is missing tests.

@stan-buildbot
Copy link
Contributor


Name Old Result New Result Ratio Performance change( 1 - new / old )
gp_pois_regr/gp_pois_regr.stan 4.79 5.0 0.96 -4.43% slower
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.02 0.02 1.02 1.82% faster
eight_schools/eight_schools.stan 0.09 0.09 0.94 -6.88% slower
gp_regr/gp_regr.stan 0.22 0.23 0.96 -4.67% slower
irt_2pl/irt_2pl.stan 6.08 6.24 0.97 -2.57% slower
performance.compilation 88.18 88.44 1.0 -0.29% slower
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 7.3 7.49 0.98 -2.5% slower
pkpd/one_comp_mm_elim_abs.stan 20.8 21.95 0.95 -5.54% slower
sir/sir.stan 90.12 91.88 0.98 -1.95% slower
gp_regr/gen_gp_data.stan 0.04 0.05 0.98 -1.88% slower
low_dim_gauss_mix/low_dim_gauss_mix.stan 2.99 3.06 0.98 -2.52% slower
pkpd/sim_one_comp_mm_elim_abs.stan 0.33 0.31 1.04 3.66% faster
arK/arK.stan 1.74 1.79 0.98 -2.44% slower
arma/arma.stan 0.76 0.81 0.94 -6.63% slower
garch/garch.stan 0.53 0.54 0.97 -3.49% slower
Mean result: 0.974562119405

Jenkins Console Log
Blue Ocean
Commit hash: c98fa84


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
Member

@rok-cesnovar rok-cesnovar left a comment

Choose a reason for hiding this comment

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

Thanks for adding tests.

@rok-cesnovar rok-cesnovar merged commit cdb9d14 into stan-dev:develop Feb 24, 2020
@rok-cesnovar rok-cesnovar deleted the generalize_view_and_size branch February 24, 2020 07:44
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.

3 participants