ndarray icon indicating copy to clipboard operation
ndarray copied to clipboard

Array comparison operators/functions

Open Qazalbash opened this issue 1 year ago • 3 comments
trafficstars

Hi,

I come from a Python background. I have used numpy for array-based computing and recently started working on JAX. They have very easy-to-use array comparison functions ^1^3 to check the relative, partial order etc. I find a lack of these functions/operators here. It would be a great enhancement and would help in testing code without writing a bunch of lines to compare errors or check the relationship between two arrays.

Until now I have been doing things like this,

assert!(distance.iter().all(|&d| d >= -ERR_MARGIN));

With the feature, it should more or less look like this,

assert!(distance.geq(-ERR_MARGIN));

Qazalbash avatar Aug 28 '24 00:08 Qazalbash