faster virtualRebase in Solv

This commit is contained in:
Zeno Rogue 2022-08-23 21:36:28 +02:00
parent 0f0d0ff7a9
commit 50087e032a
1 changed files with 37 additions and 0 deletions

View File

@ -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) {