digitalmars.D - dotProduct and sum unification
- Ilya Yaroshenko (28/28) Sep 08 2014 Hello!
- Ilya Yaroshenko (1/1) Sep 08 2014 + std.numeric.normalize
- Andrei Alexandrescu (6/7) Sep 08 2014 One issue with std.numeric is it's rather disorganized - a grab bag of
- Timon Gehr (2/4) Sep 08 2014 How are min and max numeric?
- Andrei Alexandrescu (2/6) Sep 08 2014 Won't bite :o). -- Andrei
- Idan Arye (14/22) Sep 08 2014 Not only numeric stuff - I'd argue that `levenshteinDistance` and
Hello! I have found that Phobos has sum, but in module std.algorithm! refs: std.numeric.dotProduct: std_algorithm.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
Sep 08 2014
On 9/8/14, 2:58 AM, Ilya Yaroshenko wrote:+ std.numeric.normalizeOne issue with std.numeric is it's rather disorganized - a grab bag of vaguely "numeric" stuff. However std.algorithm also includes stuff that's arguably numeric, e.g. min and max etc. I think the right way is to let the existing stuff be and improve the organization of std.numeric. Andrei
Sep 08 2014
On 09/08/2014 07:02 PM, Andrei Alexandrescu wrote:However std.algorithm also includes stuff that's arguably numeric, e.g. min and max etc.How are min and max numeric?
Sep 08 2014
On 9/8/14, 11:10 AM, Timon Gehr wrote:On 09/08/2014 07:02 PM, Andrei Alexandrescu wrote:Won't bite :o). -- AndreiHowever std.algorithm also includes stuff that's arguably numeric, e.g. min and max etc.How are min and max numeric?
Sep 08 2014
On Monday, 8 September 2014 at 17:02:21 UTC, Andrei Alexandrescu wrote:On 9/8/14, 2:58 AM, Ilya Yaroshenko wrote:Not only numeric stuff - I'd argue that `levenshteinDistance` and `balancedParens` belong to `std.string`. Most of the stuff `std.algorithm` are building blocks for algorithms - things that you never need to explain when writing pseudo-code because they are so trivial, like "iterate in decreasing order over the elements of that array that are not members of that set". But somehow other stuff found it's place into `std.algorithm` - actual algorithms like `sum` or `levenshteinDistance`. These are, indeed, "algorithms", but that doesn't mean they should be in `std.algorithm` - if we used that logic Phobos would have been composed of two giant modules, `std.algorithm` and `std.type`...+ std.numeric.normalizeOne issue with std.numeric is it's rather disorganized - a grab bag of vaguely "numeric" stuff. However std.algorithm also includes stuff that's arguably numeric, e.g. min and max etc. I think the right way is to let the existing stuff be and improve the organization of std.numeric. Andrei
Sep 08 2014