Description
There are several calls to xp = self.get_array_module() throughout the library. xp results in numpy or sparse. xp then calls an array function to do something, e.g.,:
xp = self.get_array_module()
fill = (xp.nan_to_num(self.values) == 0) * (self * 0 + value)
This pattern appears frequently throughout the library. I think it may be possible to simplify the call to just:
fill = (self.nan_to_num(self.values) == 0) * (self * 0 + value)
Where the array function (in this case, nan_to_num()) is the one pertaining to the Triangle's backend, e.g., numpy.nan_to_num() or sparse.nan_to_num().
Calling Triangle.set_backend() will swap the array functions to be called from the appropriate backend module.
Is your feature request aligned with the scope of the package?
Describe the solution you'd like, or your current workaround.
No response
Do you have any additional supporting notes?
No response
Would you be willing to contribute this ticket?
Description
There are several calls to
xp = self.get_array_module()throughout the library.xpresults innumpyorsparse.xpthen calls an array function to do something, e.g.,:This pattern appears frequently throughout the library. I think it may be possible to simplify the call to just:
Where the array function (in this case,
nan_to_num()) is the one pertaining to the Triangle's backend, e.g.,numpy.nan_to_num()orsparse.nan_to_num().Calling
Triangle.set_backend()will swap the array functions to be called from the appropriate backend module.Is your feature request aligned with the scope of the package?
Describe the solution you'd like, or your current workaround.
No response
Do you have any additional supporting notes?
No response
Would you be willing to contribute this ticket?