MCPcopy Create free account
hub / github.com/BYVoid/OpenCC / FittingCurve

Function FittingCurve

deps/google-benchmark/src/complexity.cc:29–51  ·  view source on GitHub ↗

Internal function to calculate the different scalability forms

Source from the content-addressed store, hash-verified

27
28// Internal function to calculate the different scalability forms
29BigOFunc* FittingCurve(BigO complexity) {
30 static const double kLog2E = 1.44269504088896340736;
31 switch (complexity) {
32 case oN:
33 return [](IterationCount n) -> double { return static_cast<double>(n); };
34 case oNSquared:
35 return [](IterationCount n) -> double { return std::pow(n, 2); };
36 case oNCubed:
37 return [](IterationCount n) -> double { return std::pow(n, 3); };
38 case oLogN:
39 /* Note: can't use log2 because Android's GNU STL lacks it */
40 return
41 [](IterationCount n) { return kLog2E * log(static_cast<double>(n)); };
42 case oNLogN:
43 /* Note: can't use log2 because Android's GNU STL lacks it */
44 return [](IterationCount n) {
45 return kLog2E * n * log(static_cast<double>(n));
46 };
47 case o1:
48 default:
49 return [](IterationCount) { return 1.0; };
50 }
51}
52
53// Function to return an string for the calculated complexity
54std::string GetBigOString(BigO complexity) {

Callers 1

MinimalLeastSqFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected