Orbiter 2022
Combinatorial Objects
classification_of_objects.cpp
Go to the documentation of this file.
1/*
2 * classification_of_objects.cpp
3 *
4 * Created on: Sep 13, 2020
5 * Author: betten
6 */
7
8
9
10
11#include "foundations.h"
12
13using namespace std;
14
15
16namespace orbiter {
17namespace layer1_foundations {
18namespace combinatorics {
19
20
21static void print_summary_table_entry(int *Table,
22 int m, int n, int i, int j, int val, std::string &output, void *data);
23
24
26{
27
28 Descr = NULL;
29
31
32 P = NULL;
33
34 IS = NULL;
35
36 CB = NULL;
37
38 Ago = NULL;
39 F_reject = NULL;
40
41 nb_orbits = 0;
42 Idx_transversal = NULL;
43 Ago_transversal = NULL;
44 OWCF_transversal = NULL;
45 NO_transversal = NULL;
46
47 T_Ago = NULL;
48
49}
50
52{
53 if (Ago) {
55 }
56 if (F_reject) {
58 }
59 if (Idx_transversal) {
61 }
62 if (Ago_transversal) {
64 }
65 if (T_Ago) {
67 }
68 if (OWCF_transversal) {
69#if 0
70 int i;
71
72 for (i = 0; i < nb_orbits; i++) {
73 FREE_OBJECT(OWCF[i]);
74 }
75#endif
77 }
78 if (NO_transversal) {
79 FREE_pvoid((void **) NO_transversal);
80 }
81}
82
85 int f_projective_space,
88 int verbose_level)
89{
90 int f_v = (verbose_level >= 1);
91
92
93 if (f_v) {
94 cout << "classification_of_objects::perform_classification f_projective_space=" << f_projective_space << endl;
95 }
96
101
102 //int i;
103
105
106
107
108
109
110 if (f_v) {
111 cout << "classification_of_objects::perform_classification "
112 "before classify_objects_using_nauty" << endl;
113 }
114
115 classify_objects_using_nauty(verbose_level - 1);
116
117 if (f_v) {
118 cout << "classification_of_objects::perform_classification "
119 "after classify_objects_using_nauty" << endl;
120 }
121
122
123 cout << "classification_of_objects::perform_classification We found "
124 << CB->nb_types << " types" << endl;
125
126
127
128
129
130
131 if (f_v) {
132 cout << "classification_of_objects::perform_classification done" << endl;
133 }
134
135
136}
137
138
140 int verbose_level)
141{
142 int f_v = (verbose_level >= 1);
143 int input_idx;
144 int t0, t1, dt;
146
147 if (f_v) {
148 cout << "classification_of_objects::classify_objects_using_nauty" << endl;
149 }
150
151
152 if (f_v) {
153 cout << "classification_of_objects::classify_objects_using_nauty "
154 "nb_objects_to_test = " << IS->nb_objects_to_test << endl;
155 }
156
157
158 t0 = Os.os_ticks();
159
160
161 Ago = NEW_lint(IS->Objects.size());
162
163 F_reject = NEW_int(IS->Objects.size());
164
166
168
169
170 nb_orbits = 0;
171 for (input_idx = 0; input_idx < IS->Objects.size(); input_idx++) {
172
173 if (f_v && (input_idx % 1000) == 0) {
174 cout << "classification_of_objects::classify_objects_using_nauty "
175 "input_idx = " << input_idx << " / " << IS->Objects.size() << endl;
176 }
177
179
180 OwCF = (geometry::object_with_canonical_form *) IS->Objects[input_idx];
181 if (FALSE) {
182 cout << "classification_of_objects::classify_objects_using_nauty "
183 "OwCF:" << endl;
184 OwCF->print(cout);
185 }
186
187
188
189 if (FALSE) {
190 cout << "classification_of_objects::classify_objects_using_nauty "
191 "before process_any_object" << endl;
192 }
193
194
196
198 input_idx,
199 Ago[input_idx],
200 F_reject[input_idx],
201 NO,
202 verbose_level - 1);
203
204
205 if (FALSE) {
206 cout << "classification_of_objects::classify_objects_using_nauty "
207 "after process_any_object" << endl;
208 }
209
210 if (!F_reject[input_idx]) {
213 nb_orbits++;
214 }
215
216 }
217 if (f_v) {
218 cout << "classification_of_objects::classify_objects_using_nauty "
219 "nb_orbits = " << nb_orbits << endl;
220 }
221
224
225 int iso_idx;
226
227 for (input_idx = 0, iso_idx = 0;
228
229 input_idx < IS->Objects.size();
230
231 input_idx++) {
232
233 if (F_reject[input_idx]) {
234 continue;
235 }
236
237 Idx_transversal[iso_idx] = input_idx;
238 Ago_transversal[iso_idx] = Ago[input_idx];
239 iso_idx++;
240 }
241 if (iso_idx != nb_orbits) {
242 cout << "classification_of_objects::classify_objects_using_nauty iso_idx != nb_orbits" << endl;
243 exit(1);
244 }
245
246 if (f_v) {
247 cout << "input object : ago : f_reject" << endl;
248 for (input_idx = 0; input_idx < IS->Objects.size(); input_idx++) {
249 cout << setw(3) << input_idx << " : " << setw(5) << Ago[input_idx] << " : " << F_reject[input_idx] << endl;
250 }
251 }
252
253 if (f_v) {
254 cout << "transversal of orbit representatives:" << endl;
255 int cnt;
256 cout << "iso type : input object : ago" << endl;
257 for (input_idx = 0, cnt = 0; input_idx < IS->Objects.size(); input_idx++) {
258 if (F_reject[input_idx]) {
259 continue;
260 }
261 cout << setw(3) << cnt << " : " << setw(3) << input_idx << " : " << setw(5) << Ago[input_idx] << endl;
262 cnt++;
263 }
264 }
265
266 if (f_v) {
267 cout << "classification_of_objects::classify_objects_using_nauty "
268 "before CB->finalize" << endl;
269 }
270
271 CB->finalize(verbose_level); // computes C_type_of and perm
272
273
276
277 if (f_v) {
278 cout << "Automorphism group orders of orbit transversal: ";
279 T_Ago->print_first(TRUE /* f_backwards */);
280 cout << endl;
281 }
282
283
284
285 if (Descr->f_save_ago) {
286 if (f_v) {
287 cout << "classification_of_objects::process_multiple_objects_from_file "
288 "f_save_ago is TRUE" << endl;
289 }
290
291 save_automorphism_group_order(verbose_level);
292
293 }
294
296 if (f_v) {
297 cout << "classification_of_objects::process_multiple_objects_from_file "
298 "f_save_transversal is TRUE" << endl;
299 }
300
301 save_transversal(verbose_level);
302
303 }
304
305
306
307 t1 = Os.os_ticks();
308 dt = t1 - t0;
309
310 cout << "classification_of_objects::classify_objects_using_nauty Time ";
311 Os.time_check_delta(cout, dt);
312 cout << endl;
313
314
315
316 if (f_v) {
317 cout << "classification_of_objects::classify_objects_using_nauty done" << endl;
318 }
319}
320
322{
323 int f_v = (verbose_level >= 1);
324
325 if (f_v) {
326 cout << "classification_of_objects::save_automorphism_group_order " << endl;
327 }
328 string ago_fname;
331
332 if (Descr->f_label) {
333 ago_fname.assign(Descr->label);
334 }
335 else {
336 ago_fname.assign("classification");
337
338 }
339 ST.replace_extension_with(ago_fname, "_ago.csv");
340
341 Fio.lint_vec_write_csv(Ago_transversal, nb_orbits, ago_fname, "Ago");
342 if (f_v) {
343 cout << "Written file " << ago_fname << " of size " << Fio.file_size(ago_fname) << endl;
344 }
345 if (f_v) {
346 cout << "classification_of_objects::save_automorphism_group_order done" << endl;
347 }
348}
349
351{
352 int f_v = (verbose_level >= 1);
353
354 if (f_v) {
355 cout << "classification_of_objects::save_transversal " << endl;
356 }
357 string fname;
360
361 if (Descr->f_label) {
362 fname.assign(Descr->label);
363 }
364 else {
365 fname.assign("classification");
366
367 }
368 ST.replace_extension_with(fname, "_transversal.csv");
369
370 Fio.int_vec_write_csv(Idx_transversal, nb_orbits, fname, "Transversal");
371 if (f_v) {
372 cout << "Written file " << fname << " of size " << Fio.file_size(fname) << endl;
373 }
374 if (f_v) {
375 cout << "classification_of_objects::save_transversal done" << endl;
376 }
377}
378
381 int input_idx, long int &ago, int &f_reject, data_structures::nauty_output *&NO,
382 int verbose_level)
383{
384 int f_v = (verbose_level >= 1);
385
386 if (f_v) {
387 cout << "classification_of_objects::process_any_object" << endl;
388 }
389 if (f_v) {
390 cout << "classification_of_objects::process_any_object "
391 "input_idx=" << input_idx << " / " << IS->nb_objects_to_test << endl;
392 }
393
394 if (f_v) {
395 cout << "classification_of_objects::process_any_object "
396 "before process_object" << endl;
397 }
398 int iso_idx_if_found;
399
400 f_reject = process_object(
401 OwCF,
402 ago,
403 iso_idx_if_found,
404 NO,
405 verbose_level - 1);
406
407
408 if (f_v) {
409 cout << "classification_of_objects::process_any_object "
410 "after process_object, f_reject=" << f_reject << endl;
411 }
412
413
414 if (f_reject) {
415
416 //cout << "before FREE_OBJECT(SG)" << endl;
417
418#if 0
419 if (f_projective_space) {
420 FREE_OBJECT(SG);
421 }
422 else {
423 FREE_OBJECT(A_perm);
424 }
425#endif
426
427 FREE_OBJECT(NO);
428 }
429 else {
430 if (f_v) {
431 cout << "classification_of_objects::process_any_object "
432 "New isomorphism type! The current number of "
433 "isomorphism types is " << CB->nb_types << endl;
434 }
435 int idx;
436
437 idx = CB->type_of[CB->n - 1];
438
439
440#if 0
441 if (f_projective_space) {
442 object_in_projective_space_with_action *OiPA;
443
444
445 OiPA = NEW_OBJECT(object_in_projective_space_with_action);
446
447 OiPA->init(OwCF,
448 SG->group_order_as_lint(), SG,
449 //nb_rows, nb_cols,
451 verbose_level);
452
453 //FREE_OBJECT(SG);
454
455 CB->Type_extra_data[idx] = OiPA;
456
457 NO->canonical_labeling = NULL;
458 }
459 else {
460 CB->Type_extra_data[idx] = A_perm;
461
462 }
463#endif
464
465
466 //compute_and_print_ago_distribution(cout,
467 // CB, verbose_level);
468 }
469
470
471 if (f_v) {
472 cout << "classification_of_objects::process_any_object done" << endl;
473 }
474}
475
476
479 long int &ago,
480 int &iso_idx_if_found,
482 int verbose_level)
483// returns f_found, which is TRUE if the object is rejected
484{
485 int f_v = (verbose_level >= 1);
486
487 if (f_v) {
488 cout << "classification_of_objects::process_object "
489 "n=" << CB->n << endl;
490 }
491
492
493 data_structures::bitvector *Canonical_form;
494
495
496 if (f_projective_space) {
497 OwCF->P = P;
498 }
499 else {
500 OwCF->P = NULL;
501 }
502
503
504
505 if (f_v) {
506 cout << "classification_of_objects::process_object "
507 "before OwCF->run_nauty" << endl;
508 }
509
510 OwCF->run_nauty(
511 TRUE /* f_compute_canonical_form */, Canonical_form,
512 NO,
513 verbose_level);
514
515 if (f_v) {
516 cout << "classification_of_objects::process_object "
517 "after OwCF->run_nauty" << endl;
518 }
519
520
521
523
524 NO->Ago->assign_to(go);
525
526 if (f_v) {
527 cout << "classification_of_objects::process_object "
528 "go = " << go << endl;
529
530 NO->print_stats();
531
532
533 }
534
535
536
537 ago = go.as_lint();
538
539 if (CB->n == 0) {
540 if (f_v) {
541 cout << "classification_of_objects::process_object "
542 "before CB->init" << endl;
543 }
545
546 Canonical_form->get_allocated_length(),
547
548 verbose_level);
549 if (f_v) {
550 cout << "classification_of_objects::process_object "
551 "after CB->init" << endl;
552 }
553 }
554 int f_found;
555
556 if (f_v) {
557 cout << "classification_of_objects::process_object "
558 "before CB->search_and_add_if_new" << endl;
559 }
560
562
563 Canonical_form->get_data(),
564
565 NULL /* extra_data */,
566
567 f_found, iso_idx_if_found,
568
569 verbose_level);
570
571 if (f_v) {
572 cout << "classification_of_objects::process_object "
573 "after CB->search_and_add_if_new" << endl;
574 }
575
576
577 //delete SG;
578
579 if (f_v) {
580 cout << "classification_of_objects::process_object done" << endl;
581 }
582 return f_found;
583}
584
585
586#if 0
587int classification_of_objects::process_object_with_known_canonical_labeling(
588 object_with_canonical_form *OiP,
589 int *canonical_labeling, int canonical_labeling_len,
590 int &idx,
591 nauty_output *NO,
592 int verbose_level)
593// returns f_found, which is TRUE if the object is rejected
594{
595 int f_v = (verbose_level >= 1);
596
597 if (f_v) {
598 cout << "classification_of_objects::process_object_with_known_canonical_labeling "
599 "n=" << CB->n << endl;
600 }
601
602 //longinteger_object go;
603 //int *Extra_data;
604
605
606 //uchar *canonical_form;
607 //int canonical_form_len;
608
609
610#if 0
611 if (f_v) {
612 cout << "classification_of_objects::process_object_with_known_canonical_labeling "
613 "before PA->set_stabilizer_of_object" << endl;
614 }
615
616
617 SG = PA->set_stabilizer_of_object(
618 OiP,
619 Descr->f_save_incma_in_and_out, Descr->save_incma_in_and_out_prefix,
620 TRUE /* f_compute_canonical_form */,
621 canonical_form, canonical_form_len,
622 canonical_labeling, canonical_labeling_len,
623 verbose_level - 2);
624
625
626 if (f_v) {
627 cout << "classification_of_objects::process_object_with_known_canonical_labeling "
628 "after PA->set_stabilizer_of_object" << endl;
629 }
630#else
631
632 if (f_v) {
633 cout << "classification_of_objects::process_object_with_known_canonical_labeling "
634 "before OiP->canonical_form_given_canonical_labeling" << endl;
635 }
636
637 bitvector *Bitvec_canonical_form;
638
639 OiP->canonical_form_given_canonical_labeling(
640 canonical_labeling,
641 Bitvec_canonical_form,
642 verbose_level);
643
644
645 if (f_v) {
646 cout << "classification_of_objects::process_object_with_known_canonical_labeling "
647 "after OiP->canonical_form_given_canonical_labeling" << endl;
648 }
649#endif
650
651 int i;
652
653 for (i = 0; i < NO->N; i++) {
654 NO->canonical_labeling[i] = canonical_labeling[i];
655 }
656
657
658 //SG->group_order(go);
659
660
661
662 if (CB->n == 0) {
663
665 Bitvec_canonical_form->get_allocated_length() /*canonical_form_len*/,
666 verbose_level);
667
668 }
669 int f_found;
670
671 CB->search_and_add_if_new(Bitvec_canonical_form->get_data(),
672 OiP, f_found, idx, verbose_level);
673
674
675 //delete SG;
676
677 FREE_OBJECT(Bitvec_canonical_form);
678
679 if (f_v) {
680 cout << "classification_of_objects::process_object_with_known_canonical_labeling done" << endl;
681 }
682 return f_found;
683}
684#endif
685
686#if 0
687void classification_of_objects::save(
688 std::string &output_prefix,
689 int verbose_level)
690{
691 int f_v = (verbose_level >= 1);
692 string fname;
693 file_io Fio;
694
695 if (f_v) {
696 cout << "classification_of_objects::save" << endl;
697 }
698 fname.assign(output_prefix);
699 fname.append("_classified.cvs");
700
701
702#if 0
703 {
704 ofstream fp(fname);
705 int i, j;
706
707 fp << "rep,ago,original_file,input_idx,input_set,"
708 "nb_rows,nb_cols,canonical_form" << endl;
709 for (i = 0; i < CB->nb_types; i++) {
710
711 object_in_projective_space_with_action *OiPA;
712 object_with_canonical_form *OwCF;
713
714 //cout << i << " / " << CB->nb_types << " is "
715 // << CB->Type_rep[i] << " : " << CB->Type_mult[i] << " : ";
716 OiPA = (object_in_projective_space_with_action *) CB->Type_extra_data[i];
717 OwCF = OiPA->OwCF;
718
719 if (OwCF == NULL) {
720 cout << "OiP == NULL" << endl;
721 exit(1);
722 }
723
724 if (OwCF->type != t_PAC) {
725 //OiP->print(cout);
726 }
727 //OiP->print(cout);
728
729 #if 0
730 for (j = 0; j < rep_len; j++) {
731 cout << (int) Type_data[i][j];
732 if (j < rep_len - 1) {
733 cout << ", ";
734 }
735 }
736 #endif
737 //cout << "before writing OiP->set_as_string:" << endl;
738
739 int ago;
740
741 if (OwCF->f_has_known_ago) {
742 ago = OwCF->known_ago;
743 }
744 else {
745 ago = 0; //OiPA->Aut_gens->group_order_as_lint();
746 }
747 fp << i << "," << ago
748 << "," << OwCF->input_fname
749 << "," << OwCF->input_idx
750 << ",\"" << OwCF->set_as_string << "\",";
751 //cout << "before writing OiPA->nb_rows:" << endl;
752 fp << OiPA->nb_rows << "," << OiPA->nb_cols<< ",";
753
754 //cout << "before writing canonical labeling:" << endl;
755 fp << "\"";
756 for (j = 0; j < OiPA->nb_rows + OiPA->nb_cols; j++) {
757 fp << OiPA->canonical_labeling[j];
758 if (j < OiPA->nb_rows + OiPA->nb_cols - 1) {
759 fp << ",";
760 }
761 }
762 fp << "\"";
763 fp << endl;
764 }
765 fp << "END" << endl;
766 }
767 cout << "written file " << fname << " of size "
768 << Fio.file_size(fname) << endl;
769
770#endif
771
772 if (f_v) {
773 cout << "classification_of_objects::save done" << endl;
774 }
775}
776#endif
777
778
779
781 std::ostream &fp, int verbose_level)
782{
783 int f_v = (verbose_level >= 1);
784
785 if (f_v) {
786 cout << "classification_of_objects::report_summary_of_orbits" << endl;
787 }
789 int i, j;
790
791
792 int *Table;
793 int width = 4;
794 int *row_labels;
795 int *col_labels;
796 int row_part_first[2], row_part_len[1];
797 int nb_row_parts = 1;
798 int col_part_first[2], col_part_len[1];
799 int nb_col_parts = 1;
800
801
802
803 row_part_first[0] = 0;
804 row_part_first[1] = CB->nb_types;
805 row_part_len[0] = CB->nb_types;
806
807 col_part_first[0] = 0;
808 col_part_first[1] = width;
809 col_part_len[0] = width;
810
811 Table = NEW_int(CB->nb_types * width);
812 Int_vec_zero(Table, CB->nb_types * width);
813
814 row_labels = NEW_int(CB->nb_types);
815 col_labels = NEW_int(width);
816
817 for (i = 0; i < CB->nb_types; i++) {
818 row_labels[i] = i;
819 }
820
821 for (j = 0; j < width; j++) {
822 col_labels[j] = j;
823 }
824
825 for (i = 0; i < CB->nb_types; i++) {
826 if (f_v) {
827 cout << "classification_of_objects::latex_report, i=" << i << endl;
828 }
829 //j = CB->perm[i];
830 j = i;
831 if (f_v) {
832 cout << "classification_of_objects::latex_report, i=" << i << " j=" << j << endl;
833 }
834 Table[i * width + 0] = CB->Type_rep[j];
835 Table[i * width + 1] = CB->Type_mult[j];
836 Table[i * width + 2] = 0; // group order
837 Table[i * width + 3] = 0; // object list
838 }
839
840 if (f_v) {
841 cout << "classification_of_objects::latex_report before Summary of Orbits" << endl;
842 }
843
844 fp << "\\section*{Summary of Orbits}" << endl;
845
846 fp << "$$" << endl;
848 Table, CB->nb_types, 4,
849 row_labels, col_labels,
850 row_part_first, row_part_len, nb_row_parts,
851 col_part_first, col_part_len, nb_col_parts,
852 print_summary_table_entry,
853 this /*void *data*/,
854 TRUE /* f_tex */);
855 fp << "$$" << endl;
856
857 if (f_v) {
858 cout << "classification_of_objects::latex_report after Summary of Orbits" << endl;
859 }
860
861 FREE_int(Table);
862
863 if (f_v) {
864 cout << "classification_of_objects::report_summary_of_orbits done" << endl;
865 }
866
867}
868
870 std::ostream &fp, int max_TDO_depth,
871 int f_show_incma,
872 int verbose_level)
873{
874 int f_v = (verbose_level >= 1);
875
876 if (f_v) {
877 cout << "classification_of_objects::report_all_isomorphism_types" << endl;
878 }
879 int i;
880
882
883 for (i = 0; i < CB->nb_types; i++) {
884
885 fp << "\\section*{Isomorphism type " << i << " / " << CB->nb_types << "}" << endl;
886 fp << "Isomorphism type " << i << " / " << CB->nb_types
887 //<< " stored at " << j
888 << " is original object "
889 << CB->Type_rep[i] << " and appears "
890 << CB->Type_mult[i] << " times: \\\\" << endl;
891
892 {
894 int *Input_objects;
895 int nb_input_objects;
896 CB->C_type_of->get_class_by_value(Input_objects,
897 nb_input_objects, i, 0 /*verbose_level */);
898 Sorting.int_vec_heapsort(Input_objects, nb_input_objects);
899
900 fp << "This isomorphism type appears " << nb_input_objects
901 << " times, namely for the following "
902 << nb_input_objects << " input objects: " << endl;
903 if (nb_input_objects < 10) {
904 fp << "$" << endl;
905 L.int_set_print_tex(fp, Input_objects, nb_input_objects);
906 fp << "$\\\\" << endl;
907 }
908 else {
909 fp << "Too big to print. \\\\" << endl;
910#if 0
911 fp << "$$" << endl;
912 L.int_vec_print_as_matrix(fp, Input_objects,
913 nb_input_objects, 10 /* width */, TRUE /* f_tex */);
914 fp << "$$" << endl;
915#endif
916 }
917
918 FREE_int(Input_objects);
919 }
920
921 if (f_v) {
922 cout << "classification_of_objects::latex_report before report_isomorphism_type" << endl;
923 }
924 report_isomorphism_type(fp, i, max_TDO_depth, f_show_incma, verbose_level);
925 if (f_v) {
926 cout << "classification_of_objects::latex_report after report_isomorphism_type" << endl;
927 }
928
929
930 } // next i
931 if (f_v) {
932 cout << "classification_of_objects::report_all_isomorphism_types done" << endl;
933 }
934
935}
936
937
939 std::ostream &fp, int i, int max_TDO_depth,
940 int f_show_incma,
941 int verbose_level)
942{
943 int f_v = (verbose_level >= 1);
944
945 if (f_v) {
946 cout << "classification_of_objects::report_isomorphism_type i=" << i << endl;
947 }
948 int j;
950
951 //j = CB->perm[i];
952 //j = CB->Type_rep[i];
953 j = i;
954
955 cout << "###################################################"
956 "#############################" << endl;
957 cout << "Orbit " << i << " / " << CB->nb_types
958 << " is canonical form no " << j
959 << ", original object no " << CB->Type_rep[i]
960 << ", frequency " << CB->Type_mult[i]
961 << " : " << endl;
962
963
964 {
965 int *Input_objects;
966 int nb_input_objects;
967 CB->C_type_of->get_class_by_value(Input_objects,
968 nb_input_objects, j, 0 /*verbose_level */);
969
970 cout << "This isomorphism type appears " << nb_input_objects
971 << " times, namely for the following "
972 "input objects:" << endl;
973 if (nb_input_objects < 10) {
974 L.int_vec_print_as_matrix(cout, Input_objects,
975 nb_input_objects, 10 /* width */,
976 FALSE /* f_tex */);
977 }
978 else {
979 cout << "too many to print" << endl;
980 }
981
982 FREE_int(Input_objects);
983 }
984
986
987 OwCF = OWCF_transversal[i];
988
989
990 report_object(fp,
991 OwCF,
992 i /* object_idx */,
993 max_TDO_depth,
994 f_show_incma,
995 verbose_level);
996
997
998
999
1000 if (f_v) {
1001 cout << "classification_of_objects::report_isomorphism_type i=" << i << " done" << endl;
1002 }
1003}
1004
1005
1008 int object_idx,
1009 int max_TDO_depth,
1010 int f_show_incma,
1011 int verbose_level)
1012{
1013 int f_v = (verbose_level >= 1);
1014
1015 if (f_v) {
1016 cout << "classification_of_objects::report_object" << endl;
1017 }
1018
1019 OwCF->print_tex_detailed(fp, f_show_incma, verbose_level);
1020
1021}
1022
1023
1024
1025static void print_summary_table_entry(int *Table,
1026 int m, int n, int i, int j, int val,
1027 std::string &output, void *data)
1028{
1029 int f_v = TRUE;
1031 //object_in_projective_space_with_action *OiPA;
1032 //void *extra_data;
1033 int h;
1035 char str[1000];
1036
1037 if (f_v) {
1038 cout << "print_summary_table_entry i=" << i << " j=" << j << endl;
1039 }
1040
1041 classification_of_objects *PC;
1042
1043 PC = (classification_of_objects *) data;
1044 //CB = (classify_bitvectors *) data;
1045 CB = PC->CB;
1046
1047 str[0] = 0;
1048
1049 if (i == -1) {
1050 if (j == -1) {
1051 sprintf(str, "\\mbox{Orbit}");
1052 }
1053 else if (j == 0) {
1054 sprintf(str, "\\mbox{Rep}");
1055 }
1056 else if (j == 1) {
1057 sprintf(str, "\\#");
1058 }
1059 else if (j == 2) {
1060 sprintf(str, "\\mbox{Ago}");
1061 }
1062 else if (j == 3) {
1063 sprintf(str, "\\mbox{Objects}");
1064 }
1065 }
1066 else {
1067 //cout << "print_summary_table_entry i=" << i << " j=" << j << endl;
1068 if (j == -1) {
1069 sprintf(str, "%d", i);
1070 }
1071 else if (j == 2) {
1072
1073
1074 if (f_v) {
1075 cout << "print_summary_table_entry getting extra_data" << endl;
1076 }
1077
1078#if 0
1079 longinteger_object go;
1080 //extra_data = CB->Type_extra_data[CB->perm[i]];
1081 extra_data = CB->Type_extra_data[i];
1082
1083 if (f_v) {
1084 cout << "print_summary_table_entry after getting extra_data" << endl;
1085 }
1086
1087 OiPA = (object_in_projective_space_with_action *) extra_data;
1088
1089
1090 if (f_v) {
1091 cout << "print_summary_table_entry getting extra_data OiPA=" << endl;
1092 OiPA->print();
1093 }
1094 go.create(OiPA->ago, __FILE__, __LINE__);
1095 //OiPA->Aut_gens->group_order(go);
1096 go.print_to_string(str);
1097#else
1098 ring_theory::longinteger_object go;
1099 go.create(PC->Ago_transversal[i], __FILE__, __LINE__);
1100 //OiPA->Aut_gens->group_order(go);
1101 go.print_to_string(str);
1102#endif
1103 }
1104 else if (j == 3) {
1105
1106
1107 int *Input_objects;
1108 int nb_input_objects;
1109 if (f_v) {
1110 cout << "print_summary_table_entry before CB->C_type_of->get_class_by_value" << endl;
1111 }
1112 CB->C_type_of->get_class_by_value(Input_objects,
1113 nb_input_objects, i /*CB->perm[i]*/, 0 /*verbose_level */);
1114 if (f_v) {
1115 cout << "print_summary_table_entry after CB->C_type_of->get_class_by_value" << endl;
1116 }
1117 Sorting.int_vec_heapsort(Input_objects, nb_input_objects);
1118
1119 output[0] = 0;
1120 for (h = 0; h < nb_input_objects; h++) {
1121 sprintf(str + strlen(str), "%d", Input_objects[h]);
1122 if (h < nb_input_objects - 1) {
1123 strcat(str, ", ");
1124 }
1125 if (h == 10) {
1126 strcat(str, "\\ldots");
1127 break;
1128 }
1129 }
1130
1131 FREE_int(Input_objects);
1132 }
1133 else {
1134 sprintf(str, "%d", val);
1135 }
1136 }
1137 output.assign(str);
1138}
1139
1140
1141
1142
1143}}}
1144
1145
description of a classification of objects using class classification_of_objects
void report_all_isomorphism_types(std::ostream &fp, int max_TDO_depth, int f_show_incma, int verbose_level)
void report_object(std::ostream &fp, geometry::object_with_canonical_form *OwCF, int object_idx, int max_TDO_depth, int f_show_incma, int verbose_level)
int process_object(geometry::object_with_canonical_form *OwCF, long int &ago, int &iso_idx_if_found, data_structures::nauty_output *&NO, int verbose_level)
void report_isomorphism_type(std::ostream &fp, int i, int max_TDO_depth, int f_show_incma, int verbose_level)
void process_any_object(geometry::object_with_canonical_form *OwCF, int input_idx, long int &ago, int &f_reject, data_structures::nauty_output *&NO, int verbose_level)
void perform_classification(classification_of_objects_description *Descr, int f_projective_space, geometry::projective_space *P, data_structures::data_input_stream *IS, int verbose_level)
compact storage of 0/1-data as bitvectors
classification of 0/1 matrices using canonical forms
void search_and_add_if_new(uchar *data, void *extra_data, int &f_found, int &idx, int verbose_level)
input data for classification of geometric objects from the command line
a collection of functions related to sorted vectors
functions related to strings and character arrays
void replace_extension_with(char *p, const char *new_ext)
a statistical analysis of data consisting of single integers
void init_lint(long int *data, int data_length, int f_second, int verbose_level)
Definition: tally.cpp:123
void get_class_by_value(int *&Pts, int &nb_pts, int value, int verbose_level)
Definition: tally.cpp:644
a combinatorial object for which a canonical form can be computed using Nauty
Definition: geometry.h:1487
void run_nauty(int f_compute_canonical_form, data_structures::bitvector *&Canonical_form, data_structures::nauty_output *&NO, int verbose_level)
void print_tex_detailed(std::ostream &ost, int f_show_incma, int verbose_level)
projective space PG(n,q) of dimension n over Fq
Definition: geometry.h:1916
void int_vec_write_csv(int *v, int len, std::string &fname, const char *label)
Definition: file_io.cpp:1175
void lint_vec_write_csv(long int *v, int len, std::string &fname, const char *label)
Definition: file_io.cpp:1191
void int_matrix_print_with_labels_and_partition(std::ostream &ost, int *p, int m, int n, int *row_labels, int *col_labels, int *row_part_first, int *row_part_len, int nb_row_parts, int *col_part_first, int *col_part_len, int nb_col_parts, void(*process_function_or_NULL)(int *p, int m, int n, int i, int j, int val, std::string &output, void *data), void *data, int f_tex)
void int_vec_print_as_matrix(std::ostream &ost, int *v, int len, int width, int f_tex)
a class to represent arbitrary precision integers
Definition: ring_theory.h:366
#define FREE_int(p)
Definition: foundations.h:640
#define Int_vec_zero(A, B)
Definition: foundations.h:713
#define NEW_pvoid(n)
Definition: foundations.h:637
#define NEW_OBJECT(type)
Definition: foundations.h:638
#define FREE_OBJECT(p)
Definition: foundations.h:651
#define NEW_int(n)
Definition: foundations.h:625
#define FREE_pvoid(p)
Definition: foundations.h:650
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
#define FREE_lint(p)
Definition: foundations.h:642
#define NEW_lint(n)
Definition: foundations.h:628
the orbiter library for the classification of combinatorial objects