Postby pvater » 31 Oct 2023, 13:37
i had an idea to simplify the above approach:
instead of naively constructing a cell-complex representation for a connected component C, i think it should be possible to save the combinatorics of C in an object like the real phase structure R of the patchworked hypersurface H, but restricted to C (i.e., it tells you for each facet of H in which orthant it has a copy - IF it lies in C).
Call it R_C.
with that we can just create a new `PATCHWORK` subobject on our hypersurface, initializing its real phase structure with R_C - `...->PATCHWORK(SIGNS=>[original signs], REAL_PHASE=>R_C)` (this is of course not an actual patchworked hypersurface, but we can pretend; the signs are unfortunately necessary for technical reasons).
and for this polymake can calculate the `...->BETTI_NUMBERS_Z2`. (*)
this means we don't need to manually worry about the combinatorics of how copies of facets are glued together between different orthants, because the implementation already takes care of that internally.
we just need to figure out WHEN they are glued together, in order to build R_C.
and now that i've thought about it again, the criterion is relatively simple:
recall that we encode orthants via the binary representation of unsigned integers, e.g. (+,-,+) -> 101 -> 5.
take a copy (f,o) of a facet f of H.
consider the set D of the directions of the vertices at infinity of f as 0-1-vectors.
for each subset {d1,...,dk} of D, (f,o) is glued to (f,o') where o' = o XOR d1 XOR ... XOR dk.
(for the purposes of this algorithm it's enough to glue (f,o) to (f,(o XOR d)) for each d in D, and then just iterate the gluing step)
again, something like this should probably be a user-function, but maybe it's good enough for now.
the thing that's missing in this approach is the identification of a non-orientable component, which, unfortunately, i don't know how to do here.
also, (*) should be tested, since i'm only like 80% sure that it works, and i can't check right now.