Thanks to visit codestin.com
Credit goes to github.com

Skip to content

numpy.clip does not respect out array order #7633

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

Closed
llchan opened this issue May 14, 2016 · 3 comments
Closed

numpy.clip does not respect out array order #7633

llchan opened this issue May 14, 2016 · 3 comments

Comments

@llchan
Copy link

llchan commented May 14, 2016

It appears that numpy.clip does not respect the out array order:

>>> import numpy as np
>>> np.__version__
'1.11.0'
>>> A = np.arange(15).reshape(5, 3)
>>> A
array([[ 0,  1,  2],
       [ 3,  4,  5],
       [ 6,  7,  8],
       [ 9, 10, 11],
       [12, 13, 14]])
>>> Af = np.zeros_like(A, order='F')
>>> Af
array([[0, 0, 0],
       [0, 0, 0],
       [0, 0, 0],
       [0, 0, 0],
       [0, 0, 0]])
>>> np.clip(A, 0, 7, out=Af)  # wrong
array([[0, 5, 7],
       [1, 6, 7],
       [2, 7, 7],
       [3, 7, 7],
       [4, 7, 7]])
>>> np.clip(A, 0, 7)  # expected
array([[0, 1, 2],
       [3, 4, 5],
       [6, 7, 7],
       [7, 7, 7],
       [7, 7, 7]])
@jaimefrio
Copy link
Member

The check here should also verify that both the input and output arrays have the same order (C or Fortran). I think this code could be greatly simplified by using the new iterator.

@PiyushGoyal443
Copy link

Can I work on this?

@mattip
Copy link
Member

mattip commented Sep 1, 2018

Closed by #9209

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants