Skip to content

BUG: cholesky(empty((0, 0)), upper=True) hangs #25840

@asmeurer

Description

@asmeurer

Describe the issue:

The cholesky function hangs on empty matrices when upper=True. The function does not hang when upper=False (the default). Note that upper=True is new in NumPy 2.0.

Reproduce the code example:

import numpy as np
a = np.empty((0, 0), dtype=np.float64)
np.linalg.cholesky(a, upper=True)
# <HANGS>

Error message:

No response

Python and NumPy Versions:

2.0.0.dev0+git20240125.ac8b7ac
3.11.7 | packaged by conda-forge | (main, Dec 23 2023, 14:38:07) [Clang 16.0.6 ]

Runtime Environment:

[{'numpy_version': '2.0.0.dev0+git20240125.ac8b7ac',
'python': '3.11.7 | packaged by conda-forge | (main, Dec 23 2023, 14:38:07) '
'[Clang 16.0.6 ]',
'uname': uname_result(system='Darwin', node='Aarons-M3-MacBook-Pro.local', release='23.1.0', version='Darwin Kernel Version 23.1.0: Mon Oct 9 21:33:00 PDT 2023; root:xnu-10002.41.9~7/RELEASE_ARM64_T6031', machine='arm64')},
{'simd_extensions': {'baseline': ['NEON', 'NEON_FP16', 'NEON_VFPV4', 'ASIMD'],
'found': ['ASIMDHP'],
'not_found': ['ASIMDFHM']}}]

Context for the issue:

I'm not sure how important empty matrices really are for linalg functions like cholesky, but this is causing the array-api-tests to hang. data-apis/array-api-tests#101

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