23namespace layer1_foundations {
24namespace orbiter_kernel_system {
26#define MY_OWN_BUFSIZE 1000000
39 const char *fname_out,
const char *EOF_marker,
int f_title_line,
41 vector<int> missing_idx,
44 int f_v = (verbose_level >= 1);
50 cout <<
"concatenate_files " << fname_in_mask
51 <<
" N=" << N <<
" fname_out=" << fname_out << endl;
58 ofstream fp_out(fname_out);
59 for (h = 0; h < N; h++) {
60 sprintf(fname, fname_in_mask, h);
62 cout <<
"concatenate_files input file does not exist: " << fname <<
" skipping" << endl;
64 missing_idx.push_back(h);
72 cout <<
"Encountered End-of-file without having seem EOF "
73 "marker, perhaps the file is corrupt. "
74 "I was trying to read the file " << fname << endl;
75 missing_idx.push_back(h);
80 cout <<
"Read: " << buf << endl;
81 if (strncmp(buf, EOF_marker, strlen(EOF_marker)) == 0) {
86 fp_out << buf << endl;
90 fp_out << buf << endl;
97 fp_out << EOF_marker <<
" " << cnt_total << endl;
99 cout <<
"Written file " << fname_out <<
" of size "
102 cout <<
"There are " << missing_idx.size() <<
" missing files, they are:" << endl;
103 for (h = 0; h < (int) missing_idx.size(); h++) {
104 sprintf(fname, fname_in_mask, missing_idx[h]);
105 cout << h <<
" : " << missing_idx[h] <<
" : " << fname << endl;
109 cout <<
"concatenate_files done" << endl;
114 ofstream &fp_out,
const char *EOF_marker,
int f_title_line,
116 vector<int> &missing_idx,
119 int f_v = (verbose_level >= 1);
125 cout <<
"file_io::concatenate_files_into " << fname_in_mask
126 <<
" N=" << N <<
" into an open file" << endl;
134 for (h = 0; h < N; h++) {
135 sprintf(fname, fname_in_mask, h);
137 fp_out <<
"# start of file " << fname << endl;
140 cout <<
"file_io::concatenate_files_into "
141 "input file does not exist: " << fname <<
" skipping" << endl;
143 missing_idx.push_back(h);
151 cout <<
"Encountered End-of-file without having seem EOF "
152 "marker, perhaps the file is corrupt. "
153 "I was trying to read the file " << fname << endl;
154 missing_idx.push_back(h);
160 if (strncmp(buf, EOF_marker, strlen(EOF_marker)) == 0) {
165 fp_out << buf << endl;
169 fp_out << buf << endl;
175 fp_out <<
"# end of file " << fname << endl;
180 cout <<
"There are " << missing_idx.size() <<
" missing files, they are:" << endl;
181 for (h = 0; h < (int) missing_idx.size(); h++) {
182 sprintf(fname, fname_in_mask, missing_idx[h]);
183 cout << h <<
" : " << missing_idx[h] <<
" : " << fname << endl;
187 cout <<
"file_io::concatenate_files_into done" << endl;
192 std::string &fname,
int orbit_at_level,
193 long int *&candidates,
int &nb_candidates,
int verbose_level)
195 int f_v = (verbose_level >= 1);
196 int f_vv = (verbose_level >= 2);
197 int nb, cand_first, i;
201 cout <<
"file_io::poset_classification_read_candidates_of_orbit" << endl;
202 cout <<
"verbose_level=" << verbose_level << endl;
203 cout <<
"orbit_at_level=" << orbit_at_level << endl;
207 cout <<
"file_io::poset_classification_read_candidates_of_orbit file "
208 << fname <<
" does not exist" << endl;
213 ifstream fp(fname, ios::binary);
214 fp.read((
char *) &nb,
sizeof(
int));
215 if (orbit_at_level >= nb) {
216 cout <<
"file_io::poset_classification_read_candidates_of_orbit "
217 "orbit_at_level >= nb" << endl;
218 cout <<
"orbit_at_level=" << orbit_at_level << endl;
219 cout <<
"nb=" << nb << endl;
223 cout <<
"seeking position "
224 << (1 + orbit_at_level * 2) *
sizeof(
int) << endl;
226 fp.seekg((1 + orbit_at_level * 2) *
sizeof(int), ios::beg);
227 fp.read((
char *) &nb_candidates,
sizeof(int));
229 cout <<
"nb_candidates=" << nb_candidates << endl;
231 fp.read((
char *) &cand_first,
sizeof(int));
233 cout <<
"cand_first=" << cand_first << endl;
235 candidates =
NEW_lint(nb_candidates);
238 candidates0 =
NEW_int(nb_candidates);
239 fp.seekg((1 + nb * 2 + cand_first) *
sizeof(
int), ios::beg);
240 for (i = 0; i < nb_candidates; i++) {
241 fp.read((
char *) &candidates0[i],
sizeof(
int));
242 candidates[i] = candidates0[i];
249 cout <<
"file_io::poset_classification_read_candidates_of_orbit done" << endl;
255 int level,
int orbit_at_level,
int level_of_candidates_file,
257 void (*early_test_func_callback)(
long int *S,
int len,
258 long int *candidates,
int nb_candidates,
259 long int *good_candidates,
int &nb_good_candidates,
260 void *data,
int verbose_level),
261 void *early_test_func_callback_data,
262 long int *&candidates,
266 int f_v = (verbose_level >= 1);
268 long int *candidates1 = NULL;
272 cout <<
"read_candidates_for_one_orbit_from_file" << endl;
273 cout <<
"level=" << level
274 <<
" orbit_at_level=" << orbit_at_level
275 <<
" level_of_candidates_file="
276 << level_of_candidates_file << endl;
280 level_of_candidates_file, S,
284 cout <<
"read_candidates_for_one_orbit_from_file "
285 "orbit_idx=" << orbit_idx << endl;
289 cout <<
"read_orbit_rep_and_candidates_from_files "
290 "before generator_read_candidates_of_orbit" << endl;
295 fname2.assign(prefix);
296 sprintf(str,
"_lvl_%d_candidates.bin", level_of_candidates_file);
301 candidates1, nb_candidates1, verbose_level - 1);
304 for (h = level_of_candidates_file; h < level; h++) {
306 long int *candidates2;
310 cout <<
"read_orbit_rep_and_candidates_from_files_"
311 "and_process testing candidates at level " << h
312 <<
" number of candidates = " << nb_candidates1 << endl;
314 candidates2 =
NEW_lint(nb_candidates1);
316 (*early_test_func_callback)(S, h + 1,
317 candidates1, nb_candidates1,
318 candidates2, nb_candidates2,
319 early_test_func_callback_data, 0 );
322 cout <<
"read_orbit_rep_and_candidates_from_files_"
323 "and_process number of candidates at level "
324 << h + 1 <<
" reduced from " << nb_candidates1
325 <<
" to " << nb_candidates2 <<
" by "
326 << nb_candidates1 - nb_candidates2 << endl;
330 nb_candidates1 = nb_candidates2;
335 candidates = candidates1;
336 nb_candidates = nb_candidates1;
339 cout <<
"read_candidates_for_one_orbit_from_file done" << endl;
346 int level_of_candidates_file,
long int *starter,
349 int f_v = (verbose_level >= 1);
355 cout <<
"find_orbit_index_in_data_file" << endl;
358 fname.assign(prefix);
359 sprintf(str,
"_lvl_%d", level_of_candidates_file);
363 cout <<
"find_orbit_index_in_data_file file "
364 << fname <<
" does not exist" << endl;
375 S =
NEW_lint(level_of_candidates_file);
388 str_len = strlen(buf);
390 cout <<
"read_orbit_rep_and_candidates_from_files "
391 "str_len == 0" << endl;
405 if (a != level_of_candidates_file) {
406 cout <<
"a != level_of_candidates_file" << endl;
407 cout <<
"a=" << a << endl;
408 cout <<
"level_of_candidates_file="
409 << level_of_candidates_file << endl;
412 for (i = 0; i < len; i++) {
415 for (i = 0; i < level_of_candidates_file; i++) {
416 if (S[i] != starter[i]) {
420 if (i == level_of_candidates_file) {
431 cout <<
"find_orbit_index_in_data_file done" << endl;
438 int nb_rows,
int nb_cols, std::string &fname)
444 fp << nb_rows <<
" " << nb_cols << endl;
445 for (i = 0; i < nb_rows; i++) {
447 for (j = 0; j < nb_cols; j++) {
448 if (Inc[i * nb_cols + j]) {
453 for (j = 0; j < nb_cols; j++) {
454 if (Inc[i * nb_cols + j]) {
461 cout <<
"write_exact_cover_problem_to_file written file "
462 << fname <<
" of size " <<
file_size(fname) << endl;
465#define BUFSIZE_READ_SOLUTION_FILE ONE_MILLION
468 int *Inc,
int nb_rows,
int nb_cols,
469 int *&Solutions,
int &sol_length,
int &nb_sol,
473 int f_v = (verbose_level >= 1);
474 int nb, nb_max, i, j, a, nb_sol1;
479 cout <<
"file_io::read_solution_file" << endl;
484 cout <<
"file_io::read_solution_file reading file " << fname
485 <<
" of size " <<
file_size(fname) << endl;
488 cout <<
"file_io::read_solution_file "
489 "There is something wrong with the file "
508 for (j = 0; j < nb_cols; j++) {
517 cout <<
"file_io::read_solution_file "
518 "solutions have different length" << endl;
524 for (i = 0; i < nb_rows; i++) {
527 for (i = 0; i < nb_rows; i++) {
528 for (j = 0; j < nb_cols; j++) {
529 y[i] += Inc[i * nb_cols + j] * x[j];
532 for (i = 0; i < nb_rows; i++) {
534 cout <<
"file_io::read_solution_file "
535 "Not a solution!" << endl;
546 cout <<
"file_io::read_solution_file: Counted " << nb_sol
547 <<
" solutions in " << fname
548 <<
" starting to read now." << endl;
551 Solutions =
NEW_int(nb_sol * sol_length);
560 for (j = 0; j < nb_cols; j++) {
566 for (i = 0; i < sol_length; i++) {
568 Solutions[nb_sol1 * sol_length + i] = a;
575 cout <<
"file_io::read_solution_file: Read " << nb_sol
576 <<
" solutions from file " << fname << endl;
582 cout <<
"file_io::read_solution_file done" << endl;
588 int &nb_solutions,
int &solution_size,
591 int f_v = (verbose_level >= 1);
597 cout <<
"file_io::count_number_of_solutions_in_file_and_get_solution_size " << fname << endl;
598 cout <<
"trying to read file " << fname <<
" of size "
604 cout <<
"file_io::count_number_of_solutions_in_file_and_get_solution_size file "
605 << fname <<
" does not exist" << endl;
623 cout <<
"file_io::count_number_of_solutions_in_file_and_get_solution_size "
624 "eof, break" << endl;
629 if (strlen(buf) == 0) {
630 cout <<
"file_io::count_number_of_solutions_in_file_and_get_solution_size "
631 "line " << line_number <<
" empty line" << endl;
641 if (solution_size == -1) {
646 if (solution_size != s) {
647 cout <<
"file_io::count_number_of_solutions_in_file_and_get_solution_size "
648 "solution_size is not constant" << endl;
649 cout <<
"solution_size=" << solution_size << endl;
650 cout <<
"s=" << s << endl;
651 cout <<
"line " << line_number << endl;
657 if (strncmp(buf,
"-1", 2) == 0) {
666 cout <<
"file_io::count_number_of_solutions_in_file_and_get_solution_size " << fname << endl;
667 cout <<
"nb_solutions = " << nb_solutions << endl;
675 int f_v = (verbose_level >= 1);
679 cout <<
"count_number_of_solutions_in_file " << fname << endl;
680 cout <<
"trying to read file " << fname <<
" of size "
686 cout <<
"count_number_of_solutions_in_file file "
687 << fname <<
" does not exist" << endl;
703 cout <<
"count_number_of_solutions_in_file "
704 "eof, break" << endl;
709 if (strlen(buf) == 0) {
710 cout <<
"count_number_of_solutions_in_file "
711 "empty line" << endl;
718 if (strncmp(buf,
"-1", 2) == 0) {
726 cout <<
"count_number_of_solutions_in_file " << fname << endl;
727 cout <<
"nb_solutions = " << nb_solutions << endl;
732 int *&nb_solutions,
int *&case_nb,
int &nb_cases,
735 int f_v = (verbose_level >= 1);
741 int the_case_count = 0;
744 cout <<
"count_number_of_solutions_in_file_by_case "
746 cout <<
"trying to read file " << fname <<
" of size "
754 cout <<
"count_number_of_solutions_in_file_by_case file "
755 << fname <<
" does not exist" << endl;
772 cout <<
"count_number_of_solutions_in_file_by_case "
773 "eof, break" << endl;
778 if (strlen(buf) == 0) {
779 cout <<
"count_number_of_solutions_in_file_by_case "
780 "empty line, break" << endl;
784 if (strncmp(buf,
"# start case", 12) == 0) {
785 the_case = atoi(buf + 13);
787 cout <<
"count_number_of_solutions_in_file_by_case "
788 "read start case " << the_case << endl;
790 else if (strncmp(buf,
"# end case", 10) == 0) {
795 nb_solutions1 =
NEW_int(N + 1000);
797 for (i = 0; i < N; i++) {
798 nb_solutions1[i] = nb_solutions[i];
799 case_nb1[i] = case_nb[i];
803 nb_solutions = nb_solutions1;
807 nb_solutions[nb_cases] = the_case_count;
808 case_nb[nb_cases] = the_case;
824 cout <<
"count_number_of_solutions_in_file_by_case "
826 cout <<
"nb_cases = " << nb_cases << endl;
832 int &nb_solutions,
int *&Solutions,
int &solution_size,
835 int f_v = (verbose_level >= 1);
838 cout <<
"read_solutions_from_file_and_get_solution_size" << endl;
839 cout <<
"read_solutions_from_file_and_get_solution_size trying to read file "
840 << fname <<
" of size " <<
file_size(fname) << endl;
844 cout <<
"file_io::read_solutions_from_file_and_get_solution_size "
845 "the file " << fname <<
" does not exist" << endl;
850 nb_solutions, solution_size,
854 cout <<
"file_io::read_solutions_from_file_and_get_solution_size, reading "
855 << nb_solutions <<
" solutions of size " << solution_size << endl;
858 Solutions =
NEW_int(nb_solutions * solution_size);
872 if (strlen(buf) && buf[0] ==
'#') {
882 if (a != solution_size) {
883 cout <<
"file_io::read_solutions_from_file_and_get_solution_size "
884 "a != solution_size" << endl;
887 for (i = 0; i < solution_size; i++) {
889 Solutions[nb_sol * solution_size + i] = a;
894 if (nb_sol != nb_solutions) {
895 cout <<
"file_io::read_solutions_from_file_and_get_solution_size "
896 "nb_sol != nb_solutions" << endl;
902 cout <<
"file_io::read_solutions_from_file_and_get_solution_size" << endl;
908 int &nb_solutions,
int *&Solutions,
int solution_size,
911 int f_v = (verbose_level >= 1);
918 cout <<
"read_solutions_from_file" << endl;
919 cout <<
"read_solutions_from_file trying to read file "
920 << fname <<
" of size " <<
file_size(fname) << endl;
921 cout <<
"read_solutions_from_file solution_size="
922 << solution_size << endl;
926 cout <<
"file_io::read_solutions_from_file the file " << fname <<
" does not exist" << endl;
936 cout <<
"read_solutions_from_file, reading "
937 << nb_solutions <<
" solutions" << endl;
942 Solutions =
NEW_int(nb_solutions * solution_size);
957 if (a != solution_size) {
958 cout <<
"read_solutions_from_file "
959 "a != solution_size" << endl;
962 for (i = 0; i < solution_size; i++) {
964 Solutions[nb_sol * solution_size + i] = a;
969 if (nb_sol != nb_solutions) {
970 cout <<
"read_solutions_from_file "
971 "nb_sol != nb_solutions" << endl;
976 cout <<
"read_solutions_from_file done" << endl;
982 std::vector<std::vector<int> > &Solutions,
int solution_size,
985 int f_v = (verbose_level >= 1);
988 vector<int> one_solution;
993 cout <<
"read_solutions_from_file_size_is_known" << endl;
994 cout <<
"read_solutions_from_file_size_is_known trying to read file "
995 << fname <<
" of size " <<
file_size(fname) << endl;
996 cout <<
"read_solutions_from_file_size_is_known solution_size="
997 << solution_size << endl;
1001 cout <<
"file_io::read_solutions_from_file_size_is_known the file " << fname <<
" does not exist" << endl;
1007 one_solution.resize(solution_size);
1022 one_solution[0] = a;
1023 for (i = 1; i < solution_size; i++) {
1025 one_solution[i] = a;
1027 Solutions.push_back(one_solution);
1032 cout <<
"read_solutions_from_file_size_is_known done" << endl;
1038 int *nb_solutions,
int *case_nb,
int nb_cases,
1039 int **&Solutions,
int solution_size,
1042 int f_v = (verbose_level >= 1);
1048 int the_case_count = 0;
1052 cout <<
"read_solutions_from_file_by_case" << endl;
1053 cout <<
"read_solutions_from_file_by_case trying to read file "
1054 << fname <<
" of size " <<
file_size(fname) << endl;
1055 cout <<
"read_solutions_from_file_by_case solution_size="
1056 << solution_size << endl;
1080 if (strlen(buf) == 0) {
1081 cout <<
"read_solutions_from_file_by_case "
1082 "empty line, break" << endl;
1086 if (strncmp(buf,
"# start case", 12) == 0) {
1087 the_case = atoi(buf + 13);
1089 if (the_case != case_nb[nb_case1]) {
1090 cout <<
"read_solutions_from_file_by_case "
1091 "the_case != case_nb[nb_case1]" << endl;
1094 Solutions[nb_case1] =
1095 NEW_int(nb_solutions[nb_case1] * solution_size);
1096 cout <<
"read_solutions_from_file_by_case "
1097 "read start case " << the_case << endl;
1099 else if (strncmp(buf,
"# end case", 10) == 0) {
1100 if (the_case_count != nb_solutions[nb_case1]) {
1101 cout <<
"read_solutions_from_file_by_case "
1102 "the_case_count != nb_solutions[nb_case1]" << endl;
1105 cout <<
"read_solutions_from_file_by_case "
1106 "read end case " << the_case << endl;
1111 if (the_case >= 0) {
1120 if (sz != solution_size) {
1121 cout <<
"read_solutions_from_file_by_case "
1122 "sz != solution_size" << endl;
1125 for (i = 0; i < sz; i++) {
1127 Solutions[nb_case1][the_case_count * solution_size + i] = a;
1136 cout <<
"read_solutions_from_file_by_case done" << endl;
1176 std::string &fname,
const char *label)
1183 f <<
"Case," << label << endl;
1184 for (i = 0; i < len; i++) {
1185 f << i <<
"," << v[i] << endl;
1192 std::string &fname,
const char *label)
1199 f <<
"Case," << label << endl;
1200 for (i = 0; i < len; i++) {
1201 f << i <<
"," << v[i] << endl;
1208 std::string &fname,
const char *label1,
const char *label2)
1215 f <<
"Case," << label1 <<
"," << label2 << endl;
1216 for (i = 0; i < len; i++) {
1217 f << i <<
"," << v1[i] <<
"," << v2[i] << endl;
1225 const char *label1,
const char *label2,
const char *label3)
1232 f <<
"Case," << label1 <<
"," << label2 <<
"," << label3 << endl;
1233 for (i = 0; i < len; i++) {
1234 f << i <<
"," << v1[i] <<
"," << v2[i] <<
"," << v3[i] << endl;
1241 std::string &fname,
const char **column_label)
1245 cout <<
"int_vec_array_write_csv nb_vecs=" << nb_vecs << endl;
1246 cout <<
"column labels:" << endl;
1247 for (j = 0; j < nb_vecs; j++) {
1248 cout << j <<
" : " << column_label[j] << endl;
1255 for (j = 0; j < nb_vecs; j++) {
1256 f <<
"," << column_label[j];
1259 for (i = 0; i < len; i++) {
1261 for (j = 0; j < nb_vecs; j++) {
1262 f <<
"," << Vec[j][i];
1271 std::string &fname,
const char **column_label)
1275 cout <<
"lint_vec_array_write_csv nb_vecs=" << nb_vecs << endl;
1276 cout <<
"column labels:" << endl;
1277 for (j = 0; j < nb_vecs; j++) {
1278 cout << j <<
" : " << column_label[j] << endl;
1285 for (j = 0; j < nb_vecs; j++) {
1286 f <<
"," << column_label[j];
1289 for (i = 0; i < len; i++) {
1291 for (j = 0; j < nb_vecs; j++) {
1292 f <<
"," << Vec[j][i];
1308 for (j = 0; j < n; j++) {
1312 for (i = 0; i < m; i++) {
1314 for (j = 0; j < n; j++) {
1315 f <<
"," << M[i * n + j];
1331 for (j = 0; j < n; j++) {
1335 for (i = 0; i < m; i++) {
1337 for (j = 0; j < n; j++) {
1338 f <<
"," << M[i * n + j];
1354 for (j = 0; j < n; j++) {
1355 f <<
"," << headers[j];
1358 for (i = 0; i < m; i++) {
1360 for (j = 0; j < n; j++) {
1361 f <<
"," << M[i * n + j];
1376 for (i = 0; i < m; i++) {
1377 if (V[i].size() != n) {
1378 cout <<
"file_io::int_matrix_write_csv the vectors are of differing lengths" << endl;
1388 for (j = 0; j < n; j++) {
1392 for (i = 0; i < m; i++) {
1394 for (j = 0; j < n; j++) {
1395 f <<
"," << V[i][j];
1406 std::string &fname,
double *M,
int m,
int n)
1414 for (j = 0; j < n; j++) {
1418 for (i = 0; i < m; i++) {
1420 for (j = 0; j < n; j++) {
1421 f <<
"," << M[i * n + j];
1430 int *M,
int m,
int n,
const char **column_label)
1438 for (j = 0; j < n; j++) {
1439 f <<
"," << column_label[j];
1442 for (i = 0; i < m; i++) {
1444 for (j = 0; j < n; j++) {
1445 f <<
"," << M[i * n + j];
1454 long int *M,
int m,
int n,
const char **column_label)
1462 for (j = 0; j < n; j++) {
1463 f <<
"," << column_label[j];
1466 for (i = 0; i < m; i++) {
1468 for (j = 0; j < n; j++) {
1469 f <<
"," << M[i * n + j];
1478 int *&M,
int &m,
int &n,
int verbose_level)
1480 int f_v = (verbose_level >= 1);
1484 cout <<
"file_io::int_matrix_read_csv reading file " << fname << endl;
1487 cout <<
"int_matrix_read_csv file " << fname
1488 <<
" does not exist or is empty" << endl;
1489 cout <<
"file_size(fname)=" <<
file_size(fname) << endl;
1496 cout <<
"file_io::int_matrix_read_csv before S.read_spreadsheet" << endl;
1500 cout <<
"file_io::int_matrix_read_csv after S.read_spreadsheet" << endl;
1506 cout <<
"The spreadsheet has " << S.
nb_cols <<
" columns" << endl;
1509 for (i = 0; i < m; i++) {
1510 for (j = 0; j < n; j++) {
1518 cout <<
"int_matrix_read_csv done" << endl;
1523 int *&M,
int &m,
int &n,
int verbose_level)
1525 int f_v = (verbose_level >= 1);
1529 cout <<
"file_io::int_matrix_read_csv_no_border reading file " << fname << endl;
1532 cout <<
"file_io::int_matrix_read_csv_no_border file " << fname
1533 <<
" does not exist or is empty" << endl;
1534 cout <<
"file_size(fname)=" <<
file_size(fname) << endl;
1544 cout <<
"The spreadsheet has " << S.
nb_cols <<
" columns" << endl;
1546 for (i = 0; i < m; i++) {
1547 for (j = 0; j < n; j++) {
1554 cout <<
"file_io::int_matrix_read_csv_no_border done" << endl;
1559 long int *&M,
int &m,
int &n,
int verbose_level)
1561 int f_v = (verbose_level >= 1);
1566 cout <<
"lint_matrix_read_csv reading file " << fname << endl;
1569 cout <<
"int_matrix_read_csv file " << fname
1570 <<
" does not exist or is empty" << endl;
1571 cout <<
"file_size(fname)=" <<
file_size(fname) << endl;
1582 for (i = 0; i < m; i++) {
1583 for (j = 0; j < n; j++) {
1590 cout <<
"lint_matrix_read_csv done" << endl;
1596 double *&M,
int &m,
int &n,
int verbose_level)
1598 int f_v = (verbose_level >= 1);
1602 cout <<
"double_matrix_read_csv reading file "
1606 cout <<
"double_matrix_read_csv file " << fname
1607 <<
" does not exist or is empty" << endl;
1608 cout <<
"file_size(fname)=" <<
file_size(fname) << endl;
1619 M =
new double [m * n];
1620 for (i = 0; i < m; i++) {
1621 for (j = 0; j < n; j++) {
1628 cout <<
"double_matrix_read_csv done" << endl;
1636 int f_v = (verbose_level >= 1);
1639 cout <<
"file_io::read_column_and_parse reading file " << fname << endl;
1642 cout <<
"file_io::read_column_and_parse file " << fname
1643 <<
" does not exist or is empty" << endl;
1644 cout <<
"file_size(fname)=" <<
file_size(fname) << endl;
1657 cout <<
"file_io::read_column_and_parse cannot find column " << col_label << endl;
1662 int underlying_set_size = INT_MAX;
1667 nb_sets, verbose_level);
1669 for (i = 0; i < nb_sets; i++) {
1685 cout <<
"file_io::read_column_and_parse done" << endl;
1700 for (i = 0; i < m; i++) {
1702 for (j = 0; j < n; j++) {
1724 f << m <<
" " << n << endl;
1725 for (i = 0; i < m; i++) {
1726 for (j = 0; j < n; j++) {
1727 f << M[i * n + j] <<
" ";
1741 f << m <<
" " << n << endl;
1742 for (i = 0; i < m; i++) {
1743 for (j = 0; j < n; j++) {
1744 f << M[i * n + j] <<
" ";
1756 cout <<
"int_matrix_read_text The file "
1757 << fname <<
" does not exist" << endl;
1765 for (i = 0; i < m; i++) {
1766 for (j = 0; j < n; j++) {
1774 int &nb_V, std::vector<std::vector<int>> &Edges,
int verbose_level)
1776 int f_v = (verbose_level >= 1);
1780 cout <<
"file_io::read_dimacs_graph_format fname = " << fname << endl;
1783 cout <<
"file_io::read_dimacs_graph_format The file "
1784 << fname <<
" does not exist" << endl;
1797 sscanf(buf,
"p edge %d %d", &nb_V, &nb_E);
1799 cout <<
"file_io::read_dimacs_graph_format a graph on "
1800 << nb_V <<
" vertices with " << nb_E <<
" edges" << endl;
1803 for (i = 0; i < nb_E; i++) {
1807 sscanf(buf,
"e %d %d", &a, &b);
1820 cout <<
"file_io::read_dimacs_graph_format done" << endl;
1826 int *&Set_sizes,
long int **&Sets,
1827 char **&Ago_ascii,
char **&Aut_ascii,
1831 int f_v = (verbose_level >= 1);
1832 int f_vv = (verbose_level >= 2);
1834 char *ago_ascii, *aut_ascii;
1839 cout <<
"parse_sets f_casenumbers=" << f_casenumbers
1840 <<
" nb_cases = " << nb_cases << endl;
1846 Set_sizes =
NEW_int(nb_cases);
1850 Casenumbers =
NEW_int(nb_cases);
1852 for (h = 0; h < nb_cases; h++) {
1858 if (f_casenumbers) {
1866 ago_ascii, aut_ascii);
1868 Casenumbers[h] = casenumber;
1870 Ago_ascii[h] =
NEW_char(strlen(ago_ascii) + 1);
1871 strcpy(Ago_ascii[h], ago_ascii);
1873 Aut_ascii[h] =
NEW_char(strlen(aut_ascii) + 1);
1874 strcpy(Aut_ascii[h], aut_ascii);
1878 print_set(cout, len, sets[h]);
1879 cout <<
" : " << data[h] << endl;
1882 if (f_vv && ((h % 1000000) == 0)) {
1883 cout << h <<
" : " << Casenumbers[h]
1884 <<
" : " << data[h] << endl;
1894 long int *&set,
char *ago_ascii,
char *aut_ascii)
1905 for (i = 0; i < len; i++) {
1909 if (strcmp(ago_ascii,
"1") == 0) {
1919 std::string &fname,
int verbose_level)
1921 int f_v = (verbose_level >= 1);
1928 cout <<
"count_number_of_orbits_in_file " << fname << endl;
1929 cout <<
"count_number_of_orbits_in_file "
1930 "trying to read file "
1931 << fname <<
" of size " <<
file_size(fname) << endl;
1935 cout <<
"count_number_of_orbits_in_file "
1936 "file size is -1" << endl;
1957 if (strlen(buf) == 0) {
1958 cout <<
"count_number_of_orbits_in_file "
1959 "reading an empty line" << endl;
1964 if (buf[0] ==
'#') {
1972 cout <<
"count_number_of_orbits_in_file "
1973 "found a complete file with " << nb_sol
1974 <<
" solutions" << endl;
1980 cout <<
"count_number_of_orbits_in_file "
1981 "found a set of size " << len << endl;
1997 int f_v = (verbose_level >= 1);
2002 cout <<
"count_number_of_lines_in_file " << fname << endl;
2003 cout <<
"trying to read file " << fname <<
" of size "
2008 cout <<
"count_number_of_lines_in_file file size is -1" << endl;
2038 int &nb_cases,
char **&data,
int verbose_level)
2040 int f_v = (verbose_level >= 1);
2047 cout <<
"try_to_read_file trying to read file " << fname
2048 <<
" of size " <<
file_size(fname) << endl;
2065 if (strlen(buf) == 0) {
2068 sscanf(buf + 1,
"%d", &n1);
2069 cout <<
"n1=" << n1;
2071 cout <<
"try_to_read_file() n1 != n" << endl;
2082 if (strlen(buf) == 0) {
2087 if (buf[0] ==
'#') {
2095 cout <<
"found a complete file with "
2096 << nb_sol <<
" solutions" << endl;
2113 if (strlen(buf) == 0) {
2116 sscanf(buf + 1,
"%d", &n1);
2118 cout <<
"try_to_read_file() n1 != n" << endl;
2135 if (buf[0] ==
'#') {
2143 cout <<
"read " << nb_sol
2144 <<
" solutions" << endl;
2151 strcpy(data[nb_sol], buf);
2168 std::string &fname,
int &nb_cases,
2169 char **&data,
long int **&sets,
int *&set_sizes,
2172 int f_v = (verbose_level >= 1);
2173 int f_vv = (verbose_level >= 2);
2176 cout <<
"file_io::read_and_parse_data_file: reading file "
2181 cout <<
"file_io::read_and_parse_data_file file read containing " << nb_cases
2182 <<
" cases" << endl;
2186 cout <<
"file_io::read_and_parse_data_file couldn't read file "
2192 for (i = 0; i < nb_cases; i++) {
2193 cout << i <<
" : " << data[i] << endl;
2199 cout <<
"file_io::read_and_parse_data_file: parsing sets" << endl;
2209 set_sizes, sets, Ago_ascii, Aut_ascii,
2215 for (i = 0; i < nb_cases; i++) {
2216 strcpy(data[i], Aut_ascii[i]);
2219 for (i = 0; i < nb_cases; i++) {
2226 cout <<
"file_io::read_and_parse_data_file done" << endl;
2231 char **data,
long int **&sets)
2240 set_sizes, sets, Ago_ascii, Aut_ascii,
2243 for (i = 0; i < nb_cases; i++) {
2244 if (set_sizes[i] != len) {
2245 cout <<
"file_io::parse_sets_and_check_sizes_easy "
2246 "set_sizes[i] != len" << endl;
2256 for (i = 0; i < nb_cases; i++) {
2257 strcpy(data[i], Aut_ascii[i]);
2261 for (i = 0; i < nb_cases; i++) {
2271 int *Set_sizes,
long int **Sets,
2272 char **Ago_ascii,
char **Aut_ascii,
2279 for (i = 0; i < nb_cases; i++) {
2285 for (i = 0; i < nb_cases; i++) {
2291 for (i = 0; i < nb_cases; i++) {
2308 int *&Set_sizes,
long int **&Sets,
2314 int f_v = (verbose_level >= 1);
2315 int f_vv = (verbose_level >= 2);
2320 cout <<
"file_io::read_and_parse_data_file_fancy "
2325 cout <<
"file_io::read_and_parse_data_file_fancy "
2326 "before try_to_read_file" << endl;
2330 cout <<
"file_io::read_and_parse_data_file_fancy "
2331 "file read containing "
2332 << nb_cases <<
" cases" << endl;
2336 cout <<
"file_io::read_and_parse_data_file_fancy "
2337 "couldn't read file fname="
2344 cout <<
"after try_to_read_file" << endl;
2345 for (i = 0; i < nb_cases; i++) {
2346 cout << i <<
" : " << data[i] << endl;
2353 cout <<
"file_io::read_and_parse_data_file_fancy "
2354 "parsing sets" << endl;
2357 Set_sizes, Sets, Ago_ascii, Aut_ascii,
2362 cout <<
"file_io::read_and_parse_data_file_fancy "
2363 "freeing temporary data" << endl;
2365 for (i = 0; i < nb_cases; i++) {
2370 cout <<
"file_io::read_and_parse_data_file_fancy done" << endl;
2375 long int *&the_set,
int &set_size,
int verbose_level)
2378 int f_v = (verbose_level >= 1);
2379 int f_vv = (verbose_level >= 2);
2383 cout <<
"file_io::read_set_from_file opening file " << fname
2385 <<
" for reading" << endl;
2391 if (set_size == -1) {
2393 cout <<
"file_io::read_set_from_file the file is empty, "
2394 "set_size cannot be determined" << endl;
2400 cout <<
"file_io::read_set_from_file allocating set of size "
2401 << set_size << endl;
2406 cout <<
"file_io::read_set_from_file reading set of size "
2407 << set_size << endl;
2409 for (i = 0; i < set_size; i++) {
2420 cout <<
"file_io::read_set_from_file read a set of size " << set_size
2421 <<
" from file " << fname << endl;
2424 cout <<
"file_io::read_set_from_file the set is:" << endl;
2430 cout <<
"file_io::read_set_from_file done" << endl;
2435 long int *the_set,
int set_size,
int verbose_level)
2437 int f_v = (verbose_level >= 1);
2441 cout <<
"write_set_to_file opening file "
2442 << fname <<
" for writing" << endl;
2447 f << set_size <<
" ";
2449 for (i = 0; i < set_size; i++) {
2451 if (i && ((i % 10) == 0)) {
2455 f << the_set[i] <<
" ";
2457 f << endl << -1 << endl;
2460 cout <<
"Written file " << fname <<
" of size "
2466 long int *&the_set,
int &set_size,
int verbose_level)
2468 int f_v = (verbose_level >= 1);
2469 int f_vv = (verbose_level >= 2);
2474 cout <<
"read_set_from_file_lint opening file " << fname
2476 <<
" for reading" << endl;
2482 cout <<
"read_set_from_file_lint allocating set of size "
2483 << set_size << endl;
2488 cout <<
"read_set_from_file_lint reading set of size "
2489 << set_size << endl;
2491 for (i = 0; i < set_size; i++) {
2503 cout <<
"read a set of size " << set_size
2504 <<
" from file " << fname << endl;
2507 cout <<
"the set is:" << endl;
2514 long int *the_set,
int set_size,
int verbose_level)
2516 int f_v = (verbose_level >= 1);
2520 cout <<
"write_set_to_file_lint opening file "
2521 << fname <<
" for writing" << endl;
2526 f << set_size << endl;
2528 for (i = 0; i < set_size; i++) {
2530 if (i && ((i % 10) == 0)) {
2534 f << the_set[i] <<
" ";
2536 f << endl << -1 << endl;
2539 cout <<
"Written file " << fname <<
" of size "
2545 long int *&the_set,
int &set_size,
int verbose_level)
2547 int f_v = (verbose_level >= 1);
2548 int f_vv = (verbose_level >= 2);
2553 cout <<
"read_set_from_file_int4 opening file " << fname
2555 <<
" for reading" << endl;
2557 ifstream f(fname, ios::binary);
2559 f.read((
char *) &a,
sizeof(
int_4));
2563 for (i = 0; i < set_size; i++) {
2564 f.read((
char *) &a,
sizeof(
int_4));
2576 cout <<
"read a set of size " << set_size
2577 <<
" from file " << fname << endl;
2580 cout <<
"the set is:" << endl;
2587 long int *&the_set,
int &set_size,
int verbose_level)
2589 int f_v = (verbose_level >= 1);
2590 int f_vv = (verbose_level >= 2);
2596 cout <<
"read_set_from_file_int8 opening file " << fname
2598 <<
" for reading" << endl;
2600 ifstream f(fname, ios::binary);
2602 f.read((
char *) &a,
sizeof(
int_8));
2606 for (i = 0; i < set_size; i++) {
2607 f.read((
char *) &a,
sizeof(
int_8));
2619 cout <<
"read a set of size " << set_size
2620 <<
" from file " << fname << endl;
2623 cout <<
"the set is:" << endl;
2630 long int *the_set,
int set_size,
int verbose_level)
2632 int f_v = (verbose_level >= 1);
2638 cout <<
"write_set_to_file_as_int4 opening file "
2639 << fname <<
" for writing" << endl;
2642 ofstream f(fname, ios::binary);
2645 a = (
int_4) set_size;
2646 f.write((
char *) &a,
sizeof(
int_4));
2648 if (b != set_size) {
2649 cout <<
"write_set_to_file_as_int4 "
2650 "data loss regarding set_size" << endl;
2651 cout <<
"set_size=" << set_size << endl;
2652 cout <<
"a=" << a << endl;
2653 cout <<
"b=" << b << endl;
2656 for (i = 0; i < set_size; i++) {
2657 a = (
int_4) the_set[i];
2658 f.write((
char *) &a,
sizeof(
int_4));
2660 if (b != the_set[i]) {
2661 cout <<
"write_set_to_file_as_int4 data loss" << endl;
2662 cout <<
"i=" << i << endl;
2663 cout <<
"the_set[i]=" << the_set[i] << endl;
2664 cout <<
"a=" << a << endl;
2665 cout <<
"b=" << b << endl;
2671 cout <<
"Written file " << fname
2672 <<
" of size " <<
file_size(fname) << endl;
2677 long int *the_set,
int set_size,
int verbose_level)
2679 int f_v = (verbose_level >= 1);
2684 cout <<
"write_set_to_file_as_int8 opening file "
2685 << fname <<
" for writing" << endl;
2688 ofstream f(fname, ios::binary);
2691 a = (
int_8) set_size;
2692 f.write((
char *) &a,
sizeof(
int_8));
2694 if (b != set_size) {
2695 cout <<
"write_set_to_file_as_int8 "
2696 "data loss regarding set_size" << endl;
2697 cout <<
"set_size=" << set_size << endl;
2698 cout <<
"a=" << a << endl;
2699 cout <<
"b=" << b << endl;
2702 for (i = 0; i < set_size; i++) {
2703 a = (
int_8) the_set[i];
2704 f.write((
char *) &a,
sizeof(
int_8));
2706 if (b != the_set[i]) {
2707 cout <<
"write_set_to_file_as_int8 data loss" << endl;
2708 cout <<
"i=" << i << endl;
2709 cout <<
"the_set[i]=" << the_set[i] << endl;
2710 cout <<
"a=" << a << endl;
2711 cout <<
"b=" << b << endl;
2717 cout <<
"Written file " << fname
2718 <<
" of size " <<
file_size(fname) << endl;
2723 int *&the_set,
int &set_size,
int verbose_level)
2725 int f_v = (verbose_level >= 1);
2726 int f_vv = (verbose_level >= 2);
2730 cout <<
"read_k_th_set_from_file opening file "
2731 << fname <<
" of size " <<
file_size(fname)
2732 <<
" for reading" << endl;
2739 for (h = 0; h <= k; h++) {
2740 for (i = 0; i < set_size; i++) {
2743 cout <<
"read_k_th_set_from_file: h="
2744 << h <<
" the " << i
2745 <<
"-th number is " << a << endl;
2753 cout <<
"read a set of size " << set_size
2754 <<
" from file " << fname << endl;
2757 cout <<
"the set is:" << endl;
2765 int *Inc,
int m,
int n,
int verbose_level)
2767 int f_v = (verbose_level >= 1);
2771 cout <<
"write_incidence_matrix_to_file opening file "
2772 << fname <<
" for writing" << endl;
2778 for (i = 0; i < m * n; i++) {
2783 f << m <<
" " << n <<
" " << nb_inc << endl;
2785 for (i = 0; i < m * n; i++) {
2795 cout <<
"Written file " << fname <<
" of size "
2800#define READ_INCIDENCE_BUFSIZE 1000000
2803 std::string &inc_file_name,
int inc_file_idx,
int verbose_level)
2805 int f_v = (verbose_level >= 1);
2806 int f_vv = (verbose_level >= 2);
2816 cout <<
"read_incidence_matrix_from_inc_file "
2817 << inc_file_name <<
" no " << inc_file_idx << endl;
2820 ifstream f(inc_file_name);
2826 if (strlen(buf) == 0) {
2829 sscanf(buf,
"%d %d %d", &m, &n, &nb_inc);
2833 cout <<
" nb_inc=" << nb_inc << endl;
2842 if (strlen(buf) == 0) {
2847 if (buf[0] ==
'#') {
2858 cout <<
"\nread_incidence_matrix_from_inc_file: "
2859 "found a complete file with "
2860 << cnt <<
" solutions" << endl;
2866 for (h = 1; h < nb_inc; h++) {
2868 if (a < 0 || a >= m * n) {
2869 cout <<
"attention, read " << a
2870 <<
" h=" << h << endl;
2877 if (cnt == inc_file_idx) {
2879 for (h = 0; h < m * n; h++) {
2882 for (h = 0; h < nb_inc; h++) {
2886 cout <<
"read_incidence_matrix_from_inc_file: "
2887 "found the following incidence matrix:" << endl;
2901 int &m,
int &n,
int &nb_flags,
2902 std::string &inc_file_name,
int verbose_level)
2904 int f_v = (verbose_level >= 1);
2905 int f_vv = (verbose_level >= 2);
2914 cout <<
"file_io::read_incidence_file " << inc_file_name << endl;
2917 ifstream f(inc_file_name);
2923 if (strlen(buf) == 0) {
2926 sscanf(buf,
"%d %d %d", &m, &n, &nb_flags);
2930 cout <<
" nb_flags=" << nb_flags << endl;
2939 if (strlen(buf) == 0) {
2944 if (buf[0] ==
'#') {
2955 cout <<
"file_io::read_incidence_file: "
2956 "found a complete file with "
2957 << cnt <<
" solutions" << endl;
2963 for (h = 1; h < nb_flags; h++) {
2965 if (a < 0 || a >= m * n) {
2966 cout <<
"attention, read " << a
2967 <<
" h=" << h << endl;
2977 for (h = 0; h < nb_flags; h++) {
2989 int &m,
int &n,
int &r,
2990 std::string &inc_file_name,
int verbose_level)
2992 int f_v = (verbose_level >= 1);
2993 int f_vv = (verbose_level >= 2);
3002 cout <<
"file_io::read_incidence_by_row_ranks_file " << inc_file_name << endl;
3005 ifstream f(inc_file_name);
3011 if (strlen(buf) == 0) {
3014 sscanf(buf,
"%d %d %d", &m, &n, &r);
3018 cout <<
" r=" << r << endl;
3032 if (strlen(buf) == 0) {
3037 if (buf[0] ==
'#') {
3048 cout <<
"file_io::read_incidence_file: "
3049 "found a complete file with "
3050 << cnt <<
" solutions" << endl;
3056 for (h = 0; h < sz; h++) {
3066 for (h = 0; h < sz; h++) {
3068 for (u = 0; u < r; u++) {
3069 v.push_back(h * n + Row[u]);
3083 char *inc_file_name,
int verbose_level)
3085 int f_v = (verbose_level >= 1);
3086 int f_vv = (verbose_level >= 2);
3097 cout <<
"inc_file_get_number_of_geometries "
3098 << inc_file_name << endl;
3101 ifstream f(inc_file_name);
3107 if (strlen(buf) == 0) {
3110 sscanf(buf,
"%d %d %d", &m, &n, &nb_inc);
3114 cout <<
" nb_inc=" << nb_inc << endl;
3123 if (strlen(buf) == 0) {
3128 if (buf[0] ==
'#') {
3139 cout <<
"\nread_incidence_matrix_from_inc_file: "
3140 "found a complete file with " << cnt
3141 <<
" solutions" << endl;
3147 for (h = 1; h < nb_inc; h++) {
3149 if (a < 0 || a >= m * n) {
3150 cout <<
"attention, read " << a
3151 <<
" h=" << h << endl;
3178 handle = open(name, O_RDWR);
3179 size = lseek(handle, 0L, SEEK_END);
3188 handle = open(name, O_RDONLY);
3190 size = lseek(handle, 0L, SEEK_END);
3197 cout <<
"file_io::file_size SYSTEMWINDOWS but not SYSTEMUNIX" << endl;
3211 sprintf(str,
"rm %s", fname);
3220 fwrite(&I, 1 , 4 , fp);
3227 fread(&I, 1 , 4 , fp);
3233 fwrite(p, 1 , len , fp);
3238 fread(p, 1 , len , fp);
3242 int *&the_set,
int &set_size,
int verbose_level)
3244 int f_v = (verbose_level >= 1);
3245 int f_vv = (verbose_level >= 2);
3250 cout <<
"read_numbers_from_file opening file " << fname
3251 <<
" of size " <<
file_size(fname) <<
" for reading" << endl;
3258 for (i = 0;
TRUE; i++) {
3265 cout <<
"read_set_from_file: the " << i
3266 <<
"-th number is " << d <<
" which becomes "
3273 if (i >= set_size) {
3274 cout <<
"i >= set_size" << endl;
3280 cout <<
"read a set of size " << set_size
3281 <<
" from file " << fname << endl;
3284 cout <<
"the set is:" << endl;
3291 std::string &fname_ascii,
3292 int *&Sets,
int &nb_sets,
int &set_size,
int verbose_level)
3294 int f_v = (verbose_level >= 1);
3296 cout <<
"file_io::read_ascii_set_of_sets_constant_size "
3297 "reading ascii file " << fname_ascii << endl;
3309 cout <<
"file_io::read_ascii_set_of_sets_constant_size "
3310 "Reading file " << fname_ascii <<
" of size "
3311 <<
file_size(fname_ascii) <<
":" << endl;
3313 ifstream fp(fname_ascii);
3328 cout <<
"file_io::read_ascii_set_of_sets_constant_size "
3329 "set " << nb_sets <<
":";
3337 if (nb != set_size) {
3338 cout <<
"file_io::read_ascii_set_of_sets_constant_size "
3339 "nb != set_size" << endl;
3343 for (i = 0; i < set_size; i++) {
3344 fp >> Sets[nb_sets * set_size + i];
3350 cout <<
"file_io::read_ascii_set_of_sets_constant_size "
3351 "set " << nb_sets <<
" / " << N <<
" is ";
3359 cout <<
"file_io::read_ascii_set_of_sets_constant_size "
3360 "We found " << nb_sets <<
" sets" << endl;
3364 cout <<
"writing spreads to file " << fname_spreads << endl;
3365 Fio.int_matrix_write_csv(fname_spreads, Spreads, nb_spreads,
3368 cout <<
"Written file " << fname_spreads <<
" of size "
3369 << Fio.file_size(fname_spreads) << endl;
3373 cout <<
"file_io::read_ascii_set_of_sets_constant_size "
3374 "reading ascii file " << fname_ascii <<
" done" << endl;
3380 int f_v = (verbose_level >= 1);
3383 cout <<
"file_io::write_widor" << endl;
3390 f <<
"<HTDO type=pt ptanz=" << m <<
" btanz=" << n <<
" fuse=simple>" << endl;
3392 for (j = 0; j < n; j++) {
3393 f << setw(8) << b[j] <<
" ";
3396 for (i = 0; i < m; i++) {
3397 f << setw(8) << v[i];
3398 for (j = 0; j < n; j++) {
3399 f << setw(8) << aij[i * n + j] <<
" ";
3404 for (i = 0; i < m; i++) {
3408 f <<
"</HTDO>" << endl;
3412 cout <<
"file_io::write_decomposition_stack done" << endl;
3413 cout <<
"written file " << fname <<
" of size " <<
file_size(fname) << endl;
3424 cout <<
"Descr->f_read_cases" << endl;
3443 Cases, nb_cases, n, 0 );
3446 cout <<
"nb_cases = " << nb_cases << endl;
3447 cout <<
"n = " << n << endl;
3449 cout <<
"read cases, n != 1" << endl;
3453 cout <<
"We found " << nb_cases <<
" cases to do:" << endl;
3454 int_vec_print(cout, Cases, nb_cases);
3458 const char *log_fname =
"log_file.txt";
3459 const char *log_mask =
"\tsbatch job%03d";
3461 ofstream fp_log(log_fname);
3463 for (c = 0; c < nb_cases; c++) {
3466 sprintf(str, Descr->
file_mask.c_str(), c);
3473 for (j = 0; j < Descr->
nb_lines; j++) {
3475 sprintf(str, Descr->
lines[j].c_str(), c);
3482 sprintf(str, Descr->
lines[j].c_str(), s.c_str());
3488 cout <<
"Written file " << fname <<
" of size "
3491 char log_entry[1000];
3493 sprintf(log_entry, log_mask, c);
3494 fp_log << log_entry << endl;
3497 cout <<
"Written file " << log_fname <<
" of size "
3501 cout <<
"read_cases_text" << endl;
3504 cout <<
"please use option -N <N>" << endl;
3508 cout <<
"please use option -command <command>" << endl;
3520 cout <<
"Read spreadsheet with " << S->
nb_rows <<
" rows" << endl;
3524 cout <<
"row " << row <<
" : ";
3528 cout <<
"..." << endl;
3530 cout <<
"row " << row <<
" : ";
3540 else if (Descr->
f_N) {
3551 for (i = 0, j = 0; i < l; i++, j++) {
3552 if (str[i] ==
'\\' && i < l - 1 && str[i + 1] ==
't') {
3556 else if (str[i] ==
'\\' && i < l - 1 && str[i + 1] ==
'D') {
3560 else if (str[i] ==
'\\' && i < l - 1 && str[i + 1] ==
'B') {
3564 else if (str[i] ==
'\\' && i < l - 1 && str[i + 1] ==
'n') {
3578 int f_v = (verbose_level >= 1);
3587 cout <<
"file_io::create_files" << endl;
3590 const char *makefile_fname =
"makefile_submit";
3592 ofstream fp_makefile(makefile_fname);
3594 for (i = 0; i < Descr->
N; i++) {
3596 sprintf(str, Descr->
file_mask.c_str(), i);
3599 fp_makefile <<
"\tsbatch " << fname << endl;
3603 for (j = 0; j < Descr->
nb_lines; j++) {
3606 cout <<
"mask='" << Descr->
lines[j].c_str() <<
"'" << endl;
3607 sprintf(str, Descr->
lines[j].c_str(), i, i, i, i, i, i, i, i);
3611 cout <<
"str='" << str <<
"'" << endl;
3616 for (r = 0; r < Descr->
split_m; r++) {
3617 for (j = 0; j < Descr->
repeat_N; j++) {
3618 if ((j % Descr->
split_m) == r) {
3634 cout <<
"please use option -command when using -repeat" << endl;
3637 for (j = 0; j < Descr->
repeat_N; j++) {
3639 sprintf(str, Descr->
command.c_str(), c, c, c, c);
3649 cout <<
"Written file " << fname <<
" of size "
3655 cout <<
"Written file " << makefile_fname <<
" of size "
3656 << Fio.
file_size(makefile_fname) << endl;
3660 cout <<
"file_io::create_files done" << endl;
3667 int f_v = (verbose_level >= 1);
3675 cout <<
"file_io::create_files_list_of_cases" << endl;
3678 int nb_cases = S->
nb_rows - 1;
3679 cout <<
"nb_cases=" << nb_cases << endl;
3682 const char *makefile_fname =
"makefile_submit";
3683 const char *fname_submit_script =
"submit_jobs.sh";
3685 ofstream fp_makefile(makefile_fname);
3686 ofstream fp_submit_script(fname_submit_script);
3688 fp_submit_script <<
"#!/bin/bash" << endl;
3689 for (i = 0; i < Descr->
N; i++) {
3691 sprintf(str, Descr->
file_mask.c_str(), i);
3694 fp_makefile <<
"\tsbatch " << fname << endl;
3695 fp_submit_script <<
"sbatch " << fname << endl;
3699 for (j = 0; j < Descr->
nb_lines; j++) {
3700 sprintf(str, Descr->
lines[j].c_str(), i, i, i, i, i, i, i, i);
3713 for (t = 0; t < Descr->
nb_tasks; t++) {
3714 sprintf(str, Descr->
command.c_str(), i, t, i, t);
3717 for (j = 0; j < nb_cases; j++) {
3718 if ((j % Descr->
N) != i) {
3721 if (((j - i) / Descr->
N) % Descr->
nb_tasks != t) {
3731 if (j < nb_cases - Descr->N) {
3735 fp <<
")\"\\" << endl;
3738 fp <<
" & " << endl;
3743 sprintf(str, Descr->
command.c_str(), i);
3745 fp << str <<
" \\" << endl;
3747 for (j = 0; j < nb_cases; j++) {
3748 if ((j % Descr->
N) != i) {
3756 fp <<
"\t\t" << entry <<
" \\" << endl;
3758 if (j < nb_cases - N) {
3762 fp <<
")\"\\" << endl;
3766 fp <<
" & " << endl;
3771 sprintf(str, Descr->
final_lines[j].c_str(), i, i, i, i, i, i, i, i);
3778 cout <<
"Written file " << fname <<
" of size "
3784 cout <<
"Written file " << makefile_fname <<
" of size "
3785 << Fio.
file_size(makefile_fname) << endl;
3787 const char *mask_submit_script_piecewise =
"submit_jobs_%d.sh";
3788 char fname_submit_piecewise[1000];
3793 for (h = 0; h < Descr->
N / N1; h++) {
3794 sprintf(fname_submit_piecewise, mask_submit_script_piecewise, h * N1);
3796 ofstream fp_submit_script(fname_submit_piecewise);
3798 fp_submit_script <<
"#!/bin/bash" << endl;
3799 for (i = 0; i < N1; i++) {
3801 sprintf(str, Descr->
file_mask.c_str(), h * N1 + i);
3804 fp_submit_script <<
"sbatch " << fname;
3806 fp_submit_script <<
"; ";
3809 fp_submit_script << endl;
3813 cout <<
"Written file " << fname_submit_piecewise <<
" of size "
3814 << Fio.
file_size(fname_submit_piecewise) << endl;
3815 sprintf(cmd,
"chmod +x %s", fname_submit_piecewise);
3819 cout <<
"file_io::create_files_list_of_cases done" << endl;
3827 CG.
load(fname, verbose_level);
3833 std::string &rows_text,
3836 int f_v = (verbose_level >= 1);
3839 cout <<
"file_io::do_csv_file_select_rows" << endl;
3858 fname_out.assign(fname);
3860 fname_out.append(
"_select.csv");
3863 ofstream ost(fname_out);
3866 for (i = 0; i < nb_rows; i++) {
3870 ost <<
"END" << endl;
3872 cout <<
"Written file " << fname_out <<
" of size " <<
file_size(fname_out) << endl;
3877 cout <<
"file_io::do_csv_file_select_rows done" << endl;
3885 int f_v = (verbose_level >= 1);
3888 cout <<
"file_io::do_csv_file_split_rows_modulo" << endl;
3902 for (I = 0; I < split_modulo; I++) {
3907 fname_out.assign(fname);
3909 sprintf(str,
"_split_%d_mod_%d.csv", I, split_modulo);
3910 fname_out.append(str);
3913 ofstream ost(fname_out);
3915 for (i = 0; i < S.
nb_rows - 1; i++) {
3916 if ((i % split_modulo) != I) {
3922 ost <<
"END" << endl;
3924 cout <<
"Written file " << fname_out <<
" of size " <<
file_size(fname_out) << endl;
3928 cout <<
"file_io::do_csv_file_split_rows_modulo done" << endl;
3933 std::string &cols_text,
3936 int f_v = (verbose_level >= 1);
3939 cout <<
"file_io::do_csv_file_select_cols" << endl;
3957 cout <<
"file_io::do_csv_file_select_cols nb_rows=" << nb_rows << endl;
3963 fname_out.assign(fname);
3965 fname_out.append(
"_select.csv");
3968 ofstream ost(fname_out);
3971 for (i = 0; i < nb_rows - 1; i++) {
3974 Cols, nb_cols, ost);
3976 ost <<
"END" << endl;
3978 cout <<
"Written file " << fname_out <<
" of size " <<
file_size(fname_out) << endl;
3980 fname_out.assign(fname);
3982 fname_out.append(
"_special.csv");
3985 ofstream ost(fname_out);
3988 for (i = 0; i < nb_rows - 1; i++) {
3989 ost <<
"Orb" << i <<
"=";
3991 Cols, nb_cols, ost);
3993 ost <<
"END" << endl;
3995 cout <<
"Written file " << fname_out <<
" of size " <<
file_size(fname_out) << endl;
3999 cout <<
"file_io::do_csv_file_select_cols done" << endl;
4006 std::string &rows_text, std::string &cols_text,
4009 int f_v = (verbose_level >= 1);
4012 cout <<
"file_io::do_csv_file_select_rows_and_cols" << endl;
4041 fname_out.assign(fname);
4043 fname_out.append(
"_select.csv");
4046 ofstream ost(fname_out);
4049 for (i = 0; i < nb_rows; i++) {
4052 Cols, nb_cols, ost);
4054 ost <<
"END" << endl;
4056 cout <<
"Written file " << fname_out <<
" of size " <<
file_size(fname_out) << endl;
4062 cout <<
"file_io::do_csv_file_select_rows done" << endl;
4067 std::string &csv_fname, std::string &col_label,
int verbose_level)
4069 int f_v = (verbose_level >= 1);
4072 cout <<
"file_io::do_csv_file_extract_column_to_txt" << endl;
4078 int identifier_column;
4083 cout <<
"Table " << csv_fname <<
" has been read" << endl;
4089 fname.assign(csv_fname);
4091 fname.append(col_label);
4092 fname.append(
".txt");
4098 ofstream ost(fname);
4102 for (i = 1; i < S->
nb_rows; i++) {
4110 for (j = 0; j < sz; j++) {
4119 cout <<
"Written file " << fname <<
" of size " <<
file_size(fname) << endl;
4123 cout <<
"file_io::do_csv_file_extract_column_to_txt done" << endl;
4130 std::string &csv_fname,
int verbose_level)
4132 int f_v = (verbose_level >= 1);
4135 cout <<
"file_io::do_csv_file_sort_each_row" << endl;
4145 for (i = 0; i < m; i++) {
4148 fname.assign(csv_fname);
4154 cout <<
"Written file " << fname <<
" of size " <<
file_size(fname) << endl;
4158 cout <<
"file_io::do_csv_file_sort_each_row done" << endl;
4163 std::vector<std::string> &csv_file_join_fname,
4164 std::vector<std::string> &csv_file_join_identifier,
int verbose_level)
4166 int f_v = (verbose_level >= 1);
4169 cout <<
"file_io::do_csv_file_join" << endl;
4175 nb_files = csv_file_join_fname.size();
4178 int *identifier_column;
4181 identifier_column =
NEW_int(nb_files);
4183 for (i = 0; i < nb_files; i++) {
4184 cout <<
"Reading table " << csv_file_join_fname[i] << endl;
4186 cout <<
"Table " << csv_file_join_fname[i] <<
" has been read" << endl;
4189 cout <<
"The first table is:" << endl;
4194 cout <<
"The " << i <<
"th table is:" << endl;
4202 cout <<
"adding " << nb_with <<
" -with entries" << endl;
4203 for (i = 0; i < nb_with; i++) {
4208 for (i = 0; i < nb_files; i++) {
4209 identifier_column[i] = S[i].
find_by_column(csv_file_join_identifier[i].c_str());
4210 cout <<
"Table " << csv_file_join_fname[i] <<
", identifier " << identifier_column[i] << endl;
4214 for (i = 0; i < nb_files; i++) {
4216 cout <<
"File " << fname[i] <<
" by_column[" << i <<
"]=" << by_column[i] << endl;
4220 cout <<
"joining " << nb_files <<
" files" << endl;
4221 for (i = 1; i < nb_files; i++) {
4222 cout <<
"Joining table " << 0 <<
" = " << csv_file_join_fname[0] <<
" with table " << i <<
" = " << csv_file_join_fname[i] << endl;
4223 S[0].
join_with(S + i, identifier_column[0], identifier_column[i], verbose_level - 2);
4224 cout <<
"joining " << csv_file_join_fname[0] <<
" with table " << csv_file_join_fname[i] <<
" done" << endl;
4226 cout <<
"After join, the table is:" << endl;
4238 S[0].
remove_rows(drop_column, drop_label, verbose_level);
4246 save_fname.assign(csv_file_join_fname[0]);
4248 save_fname.append(
"_joined.csv");
4251 ofstream f(save_fname);
4255 cout <<
"Written file " << save_fname <<
" of size " <<
file_size(save_fname) << endl;
4259 cout <<
"file_io::do_csv_file_join done" << endl;
4264 std::vector<std::string> &fname_in, std::string &fname_out,
int verbose_level)
4266 int f_v = (verbose_level >= 1);
4269 cout <<
"file_io::do_csv_file_concatenate" << endl;
4275 nb_files = fname_in.size();
4278 int *identifier_column;
4281 identifier_column =
NEW_int(nb_files);
4283 for (i = 0; i < nb_files; i++) {
4284 cout <<
"Reading table " << fname_in[i] << endl;
4286 cout <<
"Table " << fname_in[i] <<
" has been read" << endl;
4289 cout <<
"The " << i <<
"-th table is:" << endl;
4297 ofstream ost(fname_out);
4299 int f_enclose_in_parentheses =
FALSE;
4302 for (i = 0; i < nb_files; i++) {
4304 for (j = 1; j < S[i].
nb_rows; j++) {
4308 ost <<
"END" << endl;
4310 cout <<
"Written file " << fname_out <<
" of size " <<
file_size(fname_out) << endl;
4314 cout <<
"file_io::do_csv_file_concatenate done" << endl;
4319 int f_produce_latex_header,
4320 int nb_lines_per_table,
4323 int f_v = (verbose_level >= 1);
4326 cout <<
"file_io::do_csv_file_latex" << endl;
4335 cout <<
"file_io::do_csv_file_latex S.nb_rows = " << S.
nb_rows << endl;
4336 cout <<
"file_io::do_csv_file_latex S.nb_cols = " << S.
nb_cols << endl;
4343 fname_out.assign(fname);
4345 fname_out.append(
".tex");
4348 ofstream ost(fname_out);
4353 int *f_column_select;
4357 for (j = 0; j < S.
nb_cols; j++) {
4358 f_column_select[j] =
TRUE;
4360 f_column_select[0] =
FALSE;
4363 if (f_produce_latex_header) {
4380 nb_lines_per_table);
4384 if (f_produce_latex_header) {
4389 cout <<
"Written file " << fname_out <<
" of size " <<
file_size(fname_out) << endl;
4393 cout <<
"file_io::do_csv_file_select_rows done" << endl;
4400 int solution_size = sz;
4404 std::vector<std::vector<int> > Solutions;
4408 Solutions, solution_size,
4411 nb_solutions = Solutions.size();
4413 Sol =
NEW_int(nb_solutions * solution_size);
4414 for (i = 0; i < nb_solutions; i++) {
4415 for (j = 0; j < solution_size; j++) {
4416 Sol[i * solution_size + j] = Solutions[i][j];
4421 cout <<
"nb_solutions = " << nb_solutions << endl;
4425 T.
init(Sol, nb_solutions * solution_size,
TRUE, 0);
4426 cout <<
"tally:" << endl;
4433 int multiplicity = 4;
4436 Pts, nb_pts, multiplicity, verbose_level);
4438 cout <<
"multiplicity " << multiplicity <<
" number of pts = " << nb_pts << endl;
4449 int f_v = (verbose_level >= 1);
4452 cout <<
"file_io::save_fibration" << endl;
4463 nb_sets = Fibration.size();
4465 for (i = 0; i < nb_sets; i++) {
4466 Sz[i] = Fibration[i].size();
4473 nb_sets, Sz, verbose_level);
4475 nb_sets, Sz, verbose_level);
4476 for (i = 0; i < nb_sets; i++) {
4477 l = Fibration[i].size();
4478 for (j = 0; j < l; j++) {
4479 a = Fibration[i][j].first;
4480 b = Fibration[i][j].second;
4481 File_idx->
Sets[i][j] = a;
4482 Obj_idx->
Sets[i][j] = b;
4487 data_fname1.assign(fname);
4489 data_fname2.assign(fname);
4493 cout <<
"file_io::save_fibration before File_idx->save_csv" << endl;
4497 cout <<
"file_io::save_fibration before Obj_idx->save_csv" << endl;
4501 cout <<
"file_io::save_fibration after Obj_idx->save_csv" << endl;
4506 cout <<
"Written file " << data_fname1 <<
" of size " <<
file_size(data_fname1) << endl;
4507 cout <<
"Written file " << data_fname2 <<
" of size " <<
file_size(data_fname2) << endl;
4515 cout <<
"file_io::save_fibration done" << endl;
4521 std::string &fname,
int verbose_level)
4523 int f_v = (verbose_level >= 1);
4526 cout <<
"file_io::save_cumulative_canonical_labeling" << endl;
4529 string canonical_labeling_fname;
4530 int canonical_labeling_len;
4534 if (Cumulative_canonical_labeling.size()) {
4535 canonical_labeling_len = Cumulative_canonical_labeling[0].size();
4538 canonical_labeling_len = 0;
4541 canonical_labeling_fname.assign(fname);
4545 M =
NEW_lint(Cumulative_canonical_labeling.size() * canonical_labeling_len);
4546 for (u = 0; u < Cumulative_canonical_labeling.size(); u++) {
4547 for (v = 0; v < canonical_labeling_len; v++) {
4548 M[u * canonical_labeling_len + v] = Cumulative_canonical_labeling[u][v];
4552 M, Cumulative_canonical_labeling.size(), canonical_labeling_len);
4555 cout <<
"Written file " << canonical_labeling_fname <<
" of size " <<
file_size(canonical_labeling_fname) << endl;
4562 std::string &fname,
int verbose_level)
4564 int f_v = (verbose_level >= 1);
4567 cout <<
"file_io::save_cumulative_ago" << endl;
4574 ago_fname.assign(fname);
4576 M =
NEW_lint(Cumulative_Ago.size());
4577 for (u = 0; u < Cumulative_Ago.size(); u++) {
4578 M[u] = Cumulative_Ago[u];
4586 cout <<
"Written file " << ago_fname <<
" of size " <<
file_size(ago_fname) << endl;
4590 cout <<
"Ago distribution: ";
4597 ago_fname1.assign(ago_fname);
4606 std::string &fname,
int verbose_level)
4608 int f_v = (verbose_level >= 1);
4611 cout <<
"file_io::save_cumulative_data" << endl;
4619 if (Cumulative_data.size()) {
4620 data_len = Cumulative_data[0].size();
4626 data_fname.assign(fname);
4628 M =
NEW_lint(Cumulative_data.size() * data_len);
4629 for (u = 0; u < Cumulative_data.size(); u++) {
4630 for (v = 0; v < data_len; v++) {
4631 M[u * data_len + v] = Cumulative_data[u][v];
4635 M, Cumulative_data.size(), data_len);
4638 cout <<
"Written file " << data_fname <<
" of size " <<
file_size(data_fname) << endl;
4645 long int *data,
int nb_rows,
int data_sz,
int nb_cols,
int verbose_level)
4647 int f_v = (verbose_level >= 1);
4651 T =
NEW_int(nb_rows * nb_cols);
4654 for (i = 0; i < nb_rows; i++) {
4655 for (h = 0; h < data_sz; h++) {
4656 j = data[i * data_sz + h];
4657 T[i * nb_cols + j] = 1;
4666 cout <<
"file_io::write_characteristic_matrix Written file " << fname <<
" of size " <<
file_size(fname) << endl;
a collection of combinatorial functions
void unrank_k_subset(int rk, int *set, int n, int k)
void init_basic_with_Sz_in_int(int underlying_set_size, int nb_sets, int *Sz, int verbose_level)
void save_csv(std::string &fname, int f_make_heading, int verbose_level)
void init_simple(int underlying_set_size, int nb_sets, int verbose_level)
a collection of functions related to sorted vectors
void int_vec_heapsort(int *v, int len)
for reading and writing of csv files
void read_spreadsheet(std::string &fname, int verbose_level)
void join_with(spreadsheet *S2, int by1, int by2, int verbose_level)
double get_double(int i, int j)
void remove_rows(const char *drop_column, const char *drop_label, int verbose_level)
void print_table_row(int row, int f_enclose_in_parentheses, std::ostream &ost)
void print_table_latex(std::ostream &ost, int *f_column_select, int f_enclose_in_parentheses, int nb_lines_per_table)
void print_table_row_with_column_selection(int row, int f_enclose_in_parentheses, int *Col_selection, int nb_cols_selected, std::ostream &ost)
long int get_int(int i, int j)
void add_column_with_constant_value(const char *label, char *value)
int find_column(std::string &column_label)
void get_string(std::string &str, int i, int j)
void print_table(std::ostream &ost, int f_enclose_in_parentheses)
int find_by_column(const char *join_by)
a statistical analysis of data consisting of single integers
void init(int *data, int data_length, int f_second, int verbose_level)
void save_classes_individually(std::string &fname)
void print(int f_backwards)
void init_lint(long int *data, int data_length, int f_second, int verbose_level)
void get_data_by_multiplicity(int *&Pts, int &nb_pts, int multiplicity, int verbose_level)
a graph with a vertex coloring
void load(std::string &fname, int verbose_level)
rules to create text files
int f_line_numeric[MAX_LINES]
std::string final_lines[MAX_LINES]
int read_cases_column_of_fname
std::string lines[MAX_LINES]
std::string read_cases_fname
a collection of functions related to file io
int count_number_of_lines_in_file(std::string &fname, int verbose_level)
void int_vec_array_write_csv(int nb_vecs, int **Vec, int len, std::string &fname, const char **column_label)
void parse_sets_and_check_sizes_easy(int len, int nb_cases, char **data, long int **&sets)
void read_set_from_file_int4(std::string &fname, long int *&the_set, int &set_size, int verbose_level)
void read_k_th_set_from_file(std::string &fname, int k, int *&the_set, int &set_size, int verbose_level)
void read_solutions_from_file_and_get_solution_size(std::string &fname, int &nb_solutions, int *&Solutions, int &solution_size, int verbose_level)
void count_number_of_solutions_in_file_and_get_solution_size(std::string &fname, int &nb_solutions, int &solution_size, int verbose_level)
void int_matrix_write_csv(std::string &fname, int *M, int m, int n)
int count_number_of_orbits_in_file(std::string &fname, int verbose_level)
void create_files_list_of_cases(data_structures::spreadsheet *S, create_file_description *Descr, int verbose_level)
void save_fibration(std::vector< std::vector< std::pair< int, int > > > &Fibration, std::string &fname, int verbose_level)
void int_vecs3_write_csv(int *v1, int *v2, int *v3, int len, std::string &fname, const char *label1, const char *label2, const char *label3)
void do_csv_file_select_rows(std::string &fname, std::string &rows_text, int verbose_level)
void do_csv_file_sort_each_row(std::string &csv_fname, int verbose_level)
void write_set_to_file_lint(std::string &fname, long int *the_set, int set_size, int verbose_level)
void int_matrix_read_csv_no_border(std::string &fname, int *&M, int &m, int &n, int verbose_level)
void save_cumulative_canonical_labeling(std::vector< std::vector< int > > &Cumulative_canonical_labeling, std::string &fname, int verbose_level)
void int_vec_write_csv(int *v, int len, std::string &fname, const char *label)
void lint_matrix_write_csv(std::string &fname, long int *M, int m, int n)
void int_matrix_write_text(std::string &fname, int *M, int m, int n)
void int_vecs_write_csv(int *v1, int *v2, int len, std::string &fname, const char *label1, const char *label2)
void do_csv_file_select_cols(std::string &fname, std::string &cols_text, int verbose_level)
int_4 fread_int4(FILE *fp)
void read_and_parse_data_file_fancy(std::string &fname, int f_casenumbers, int &nb_cases, int *&Set_sizes, long int **&Sets, char **&Ago_ascii, char **&Aut_ascii, int *&Casenumbers, int verbose_level)
void int_matrix_read_csv(std::string &fname, int *&M, int &m, int &n, int verbose_level)
void read_incidence_by_row_ranks_file(std::vector< std::vector< int > > &Geos, int &m, int &n, int &r, std::string &inc_file_name, int verbose_level)
void concatenate_files_into(const char *fname_in_mask, int N, std::ofstream &fp_out, const char *EOF_marker, int f_title_line, int &cnt_total, std::vector< int > &missing_idx, int verbose_level)
int inc_file_get_number_of_geometries(char *inc_file_name, int verbose_level)
void count_number_of_solutions_in_file_by_case(std::string &fname, int *&nb_solutions, int *&case_nb, int &nb_cases, int verbose_level)
void copy_file_to_ostream(std::ostream &ost, const char *fname)
void vector_matrix_write_csv(std::string &fname, std::vector< std::vector< int > > &V)
void lint_matrix_write_csv_override_headers(std::string &fname, std::string *headers, long int *M, int m, int n)
void poset_classification_read_candidates_of_orbit(std::string &fname, int orbit_at_level, long int *&candidates, int &nb_candidates, int verbose_level)
void write_set_to_file_as_int8(std::string &fname, long int *the_set, int set_size, int verbose_level)
void read_column_and_parse(std::string &fname, std::string &col_label, data_structures::set_of_sets *&SoS, int verbose_level)
void double_matrix_write_csv(std::string &fname, double *M, int m, int n)
void do_csv_file_split_rows_modulo(std::string &fname, int split_modulo, int verbose_level)
void parse_sets(int nb_cases, char **data, int f_casenumbers, int *&Set_sizes, long int **&Sets, char **&Ago_ascii, char **&Aut_ascii, int *&Casenumbers, int verbose_level)
void read_set_from_file_lint(std::string &fname, long int *&the_set, int &set_size, int verbose_level)
long int file_size(std::string &fname)
void free_data_fancy(int nb_cases, int *Set_sizes, long int **Sets, char **Ago_ascii, char **Aut_ascii, int *Casenumbers)
void read_dimacs_graph_format(std::string &fname, int &nb_V, std::vector< std::vector< int > > &Edges, int verbose_level)
void int_matrix_write_csv_with_labels(std::string &fname, int *M, int m, int n, const char **column_label)
void int_matrix_write_cas_friendly(std::string &fname, int *M, int m, int n)
void do_csv_file_latex(std::string &fname, int f_produce_latex_header, int nb_lines_per_table, int verbose_level)
void lint_matrix_read_csv(std::string &fname, long int *&M, int &m, int &n, int verbose_level)
void fread_uchars(FILE *fp, uchar *p, int len)
void write_exact_cover_problem_to_file(int *Inc, int nb_rows, int nb_cols, std::string &fname)
void do_csv_file_concatenate(std::vector< std::string > &fname, std::string &fname_out, int verbose_level)
void concatenate_files(const char *fname_in_mask, int N, const char *fname_out, const char *EOF_marker, int f_title_line, int &cnt_total, std::vector< int > missing_idx, int verbose_level)
void read_solution_file(std::string &fname, int *Inc, int nb_rows, int nb_cols, int *&Solutions, int &sol_length, int &nb_sol, int verbose_level)
void read_incidence_file(std::vector< std::vector< int > > &Geos, int &m, int &n, int &nb_flags, std::string &inc_file_name, int verbose_level)
void lint_matrix_write_text(std::string &fname, long int *M, int m, int n)
void write_decomposition_stack(char *fname, int m, int n, int *v, int *b, int *aij, int verbose_level)
void do_csv_file_join(std::vector< std::string > &csv_file_join_fname, std::vector< std::string > &csv_file_join_identifier, int verbose_level)
void write_incidence_matrix_to_file(std::string &fname, int *Inc, int m, int n, int verbose_level)
void parse_line(char *line, int &len, long int *&set, char *ago_ascii, char *aut_ascii)
int try_to_read_file(std::string &fname, int &nb_cases, char **&data, int verbose_level)
void read_ascii_set_of_sets_constant_size(std::string &fname_ascii, int *&Sets, int &nb_sets, int &set_size, int verbose_level)
void read_solutions_from_file(std::string &fname, int &nb_solutions, int *&Solutions, int solution_size, int verbose_level)
void do_csv_file_select_rows_and_cols(std::string &fname, std::string &rows_text, std::string &cols_text, int verbose_level)
void lint_vec_write_csv(long int *v, int len, std::string &fname, const char *label)
void int_matrix_read_text(std::string &fname, int *&M, int &m, int &n)
void read_and_parse_data_file(std::string &fname, int &nb_cases, char **&data, long int **&sets, int *&set_sizes, int verbose_level)
void read_candidates_for_one_orbit_from_file(std::string &prefix, int level, int orbit_at_level, int level_of_candidates_file, long int *S, void(*early_test_func_callback)(long int *S, int len, long int *candidates, int nb_candidates, long int *good_candidates, int &nb_good_candidates, void *data, int verbose_level), void *early_test_func_callback_data, long int *&candidates, int &nb_candidates, int verbose_level)
void fwrite_uchars(FILE *fp, uchar *p, int len)
void lint_matrix_write_csv_with_labels(std::string &fname, long int *M, int m, int n, const char **column_label)
void lint_vec_array_write_csv(int nb_vecs, long int **Vec, int len, std::string &fname, const char **column_label)
void save_cumulative_data(std::vector< std::vector< int > > &Cumulative_data, std::string &fname, int verbose_level)
void read_solutions_and_tally(std::string &fname, int sz, int verbose_level)
void delete_file(const char *fname)
int number_of_vertices_in_colored_graph(std::string &fname, int verbose_level)
void save_cumulative_ago(std::vector< long int > &Cumulative_Ago, std::string &fname, int verbose_level)
void count_number_of_solutions_in_file(std::string &fname, int &nb_solutions, int verbose_level)
void write_set_to_file_as_int4(std::string &fname, long int *the_set, int set_size, int verbose_level)
void double_matrix_read_csv(std::string &fname, double *&M, int &m, int &n, int verbose_level)
void read_numbers_from_file(std::string &fname, int *&the_set, int &set_size, int verbose_level)
void create_file(create_file_description *Descr, int verbose_level)
void write_characteristic_matrix(std::string &fname, long int *data, int nb_rows, int data_sz, int nb_cols, int verbose_level)
void do_csv_file_extract_column_to_txt(std::string &csv_fname, std::string &col_label, int verbose_level)
void create_files(create_file_description *Descr, int verbose_level)
void read_incidence_matrix_from_inc_file(int *&M, int &m, int &n, std::string &inc_file_name, int inc_file_idx, int verbose_level)
void read_solutions_from_file_size_is_known(std::string &fname, std::vector< std::vector< int > > &Solutions, int solution_size, int verbose_level)
void fwrite_int4(FILE *fp, int a)
void read_set_from_file(std::string &fname, long int *&the_set, int &set_size, int verbose_level)
void write_set_to_file(std::string &fname, long int *the_set, int set_size, int verbose_level)
int find_orbit_index_in_data_file(std::string &prefix, int level_of_candidates_file, long int *starter, int verbose_level)
void read_solutions_from_file_by_case(std::string &fname, int *nb_solutions, int *case_nb, int nb_cases, int **&Solutions, int solution_size, int verbose_level)
void fix_escape_characters(char *str)
void read_set_from_file_int8(std::string &fname, long int *&the_set, int &set_size, int verbose_level)
interface to create latex output files
void head(std::ostream &ost, int f_book, int f_title, const char *title, const char *author, int f_toc, int f_landscape, int f_12pt, int f_enlarged_page, int f_pagenumbers, const char *extras_for_preamble)
void foot(std::ostream &ost)
#define BUFSIZE_READ_SOLUTION_FILE
#define READ_INCIDENCE_BUFSIZE
#define Lint_vec_copy(A, B, C)
#define Int_vec_scan(A, B, C)
#define Int_vec_zero(A, B)
#define Int_vec_print_fully(A, B, C)
#define Lint_vec_scan(A, B, C)
#define Lint_vec_print(A, B, C)
#define Int_vec_print_integer_matrix_width(A, B, C, D, E, F)
#define Int_vec_print(A, B, C)
the orbiter library for the classification of combinatorial objects