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

Eigen support for special matrix objects #316

Merged
merged 2 commits into from
Aug 4, 2016

Conversation

jagerman
Copy link
Member

@jagerman jagerman commented Aug 4, 2016

One more eigen support enhancement.

Functions returning specialized Eigen matrices like Eigen::DiagonalMatrix and Eigen::SelfAdjointView--which inherit from EigenBase but not DenseBase--isn't currently allowed; such classes are explicitly copyable into a Matrix (by definition), and so we can support functions that return them (but can't be handled via DenseBase) by copying the value into a Matrix then casting that resulting dense Matrix into a numpy.ndarray. This commit does exactly that.

This also includes some doc updates that cover this and the previous eigen PR changes.

Functions returning specialized Eigen matrices like Eigen::DiagonalMatrix and
Eigen::SelfAdjointView--which inherit from EigenBase but not
DenseBase--isn't currently allowed; such classes are explicitly copyable
into a Matrix (by definition), and so we can support functions that
return them by copying the value into a Matrix then casting that
resulting dense Matrix into a numpy.ndarray.  This commit does exactly
that.
@@ -1098,6 +1098,14 @@ pybind11 will automatically and transparently convert
1. Static and dynamic Eigen dense vectors and matrices to instances of
``numpy.ndarray`` (and vice versa).

1. Returned matrix expressions such as blocks (including columns or rows) and
Copy link
Member

Choose a reason for hiding this comment

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

super-minor: this should probably be a list with increasing numbers :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops; I saw the old repeated 1. and assumed it worked like Markdown, but apparently not

@wjakob
Copy link
Member

wjakob commented Aug 4, 2016

Thanks!

@wjakob wjakob merged commit 67bfeb1 into pybind:master Aug 4, 2016
@jagerman jagerman deleted the eigen-base-types branch August 4, 2016 20:38
@rwgk rwgk mentioned this pull request Feb 9, 2023
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

2 participants