Here is the code for array_equal:
def array_equal(a1, a2):
try:
a1, a2 = asarray(a1), asarray(a2)
except:
return False
if a1.shape != a2.shape:
return False
return bool(asarray(a1 == a2).all())
As you can see, this is not a level function c-api. After making sure that both inputs are arrays and that this form matches, it performs a test of the element ==followed by all.
This does not work reliably with floats. This is normal with ints and boolean.
, c-api - , , , .
PyArray_CountNonzero(PyArrayObject* self)
. , , PyArray_Nonzero , . , 2 ( dtype), .
, , . nditer, .