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
Describe the bug
A program I am working on performs a call to ulab.numpy.roll to shift around an array by an varying amount of distance. I noticed that when the distance argument is set to 0, the function returns an array of the correct length but with all 0s. Quickly scanning over the code for this in code/numpy/numerical.c, my guess is that L1224 is never run to copy over the results.
Expected behavior
I would expect the output of np.roll(data, 0) to simply pass through the data. If the axis is provided, that may have different results, but I am not certain of the expected behavior in that case.
I think a decent enough solution would be to detect if the distance/shift argument is 0 and pass the output through early.
Changing numerical.c#L1223 to if(--counter <= 0) { may also work, but I suspect that it would have the same effect as if distance were equal to 1, which would not be desired.
The text was updated successfully, but these errors were encountered:
Describe the bug
A program I am working on performs a call to
ulab.numpy.roll
to shift around an array by an varying amount of distance. I noticed that when the distance argument is set to 0, the function returns an array of the correct length but with all 0s. Quickly scanning over the code for this in code/numpy/numerical.c, my guess is that L1224 is never run to copy over the results.micropython-ulab/code/numpy/numerical.c
Lines 1223 to 1225 in eacb0c9
ulab version: 6.4.1-2D
To Reproduce
Output:
Describe the steps to reproduce the behavior.
Expected behavior
I would expect the output of np.roll(data, 0) to simply pass through the data. If the axis is provided, that may have different results, but I am not certain of the expected behavior in that case.
I think a decent enough solution would be to detect if the distance/shift argument is 0 and pass the output through early.
Changing numerical.c#L1223 to
if(--counter <= 0) {
may also work, but I suspect that it would have the same effect as if distance were equal to 1, which would not be desired.The text was updated successfully, but these errors were encountered: