Improved result output
This commit is contained in:
24
main.cpp
24
main.cpp
@@ -86,6 +86,7 @@ void test_function() {
|
||||
assert((BoolSquareMatrix<uint16_t, 4>(0b0100011110111001).get_determinant() != 0));
|
||||
assert((BoolSquareMatrix<uint16_t, 4>(0b0000110100001101).get_determinant() == 0));
|
||||
assert((BoolSquareMatrix<uint16_t, 4>(0b0010101111110001).get_determinant() != 0));
|
||||
|
||||
cout << "self-test passed" << endl;
|
||||
}
|
||||
|
||||
@@ -125,11 +126,11 @@ vector<MyFunction> get_function_class(MyFunction f, const vector< MyMatrix >& tr
|
||||
}
|
||||
|
||||
set<MyFunction> 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<Storage, ARGS_COUNT>(
|
||||
[transformation, f](const BoolVector<Storage, ARGS_COUNT> vec) -> Storage {
|
||||
return f.at((transformation * vec).get_value());
|
||||
[transformation, cur_f](const BoolVector<Storage, ARGS_COUNT> 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<MyFunction> monomials) {
|
||||
ranks.clear();
|
||||
for (auto i = total_ranks - 1; i != 0; --i)
|
||||
ranks.push_back(vector<MyFunction>()); // empty set
|
||||
size_t total_unique_functions = 0;
|
||||
size_t total_functions = 0;
|
||||
map<MyFunction, size_t> 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<MyFunction> 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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user