Should implementing `__imatmul__` really be enforced?

Open
#509 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
numpy, python

Research direction

Read the issue alongside NumPy PR #21912, then review the current array API treatment of in-place matmul, @=, and shape compatibility. Done means reaching a documented decision on whether imatmul should be required and what in-place and assignment semantics apply.

Written by the indexing model from the issue text.

Description

topic: Linear Algebra

I was not around when this may have been discussed in https://github.com/numpy/numpy/pull/21912. In-place matmul is a weird beast, but for NumPy it would be strange to make @= and out-of-place operator.
Because of this, NumPy doesn't define it currently, and I am unsure that it should be done. Would NumPy have the tight restriction that the shape must fit and we actually assign back to a (i.e. truly in-place at all operators?).

That would make sense, but even then, it would even be slower and use as much memory as before anyway.

Dominant language
Python
Stars
281
Forks
52
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

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 data-apis/array-api

All issues in data-apis/array-api

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.