ndarray
ndarray copied to clipboard
Elementwise comparison, with array result
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).
Yes, but the comparison operators can't return this. Slightly differently named methods may.
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..
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);