8000 BUG: cholesky(empty((0, 0)), upper=True) hangs · Issue #25840 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
asmeurer opened this issue Feb 16, 2024 · 2 comments · Fixed by #25843
Closed

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

asmeurer opened this issue Feb 16, 2024 · 2 comments · Fixed by #25843
Labels

Comments

@asmeurer
Copy link
Member

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

@charris charris changed the title BUG: choleky(empty((0, 0)), upper=True) hangs BUG: cholesky(empty((0, 0)), upper=True) hangs Feb 16, 2024
@ngoldbaum
Copy link
Member

ping @mtsokol @mhvk

@mhvk
Copy link
Contributor
mhvk commented Feb 17, 2024

Oops, the problem was that I didn't really understand what size_t meant - it is unsigned, so 0 - 1 is a very large number. Fix was thus simple - see #25843.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
0