LinalgScalar does not have to imply Sub and Div

Open
#737 10 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Stale
Tech stack
rust
Domain
backend

Research direction

Start with src/linalg_traits.rs at the linked LinalgScalar definition, then inspect its uses and run the relevant test suite to identify which bounds are required. Done means the unnecessary Sub, Div, Add, and Mul bounds are relaxed without breaking compilation or existing tests.

Written by the indexing model from the issue text.

Description

Recall the definition of LinalgScalar:
https://github.com/rust-ndarray/ndarray/blob/eb82c93f0147df38e061597221ece3627f119a60/src/linalg_traits.rs#L18-L28

However, no algorithm involving LinalgScalar requires the scalar to be invertible in the additive group and multiplicative semigroup, in this crate at the very least. Therefore, Sub and Div trait bounds are not used. It would be more flexible if Sub and Div trait bounds are relaxed.

In addition, Add<Self, Output=Self> and Mul<Self, Output=Self> is already implied by num::Zero and num::One, respectively. These trait bounds can be relaxed, too.

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.