I mostly work with arrays in numpy but sometimes I get stuck with a problem that needs a for loop - only two things I can think of are parallelize the for loop or use numba/jax JIT functions and GPU acceleration.
Both don’t just work out of the box like Julia or MATLAB’s “parfor” loop, but seem to work well enough for non trivial for loop cases.
Have you tried Jax or Taichi? https://www.taichi-lang.org/
For Monte Carlo simulations, Pyro and tensorflow_probability have also nice abstractions.
I mostly work with arrays in numpy but sometimes I get stuck with a problem that needs a for loop - only two things I can think of are parallelize the for loop or use numba/jax JIT functions and GPU acceleration.
Both don’t just work out of the box like Julia or MATLAB’s “parfor” loop, but seem to work well enough for non trivial for loop cases.