-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
210 lines (191 loc) · 4.73 KB
/
main.cpp
File metadata and controls
210 lines (191 loc) · 4.73 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <iostream>
#include "young.h"
#include <set>
#include <random>
#include <algorithm>
#include <map>
#include <ctime>
using namespace std;
const size_t MAXN = (size_t)1e4; //size of YT
const double EPS = 1e-8;
long long factorial[20];
//const unsigned int N = 5;
//long double branch_prob[MAXN];
int main() {
freopen("out.txt", "w", stdout);
//freopen("err.txt", "w", stderr);
cout.precision(6);
size_t N = MAXN;
double *r = new double[N];
rand_arr(r, N);
PQ_tableaux<double> PQ;
PQ.push(r, N);
double *points = new double[10];
for (size_t i = 0; i < 10; ++i)
{
points[i] = ((double)i + 1) / 10;
}
const size_t M = (size_t)1e5;
pair<double, double> coord[10][M / 100];
PQ.push(points, 10);
for (size_t i = 0; i < M; ++i)
{
PQ.push(rand01());
if (i % 100 == 0)
{
for (size_t j = 0; j < 10; ++j)
{
coord[j][i / 100] = PQ.find(points[j]);
}
}
}
for (size_t i = 0; i < M / 100; ++i)
{
for (size_t j = 0; j < 10; ++j)
{
cout << coord[j][i].first << ' ' << coord[j][i].second << ' ';
}
cout << "\n";
}
//system("pause");
/*
double add = 1 / (double)MAXN;
double r = 0;
for (size_t i = 0; i < MAXN; ++i)
{
ra[i] = r;
r += add;
}
rand_permute_self_inverse(ra, MAXN);
*/
/*
const long MAN = (long)2e2;
long *func = new long[MAN];
long *height = new long[MAN];
long *length = new long[MAN];
for (size_t MAXN = 1; MAXN < MAN; ++MAXN)
{
cerr << MAXN << "\n";
double *ra = 0;
ra = new double[MAXN];
rand_arr(ra, MAXN);
PQ_tableaux<double> PQ;
PQ.push(ra, MAXN);
height[MAXN] = PQ.height();
length[MAXN] = PQ.length();
double *max_ra = new double[MAXN];
for (size_t cnt = 0; cnt * cnt < 16 * MAXN; ++cnt)
{
for (size_t i = 0; i < MAXN; ++i)
{
double tmp = 0;
for (size_t j = 0; j < i; ++j)
{
tmp = max(tmp, (ra[j] < ra[i]) ? ra[j] : 0);
}
max_ra[i] = tmp;
}
PQ_tableaux<double> PQ_max;
PQ_max.push(max_ra, MAXN);
if (PQ_max.height() == 1)
{
func[MAXN] = cnt;
break;
}
for (size_t i = 0; i < MAXN; ++i)
{
ra[i] = max_ra[i];
}
}
}
for (size_t i = 0; i < MAN; ++i)
{
cout << i << ' ' << func[i] << ' ' << length[i] << ' ' << height[i] << "\n";
}
*/
/*
PQ.showP();
cout << "\n\n";
PQ.truncate(max_ra[9], ra[9]);
PQ.showP();
cout << "\n\n";
PQ.truncate(max_ra[89], ra[89]);
PQ.showP();
cout << "\n\n";
*/
/*
int n = 6000;
for (int my_try = 0; my_try < 100; my_try++) {
vector <double> vec = rand_vec(n);
PQ_tableaux PQ;
PQ.push(vec);
for (int i = 0; i < 1; i++)
cout << vec[i] << " " << sqrt(PQ.find(vec[i])) / sqrt(n) << " " << vec[i] / ((PQ.find(vec[i]) + 1) / sqrt(n)) << endl;
}
*/
/*
factorial[0] = 1; //Trying to count some statistics on small sizes of YT
for (int i = 1; i < 20; ++i) //Firstly, some precounting
{
factorial[i] = factorial[i - 1] * i;
}
for (int N = 1; N < 5; ++N)
{
//vector<double> vec = { 5, 2, 4, 3, 1, 7, 6 };
vector<double> vec = rand_vec(N);
vector<double> vec_copy = vec;
cout << "random vector: " << vec << "\n";
vector<int> permutation(N);
map<vector<int>, vector<double>> identity_points; //Map contains info about each type of YT
for (int i = 0; i < N; ++i) //For each type: an array with numbers of
{
permutation[i] = i; //the permutation number which contains
} //this number of identity points
for (int i = 0; i < factorial[N]; ++i)
{
permutate(vec, permutation);
PQ_tableaux PQ;
PQ.push(vec);
if (identity_points.find(PQ.type()) == identity_points.end())
{
identity_points[PQ.type()] = vector<double>(N + 1);
}
identity_points[PQ.type()][count_identity_points(vec)]++;
next_permutation(permutation.begin(), permutation.end());
vec = vec_copy;
}
vector<double> measure(N + 1, 0);
for (auto i : identity_points)
{
cout << i.first << "\n" << i.second << "\n";
measure = measure + i.second;
}
int total = 0;
cout << "Plancherel measure: ";
for (auto i : identity_points)
{
cout << sum(i.second) << " ";
total += sum(i.second);
}
cout << "\n" << "total: " << total << "\n";
cout << "id_points statistics for all permutation: " << measure << "\n" << "\n";
}
*/
//system("pause");
return 0;
/*
PQ_tableaux PQ;
PQ.push({ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1 });
cout << PQ;
vector <double> per;
for (int i = 0; i < PQ.size(); i++) {
per.push_back(PQ.erase());
}
reverse(per.begin(),per.end());
for (int i = 0; i < per.size(); i++)
cout << per[i] <<" ";
return 0;
*/
}