вс, 11 окт. 2020 г., 13:31 Hongyi Zhao <hongyi.z...@gmail.com>:
> On Sun, Oct 11, 2020 at 3:42 PM Evgeni Burovski > <evgeny.burovs...@gmail.com> wrote: > > > > On Sun, Oct 11, 2020 at 9:55 AM Evgeni Burovski > > <evgeny.burovs...@gmail.com> wrote: > > > > > > The script seems to be computing the particle numbers for an array of > chemical potentials. > > > > > > Two ways of speeding it up, both are likely simpler then using dask: > > > > > > First: use numpy > > > > > > 1. Move constructing mu_all out of the loop (np.linspace) > > > 2. Arrange the integrands into a 2d array > > > 3. np.trapz along an axis which corresponds to a single integrand array > > > (Or avoid the overhead of trapz by just implementing the trapezoid > formula manually) > > > > > > Roughly like this: > > https://gist.github.com/ev-br/0250e4eee461670cf489515ee427eb99 > > I can't find the cython part suggested by you, i.e., move the loop > into cython. Furthermore, I also learned that the numpy array is > optimized and has the performance close to C/C++. > > > Basically, it seems pure numpy is OK here and nothing more sophisticated > is needed.
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion