Open mlesnick opened 4 years ago
With the current organization of the code (which certainly needs work), it is not easy to see how to implement this fix. Here are some notes on this, for later use:
-The ComputationInput class (defined in computation.h) stores the exact grades and y_grades.
-ComputationInput is built from an InputData struct (defined in data_reader.h); it largely stores the same information as InputData, and in fact does so redundantly. (There is a TODO in computation.h noting that ComputationInput and InputData should be merged into a single entity.)
-The printing of the presentation is done by computation.minpres_ready.connect(), defined in console.cpp, via a call to the Presentation::print_sparse(). (I think this is run, via some boost signaling magic, when minpres_ready() is called in Computation::compute_raw.)
To print the desired firep format for a presentation, a quick fix could be as follows: 1)modify the Presentation class to store the vectors of exact x- and y-grades, perhaps also introduce a constructor which stores that info upon initialization. 2)rewrite Presentation::print_sparse() to print in the correct format, taking advantage of the exact grade info. 3)Modify Computation::compute_min_pres_and_betti_nums (line 197) to construct the presentation with the exact x- and y-grade info. (Note that since this method takes the ComputationInput object as an argument, one has convenient access to the exact grade info here.)
I'm not sure how elegant this is. And it doesn't address closely related issues/todos, namely that morally, the FIRep and Bifiltration classes should perhaps also store exact grade info (see issue #99), and also that it would be helpful to have an option in RIVET to print fireps (in the correct format). If we want that, then it seems that in addition to modifying the classes in question, we will also have to do some work on the DataReader class, where a lot of the action happens with respect to building the bifiltrations and fireps.
Minimal presentations are special cases of FI-Reps. But the RIVET formats for the two are incompatible. This means in particular, that if you compute a minimal presentation via the -- minpres flag, you can't open it in RIVET to visualize it or print its Hilbert Function/ Betti numbers. (The 0th and 1st Betti numbers are already there for you, but not 2nd.)
Clearly, the minimal presentation should be printed out in FI-Rep input format. As the one who wrote the print function for the minimal presentations, I don't know why I didn't realize this earlier.