Quansight-Labs / unumpy

A backend-dispatchable version of NumPy.
https://unumpy.uarray.org/
BSD 3-Clause "New" or "Revised" License
19 stars 10 forks source link

Add some logical functions #45

Closed joaosferreira closed 4 years ago

joaosferreira commented 4 years ago

As stated in https://github.com/Quansight-Labs/unumpy/pull/44#discussion_r383711633, the functions np.isclose and np.allclose are more appropriate when comparing floating-point values, which is necessary in several scenarios.

With this in mind we propose that these should be added to the family of available unumpy functions as to avoid using the original numpy library and others.

sayandip18 commented 4 years ago

I would love to fix this issue, but not sure where these functions will be used. Can anyone help me get started?

hameerabbasi commented 4 years ago

Hi, @sayandip18. You can find example multimethods in: https://github.com/Quansight-Labs/unumpy/blob/master/unumpy/_multimethods.py

Documentation on writing new multimethods is available here: https://uarray.org/en/latest/multimethod_docs.html

You will need to add multimethods that mirror the API of np.isclose and np.allclose.

sayandip18 commented 4 years ago

Is the Numpy-C API a prerequisite for this?

hameerabbasi commented 4 years ago

The NumPy C-API is not a prerequisite for any of our projects. The Python C-API is a prerequisite for uarray only. unumpy doesn't have any prerequisites besides a solid understanding of Python.

The task that is associated with this issue is a part of unumpy.

hameerabbasi commented 4 years ago

To be clear, a unumpy multimethod is an empty shell that dispatches to NumPy or another backend. It is not a full-fledged implementation, although it can include a simplified implementation in terms of other multimethods.