From 20771ddae466227ad5c4f8fc09d9024f5bcef969 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 20 May 2021 22:59:24 +0200 Subject: [PATCH] fieldpattern:: an option to use 'quotient group' fieldpatterns in 3D for more efficient representation --- fieldpattern.cpp | 78 ++++++++++++++++++++++++++++++++++++++++++++++-- reg3.cpp | 2 +- 2 files changed, 76 insertions(+), 4 deletions(-) diff --git a/fieldpattern.cpp b/fieldpattern.cpp index 569a971d..5bd4079b 100644 --- a/fieldpattern.cpp +++ b/fieldpattern.cpp @@ -11,6 +11,8 @@ namespace hr { EX namespace fieldpattern { +EX bool use_quotient_fp = false; + int limitsq = 10; int limitp = 10000; int limitv = 100000; @@ -311,6 +313,8 @@ struct fpattern { unsigned compute_hash(); void set_field(int p, int sq); + + unsigned hashv; #if MAXMDIM >= 4 // general 4D @@ -328,6 +332,7 @@ struct fpattern { #endif vector find_triplets(); + void generate_quotientgroup(); }; #if CAP_THREAD && MAXMDIM >= 4 @@ -505,11 +510,78 @@ bool fpattern::generate_all3() { for(int j=0; j= limitv) { println(hlog, "limitv exceeded"); return false; } } - unsigned hashv = compute_hash(); + hashv = compute_hash(); DEBB(DF_FIELD, ("all = ", isize(matrices), "/", local_group, " = ", isize(matrices) / local_group, " hash = ", hashv, " count = ", ++hash_found[hashv])); + + if(use_quotient_fp) + generate_quotientgroup(); return true; } +void fpattern::generate_quotientgroup() { + int MS = isize(matrices); + int best_p = 0, best_i = 0; + for(int i=0; i= local_group) + j = gmul(j, i), p++; + if(j == 0 && p > best_p) { + bool okay = true; + + vector visited(MS, false); + for(int ii=0; ii 1) { + vector new_id(MS, -1); + vector orig_id(MS, -1); + vector new_matrices; + int nv = 0; + for(int i=0; i= 4 if(dis) { dis->discovered(); continue; } #endif - if(force_hash && compute_hash() != force_hash) continue; + if(force_hash && hashv != force_hash) continue; cmb++; goto ok; bad: ; @@ -1415,7 +1487,7 @@ void discovery::activate() { void discovery::discovered() { std::unique_lock lk(lock); auto& e = experiment; - hashes_found[e.compute_hash()] = make_tuple(e.Prime, e.wsquare, e.R, e.P, e.X, isize(e.matrices) / e.local_group); + hashes_found[e.hashv] = make_tuple(e.Prime, e.wsquare, e.R, e.P, e.X, isize(e.matrices) / e.local_group); } void discovery::suspend() { is_suspended = true; } diff --git a/reg3.cpp b/reg3.cpp index d097309d..764860e5 100644 --- a/reg3.cpp +++ b/reg3.cpp @@ -386,7 +386,7 @@ EX namespace reg3 { tmatrices[a].resize(S7); for(int b=0; bgmul(f->gmul(k, moveid[b]), lgr); + k = f->matcode[ f->mmul(f->mmul(f->matrices[k], f->matrices[moveid[b]]), f->P) ]; for(int l=0; lgmul(k, l) % lgr == 0) { tmatrices[a][b] = cgi.adjmoves[b] * f->fullv[l]; allh[a]->c.connect(b, allh[k/lgr], movedir[l], false);