Added print_lens

This commit is contained in:
2020-04-05 23:41:43 +03:00
parent 041ff29388
commit d1998d0fd2

View File

@@ -13,11 +13,11 @@
using namespace std;
typedef uint16_t Storage;
typedef uint32_t Storage;
const size_t ARGS_COUNT = 4;
const size_t FUNCTION_LEN = 1ll << ARGS_COUNT;
const size_t FUNCTIONS_COUNT = 1ll << FUNCTION_LEN;
const bool ONLY_CREATE_CLASSES = true;
const bool ONLY_CREATE_CLASSES = false;
typedef Function<Storage, FUNCTION_LEN> MyFunction;
typedef BoolSquareMatrix<Storage, ARGS_COUNT> MyMatrix;
@@ -104,6 +104,18 @@ Function<STORAGE, 1ll << ARGUMENTS_COUNT > get_function_from_callable(Callable I
return Function<STORAGE, values_count >(function_values);
}
template<class CONTAINER>
void print_lens(CONTAINER len_map) {
map<int, size_t> counter;
for (const auto el: len_map) {
if ( counter.find(el) == counter.end() )
counter[el] = 0;
++counter[el];
}
for (auto&& el: counter)
cout << "len " << el.first << " count " << el.second << endl;
}
vector< MyMatrix > get_good_matrices() {
vector< MyMatrix > res;
for (size_t cur_val = 1ll << (ARGS_COUNT * ARGS_COUNT); cur_val != 0; --cur_val) {
@@ -278,6 +290,7 @@ size_t recover_ranks(vector< vector<MyFunction> >& ranks, vector<int8_t>& used_m
buf /= 2;
}
}
ranks.back().shrink_to_fit();
}
}
@@ -378,6 +391,8 @@ void fill_ranks(vector<MyFunction> monomials) {
return;
}
print_lens(used_map);
auto possible_tranformations = get_good_matrices();
cout << "Total " << possible_tranformations.size() << " linear tranformations" << endl;