dotProduct and sum unification

Ilya Yaroshenko via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 8 02:52:59 PDT 2014


Hello!

I have found that Phobos has sum, but in module std.algorithm!

refs:
  std.numeric.dotProduct:
   http://dlang.org/phobos/std_numeric.html#.dotProduct
  std_algorithm.sum:
   http://dlang.org/phobos/std_algorithm.html#.sum

Both sum and dotProduct are general purpose numeric algorithms 
(yes, very trivial) with the same summation logic. The summation 
method can be:

  a. Strongly Serial (it needed for numeric algorithms like in 
cephes(Netlib) library.)
  b. Fast (with SIMD instruction or loop unrolling like in 
dotProduct source code)
  c. Reversed Strongly Serial
  d. Reversed Fast
  e. Precise (like in sum source code) There are different ways of 
precise summation.  For example in Julia language you can choice 
an algorithm.
     e.1 Precise algorithm 1
     ...
     e.2 Precise algorithm N

So, can I make PR with that
  1. realize unification in single module (std.numeric?) and logic
  2. provide ability to select summation algorithm (default == 
Fast?)

Best regards,
Ilya


More information about the Digitalmars-d mailing list