Skip to content
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

BUG: meshgrid() for 3 or 4 arrays of input is giving wrong results #26796

Open
R0ckySu opened this issue Jun 25, 2024 · 1 comment
Open

BUG: meshgrid() for 3 or 4 arrays of input is giving wrong results #26796

R0ckySu opened this issue Jun 25, 2024 · 1 comment
Labels
33 - Question Question about NumPy usage or development

Comments

@R0ckySu
Copy link

R0ckySu commented Jun 25, 2024

Describe the issue:

meshgrid() works fine with just 2 arrays as input.
When working with higher dimension(greater than 3) it fails to construct the meshgrid in the right order.

Reproduce the code example:

A = [1,2,3]
B = [311,422]
C = [0.11,0.22,0.33]
Am, Bm, Cm = np.meshgrid(A,B,C)

Error message:

Expect Bm to be:
array([[[311, 311, 311],
        [422, 422, 422]],

       [[311, 311, 311],
        [422, 422, 422]],

       [[311, 311, 311],
        [422, 422, 422]]])
But get:
array([[[311, 311, 311],
        [311, 311, 311],
        [311, 311, 311]],

       [[422, 422, 422],
        [422, 422, 422],
        [422, 422, 422]]])

Python and NumPy Versions:

1.26.4
3.9.19 | packaged by conda-forge | (main, Mar 20 2024, 12:38:46) [MSC v.1929 64 bit (AMD64)]

Runtime Environment:

[{'numpy_version': '1.26.4',
'python': '3.9.19 | packaged by conda-forge | (main, Mar 20 2024, 12:38:46) '
'[MSC v.1929 64 bit (AMD64)]',
'uname': uname_result(system='Windows', node='DESKTOP-5LVQAIH', release='10', version='10.0.22621', machine='AMD64')},
{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2',
'AVX512F',
'AVX512CD',
'AVX512_SKX',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL'],
'not_found': []}},
{'architecture': 'SkylakeX',
'filepath': 'C:\Users\LabUser '
'OPX\AppData\Roaming\Python\Python39\site-packages\numpy.libs\libopenblas64__v0.3.23-293-gc2f4bdbb-gcc_10_3_0-2bde3a66a51006b2b53eb373ff767a3f.dll',
'internal_api': 'openblas',
'num_threads': 16,
'prefix': 'libopenblas',
'threading_layer': 'pthreads',
'user_api': 'blas',
'version': '0.3.23.dev'},
{'architecture': 'SkylakeX',
'filepath': 'C:\Users\LabUser '
'OPX\AppData\Roaming\Python\Python39\site-packages\scipy.libs\libopenblas_v0.3.27--3aa239bc726cfb0bd8e5330d8d4c15c6.dll',
'internal_api': 'openblas',
'num_threads': 16,
'prefix': 'libopenblas',
'threading_layer': 'pthreads',
'user_api': 'blas',
'version': '0.3.27'}]

Context for the issue:

No response

@Jaimin020
Copy link

Jaimin020 commented Jun 25, 2024

Bug confirmed. I've attached a reproducible notebook with the relevant code. I am working on this bug.
link: https://colab.research.google.com/drive/1lBdxPRiU-mgf_Rx7vvZKNqnO8Fa_BdZ-?usp=sharing

@seberg seberg added 33 - Question Question about NumPy usage or development and removed 00 - Bug labels Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
33 - Question Question about NumPy usage or development
Projects
None yet
Development

No branches or pull requests

3 participants