From 50087e032add663c360ee0e84797f7ab114739f5 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 23 Aug 2022 21:36:28 +0200 Subject: [PATCH] faster virtualRebase in Solv --- geometry2.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/geometry2.cpp b/geometry2.cpp index 4f5cf930..66677280 100644 --- a/geometry2.cpp +++ b/geometry2.cpp @@ -331,6 +331,43 @@ void virtualRebase(cell*& base, T& at, const U& check) { return; } + if(geometry == gSol) { + /** the general algorithm sometimes makes much more iterations than needed... try to approximate the geodesic */ + hyperpoint h = check(at); + auto step = [&] (int i) { + at = currentmap->adj(base, i) * at; + base = base->cmove(i); + h = check(at); + }; + + auto nw = vid.binary_width * log(2); + while(abs(h[0]) > 2) step(2); + while(h[0] < -0.5 * nw) step(0); + while(h[0] > +0.5 * nw) step(4); + while(abs(h[1]) > 2) { + step(6); + while(h[0] < -0.5 * nw) step(0); + while(h[0] > +0.5 * nw) step(4); + } + while(h[1] < -0.5 * nw) step(1); + while(h[1] > +0.5 * nw) step(5); + while(h[2] > 1) { + step(6); + while(h[0] < -0.5 * nw) step(0); + while(h[0] > +0.5 * nw) step(4); + while(h[1] < -0.5 * nw) step(1); + while(h[1] > +0.5 * nw) step(5); + } + while(h[2] < -1) { + step(2); + while(h[0] < -0.5 * nw) step(0); + while(h[0] > +0.5 * nw) step(4); + while(h[1] < -0.5 * nw) step(1); + while(h[1] > +0.5 * nw) step(5); + } + } + /* todo variants of sol */ + if(prod) { auto d = product_decompose(check(at)).first; while(d > cgi.plevel / 2) {