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
Fix diagonal() strides calculation for empty results (#2814)
Previously `dpnp.diagonal()` returned incorrect strides when the
diagonal was empty (e.g., when offset >= array width). The stride was
set to itemsize instead of the correct `st_n + st_m`.
This PR:
* fixes stride calculation to consistently use (st_n + st_m)
* simplifies implementation using unified formula to calculate resulting
shape, strides, and offset
* extends tests coverage including scenarios with empty diagonals,
views, and non-contiguous arrays
The PR closes#2761.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,6 +77,7 @@ Also, that release drops support for Python 3.9, making Python 3.10 the minimum
77
77
* Resolved an issue where `dpnp` always returns the base allocation pointer, when the view start is expected [#2651](https://github.com/IntelPython/dpnp/pull/2651)
78
78
* Fixed an issue causing an exception in `dpnp.geomspace` and `dpnp.logspace` when called with explicit `device` keyword but any input array is allocated on another device [#2723](https://github.com/IntelPython/dpnp/pull/2723)
79
79
* Fixed `.data.ptr` property on array views to correctly return the pointer to the view's data location instead of the base allocation pointer [#2812](https://github.com/IntelPython/dpnp/pull/2812)
80
+
* Resolved an issue with strides calculation in `dpnp.diagonal` to return correct values for empty diagonals [#2814](https://github.com/IntelPython/dpnp/pull/2814)
0 commit comments