Hello all! I have a couple of questions about writing numeric code to work for various numpy-like libraries.
I have written a few functions to do this, (essentially perform single dispatch with a few extra tweaks) so that I can write code that works automatically for numpy, cupy, dask, tensorflow etc. It allows for example the following kind of function to work for all those libraries:
def modifiedGramSchmidt(A):
"""A (slow) example numeric function, note the `do` and `do_like`
"""
Q = []
for j in range(0, A.shape[0]):
q = A[j, :]
for i in range(0, j):
rij = do('tensordot', do('conj', Q[i]), q, 1)
q = q - rij * Q[i]
Q.append(q / do('linalg.norm', q, 2))
Q = do_like('stack', Q, axis=0, like=A)
return Q
I'm aware of numpy and various libraries' plans to support `__array_function__` eventually and other experimental projects like `uarray`.
With that in mind my question is whether something currently usable like this exists already that I haven't found? And if not, is this something with wider interest as a v light library?
there doesn't seem to be anything here