Closed FrancescAlted closed 2 years ago
The idea is that things like:
import numpy as np import iarray as ia from iarray import udf @udf.scalar(lib="lib2") def fmult(a: udf.float64, b: udf.float64) -> float: return a * b @udf.jit def fmult2(out: udf.Array(udf.float64, 1), a: udf.Array(udf.float64, 1)) -> int: n = out.window_shape[0] for i in range(n): out[i] = lib.fmult(4, a[i]) return 0 print("** vector udf evaluation ...") a1 = ia.linspace([10], 0, 10) expr = ia.expr_from_udf(fmult2, [a1]) b1 = expr.eval() print(b1.data) print("** numpy evaluation ...") b2 = 4 * a1.data print(b2) np.testing.assert_array_almost_equal(b1.data, b2)
would work.
Done in https://github.com/inaos/iron-array-python/pull/160
The idea is that things like:
would work.