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

Return numpy arrays from Rust #155

Draft
wants to merge 4 commits into
base: fastsim-2
Choose a base branch
from
Draft

Return numpy arrays from Rust #155

wants to merge 4 commits into from

Conversation

kylecarow
Copy link
Collaborator

@kylecarow kylecarow commented Sep 13, 2024

@calbaker check this out!!!

I think setting using numpy arrays already worked, so this is something we can do now:
image

@kylecarow kylecarow requested a review from calbaker September 13, 2024 16:45
@kylecarow
Copy link
Collaborator Author

It seems some pymethods that return Vecs (e.g. RustCycle::get_dist_m) should be changed to return numpy arrays as well, so they don't become lists on the Python side. @calbaker thoughts?

@calbaker
Copy link
Collaborator

calbaker commented Dec 5, 2024

@kylecarow , is this ready to go?

@kylecarow kylecarow marked this pull request as draft December 5, 2024 21:20
@kylecarow
Copy link
Collaborator Author

kylecarow commented Dec 5, 2024

@calbaker The major thing that this needs is a warning or error on setting at an index: my_numpy_array[i] = ...
This PR doesn't do that yet

@calbaker
Copy link
Collaborator

calbaker commented Dec 9, 2024

@calbaker The major thing that this needs is a warning or error on setting at an index: my_numpy_array[i] = ... This PR doesn't do that yet

@kylecarow , could you maybe make a python class that inherits np.array and adds this behavior?

@calbaker
Copy link
Collaborator

@kylecarow, ping!

@kylecarow
Copy link
Collaborator Author

@calbaker This one is proving tricky, maybe we could look at it together sometime

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