Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-implement PixMap writer in Elpi #209

Merged
merged 3 commits into from
Nov 13, 2024

Conversation

MSoegtropIMC
Copy link
Contributor

This PR re-implements the pixmap writer in Elpi, which has the advantage that no plugin needs to be maintained. It is also a bit more comfortable than the original plugin:

  • it allows to give a file name for the .ppm file
  • it does the required vm_compute, so that this need not (but can) be done upfront
  • the resulting file is a PPM rather than a PGM file, which has only half the size (no spaces between numbers).

The conversion from a sparse raster to a 2D list of bools is done as Coq program. Tests showed that the complete conversion in one step is more efficient than e.g. a line by line conversion. Elpi is only used to write the PPM file and to define a top level vernacular command.

A conversion of the sparse raster as an Elpi program is also possible but likely not more efficient. If the vm_compute for doing the plot is done in a separate step, the conversion to a full raster and output as file takes only a few 10 ms for a 200x200 grid.

This also fixes some requires in examples/bigD.v

@SkySkimmer
Copy link
Contributor

Don't forget to open a PR fixing the deps in Coq CI before this gets merged

@spitters spitters merged commit 60902f8 into coq-community:master Nov 13, 2024
3 checks passed
@spitters
Copy link
Collaborator

LGTM! Sorry, I was too quick merging.
Please address the @SkySkimmer 's suggestion above.

@MSoegtropIMC
Copy link
Contributor Author

Yes, I already did the change in a branch - I just had an odd problem with my commit email I need to clarify.

@MSoegtropIMC
Copy link
Contributor Author

@SkySkimmer : I didn't do this in a longer while. I guess I need not create an overlay and just add the additional dependency in the yaml file. As far as I understand overlays are for the reverse situation where a change in Coq breaks packages in CI.

@SkySkimmer
Copy link
Contributor

yes

@SkySkimmer
Copy link
Contributor

also need to update Makefile.ci

@spitters
Copy link
Collaborator

also need to update Makefile.ci

@SkySkimmer I guess we are still waiting for this.
After that what's the best way to merge this PR? I don't immediately see a button for it on github.
(Also, feel free to just do it, if you know what to do...)

@MSoegtropIMC
Copy link
Contributor Author

@spitters : as I wrote in the "Undo PR" this is solved in Coq CI. The Coq PR is coq/coq#19830 (merged).

@MSoegtropIMC
Copy link
Contributor Author

To re-merge this, you need to undo the PR which reverted this PR. That is you need to revert #210. You should have a button for this at the bottom of the PR if you are admin.

@spitters
Copy link
Collaborator

I've reverted the revert. What should I do next? Or can you restart the PR?

@MSoegtropIMC
Copy link
Contributor Author

@spitters : to me it looks fine as is - nothing else to be done.

You have the "write_image" folder in root and example/Circle.v has commands like

Elpi WritePPM "Circle.ppm" ( Circle_bigD ).

@SkySkimmer
Copy link
Contributor

@MSoegtropIMC
Copy link
Contributor Author

@SkySkimmer : sure, will do right away,

@MSoegtropIMC
Copy link
Contributor Author

See coq/opam#3247

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants