Array comparison operators/functions

Open
#1,431 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
32/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
data

Research direction

Start by reviewing the requested ndarray comparison functions and operators in the issue, along with the existing array APIs that would need to support them. Define the comparison scope and expected behavior, including examples such as geq, allclose, isclose, and equal; done means the selected APIs are implemented with tests covering the documented comparisons.

Written by the indexing model from the issue text.

Description

enhancement

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));
Dominant language
Rust
Stars
4.3k
Forks
391
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-ndarray/ndarray

All issues in rust-ndarray/ndarray

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.