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
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:return std::accumulate(a.begin(), a.end(), 0.0);
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)
{
}
Results (which would be expected from std lib ;)
Running each test 4294967295 of times:
--------------------------
sum_arr_copy
64.79 s14.91 s
result: 2.84756e+10
--------------------------
sum_carr14.91 s
result: 2.84756e+10
--------------------------
sum_arr_copy_accumulate
result: 2.84756e+10
--------------------------
sum_carr_temp_result
14.91 s14.91 s
result: 2.84756e+10
--------------------------
sum_carr_accumulate
14.96 s
result: 2.84756e+10
--------------------------
sum_doubles_copy
15.00 s
result: 2.84756e+10
--------------------------
sum_doubles_copy_optimized
result: 2.84756e+10
--------------------------
sum_doubles_copy_temp_result
14.92 s
result: 2.84756e+10
--------------------------
sum_doubles_ref_temp_result14.97 stests done
result: 2.84756e+10
Regards,
Ovanes
On Jan 29, 2008 5:42 AM, Steven Watanabe <watanabesj@gmail.com> 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