FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

BUG: `vecdot` of object arrays along zero-length slice is `None` · Issue #31019 · numpy/numpy · GitHub

/ numpy Public

BUG: vecdot of object arrays along zero-length slice is None #31019

Description

Describe the issue:

For object arrays x, I expected vecdot to follow a definition like np.sum(x*x), but this doesn't seem to hold when the length along axis is 0. In this case, the result is None instead of 0.

Reproduce the code example:

import numpy as np
x = np.empty((0,), dtype=object)
np.vecdot(x, x)  # None
x = np.empty((1, 0), dtype=object)
np.vecdot(x, x)  # array([None], dtype=object)

Error message:

Python and NumPy Versions:

2.3.5
3.13.12 | packaged by conda-forge | (main, Feb 5 2026, 05:41:12) [MSC v.1944 64 bit (AMD64)]

Runtime Environment:

No response

How does this issue affect you or how did you find it:

Discovered in the context of running https://github.com/mdhaber/mparray/ against array-api-tests. I can work around it by adding a special case, but it would be nice to have it fixed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL