mirror of https://github.com/google/benchmark.git
initialized doubles to 0.0
This commit is contained in:
parent
1715885611
commit
37ab858e4b
|
@ -48,23 +48,23 @@ enum BigO {
|
|||
|
||||
struct LeastSq {
|
||||
LeastSq() :
|
||||
coef(0),
|
||||
rms(0),
|
||||
complexity(benchmark::oNone) {}
|
||||
coef(0.0),
|
||||
rms(0.0),
|
||||
complexity(oNone) {}
|
||||
|
||||
double coef;
|
||||
double rms;
|
||||
benchmark::BigO complexity;
|
||||
BigO complexity;
|
||||
};
|
||||
|
||||
// Function to return an string for the calculated complexity
|
||||
std::string GetBigOString(benchmark::BigO complexity);
|
||||
std::string GetBigOString(BigO complexity);
|
||||
|
||||
// Find the coefficient for the high-order term in the running time, by
|
||||
// minimizing the sum of squares of relative error.
|
||||
LeastSq MinimalLeastSq(const std::vector<int>& n,
|
||||
const std::vector<double>& time,
|
||||
const benchmark::BigO complexity = benchmark::oAuto);
|
||||
const BigO complexity = oAuto);
|
||||
|
||||
} // end namespace benchmark
|
||||
#endif // COMPLEXITY_H_
|
||||
|
|
|
@ -86,10 +86,10 @@ std::string GetBigOString(BigO complexity) {
|
|||
LeastSq CalculateLeastSq(const std::vector<int>& n,
|
||||
const std::vector<double>& time,
|
||||
std::function<double(int)> fitting_curve) {
|
||||
double sigma_gn = 0;
|
||||
double sigma_gn_squared = 0;
|
||||
double sigma_time = 0;
|
||||
double sigma_time_gn = 0;
|
||||
double sigma_gn = 0.0;
|
||||
double sigma_gn_squared = 0.0;
|
||||
double sigma_time = 0.0;
|
||||
double sigma_time_gn = 0.0;
|
||||
|
||||
// Calculate least square fitting parameter
|
||||
for (size_t i = 0; i < n.size(); ++i) {
|
||||
|
@ -106,7 +106,7 @@ LeastSq CalculateLeastSq(const std::vector<int>& n,
|
|||
result.coef = sigma_time_gn / sigma_gn_squared;
|
||||
|
||||
// Calculate RMS
|
||||
double rms = 0;
|
||||
double rms = 0.0;
|
||||
for (size_t i = 0; i < n.size(); ++i) {
|
||||
double fit = result.coef * fitting_curve(n[i]);
|
||||
rms += pow((time[i] - fit), 2);
|
||||
|
|
Loading…
Reference in New Issue