Thread overview | ||||||
---|---|---|---|---|---|---|
|
February 26, 2015 Mister Math is wanted! | ||||
---|---|---|---|---|
| ||||
Hello all! Python's fsum is ready for D : https://github.com/D-Programming-Language/phobos/pull/2991 Destroy! |
February 26, 2015 Re: Mister Math is wanted! | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ilya Yaroshenko | On 2/26/15 5:34 AM, Ilya Yaroshenko wrote: > Hello all! > > Python's fsum is ready for D : > https://github.com/D-Programming-Language/phobos/pull/2991 > > Destroy! Unfortunate overlap in functionality is unfortunate. $ git grep -i kahan std/algorithm/iteration.d:$(D sum) uses the $(WEB en.wikipedia.org/wiki/Kahan_summation, std/algorithm/iteration.d:Kahan summation) algorithm.) std/algorithm/iteration.d: return sumKahan!E(seed, r); std/algorithm/iteration.d:// Kahan algo http://en.wikipedia.org/wiki/Kahan_summation_algorithm std/algorithm/iteration.d:private auto sumKahan(Result, R)(Result result, R r) $ _ Andrei |
February 27, 2015 Re: Mister Math is wanted! | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | > Unfortunate overlap in functionality is unfortunate.
>
> $ git grep -i kahan
> std/algorithm/iteration.d:$(D sum) uses the $(WEB en.wikipedia.org/wiki/Kahan_summation,
> std/algorithm/iteration.d:Kahan summation) algorithm.)
> std/algorithm/iteration.d: return sumKahan!E(seed, r);
> std/algorithm/iteration.d:// Kahan algo http://en.wikipedia.org/wiki/Kahan_summation_algorithm
> std/algorithm/iteration.d:private auto sumKahan(Result, R)(Result result, R r)
> $ _
>
>
> Andrei
Would one of the following solutions be fortunate ?
I. Use alias of fsum!(Summation. Appropriate) for floating version of std.algorithm.sum.
Appropriate algorithm performs D Pairwise summation for random access ranges.
Otherwise performs D KBN summation of floating point and complex numbers and
Kahan summation of user defined types.
or
II. Move this submodule to std.algorithm.iteration.
or
III. Remove Kahan (including KBN and KB2) and Pairwise algorithms from fsum, and use only Precise algorithm for std.numeric.
|
February 27, 2015 Re: Mister Math is wanted! | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ilya Yaroshenko | On Friday, 27 February 2015 at 09:27:49 UTC, Ilya Yaroshenko
wrote:
>> Unfortunate overlap in functionality is unfortunate.
>>
>> $ git grep -i kahan
>> std/algorithm/iteration.d:$(D sum) uses the $(WEB en.wikipedia.org/wiki/Kahan_summation,
>> std/algorithm/iteration.d:Kahan summation) algorithm.)
>> std/algorithm/iteration.d: return sumKahan!E(seed, r);
>> std/algorithm/iteration.d:// Kahan algo http://en.wikipedia.org/wiki/Kahan_summation_algorithm
>> std/algorithm/iteration.d:private auto sumKahan(Result, R)(Result result, R r)
>> $ _
>>
>>
>> Andrei
>
> Would one of the following solutions be fortunate ?
>
> I. Use alias of fsum!(Summation. Appropriate) for floating version of std.algorithm.sum.
>
> Appropriate algorithm performs D Pairwise summation for random access ranges.
> Otherwise performs D KBN summation of floating point and complex numbers and
> Kahan summation of user defined types.
>
> or
>
> II. Move this submodule to std.algorithm.iteration.
>
> or
>
> III. Remove Kahan (including KBN and KB2) and Pairwise algorithms from fsum, and use only Precise algorithm for std.numeric.
Probably, I have found good solution. Summator struct can be
represented in std.numeric and std.algorithm.sum can be extended
by the new functionality. So there will be no overlap in
functionality.
|
Copyright © 1999-2021 by the D Language Foundation