On Sun, Oct 3, 2021 at 9:27 PM <hongyi.z...@gmail.com> wrote: > > So, C/Python operator `~` has been overridden by the corresponding user > function in numpy, but where is the corresponding source code > implementation? >
ufuncs are implemented in C. We provide so-called loop functions that iterate over contiguous segments of the operand arrays. We use a custom code generator to make implementations for all of the types. Here are the ones that correspond to `np.invert`. (the bool implementation uses the `logical_not` loop). https://github.com/numpy/numpy/blob/main/numpy/core/src/umath/loops.c.src#L612-L626 -- Robert Kern
_______________________________________________ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: arch...@mail-archive.com