-
Notifications
You must be signed in to change notification settings - Fork 0
/
fitting_data_set_generator.cpp
81 lines (67 loc) · 1.25 KB
/
fitting_data_set_generator.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
* fitting_data_set_generator.cpp
* new_LT
*
* Created by 刁培倫 on 2010/11/14.
* Copyright 2010 __MyCompanyName__. All rights reserved.
*
*/
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
string s;
vector< vector<double> > data;
while(getline(cin, s)){
data.clear();
{
istringstream iss(s);
double d;
int i=0;
while (iss >> d) {
data.push_back(vector<double>());
data[i].push_back(d);
i++;
}
if (i==0) {
cout << '\n';
continue;
}
}
while ( getline(cin, s) ) {
istringstream iss(s);
double d;
int i;
for (i=0; iss >> d; i++) {
data[i].push_back(d);
}
if (i==0) {
break;
}
}
for (vector< vector<double> >::iterator i=data.begin(); i!=data.end(); i++) {
sort(i->begin(), i->end());
*i = vector<double>(i->rbegin(), i->rend());
int size = i->size();
for (int s=0; s<100; s++) {
double sum=0;
int n=0;
for (int x=s*(size/100); x< (s+1)*(size/100); x++) {
sum += (*i)[x];
n++;
}
// if (sum > 0)
cout << sum/n << '\t';
// else {
// cout << "1.00E-8\t";
// }
}
cout << '\n';
}
cout << '\n';
}
return 0;
}