From 0d284b7bfc1d773186a8506e61fdff8a5dd1a8c6 Mon Sep 17 00:00:00 2001 From: Aleksey Lobanov Date: Mon, 24 Feb 2020 22:53:34 +0300 Subject: [PATCH] Improved result output --- main.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/main.cpp b/main.cpp index b2eb0a4..216c3ed 100644 --- a/main.cpp +++ b/main.cpp @@ -86,6 +86,7 @@ void test_function() { assert((BoolSquareMatrix(0b0100011110111001).get_determinant() != 0)); assert((BoolSquareMatrix(0b0000110100001101).get_determinant() == 0)); assert((BoolSquareMatrix(0b0010101111110001).get_determinant() != 0)); + cout << "self-test passed" << endl; } @@ -125,11 +126,11 @@ vector get_function_class(MyFunction f, const vector< MyMatrix >& tr } set transformed_res(cur_res.begin(), cur_res.end()); - for (auto f: cur_res) { + for (auto cur_f: cur_res) { for (auto transformation: tranformations) { MyFunction linear_transformed = get_function_from_callable( - [transformation, f](const BoolVector vec) -> Storage { - return f.at((transformation * vec).get_value()); + [transformation, cur_f](const BoolVector vec) -> Storage { + return cur_f.at((transformation * vec).get_value()); } ); bool is_inserted = transformed_res.insert(linear_transformed).second; @@ -284,27 +285,38 @@ void fill_ranks(vector monomials) { ranks.clear(); for (auto i = total_ranks - 1; i != 0; --i) ranks.push_back(vector()); // empty set + size_t total_unique_functions = 0; size_t total_functions = 0; + map class_sizes; for (size_t fn_value = 0; fn_value < used_map.size(); ++fn_value) { auto cur_rank = used_map[fn_value]; if ( not cur_rank ) continue; - ++total_functions; + ++total_unique_functions; MyFunction current_fn(fn_value); vector function_class = get_function_class( current_fn, possible_tranformations, f_out ); f_out << "size of function class " << current_fn.string() << " is " << function_class.size() << endl; + class_sizes[current_fn] = function_class.size(); for (auto marked_function: function_class) { + if ( used_map[marked_function.value()] == 0 ) + f_out << "already 0 at " << marked_function.string() << " " << function_formulas[marked_function.value()] + << " from class " << current_fn.string() << " " << function_formulas[current_fn.value()] << endl; used_map[marked_function.value()] = 0; + ++total_functions; } ranks.at(cur_rank - 1).push_back(current_fn); } - cout << "total unique functions: " << total_functions << endl; + if ( total_functions != FUNCTIONS_COUNT) + cout << "total counted functions: " << total_functions + << " but must be " << FUNCTIONS_COUNT << endl; + cout << "total function classes: " << total_unique_functions << endl; for (size_t rank_ind = 0; rank_ind < ranks.size(); ++rank_ind) { f_out << "rank index = " << rank_ind + 1 << endl; for (auto f: ranks.at(rank_ind)) - f_out << f.string() << endl; + f_out << f.string() << " size: " << class_sizes[f] << " " + << function_formulas[f.value()] << endl; } f_out.close(); }