
sum_arr_copy_accumulate is wrong. Array should be passed as copy. (I don't
know what's going on with me these days). Sorry for spamming the group...
Timing of copying the array and calling accumulate:
sum_arr_copy_accumulate
50.15 s
result: 2.84756e+10
Best Regards,
Ovanes
On Jan 29, 2008 9:25 AM, Ovanes Markarian
Seven,
thanks a lot for pointing it out. That was a classical error!! :(
Anyway I re-ran the test, with corrected accumulate calls:
corrected calls: array_type::value_type sum_carr_accumulate(array_type const& a) { return std::accumulate(a.begin(), a.end(), 0.0); }
array_type::value_type sum_arr_copy_accumulate(array_type const& a) { return std::accumulate(a.begin(), a.end(), 0.0); }
Results (which would be expected from std lib ;)
Running each test 4294967295 of times: -------------------------- sum_arr_copy 64.79 s
result: 2.84756e+10 -------------------------- sum_carr 14.91 s
result: 2.84756e+10 -------------------------- sum_arr_copy_accumulate 14.91 s
result: 2.84756e+10 -------------------------- sum_carr_temp_result 14.91 s
result: 2.84756e+10 -------------------------- sum_carr_accumulate 14.91 s
result: 2.84756e+10 -------------------------- sum_doubles_copy 15.00 s
result: 2.84756e+10 -------------------------- sum_doubles_copy_optimized 14.96 s
result: 2.84756e+10 -------------------------- sum_doubles_copy_temp_result 14.92 s
result: 2.84756e+10 -------------------------- sum_doubles_ref_temp_result 14.97 s
result: 2.84756e+10 tests done
Regards, Ovanes
On Jan 29, 2008 5:42 AM, Steven Watanabe
wrote: AMDG
Ovanes Markarian wrote:
array_type::value_type sum_carr_accumulate(array_type const& a) { return std::accumulate(a.begin(), a.end(), 0); }
array_type::value_type sum_arr_copy_accumulate(array_type const& a) { return std::accumulate(a.begin(), a.end(), 0); }
Please take a look, that accumulate produced wrong result.
Of course. The results are being collected in an int...
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users