[Issue 4725] std.algorithm.sum()

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 8 15:15:13 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=4725



--- Comment #21 from bearophile_hugs at eml.cc 2013-06-08 15:15:10 PDT ---
Fortran has a built in sum() that supports a second useful optional argument,
that specifies the dimension along to compute the sum, it's useful for 2D or nD
arrays:

ke = 0.5d0 * dot_product(mass, sum(v ** 2, dim=1))

See:
http://gcc.gnu.org/onlinedocs/gfortran/SUM.html

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list