Skip to content

Allow select to return eigen expressions if both branches match#3343

Closed
andrjohns wants to merge 5 commits into
developfrom
select-expr
Closed

Allow select to return eigen expressions if both branches match#3343
andrjohns wants to merge 5 commits into
developfrom
select-expr

Conversation

@andrjohns

Copy link
Copy Markdown
Collaborator

Summary

Updates the select() function to support returning Eigen expressions as long as the same expression type is passed for both branches.

Tests

Extra tests for expression returns have been added

Side Effects

N/A

Release notes

The select() function will now return eigen expressions without evaluation if both expression types match

Checklist

  • Copyright holder: Andrew Johnson

    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

@andrjohns

Copy link
Copy Markdown
Collaborator Author

The current implementation also requires that both branches have the same dimensions as well as the same type (e.g., select(c, vec1, vec2) requires vec1 and vec2 to be the same length) - which feels like an unnecessary restriction - safe for me to remove?

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.

2 participants