Skip to content

Elementwise comparison, with array result #35

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

Open
aldanor opened this issue Dec 27, 2015 · 3 comments
Open

Elementwise comparison, with array result #35

aldanor opened this issue Dec 27, 2015 · 3 comments

Comments

@aldanor
Copy link

aldanor commented Dec 27, 2015

Would it make sense to have a.le(b) (also a.leq(b), a.ge(b), a.geq(b)) return boolean arrays? (where a, b : PartialOrd and properly broadcastable).

@bluss
Copy link
Member

bluss commented Dec 27, 2015

Yes, but the comparison operators can't return this. Slightly differently named methods may.

@aldanor
Copy link
Author

aldanor commented Dec 27, 2015

I meant PartialOrd of course -- and forgot that it already uses these method names :)

So ne, eq, ge, gt, le, lt are taken by traits, I guess the names could be something like equal, not_equal, less, less_or_equal (or less_than, leq_than), or something like that..

@bluss bluss changed the title Comparison operators Elementwise comparison, with array result Jan 16, 2016
@rust-ndarray rust-ndarray deleted a comment from bluss May 17, 2023
@rust-ndarray rust-ndarray deleted a comment from aldanor May 17, 2023
@rust-ndarray rust-ndarray deleted a comment from bluss May 17, 2023
@nilgoyette
Copy link
Collaborator

Might be a good idea. In the meantime, one can use map_collect

let lt = Zip::from(&a).and(&b).map_collect(|&a, &b| a < b);

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

3 participants