Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
p1-stats
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
karter
p1-stats
Commits
68fc9ffc
Commit
68fc9ffc
authored
2 years ago
by
karter
Browse files
Options
Downloads
Patches
Plain Diff
fixed everything Final Version
parent
9248e571
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
stats.cpp
+3
-0
3 additions, 0 deletions
stats.cpp
stats_tests.cpp
+1
-1
1 addition, 1 deletion
stats_tests.cpp
with
4 additions
and
1 deletion
stats.cpp
+
3
−
0
View file @
68fc9ffc
...
...
@@ -58,6 +58,7 @@ double mean(vector<double> v)
}
double
median
(
vector
<
double
>
v
)
{
sort
(
v
);
double
median
;
int
location
;
if
(
v
.
size
()
%
2
==
0
)
...
...
@@ -108,6 +109,7 @@ double max(vector<double> v)
}
double
stdev
(
vector
<
double
>
v
)
{
sort
(
v
);
double
ssq
=
0
;
double
meanssq
=
0
;
for
(
size_t
i
=
0
;
i
<
v
.
size
();
i
++
)
...
...
@@ -120,6 +122,7 @@ double stdev(vector<double> v)
}
double
percentile
(
vector
<
double
>
v
,
double
p
)
{
sort
(
v
);
double
fractpart
,
intpart
=
0
;
double
rank
=
(
p
/
100
)
*
(
v
.
size
()
-
1
)
+
1
;
...
...
This diff is collapsed.
Click to expand it.
stats_tests.cpp
+
1
−
1
View file @
68fc9ffc
...
...
@@ -39,7 +39,7 @@ int main()
//vector<double> data = {-1,2,10,3,4};
//vector<double> data = {-10,-100,-10000,2,3};
//vector<double> data = {6,7,8,9,10};
vector
<
double
>
data
=
{
0.5
,
1.5
,
2.5
,
3.5
};
vector
<
double
>
data
=
{
0.5
,
-
1.5
,
2.5
,
-
3.5
};
//vector<double> data = {1,1,2,2};
//vector<double> data = {1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7};
test_summarize
(
data
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment