Repository navigation
Conversation
Modified array_equiv to consider structured arrays with differently named fields, but equivalent data, to be equivalent.
|
That would make the difference between array_equal and array_equiv - but structure array comparison seems to behave similar to both, so maybe it's really a matter of taste: >>> x = np.array([(0,1),(2,3)], dtype=[('a', 'i4'), ('b', 'i4')])
>>> y = np.array([(0,1),(2,3)], dtype=[('a', 'i4'), ('b', 'i4')]).reshape(1,-1)
>>> x == y
array([[ True, True]], dtype=bool)I was not aware that '==' did work already, so maybe most of the array_equal code could simply be replaced by return bool((a1 == a2).all())? |
|
I actually fixed the == in 1.6. It had already been implemented, but incorrectly. I think even just should be fine, but it's worth having tests which confirm this. One thing to think about for the future, is that I think == for struct dtypes should return a struct dtype with matching names but all 'bool' dtypes, and all() should be extended to reduce the bool-struct to a single value as well... The above line of code would still work correctly with these changes, so that's good. |
|
@dhomeier How does this story end? |
|
Closed by #3322. |
feat: Add vsri_n_s8
Implementation of http://projects.scipy.org/numpy/ticket/1941 with tests. Please comment if the behaviour of array_equiv in commit 4b896f8 or in HEAD is preferred.