Skip to content

Commit 69256cd

Browse files
authored
Merge pull request #211 from coq-community/revert-210-revert-209-fix_examples
Revert "Revert "Re-implement PixMap writer in Elpi""
2 parents 4599f12 + 5d848c8 commit 69256cd

File tree

14 files changed

+207
-194
lines changed

14 files changed

+207
-194
lines changed

configure.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
cp -f Make.in Make
66

7-
DIRECTORIES="algebra complex coq_reals fta ftc liouville logic metrics model raster reals tactics transc order metric2 stdlib_omissions util classes ode"
7+
DIRECTORIES="algebra complex coq_reals fta ftc liouville logic metrics model raster reals tactics transc order metric2 stdlib_omissions util classes ode write_image"
88

99
find $DIRECTORIES -name "*.v" >>Make
1010

coq-corn.opam

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ install: [make "install"]
4848
depends: [
4949
"coq" {(>= "8.18" & < "8.20~") | (= "dev")}
5050
"coq-math-classes" {(>= "8.8.1") | (= "dev")}
51+
"coq-elpi" {(>= "1.18.0") | (= "dev")}
5152
"coq-bignums"
5253
]
5354

dump/INSTALL

Lines changed: 0 additions & 10 deletions
This file was deleted.

dump/Makefile

Lines changed: 0 additions & 14 deletions
This file was deleted.

dump/_CoqProject

Lines changed: 0 additions & 7 deletions
This file was deleted.

dump/src/dump_plugin.mlpack

Lines changed: 0 additions & 1 deletion
This file was deleted.

dump/src/dune

Lines changed: 0 additions & 6 deletions
This file was deleted.

dump/src/g_dump.mlg

Lines changed: 0 additions & 120 deletions
This file was deleted.

dump/theories/Loader.v

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/Circle.v

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
(* I define the image of a path, a [Compact] subset of the plane.*)
44
(* Finally, plot a hi-res Circle*)
55

6-
Require Import Plot RasterQ Qmetric.
6+
From CoRN Require Import Plot RasterQ Qmetric.
77
Require Import CoRN.reals.fast.Interval.
88
Require Import CoRN.metric2.MetricMorphisms.
99
Require Import CoRN.reals.faster.ARArith.
10-
Require Import ARplot.
10+
From CoRN Require Import ARplot.
1111
Require Import CoRN.reals.faster.ARcos
1212
CoRN.reals.faster.ARsin
1313
CoRN.reals.faster.ARexp
1414
CoRN.reals.faster.ARbigD
1515
CoRN.reals.faster.ARinterval.
1616
Require Import CoRN.reals.fast.CRtrans.
17-
Require Import CoRN.dump.theories.Loader.
17+
Require Import CoRN.write_image.WritePPM.
1818

1919
Local Open Scope uc_scope.
2020

@@ -47,21 +47,19 @@ Definition Cos_faster : sparse_raster _ _
4747

4848
End PlotCirclePath.
4949

50-
(* 6 seconds *)
51-
Time Definition Circle_bigD : sparse_raster _ _
52-
:= Eval vm_compute in
53-
@Circle_faster bigD _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ bigD_appRat.
50+
Definition Circle_bigD : sparse_raster _ _
51+
:= @Circle_faster bigD _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ bigD_appRat.
5452

55-
DumpGrayMap Circle_bigD.
56-
(* Now have a look at plot.pgm *)
53+
(* 3.7s on Apple M1 - this is mostly the creation of the sparse raster *)
54+
Time Elpi WritePPM "Circle.ppm" ( Circle_bigD ).
55+
(* Now have a look at Circle.ppm *)
5756

58-
Time Definition Cos_bigD : sparse_raster _ _
59-
:= Eval vm_compute in
60-
@Cos_faster bigD _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ bigD_appRat.
61-
62-
DumpGrayMap Cos_bigD.
63-
(* Now have a look at plot.pgm *)
57+
Definition Cos_bigD : sparse_raster _ _
58+
:= @Cos_faster bigD _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ bigD_appRat.
6459

60+
(* 3.1s on Apple M1 *)
61+
Time Elpi WritePPM "Cos.ppm" ( Cos_bigD ).
62+
(* Now have a look at Cos.ppm *)
6563

6664
Definition CircleFunction_aux
6765
: ProductMS Q_as_MetricSpace Q_as_MetricSpace --> ProductMS CR CR
@@ -70,20 +68,18 @@ Definition CircleFunction_aux
7068
Definition CirclePath : Q_as_MetricSpace --> Complete Q2:=
7169
(uc_compose (uc_compose Couple CircleFunction_aux) (diag Q_as_MetricSpace)).
7270
(* The following hangs:
71+
TODO this does not even compile
7372
Definition CirclePath': UCFunction Q R2:=
74-
ucFunction (fun q:Q => Couple (cos_uc q, sin_uc q)).*)
73+
ucFunction (fun q:Q => Couple (cos_uc q, sin_uc q)). *)
7574

7675

77-
(* 20 seconds *)
78-
(* The raster must be evaluated before being plotted by DumpGrayMap,
79-
here with vm_compute. *)
80-
Time Definition Circle : sparse_raster _ _
81-
:= Eval vm_compute in
82-
(let (_,r) := Plot.PlotPath 0 7 (-(1)) 1 (reflexivity _)
76+
Definition Circle : sparse_raster _ _
77+
:= (let (_,r) := Plot.PlotPath 0 7 (-(1)) 1 (reflexivity _)
8378
(-(1)) 1 (reflexivity _) 200 CirclePath
8479
in r).
8580

86-
DumpGrayMap Circle.
87-
(* Now have a look at plot.pgm *)
81+
(* 16.3 seconds on Apple M1 *)
82+
Time Elpi WritePPM "Circle2.ppm" ( Circle ).
83+
(* Now have a look at Circle2.ppm *)
8884

8985

0 commit comments

Comments
 (0)