explorer
explorer copied to clipboard
Optimize ops of PolarsBackend.Series using scalar values with broadcasting
AS-IS
(series, scalar) or (scalar, series) -> expression
TO-BE
(series, scalar) or (scalar, series) -> broadcasting in polars
from @philss
I think that way going to be faster, but it's hard to maintain because some functions may have 3 possible branches: (series, series), (series, scalar), (scalar, series). We could use macros to make the work less painful.
example: https://github.com/nallwhy/explorer/commit/6c0147dcc3bd1f31590238b8ed58eda7ace9876b benchmarks: https://github.com/elixir-nx/explorer/pull/370#issuecomment-1274932347 discussion: https://github.com/elixir-nx/explorer/pull/370#issuecomment-1274950401