Skip to content

Commit

Permalink
Bears-R-Us#3757: ak.array gives unexpected results on a transposed nu…
Browse files Browse the repository at this point in the history
…mpy multi-dimensional array.
  • Loading branch information
ajpotts committed Sep 10, 2024
1 parent 95cbb1b commit c17b331
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arkouda/pdarraycreation.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ def array(
raise RuntimeError(
"Array exceeds allowed transfer size. Increase ak.client.maxTransferBytes to allow"
)
# Make a copy to avoid
a = a.copy()
# Pack binary array data into a bytes object with a command header
# including the dtype and size. If the server has a different byteorder
# than our numpy array we need to swap to match since the server expects
Expand Down
13 changes: 13 additions & 0 deletions tests/pdarray_creation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ def test_array_creation_misc(self):
with pytest.raises(TypeError):
ak.array(list(list(0)))

@pytest.mark.skip_if_max_rank_less_than(2)
def test_array_creation_transpose_bug_reproducer(self):

import numpy as np

rows = 5
cols = 5
nda = np.random.randint(1, 10, (rows, cols))

from arkouda.testing import assert_arkouda_array_equal

assert_arkouda_array_equal(ak.transpose(ak.array(nda)), ak.array(np.transpose(nda)))

def test_infer_shape_from_size(self):
from arkouda.util import _infer_shape_from_size

Expand Down

0 comments on commit c17b331

Please sign in to comment.