Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

RFC: specify expected behavior for `matrix_norm` and `vector_norm` when provided an empty array

Open
#901 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
documentation

Research direction

Read the specification entries for matrix_norm and vector_norm, then review the linked NumPy pull request and Array API issue #232 for precedent. Done means the RFC reaches a decision and the specification explicitly records behavior for empty inputs across the stated ord and p cases.

Written by the indexing model from the issue text.

Description

RFC

It would be useful for the specification to state the expected result of an empty norm (related to the discussion in https://github.com/numpy/numpy/pull/28343)

In https://github.com/data-apis/array-api/issues/232, it was decided that sum and prod of empty arays should return 0 and 1 respectively, as these are the additive and multiplicative identites, and for min and max to leave the behavior explicitly undefined.

If we extend this logic to matrix_norm, it implies that for ord='fro' or ord='nuc', the result for an empty matrix should be 0.0, and for other values of ord the behavior is undefined.

Extending this logic to vector_norm, it implies that for an empty vector the p-norm should be 0.0 for positive p; the correct behavior for negative and infinite p are less clear to me.

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.