Right, wasn't sure if we kept that around or not.

> On Nov 15, 2014, at 7:56 PM, Ivar Nesje <[email protected]> wrote:
> 
> Seems like this thread is missing a reference to the standard library 
> function sum_kbn.
> 
> kl. 12:33:31 UTC+1 lørdag 15. november 2014 skrev [email protected] følgende:
>> 
>> Dear Stefan,
>> 
>> Thank you for your quick answer. That's what I had in mind. I just thought, 
>> very naively I must admit, that sum(a) would have computed the total sum in 
>> the same order as one of the other 4 approaches.
>> I'll have a look at compensated summation.
>> 
>> Thanks again,
>> 
>> Le samedi 15 novembre 2014 12:18:46 UTC+1, Stefan Karpinski a écrit :
>>> 
>>> This is expected. Floating-point addition is non-associative and these 
>>> codes add values in different orders. Julia's built-in sum function uses 
>>> recursive pairwise summation, which is the most accurate of these three 
>>> approaches but nearly as fast as linear scanning. A slower but more 
>>> accurate algorithm is compensated summation. Even compensated summation is 
>>> not completely accurate; completely accurate floating-point summation is 
>>> tricky.
>>> 
>>> On Sat, Nov 15, 2014 at 11:52 AM, <[email protected]> wrote:
>>>> Dear all,
>>>> 
>>>> Some (serious?) issue was raised on a mailing list concerning the "sum" 
>>>> functions involved in computing the sum of elements of an array.
>>>> 
>>>> It seems that we obtain different results for the three following 
>>>> procedures:
>>>> 
>>>> - using sum over the whole matrix
>>>> - using sum over the columns/rows of the matrix and summing these results 
>>>> within a loop
>>>> - computing the sum with a double loop over all the elements of the matrix
>>>> 
>>>> Attached is a file with the different procedures and their results for a 
>>>> particular matrix.
>>>> 
>>>> What is wrong with the implementation of the sum function?
>>>> This could have important consequences with iterative procedures.
>>>> 
>>>> Many thanks,
>>> 

Reply via email to