mirror of
https://github.com/allemangD/toddcox-visualize.git
synced 2025-11-10 12:02:47 -05:00
add bound to support for infinite groups and free relations
special values tc::UNBOUND and tc::FREE used for this.
This commit is contained in:
@@ -10,19 +10,26 @@
|
||||
|
||||
#define NAMED(x) #x, x
|
||||
|
||||
void bench(std::string group_expr, tc::Group group, const std::vector<tc::Gen> &gens) {
|
||||
void bench(
|
||||
std::string group_expr,
|
||||
const tc::Group &group,
|
||||
const std::vector<tc::Gen> &gens,
|
||||
const tc::Coset bound = tc::UNBOUNDED
|
||||
) {
|
||||
std::clock_t s = std::clock();
|
||||
tc::Cosets cosets = tc::solve(group, gens);
|
||||
tc::Cosets cosets = tc::solve(group, gens, bound);
|
||||
std::clock_t e = std::clock();
|
||||
|
||||
double time = (double) (e - s) / CLOCKS_PER_SEC;
|
||||
auto time = (double) (e - s) / CLOCKS_PER_SEC;
|
||||
tc::Coset order = cosets.size();
|
||||
size_t cos_s = (size_t) (order / time);
|
||||
auto cos_s = (size_t) (order / time);
|
||||
|
||||
bool complete = cosets.complete;
|
||||
|
||||
std::string name = fmt::format("{}/{}", group_expr, gens);
|
||||
std::string row = fmt::format(
|
||||
"{:>24},{:>10},{:>8.3f}s,{:>10L}",
|
||||
name, order, time, cos_s
|
||||
"{:>24},{:>10},{:>6},{:>8.3f}s,{:>10L}",
|
||||
name, order, complete, time, cos_s
|
||||
);
|
||||
fmt::print("{}\n", row);
|
||||
}
|
||||
@@ -40,6 +47,11 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
fmt::print("{:>24},{:>10},{:>9},{:>10}\n", "NAME", "ORDER", "TIME", "COS/S");
|
||||
|
||||
auto g = tc::group::A(4);
|
||||
g.set(tc::Rel{0, 3, 3});
|
||||
bench("~A(3)", g, {}, 4385964);
|
||||
bench("~I(1)", sch(tc::FREE), {}, 4385964);
|
||||
|
||||
bench(NAMED(H(2)), {});
|
||||
bench(NAMED(H(3)), {});
|
||||
bench(NAMED(H(4)), {});
|
||||
|
||||
Reference in New Issue
Block a user