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

Add tuple-returning special functions #2931

Merged
merged 17 commits into from
Aug 18, 2023
Merged

Conversation

WardBrian
Copy link
Member

Summary

This adds the following functions which return tuples. Each is already implemented piecewise, these versions just reduce computation:

  • qr_thin
  • eigendecompose_sym
  • eigendecompose
  • complex_schur_decompose
  • svd
  • csr_extract

Tests

Existing tests for the base functions were copied and applied to these tuple-returning variants.

Side Effects

Release notes

Added new functions qr_thin, eigendecompose_sym, eigendecompose, complex_schur_decompose, svd, and csr_extract.
Each of these is equivalent to calling several existing functions, but should be more efficient due to sharing work. For example, svd(m) is equivalent to (svd_U(m), singular_values(m), svd_V(m)).

Checklist

  • Math issue: Closes Add tuple-returning versions of special functions #2845

  • Copyright holder: Simons Foundation

    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

@WardBrian WardBrian changed the title Feature/2845 tuple fns Add tuple-returning special functions Aug 16, 2023
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.

Looked over the code and looks good! Reviewing the tests now

stan/math/prim/fun/csr_extract.hpp Outdated Show resolved Hide resolved
stan/math/prim/fun/csr_extract.hpp Outdated Show resolved Hide resolved
stan/math/prim/fun/csr_extract.hpp Show resolved Hide resolved
stan/math/prim/fun/csr_extract.hpp Show resolved Hide resolved
stan/math/prim/fun/eigendecompose.hpp Outdated Show resolved Hide resolved
stan/math/prim/fun/qr_thin.hpp Outdated Show resolved Hide resolved
stan/math/prim/fun/svd.hpp Show resolved Hide resolved
stan/math/rev/fun/eigendecompose_sym.hpp Outdated Show resolved Hide resolved
stan/math/rev/fun/eigenvectors_sym.hpp Outdated Show resolved Hide resolved
stan/math/rev/fun/svd.hpp Outdated Show resolved Hide resolved
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.

Few small comments

stan/math/prim/fun/complex_schur_decompose.hpp Outdated Show resolved Hide resolved
stan/math/prim/fun/complex_schur_decompose.hpp Outdated Show resolved Hide resolved
stan/math/prim/fun/eigenvectors_sym.hpp Outdated Show resolved Hide resolved
stan/math/prim/fun/svd.hpp Outdated Show resolved Hide resolved
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.

One small comment but besides that lgtm!

@WardBrian WardBrian merged commit 5d1fd38 into develop Aug 18, 2023
7 checks passed
@WardBrian WardBrian deleted the feature/2845-tuple-fns branch August 18, 2023 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add tuple-returning versions of special functions
4 participants