-
Notifications
You must be signed in to change notification settings - Fork 116
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
Optional support for nalgebra types #347
Conversation
6e47b97
to
836c345
Compare
836c345
to
0ea6dc1
Compare
Agreed that having this as an optional feature makes sense for now. If users wanted to make the ndarray backend optional there can be a longer design discussion to figure out how to make it switchable. For this PR, do you think the method names should have nalgebra in them? E.g. |
I think this would be inconsistent with how we handle ndarray ( I do think that the probability of confusion is small though as ndarray's "array" terminology is nicely distinct from nalgebra's "matrix" terminology. One major issue I see is discoverability, e.g. searching for nalgebra will not yield those methods. But I think I would prefer to mitigate this using doc aliases: I will will also extend the top-level documentation to give an overview of the nalgebra support as introduced here. |
9fc9928
to
96d7a06
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this hard work!
I'm new to the nalgebra crate, but I enjoyed learning its unique features while reviewing 🙂
I have a few suggestions:
- Note that the converted NumPy array from nalgebra has always fortran-layout
- Conversion tests for a few more aliases (e.g.,
Vector3
) - Maybe we might want to ask some original authors (e.g., @de-vri-es) for a quick review if it's OK? I
Will do.
Will do. (I do see room for future improvements here as we currently convert a
Certainly. I think pinging them via your comment should be enough, right? |
Done. |
Honestly, it's been a while since I've looked at the numpy memory layout. I would trust someone who has dug through the docs more recently more than me ;) |
Thanks. Fair enough 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks :) just some comments and nits from me.
…ndency is enabled.
…bility of nalgebra support.
…bra matrices and test the conversion of the naglebra vector aliases.
54e98a7
to
b50319d
Compare
Thank you! |
This is loosely based on https://github.com/qsib-cbie/nalgebra-numpy (which is based on https://github.com/fusion-engineering/nalgebra-numpy targetting an older version of
pyo3
) but I tried to achieve a deeper integration into our existing types and optimized theToPyArray
implementation to copy contiguous data usingptr::copy_nonoverlapping
.Closes #263