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

Accepting integer arguments for Array::range? #525

Open
nyanpasu64 opened this issue Nov 1, 2018 · 1 comment
Open

Accepting integer arguments for Array::range? #525

nyanpasu64 opened this issue Nov 1, 2018 · 1 comment

Comments

@nyanpasu64
Copy link

Right now I'm trying to pass integer arguments to Array::range. I have to first cast arguments to f32, then casting the result to int doesn't compile arr.mapv(|elem| elem as usize) does it work for Linspace<>?.

I noticed that range() works as I want for end<begin (unlike 5..1 which is empty). However #493 (comment) indicates I will have to perform data copies on every single range() I call, which sounds like a waste of resources.

Why doesn't Array::range and Linspace accept integer values?

@bluss
Copy link
Member

bluss commented Nov 3, 2018

They are made for float arguments, use from_iter for integers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants