-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
203 lines (161 loc) · 6.43 KB
/
main.c
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
#include <stdlib.h>
#include <iostream>
#include <ctime>
#include <cmath>
#include <fstream>
#include <iterator>
#include <algorithm>
#include "Partition.h"
#include "DimVec.h"
#include "DimVecBank.h"
#include "DimVecAnalyser.h"
#include "Python.h"
#include "test.h"
#include "PartitionSet.h"
using namespace std;
int_partition_bank thePartnBank(17);
dim_vec_bank theDimVecBank(thePartnBank, 3);
auto predT = [](const dim_vec&){ return true; };
auto predRoot = [](const dim_vec& dv){ return dv.IsRoot(); };
auto predReal = [](const dim_vec& dv){ return dv.IsReal(); };
auto predRedux = [](const dim_vec& dv){ return dv.IsReducible(); };
auto predEqArms = [](const dim_vec& dv){ return dv.IsEquibrachial(); };
auto predFinalEqArms = [](const dim_vec& dv){ return dv.GetFinalReduction()->IsEquibrachial();};
PythonEngine thePython;
void build_dim_vecs_from_scratch()
{
clock_t time = clock();
cout << "Dimension Vectors Building" << endl;
theDimVecBank.BuildAll();//(predRedux);//(predT);
//for(nat n = 0; n < theDimVecBank.size(); ++n)
// theDimVecBank[n].BuildEqualArms();
cout << "Dimension Vectors Built in " << (clock() - time)/1000000.0 << endl;
time = clock();
theDimVecBank.ComputeRootStatus();
cout << "Dimension Vector Statuses Found " << (clock() - time)/1000000.0 << endl;
time = clock();
theDimVecBank.ComputeRootStatusOfReducibles();
cout << "Reducible Dimension Vector Statuses Found " << (clock() - time)/1000000.0 << endl;
time = clock();
theDimVecBank.ComputeDominanceStatus();
cout << "Dimension Vector Dominance Statuses Found " << (clock() - time)/1000000.0 << endl;
time = clock();
/*
theDimVecBank.BuildProperties();
cout << "Dimension Vector Properties Found " << clock() - time << endl;
time = clock();
theDimVecBank.CountReflectees();
cout << "Dimension Vector Reflectees Counted " << clock() - time << endl;
time = clock();
*/
}
void write_dim_vecs() {
clock_t time = clock();
theDimVecBank.Write();
cout << "Dimension Vectors Written to File " << (clock() - time)/1000000.0 << endl;
time = clock();
}
void read_dim_vecs() {
clock_t time = clock();
theDimVecBank.Read();
cout << "Dimension Vectors Read from File " << (clock() - time)/1000000.0 << endl;
time = clock();
}
int main()
{
//TestDimVecBank2();
thePartnBank.Build();
thePartnBank.BuildProperties();
//thePartnBank.Print();
/*for(const int_partition_layer& layer : thePartnBank)
{
for(auto ip = layer.begin(); ip != layer.end(); ++ip)
{
ip->Print(0);
for(auto q : layer.GetProperties(ip).theCoveringDominees)
q->Print(2);
for(auto q : layer.GetProperties(ip).theCoveringDominators)
q->Print(4);
}
}*/
//thePartnBank.BuildPairBounds();
build_dim_vecs_from_scratch();
//read_dim_vecs();
//write_dim_vecs();
for(const auto& layer : theDimVecBank)
{
dim_vec_layer_analyser analyser(layer);
//const dim_vec_layer& layer = analyser.GetDimVecLayer();
auto pred = [](const dim_vec& dv){ return dv.IsMaximallyDominant() && dv.IsImaginary(); };
analyser.copy_pred(pred, analyser);
printf("Num(%i): %lu\n", layer.GetN(), analyser.size());
/*for(auto i = analyser.begin(); i != analyser.end(); ++i)
{
const dim_vec& dv = **i;
if(dv.IsFundamental())
dv.PrintArms(0,cout);
dv.Print(0,cout);
}*/
}
return 0;
PartitionSet P1(theDimVecBank, 20,20,int_partition());
P1.decompose();
P1.PrintHeading(cout);
P1.Print(cout, 0);
PartitionSet P2(theDimVecBank, 19,19,int_partition());
P2.decompose();
P2.PrintHeading(cout);
P2.Print(cout, 0);
PartitionSet P3(theDimVecBank, 18,18,int_partition());
P3.decompose();
P3.PrintHeading(cout);
P3.Print(cout, 0);
P3.PrintComputation(cout);
return 0;
if(thePython.Python2DInit())
{
vector<vector<itr_partn>> dots1(thePartnBank.size()), dots2(thePartnBank.size()), dots3(thePartnBank.size());
vector<nat> weights({5,8,10});
for(auto i = weights.begin(); i != weights.end(); ++i)
//for(nat n = 9; n < thePartnBank.size(); ++n)
{
nat n = *i;
dim_vec_layer_analyser analyser(theDimVecBank[n]);
thePython.Init(analyser);
thePython.GetDimVecs([](const dim_vec& a){ return a.IsReal(); });
for(auto i = thePython.begin(); i != thePython.end(); ++i)
dots1[n].push_back((*i)->GetArms()[0]);
thePython.Python2D(thePartnBank, dots1, 'b', '.');
/*analyser.copy_pred([](const dim_vec& a){ return a.IsImaginary(); },dimvecs);
for(auto i = dimvecs.begin(); i != dimvecs.end(); ++i)
dots2[n].push_back((*i)->GetArms()[0]);
analyser.copy_pred([](const dim_vec& a){ return !a.IsRoot(); },dimvecs);
for(auto i = dimvecs.begin(); i != dimvecs.end(); ++i)
dots3[n].push_back((*i)->GetArms()[0]);
dimvecs.clear();*/
}
//Python2D(myfile, thePartnBank, dots3, 'y', '.');
//Python2D(myfile, thePartnBank, dots2, 'r', '.');
//Python2D(myfile, thePartnBank, dots1, 'b', '.');
thePython.PythonEnd();
}
return 0;
//dim_vec_layer_analyser analyser(theDimVecBank[thePartnBank.size() - 1]);
//thePython.Init(analyser);
if(thePython.Python3DInit())
{
/*dimvecs.clear();
analyser.copy_pred([](const dim_vec& a){ return a.IsReal(); },dimvecs);
Python(myfile, thePartnBank.back(), dimvecs, 'r', ',');*/
thePython.GetDimVecs([](const dim_vec& a){ return predFinalEqArms(a); });
thePython.Python3D('g', ',');
thePython.GetDimVecs([](const dim_vec& a){ return !predFinalEqArms(a) && a.IsReducible() && ((2*a.GetQuadraticForm() - 2*a.GetWeight()*a.GetWeight()) % 3 != 0); });
thePython.Python3D('r', ',');
thePython.GetDimVecs([](const dim_vec& a){ return !predFinalEqArms(a) && a.IsReducible() && ((2*a.GetQuadraticForm() - 2*a.GetWeight()*a.GetWeight()) % 3 == 0); });
thePython.Python3D('b', ',');
/*dimvecs.clear();
analyser.copy_pred([](const dim_vec& a){ return a.IsRoot() && !a.IsReducible() && !a.IsMaximallyCoarse(); },dimvecs);
Python(myfile, thePartnBank.back(), dimvecs, 'b', '.');*/
thePython.PythonEnd();
}
}