How to sum multidimensional arrays?
p.shkadzko
p.shkadzko at gmail.com
Thu Feb 27 15:28:01 UTC 2020
On Thursday, 27 February 2020 at 14:15:26 UTC, p.shkadzko wrote:
> This works but it does not look very efficient considering we
> flatten and then calling array twice. It will get even worse
> with 3D arrays.
And yes, benchmarks show that summing 2D arrays like in the
example above is significantly slower than in numpy. But that is
to be expected... I guess.
D -- sum of two 5000 x 6000 2D arrays: 3.4 sec.
numpy -- sum of two 5000 x 6000 2D arrays: 0.0367800739913946 sec.
More information about the Digitalmars-d-learn
mailing list