Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ This release is compatible with NumPy 2.5.
* Fixed `PytestRemovedIn10Warning` raised by `pytest` 9.1.0 by converting class-scoped fixtures to class methods [#2952](https://github.com/IntelPython/dpnp/pull/2952)
* Fixed `dpnp.linalg.svd(..., hermitian=True)` returning a non-unitary `vh` for singular input arrays due to a zero sign appearing [#2954](https://github.com/IntelPython/dpnp/pull/2954)
* Fixed scalar conversion of size-one `dpnp.tensor.usm_ndarray` (e.g. `int()`, `float()`, indexing) which failed with NumPy 2.5 after the in-place `ndarray.shape` assignment was deprecated [#2958](https://github.com/IntelPython/dpnp/pull/2958)
* Fixed `dpnp.mgrid` and `dpnp.ogrid` to return consistent results between single-slice and tuple-of-slices syntax when the step is a complex number with a non-integer magnitude (e.g. `2.5j`) [#2971](https://github.com/IntelPython/dpnp/pull/2971)

### Security

Expand Down
5 changes: 2 additions & 3 deletions dpnp/dpnp_algo/dpnp_arraycreation.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,10 @@ def __getitem__(self, key):
if start is None:
start = 0
if isinstance(step, complex):
step = abs(step)
length = int(step)
step_float = abs(step)
step = length = int(step_float)
if step != 1:
step = (stop - start) / float(step - 1)
stop = stop + step
return (
dpnp.arange(
0,
Expand Down
6 changes: 6 additions & 0 deletions dpnp/tests/test_arraycreation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,8 @@ def check_results(self, result, expected):
slice(0, 5, 0.5), # float step
slice(0, 5, 1j), # complex step
slice(0, 5, 5j), # complex step
slice(0, 10, 2.5j), # complex step with non-integer magnitude
slice(0, 10, 3.5j), # non-integer magnitude with interior points
slice(None, 5, 1), # no start
slice(0, 5, None), # no step
],
Expand All @@ -1090,6 +1092,10 @@ def test_single_slice(self, grid, slice):
slice(0.0, 5, 1),
slice(0, 10, 1j),
), # float start and complex step
(
slice(0, 10, 2.5j),
slice(0, 10, 3.5j),
), # complex step with non-integer magnitude
],
)
def test_md_slice(self, grid, slices):
Expand Down
Loading