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

Typed Array interface using rust-ndarray #9

Closed
termoshtt opened this issue May 6, 2017 · 4 comments
Closed

Typed Array interface using rust-ndarray #9

termoshtt opened this issue May 6, 2017 · 4 comments

Comments

@termoshtt
Copy link
Collaborator

From #5

@termoshtt termoshtt mentioned this issue May 11, 2017
@termoshtt
Copy link
Collaborator Author

In #14, we got an interface as ndarray::ArrayViewD<T>. This is enough to enable rust-ndarray functionality for PyArray.

The inverse conversion, e.g. ndarray::Array to PyArray will be implemented as IntoPyArray trait.
It will enable us to convert Vec<T>, &[T], and ndarray::Array to PyArray.

@crackcomm
Copy link

crackcomm commented May 11, 2017

Collecting from iterator to PyArray would be very useful:

assert_eq!(arr.iter().map(|x| f(x)).collect::<PyArray>())

@termoshtt
Copy link
Collaborator Author

I add ToPyArray trait at #15:

let arr = (0..10).map(|x| x * x).to_pyarray(gil.python(), &np);

@termoshtt
Copy link
Collaborator Author

Desired functionality has been implemented!

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

No branches or pull requests

2 participants