17namespace layer1_foundations {
18namespace combinatorics {
21static void print_summary_table_entry(
int *Table,
22 int m,
int n,
int i,
int j,
int val, std::string &output,
void *data);
85 int f_projective_space,
90 int f_v = (verbose_level >= 1);
94 cout <<
"classification_of_objects::perform_classification f_projective_space=" <<
f_projective_space << endl;
111 cout <<
"classification_of_objects::perform_classification "
112 "before classify_objects_using_nauty" << endl;
118 cout <<
"classification_of_objects::perform_classification "
119 "after classify_objects_using_nauty" << endl;
123 cout <<
"classification_of_objects::perform_classification We found "
132 cout <<
"classification_of_objects::perform_classification done" << endl;
142 int f_v = (verbose_level >= 1);
148 cout <<
"classification_of_objects::classify_objects_using_nauty" << endl;
153 cout <<
"classification_of_objects::classify_objects_using_nauty "
171 for (input_idx = 0; input_idx <
IS->
Objects.size(); input_idx++) {
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;
182 cout <<
"classification_of_objects::classify_objects_using_nauty "
190 cout <<
"classification_of_objects::classify_objects_using_nauty "
191 "before process_any_object" << endl;
206 cout <<
"classification_of_objects::classify_objects_using_nauty "
207 "after process_any_object" << endl;
218 cout <<
"classification_of_objects::classify_objects_using_nauty "
227 for (input_idx = 0, iso_idx = 0;
242 cout <<
"classification_of_objects::classify_objects_using_nauty iso_idx != nb_orbits" << endl;
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;
254 cout <<
"transversal of orbit representatives:" << endl;
256 cout <<
"iso type : input object : ago" << endl;
257 for (input_idx = 0, cnt = 0; input_idx <
IS->
Objects.size(); input_idx++) {
261 cout << setw(3) << cnt <<
" : " << setw(3) << input_idx <<
" : " << setw(5) <<
Ago[input_idx] << endl;
267 cout <<
"classification_of_objects::classify_objects_using_nauty "
268 "before CB->finalize" << endl;
278 cout <<
"Automorphism group orders of orbit transversal: ";
287 cout <<
"classification_of_objects::process_multiple_objects_from_file "
288 "f_save_ago is TRUE" << endl;
297 cout <<
"classification_of_objects::process_multiple_objects_from_file "
298 "f_save_transversal is TRUE" << endl;
310 cout <<
"classification_of_objects::classify_objects_using_nauty Time ";
317 cout <<
"classification_of_objects::classify_objects_using_nauty done" << endl;
323 int f_v = (verbose_level >= 1);
326 cout <<
"classification_of_objects::save_automorphism_group_order " << endl;
336 ago_fname.assign(
"classification");
343 cout <<
"Written file " << ago_fname <<
" of size " << Fio.
file_size(ago_fname) << endl;
346 cout <<
"classification_of_objects::save_automorphism_group_order done" << endl;
352 int f_v = (verbose_level >= 1);
355 cout <<
"classification_of_objects::save_transversal " << endl;
365 fname.assign(
"classification");
372 cout <<
"Written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
375 cout <<
"classification_of_objects::save_transversal done" << endl;
384 int f_v = (verbose_level >= 1);
387 cout <<
"classification_of_objects::process_any_object" << endl;
390 cout <<
"classification_of_objects::process_any_object "
395 cout <<
"classification_of_objects::process_any_object "
396 "before process_object" << endl;
398 int iso_idx_if_found;
409 cout <<
"classification_of_objects::process_any_object "
410 "after process_object, f_reject=" << f_reject << endl;
431 cout <<
"classification_of_objects::process_any_object "
432 "New isomorphism type! The current number of "
433 "isomorphism types is " <<
CB->
nb_types << endl;
442 object_in_projective_space_with_action *OiPA;
445 OiPA =
NEW_OBJECT(object_in_projective_space_with_action);
448 SG->group_order_as_lint(), SG,
472 cout <<
"classification_of_objects::process_any_object done" << endl;
480 int &iso_idx_if_found,
485 int f_v = (verbose_level >= 1);
488 cout <<
"classification_of_objects::process_object "
489 "n=" <<
CB->
n << endl;
506 cout <<
"classification_of_objects::process_object "
507 "before OwCF->run_nauty" << endl;
511 TRUE , Canonical_form,
516 cout <<
"classification_of_objects::process_object "
517 "after OwCF->run_nauty" << endl;
527 cout <<
"classification_of_objects::process_object "
528 "go = " << go << endl;
541 cout <<
"classification_of_objects::process_object "
542 "before CB->init" << endl;
550 cout <<
"classification_of_objects::process_object "
551 "after CB->init" << endl;
557 cout <<
"classification_of_objects::process_object "
558 "before CB->search_and_add_if_new" << endl;
567 f_found, iso_idx_if_found,
572 cout <<
"classification_of_objects::process_object "
573 "after CB->search_and_add_if_new" << endl;
580 cout <<
"classification_of_objects::process_object done" << endl;
587int classification_of_objects::process_object_with_known_canonical_labeling(
588 object_with_canonical_form *OiP,
589 int *canonical_labeling,
int canonical_labeling_len,
595 int f_v = (verbose_level >= 1);
598 cout <<
"classification_of_objects::process_object_with_known_canonical_labeling "
599 "n=" <<
CB->
n << endl;
612 cout <<
"classification_of_objects::process_object_with_known_canonical_labeling "
613 "before PA->set_stabilizer_of_object" << endl;
617 SG = PA->set_stabilizer_of_object(
619 Descr->f_save_incma_in_and_out,
Descr->save_incma_in_and_out_prefix,
621 canonical_form, canonical_form_len,
622 canonical_labeling, canonical_labeling_len,
627 cout <<
"classification_of_objects::process_object_with_known_canonical_labeling "
628 "after PA->set_stabilizer_of_object" << endl;
633 cout <<
"classification_of_objects::process_object_with_known_canonical_labeling "
634 "before OiP->canonical_form_given_canonical_labeling" << endl;
637 bitvector *Bitvec_canonical_form;
639 OiP->canonical_form_given_canonical_labeling(
641 Bitvec_canonical_form,
646 cout <<
"classification_of_objects::process_object_with_known_canonical_labeling "
647 "after OiP->canonical_form_given_canonical_labeling" << endl;
653 for (i = 0; i < NO->N; i++) {
654 NO->canonical_labeling[i] = canonical_labeling[i];
665 Bitvec_canonical_form->get_allocated_length() ,
672 OiP, f_found, idx, verbose_level);
680 cout <<
"classification_of_objects::process_object_with_known_canonical_labeling done" << endl;
687void classification_of_objects::save(
688 std::string &output_prefix,
691 int f_v = (verbose_level >= 1);
696 cout <<
"classification_of_objects::save" << endl;
698 fname.assign(output_prefix);
699 fname.append(
"_classified.cvs");
707 fp <<
"rep,ago,original_file,input_idx,input_set,"
708 "nb_rows,nb_cols,canonical_form" << endl;
711 object_in_projective_space_with_action *OiPA;
712 object_with_canonical_form *OwCF;
720 cout <<
"OiP == NULL" << endl;
724 if (OwCF->type !=
t_PAC) {
730 for (j = 0; j < rep_len; j++) {
731 cout << (int) Type_data[i][j];
732 if (j < rep_len - 1) {
741 if (OwCF->f_has_known_ago) {
742 ago = OwCF->known_ago;
747 fp << i <<
"," << ago
748 <<
"," << OwCF->input_fname
749 <<
"," << OwCF->input_idx
750 <<
",\"" << OwCF->set_as_string <<
"\",";
752 fp << OiPA->nb_rows <<
"," << OiPA->nb_cols<<
",";
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) {
767 cout <<
"written file " << fname <<
" of size "
768 << Fio.file_size(fname) << endl;
773 cout <<
"classification_of_objects::save done" << endl;
781 std::ostream &fp,
int verbose_level)
783 int f_v = (verbose_level >= 1);
786 cout <<
"classification_of_objects::report_summary_of_orbits" << endl;
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;
803 row_part_first[0] = 0;
807 col_part_first[0] = 0;
808 col_part_first[1] = width;
809 col_part_len[0] = width;
821 for (j = 0; j < width; j++) {
827 cout <<
"classification_of_objects::latex_report, i=" << i << endl;
832 cout <<
"classification_of_objects::latex_report, i=" << i <<
" j=" << j << endl;
836 Table[i * width + 2] = 0;
837 Table[i * width + 3] = 0;
841 cout <<
"classification_of_objects::latex_report before Summary of Orbits" << endl;
844 fp <<
"\\section*{Summary of Orbits}" << endl;
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,
858 cout <<
"classification_of_objects::latex_report after Summary of Orbits" << endl;
864 cout <<
"classification_of_objects::report_summary_of_orbits done" << endl;
870 std::ostream &fp,
int max_TDO_depth,
874 int f_v = (verbose_level >= 1);
877 cout <<
"classification_of_objects::report_all_isomorphism_types" << endl;
885 fp <<
"\\section*{Isomorphism type " << i <<
" / " <<
CB->
nb_types <<
"}" << endl;
886 fp <<
"Isomorphism type " << i <<
" / " <<
CB->
nb_types
888 <<
" is original object "
895 int nb_input_objects;
897 nb_input_objects, i, 0 );
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) {
906 fp <<
"$\\\\" << endl;
909 fp <<
"Too big to print. \\\\" << endl;
913 nb_input_objects, 10 ,
TRUE );
922 cout <<
"classification_of_objects::latex_report before report_isomorphism_type" << endl;
926 cout <<
"classification_of_objects::latex_report after report_isomorphism_type" << endl;
932 cout <<
"classification_of_objects::report_all_isomorphism_types done" << endl;
939 std::ostream &fp,
int i,
int max_TDO_depth,
943 int f_v = (verbose_level >= 1);
946 cout <<
"classification_of_objects::report_isomorphism_type i=" << i << endl;
955 cout <<
"###################################################"
956 "#############################" << endl;
957 cout <<
"Orbit " << i <<
" / " <<
CB->
nb_types
958 <<
" is canonical form no " << j
966 int nb_input_objects;
968 nb_input_objects, j, 0 );
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) {
975 nb_input_objects, 10 ,
979 cout <<
"too many to print" << endl;
1001 cout <<
"classification_of_objects::report_isomorphism_type i=" << i <<
" done" << endl;
1013 int f_v = (verbose_level >= 1);
1016 cout <<
"classification_of_objects::report_object" << endl;
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)
1038 cout <<
"print_summary_table_entry i=" << i <<
" j=" << j << endl;
1041 classification_of_objects *PC;
1043 PC = (classification_of_objects *) data;
1051 sprintf(str,
"\\mbox{Orbit}");
1054 sprintf(str,
"\\mbox{Rep}");
1057 sprintf(str,
"\\#");
1060 sprintf(str,
"\\mbox{Ago}");
1063 sprintf(str,
"\\mbox{Objects}");
1069 sprintf(str,
"%d", i);
1075 cout <<
"print_summary_table_entry getting extra_data" << endl;
1079 longinteger_object go;
1084 cout <<
"print_summary_table_entry after getting extra_data" << endl;
1087 OiPA = (object_in_projective_space_with_action *) extra_data;
1091 cout <<
"print_summary_table_entry getting extra_data OiPA=" << endl;
1094 go.create(OiPA->ago, __FILE__, __LINE__);
1096 go.print_to_string(str);
1098 ring_theory::longinteger_object go;
1099 go.create(PC->Ago_transversal[i], __FILE__, __LINE__);
1101 go.print_to_string(str);
1108 int nb_input_objects;
1110 cout <<
"print_summary_table_entry before CB->C_type_of->get_class_by_value" << endl;
1113 nb_input_objects, i , 0 );
1115 cout <<
"print_summary_table_entry after CB->C_type_of->get_class_by_value" << endl;
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) {
1126 strcat(str,
"\\ldots");
1134 sprintf(str,
"%d", val);
description of a classification of objects using class classification_of_objects
classification_of_objects()
~classification_of_objects()
data_structures::data_input_stream * IS
classification_of_objects_description * Descr
data_structures::classify_bitvectors * CB
geometry::object_with_canonical_form ** OWCF_transversal
void report_all_isomorphism_types(std::ostream &fp, int max_TDO_depth, int f_show_incma, int verbose_level)
data_structures::nauty_output ** NO_transversal
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)
long int * Ago_transversal
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)
void save_automorphism_group_order(int verbose_level)
void classify_objects_using_nauty(int verbose_level)
data_structures::tally * T_Ago
geometry::projective_space * P
void report_summary_of_orbits(std::ostream &fp, int verbose_level)
void save_transversal(int verbose_level)
compact storage of 0/1-data as bitvectors
long int get_allocated_length()
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)
void finalize(int verbose_level)
void init(int N, int rep_len, int verbose_level)
output data created by a run of nauty
ring_theory::longinteger_object * Ago
a collection of functions related to sorted vectors
void int_vec_heapsort(int *v, int len)
a statistical analysis of data consisting of single integers
void init_lint(long int *data, int data_length, int f_second, int verbose_level)
void print_first(int f_backwards)
void get_class_by_value(int *&Pts, int &nb_pts, int value, int verbose_level)
projective space PG(n,q) of dimension n over Fq
a collection of functions related to file io
void int_vec_write_csv(int *v, int len, std::string &fname, const char *label)
long int file_size(std::string &fname)
void lint_vec_write_csv(long int *v, int len, std::string &fname, const char *label)
interface to create latex output files
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_set_print_tex(std::ostream &ost, int *v, int len)
void int_vec_print_as_matrix(std::ostream &ost, int *v, int len, int width, int f_tex)
interface to system functions
void time_check_delta(std::ostream &ost, int dt)
a class to represent arbitrary precision integers
void assign_to(longinteger_object &b)
#define Int_vec_zero(A, B)
the orbiter library for the classification of combinatorial objects