Skip to content

BUG: linalg.solve brings different results on numpy 1.x and 2.x #28709

Closed
@0x1abcd

Description

@0x1abcd

Describe the issue:

linalg.solve brings different results on numpy 1.26.4 and 2.2.3.
Is the version 2.2.3 result correct?

Reproduce the code example:

import numpy as np

print(np.linalg.solve(np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]), np.array([[1, 2], [3, 4]])))

Error message:

numpy version 1.26.4:
[[0.  0.5]
 [0.  0.5]]

numpy version 2.2.3:
[[[ 1.  0.]
  [ 0.  1.]]

 [[ 5.  4.]
  [-4. -3.]]]

Python and NumPy Versions:

1.26.4
3.12.7 | packaged by Anaconda, Inc. | (main, Oct 4 2024, 13:27:36) [GCC 11.2.0]

2.2.3
3.10.0 (default, Mar 3 2022, 09:58:08) [GCC 7.5.0]

Runtime Environment:

[{'numpy_version': '1.26.4',
'python': '3.12.7 | packaged by Anaconda, Inc. | (main, Oct 4 2024, '
'13:27:36) [GCC 11.2.0]',
'uname': uname_result(system='Linux', node='zzz', release='5.15.167.4-microsoft-standard-WSL2', version='#1 SMP Tue Nov 5 00:21:55 UTC 2024', machine='x86_64')},
{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2'],
'not_found': ['AVX512F',
'AVX512CD',
'AVX512_KNL',
'AVX512_KNM',
'AVX512_SKX',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL']}},
{'architecture': 'Haswell',
'filepath': '/home/jacin/anaconda3/lib/python3.12/site-packages/numpy.libs/libopenblas64_p-r0-0cf96a72.3.23.dev.so',
'internal_api': 'openblas',
'num_threads': 18,
'prefix': 'libopenblas',
'threading_layer': 'pthreads',
'user_api': 'blas',
'version': '0.3.23.dev'}]

[{'numpy_version': '2.2.3',
'python': '3.10.0 (default, Mar 3 2022, 09:58:08) [GCC 7.5.0]',
'uname': uname_result(system='Linux', node='zzz', release='5.15.167.4-microsoft-standard-WSL2', version='#1 SMP Tue Nov 5 00:21:55 UTC 2024', machine='x86_64')},
{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2'],
'not_found': ['AVX512F',
'AVX512CD',
'AVX512_KNL',
'AVX512_KNM',
'AVX512_SKX',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL']}},
{'architecture': 'Haswell',
'filepath': '/home/jacin/anaconda3/envs/llm4api/lib/python3.10/site-packages/numpy.libs/libscipy_openblas64_-6bb31eeb.so',
'internal_api': 'openblas',
'num_threads': 18,
'prefix': 'libscipy_openblas',
'threading_layer': 'pthreads',
'user_api': 'blas',
'version': '0.3.28'}]

Context for the issue:

No response

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