Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
benchmark
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
benchmark
Commits
5e52d2d6
Commit
5e52d2d6
authored
May 23, 2016
by
Ismael
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor fitting curve
parent
5f9823bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
minimal_leastsq.cc
src/minimal_leastsq.cc
+16
-13
No files found.
src/minimal_leastsq.cc
View file @
5e52d2d6
...
...
@@ -20,19 +20,22 @@
#include <math.h>
// Internal function to calculate the different scalability forms
double
fittingCurve
(
double
N
,
benchmark
::
BigO
Complexity
)
{
if
(
Complexity
==
benchmark
::
O_N
)
return
N
;
else
if
(
Complexity
==
benchmark
::
O_N_Squared
)
return
pow
(
N
,
2
);
else
if
(
Complexity
==
benchmark
::
O_N_Cubed
)
return
pow
(
N
,
3
);
else
if
(
Complexity
==
benchmark
::
O_log_N
)
return
log2
(
N
);
else
if
(
Complexity
==
benchmark
::
O_N_log_N
)
return
N
*
log2
(
N
);
return
1
;
// Default value for O_1
double
fittingCurve
(
double
n
,
benchmark
::
BigO
complexity
)
{
switch
(
complexity
)
{
case
benchmark
:
:
O_N
:
return
n
;
case
benchmark
:
:
O_N_Squared
:
return
pow
(
n
,
2
);
case
benchmark
:
:
O_N_Cubed
:
return
pow
(
n
,
3
);
case
benchmark
:
:
O_log_N
:
return
log2
(
n
);
case
benchmark
:
:
O_N_log_N
:
return
n
*
log2
(
n
);
case
benchmark
:
:
O_1
:
default:
return
1
;
}
}
// Internal function to find the coefficient for the high-order term in the running time, by minimizing the sum of squares of relative error.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment