18namespace layer4_classification {
19namespace poset_classification {
23void poset_classification::generate_source_code(
24 int level,
int verbose_level)
26 int f_v = (verbose_level >= 1);
27 int f_vv = (verbose_level >= 2);
40 cout <<
"poset_classification::generate_source_code" << endl;
44 sprintf(str,
"_level_%d", level);
45 my_prefix.append(str);
47 fname.assign(my_prefix);
59 fp <<
"static long int " << Control->
problem_label <<
"_nb_reps = " << nb_iso <<
";" << endl;
60 fp <<
"static long int " << Control->
problem_label <<
"_size = " << level <<
";" << endl;
61 fp <<
"static long int " << Control->
problem_label <<
"_reps[] = {" << endl;
62 for (iso_type = 0; iso_type < nb_iso; iso_type++) {
66 for (i = 0; i < level; i++) {
73 fp <<
"static const char *" << Control->
problem_label <<
"_stab_order[] = {" << endl;
74 for (iso_type = 0; iso_type < nb_iso; iso_type++) {
91 fp <<
"static int " << Control->
problem_label <<
"_make_element_size = "
99 stab_gens_first =
NEW_int(nb_iso);
100 stab_gens_len =
NEW_int(nb_iso);
102 fp <<
"static int " << Control->
problem_label <<
"_stab_gens[] = {" << endl;
103 for (iso_type = 0; iso_type < nb_iso; iso_type++) {
112 stab_gens_first[iso_type] = fst;
114 fst += stab_gens_len[iso_type];
117 for (j = 0; j < stab_gens_len[iso_type]; j++) {
119 cout <<
"poset_classification::generate_source_code "
120 "before extract_strong_generators_in_order "
121 "poset_classification "
122 << j <<
" / " << stab_gens_len[iso_type] << endl;
136 fp <<
"static long int " << Control->
problem_label <<
"_stab_gens_fst[] = { ";
137 for (iso_type = 0; iso_type < nb_iso; iso_type++) {
138 fp << stab_gens_first[iso_type];
139 if (iso_type < nb_iso - 1) {
142 if (((iso_type + 1) % 10) == 0) {
148 fp <<
"static long int " << Control->
problem_label <<
"_stab_gens_len[] = { ";
149 for (iso_type = 0; iso_type < nb_iso; iso_type++) {
150 fp << stab_gens_len[iso_type];
151 if (iso_type < nb_iso - 1) {
154 if (((iso_type + 1) % 10) == 0) {
170 cout <<
"written file " << fname <<
" of size "
173 cout <<
"poset_classification::generate_source_code done" << endl;
177void poset_classification::generate_history(
int level,
int verbose_level)
179 int f_v = (verbose_level >= 1);
180 int f_vv = (verbose_level >= 2);
194 cout <<
"poset_classification::generate_history" << endl;
198 sprintf(str,
"_history_level_%d", level);
199 my_prefix.append(str);
201 fname.assign(my_prefix);
202 fname.append(
".cpp");
215 fp <<
"static int " << problem_label <<
"_make_element_size = "
219 for (lvl = 0; lvl <= level; lvl++) {
221 cout <<
"poset_classification::generate_history lvl = " << lvl <<
" / " << level << endl;
224 fp <<
"// level " << lvl <<
":" << endl;
225 fp <<
"static long int " << problem_label <<
"_lvl_" << lvl <<
"_nb_reps = " << nb_iso <<
";" << endl;
226 fp <<
"static long int " << problem_label <<
"_lvl_" << lvl <<
"_size = " << level <<
";" << endl;
227 fp <<
"static long int " << problem_label <<
"_lvl_" << lvl <<
"_reps[] = {" << endl;
228 for (iso_type = 0; iso_type < nb_iso; iso_type++) {
232 for (i = 0; i < lvl; i++) {
241 int f_progress =
FALSE;
250 fp <<
"static const char *" << problem_label <<
"_lvl_" << lvl <<
"_stab_order[] = {" << endl <<
"\t";
251 for (iso_type = 0; iso_type < nb_iso; iso_type++) {
274 if (((iso_type + 1) % 10) == 0) {
279 if ((iso_type % L100) == 0) {
280 cout <<
"poset_classification::generate_history "
281 "first loop at " << iso_type / L100 <<
"%" << endl;
291 int *stab_gens_first;
295 stab_gens_first =
NEW_int(nb_iso);
296 stab_gens_len =
NEW_int(nb_iso);
298 fp <<
"static int " << problem_label <<
"_lvl_" << lvl <<
"_stab_gens[] = {" << endl;
299 for (iso_type = 0; iso_type < nb_iso; iso_type++) {
305 stab_gens_first[iso_type] = fst;
306 stab_gens_len[iso_type] = 0;
316 stab_gens_first[iso_type] = fst;
318 fst += stab_gens_len[iso_type];
321 for (j = 0; j < stab_gens_len[iso_type]; j++) {
323 cout <<
"poset_classification::generate_source_code "
324 "before extract_strong_generators_in_order "
325 "poset_classification "
326 << j <<
" / " << stab_gens_len[iso_type] << endl;
337 if ((iso_type % L100) == 0) {
338 cout <<
"poset_classification::generate_history "
339 "second loop at " << iso_type / L100 <<
"%" << endl;
346 fp <<
"static long int " << problem_label <<
"_lvl_" << lvl <<
"_stab_gens_fst[] = { " << endl <<
"\t";
347 for (iso_type = 0; iso_type < nb_iso; iso_type++) {
348 fp << stab_gens_first[iso_type];
349 if (iso_type < nb_iso - 1) {
352 if (((iso_type + 1) % 10) == 0) {
358 fp <<
"static long int " << problem_label <<
"_lvl_" << lvl <<
"_stab_gens_len[] = { " << endl <<
"\t";
359 for (iso_type = 0; iso_type < nb_iso; iso_type++) {
360 fp << stab_gens_len[iso_type];
361 if (iso_type < nb_iso - 1) {
364 if (((iso_type + 1) % 10) == 0) {
378 int *flag_orbit_first;
380 int total_number_flag_orbits = 0;
383 flag_orbit_first =
NEW_int(nb_iso);
384 flag_orbit_nb =
NEW_int(nb_iso);
386 for (iso_type = 0; iso_type < nb_iso; iso_type++) {
396 flag_orbit_first[0] = 0;
397 for (iso_type = 1; iso_type < nb_iso; iso_type++) {
398 flag_orbit_first[iso_type] =
399 flag_orbit_first[iso_type - 1] +
400 flag_orbit_nb[iso_type - 1];
402 fp <<
"static long int " << problem_label <<
"_lvl_" << lvl <<
"_total_number_flag_orbits = " << total_number_flag_orbits << endl;
403 fp <<
"static long int " << problem_label <<
"_lvl_" << lvl <<
"_flag_orbit_fst[] = { " << endl <<
"\t";
404 for (iso_type = 0; iso_type < nb_iso; iso_type++) {
405 fp << flag_orbit_first[iso_type];
406 if (iso_type < nb_iso - 1) {
409 if (((iso_type + 1) % 10) == 0) {
414 fp <<
"static long int " << problem_label <<
"_lvl_" << lvl <<
"_flag_orbit_nb[] = { " << endl <<
"\t";
415 for (iso_type = 0; iso_type < nb_iso; iso_type++) {
416 fp << flag_orbit_nb[iso_type];
417 if (iso_type < nb_iso - 1) {
420 if (((iso_type + 1) % 10) == 0) {
430 fp <<
"static int " << problem_label <<
"_lvl_" << lvl <<
"_flag_orbit_type[] = { " << endl <<
"\t";
431 for (f = 0; f < total_number_flag_orbits; f++) {
436 so = f - flag_orbit_first[po];
437 cout <<
"flag orbit f=" << f <<
" po=" << po <<
" so=" << so << endl;
445 cout <<
"so >= N->get_nb_of_extensions()" << endl;
452 if (f < total_number_flag_orbits - 1) {
455 if (((f + 1) % 10) == 0) {
462 fp <<
"static long int " << problem_label <<
"_lvl_" << lvl <<
"_flag_orbit_pt[] = { " << endl <<
"\t";
463 for (f = 0; f < total_number_flag_orbits; f++) {
468 so = f - flag_orbit_first[po];
469 cout <<
"flag orbit f=" << f <<
" po=" << po <<
" so=" << so << endl;
478 if (f < total_number_flag_orbits - 1) {
481 if (((f + 1) % 10) == 0) {
487 fp <<
"static long int " << problem_label <<
"_lvl_" << lvl <<
"_flag_orbit_ol[] = { " << endl <<
"\t";
488 for (f = 0; f < total_number_flag_orbits; f++) {
493 so = f - flag_orbit_first[po];
494 cout <<
"flag orbit f=" << f <<
" po=" << po <<
" so=" << so << endl;
502 if (f < total_number_flag_orbits - 1) {
505 if (((f + 1) % 10) == 0) {
514 fusion_idx =
NEW_int(total_number_flag_orbits);
516 for (f = 0; f < total_number_flag_orbits; f++) {
521 so = f - flag_orbit_first[po];
522 cout <<
"flag orbit f=" << f <<
" po=" << po <<
" so=" << so << endl;
529 fusion_idx[f] = nb_fuse;
535 nb_fuse_total = nb_fuse;
539 fp <<
"static long int " << problem_label <<
"_lvl_" << lvl <<
"_flag_index[] = { " << endl <<
"\t";
540 for (f = 0; f < total_number_flag_orbits; f++) {
545 so = f - flag_orbit_first[po];
546 cout <<
"flag orbit f=" << f <<
" po=" << po <<
" so=" << so << endl;
560 if (f < total_number_flag_orbits - 1) {
563 if (((f + 1) % 10) == 0) {
573 cout <<
"collecting data" << endl;
574 fuse_data =
NEW_int(nb_fuse_total * 3);
576 for (f = 0; f < total_number_flag_orbits; f++) {
581 so = f - flag_orbit_first[po];
582 cout <<
"flag orbit f=" << f <<
" po=" << po <<
" so=" << so << endl;
596 cout <<
"writing data1" << endl;
597 fp <<
"static long int " << problem_label <<
"_lvl_" << lvl <<
"_flag_fuse_data1[] = { " << endl <<
"\t";
598 for (nb_fuse = 0; nb_fuse < nb_fuse_total; nb_fuse++) {
599 fp << fuse_data[nb_fuse * 3 + 1];
600 if (nb_fuse < nb_fuse_total - 1) {
603 if (((nb_fuse + 1) % 10) == 0) {
609 cout <<
"writing data2" << endl;
610 fp <<
"static long int " << problem_label <<
"_lvl_" << lvl <<
"_flag_fuse_data2[] = { " << endl <<
"\t";
611 for (nb_fuse = 0; nb_fuse < nb_fuse_total; nb_fuse++) {
612 fp << fuse_data[nb_fuse * 3 + 2];
613 if (nb_fuse < nb_fuse_total - 1) {
616 if (((nb_fuse + 1) % 10) == 0) {
623 cout <<
"writing iso" << endl;
624 fp <<
"static long int " << problem_label <<
"_lvl_" << lvl <<
"_flag_fuse_iso[] = { " << endl;
625 for (nb_fuse = 0; nb_fuse < nb_fuse_total; nb_fuse++) {
626 hdl = fuse_data[nb_fuse * 3 + 0];
646 cout <<
"written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
648 cout <<
"poset_classification::generate_history done" << endl;
a collection of functions related to sorted vectors
int int_vec_search(int *v, int len, int a, int &idx)
a collection of functions related to file io
long int file_size(std::string &fname)
a class to represent arbitrary precision integers
std::ostream & print_not_scientific(std::ostream &ost)
void element_retrieve(int hdl, void *elt, int verbose_level)
void element_print_for_make_element(void *elt, std::ostream &ost)
a set and its known set stabilizer
ring_theory::longinteger_object target_go
groups::strong_generators * Strong_gens
data_structures_groups::vector_ge * gens
std::string problem_label
data_structures_groups::set_and_stabilizer * get_set_and_stabilizer(int level, int orbit_at_level, int verbose_level)
poset_orbit_node * get_node_ij(int level, int node)
int nb_orbits_at_level(int level)
void get_set_by_level(int level, int node, long int *set)
int test_if_stabilizer_is_trivial(int level, int orbit_at_level, int verbose_level)
to represent one poset orbit; related to the class poset_classification
extension * get_E(int idx)
int get_nb_of_extensions()
the orbiter library for the classification of combinatorial objects