You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using intersect1d where the input arrays are of differing integer types, for example, int64 and uint64. The dtype of the resulting numpy array is float64. This feels like a bug where the correct dtype for the output should be the most general integer type (probably the signed integer).
Agreed, closing as duplicate of gh-20905. Granted, comparisons now get it right, but intersection uses sorting, so it's a bit of a weird thing...
It's weird, maybe we should change the behavior at some point, but it is "expected" and discussed in many other places we can add to.
Describe the issue:
When using intersect1d where the input arrays are of differing integer types, for example, int64 and uint64. The dtype of the resulting numpy array is float64. This feels like a bug where the correct dtype for the output should be the most general integer type (probably the signed integer).
Reproduce the code example:
Error message:
No response
Python and NumPy Versions:
1.26.2
3.12.0 | packaged by Anaconda, Inc. | (main, Oct 2 2023, 12:22:05) [Clang 14.0.6 ]
Runtime Environment:
[{'numpy_version': '1.26.2',
'python': '3.12.0 | packaged by Anaconda, Inc. | (main, Oct 2 2023, '
'12:22:05) [Clang 14.0.6 ]',
'uname': uname_result(system='Darwin', node='Arthurs-MacBook-Air.local', release='23.1.0', version='Darwin Kernel Version 23.1.0: Mon Oct 9 21:28:31 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T8112', machine='arm64')},
{'simd_extensions': {'baseline': ['NEON', 'NEON_FP16', 'NEON_VFPV4', 'ASIMD'],
'found': ['ASIMDHP'],
'not_found': ['ASIMDFHM']}},
{'architecture': 'armv8',
'filepath': '/Users/arthurtolley/miniconda3/envs/test_env/lib/libopenblasp-r0.3.21.dylib',
'internal_api': 'openblas',
'num_threads': 8,
'prefix': 'libopenblas',
'threading_layer': 'pthreads',
'user_api': 'blas',
'version': '0.3.21'}]
None
Context for the issue:
This bug was preventing the usage of the output of intersect1d from being used to index an array further along our script.
We have enforced explicit types for the inputs to intersect1d in a recent PR: gwastro/pycbc#4586
The text was updated successfully, but these errors were encountered: