summate.c: handle equalities for all summation algorithms
[barvinok.git] / Makefile.am
blob6804f7a9c9ba234d95597a65e7335de0c64c2b27
1 if HAVE_GINAC
2     MAYBE_BERNSTEIN = bernstein
3 endif
4 if BUNDLED_POLYLIB
5     MAYBE_POLYLIB = polylib
6 endif
7 if BUNDLED_PIPLIB
8     MAYBE_PIPLIB = piplib
9 endif
10 if USE_ZSOLVE
11     MAYBE_ZSOLVE = zsolve
12 endif
13 if USE_PARKER
14     MAYBE_PARKER = parker
15 endif
16 SUBDIRS = $(MAYBE_PIPLIB) $(MAYBE_POLYLIB) $(MAYBE_BERNSTEIN) \
17                 lib $(MAYBE_ZSOLVE) $(MAYBE_PARKER) . omega doc
19 FORCE:
20 lib/libgnu.la: FORCE
21         $(MAKE) $(AM_MAKEFLAGS) -C lib libgnu.la
22 bernstein/libbernstein.la: FORCE
23         $(MAKE) $(AM_MAKEFLAGS) -C bernstein libbernstein.la
24 polylib/libpolylibgmp.la: FORCE
25         $(MAKE) $(AM_MAKEFLAGS) -C polylib libpolylibgmp.la
26 piplib/libpiplibMP.la: FORCE
27         $(MAKE) $(AM_MAKEFLAGS) -C piplib libpiplibMP.la
28 zsolve/libzsolve.la: FORCE
29         $(MAKE) $(AM_MAKEFLAGS) -C zsolve libzsolve.la
30 parker/libparker.la: FORCE
31         $(MAKE) $(AM_MAKEFLAGS) -C parker libparker.la
33 AM_CPPFLAGS = -I$(srcdir)/bernstein/include -I$(srcdir)/lib \
34               @POLYLIB_CPPFLAGS@ @PIPLIB_CPPFLAGS@ @ginac_CFLAGS@
35 AM_LDFLAGS = -Llib @POLYLIB_LDFLAGS@ @PIPLIB_LDFLAGS@
37 lib_LTLIBRARIES = libbarvinok-core.la libbarvinok.la
38 bin_PROGRAMS = barvinok_count barvinok_enumerate barvinok_enumerate_e \
39                   barvinok_ehrhart polytope_scan
40 noinst_PROGRAMS = test testlib randomtest \
41                   remove_redundant_equalities \
42                   barvinok_union polytope_volume test_approx \
43                   barvinok_summate verify_lexsmaller piptest \
44                   polyhedron_sample 4coins lexmin @bv_barvinok_bound@ \
45                   @bv_cone_hilbert_basis@ cone_integer_hull \
46                   polytope_lattice_width polytope_minimize \
47                   polyhedron_integer_hull
48 EXTRA_PROGRAMS = barvinok_bound test_bound cone_hilbert_basis
49 pkginclude_HEADERS = \
50     barvinok/NTL_QQ.h \
51     barvinok/barvinok.h \
52     barvinok/util.h \
53     barvinok/evalue.h \
54     barvinok/genfun.h \
55     barvinok/options.h \
56     barvinok/polylib.h \
57     barvinok/sample.h \
58     barvinok/basis_reduction.h \
59     barvinok/bernstein.h
60 nodist_pkginclude_HEADERS = \
61     barvinok/NTL.h \
62     barvinok/set.h
63 LINK = $(CXXLINK)
65 if HAVE_CDDLIB
66     BR_CDD = basis_reduction_cdd.cc initcdd.cc
67     POLYSIGN_CDD = polysign_cddf.cc polysign_cdd.cc
68 endif
69 if HAVE_GLPK
70     BR_GLPK = basis_reduction_glpk.c
71     POLYSIGN_GLPK = polysign_glpk.c
72 endif
73 if HAVE_TOPCOM
74     TOPCOM = topcom.c topcom.h
75 endif
76 if USE_ZSOLVE
77     HILBERT_C = hilbert.c
78 endif
79 libbarvinok_core_la_SOURCES = \
80     barvinok/evalue.h \
81     barvinok/genfun.h \
82     barvinok/util.h \
83     barvinok/barvinok.h \
84     NTL_QQ.cc \
85     basis_reduction.c \
86     basis_reduction_pip.c \
87     basis_reduction_pip_dual.c \
88     evalue.c \
89     genfun.cc \
90     util.c \
91     version.c \
92     bernoulli.c \
93     bernoulli.h \
94     bfcounter.cc \
95     bfcounter.h \
96     binomial.c \
97     binomial.h \
98     conversion.cc \
99     conversion.h \
100     counter.cc \
101     counter.h \
102     decomposer.cc \
103     decomposer.h \
104     dpoly.cc \
105     dpoly.h \
106     euler.cc \
107     euler.h \
108     genfun_constructor.cc \
109     genfun_constructor.h \
110     $(HILBERT_C) \
111     hilbert.h \
112     hull.c \
113     hull.h \
114     ilp.c \
115     ilp.h \
116     lattice_point.cc \
117     lattice_point.h \
118     lattice_width.c \
119     lattice_width.h \
120     laurent.cc \
121     laurent.h \
122     normalization.c \
123     normalization.h \
124     options.c \
125     param_util.c \
126     param_util.h \
127     piputil.h \
128     piputil.c \
129     $(POLYSIGN_CDD) \
130     $(POLYSIGN_GLPK) \
131     polysign.c \
132     polysign_pip.c \
133     polysign_polylib.c \
134     polysign.h \
135     power.h \
136     reduce_domain.c \
137     reduce_domain.h \
138     reducer.cc \
139     reducer.h \
140     remove_equalities.h \
141     remove_equalities.c \
142     sample.c \
143     scale.c \
144     scale.h \
145     scarf.cc \
146     series.cc \
147     $(TOPCOM) \
148     summate.c \
149     summate.h \
150     volume.c \
151     volume.h \
152     mat_util.cc \
153     mat_util.h \
154     matrix_read.cc \
155     matrix_read.h \
156     barvinok.cc \
157     barvinok_e.cc \
158     $(BR_CDD) \
159     $(BR_GLPK)
160 EXTRA_libbarvinok_la_SOURCES = \
161     basis_reduction_cdd.cc \
162     basis_reduction_glpk.c \
163     range.cc \
164     range.h \
165     bernstein.cc \
166     hilbert.c \
167     polysign_cddf.cc \
168     polysign_cdd.cc \
169     polysign.c \
170     initcdd.cc \
171     initcdd.h \
172     topcom.c \
173     topcom.h
174 if BUNDLED_POLYLIB
175     POLYLIB_LA = $(top_builddir)/polylib/libpolylibgmp.la
176 endif
177 if BUNDLED_PIPLIB
178     PIPLIB_LA = $(top_builddir)/piplib/libpiplibMP.la
179 endif
180 if USE_ZSOLVE
181     ZSOLVE_LA = zsolve/libzsolve.la
182 endif
183 libbarvinok_core_la_LIBADD = @LTLIBOBJS@ $(POLYLIB_LA) @POLYLIB_LIBS@ \
184                              $(PIPLIB_LA) @PIPLIB_LIBS@ \
185                              $(ZSOLVE_LA) lib/libgnu.la
186 libbarvinok_core_la_LDFLAGS = @BV_LDFLAGS@ -version-info @versioninfo@
187 if HAVE_GINAC
188     BERNSTEIN_CC = bernstein.cc range.cc
189 endif
190 libbarvinok_la_SOURCES = \
191     $(BERNSTEIN_CC)
192 if HAVE_GINAC
193     BERNSTEIN_LA = $(top_builddir)/bernstein/libbernstein.la
194 endif
195 libbarvinok_la_LIBADD = libbarvinok-core.la $(BERNSTEIN_LA)
196 libbarvinok_la_LDFLAGS = @BV_LDFLAGS@ -version-info @versioninfo@
197 LDADD = libbarvinok-core.la @POLYLIB_LIBS@ @PIPLIB_LIBS@
199 test_SOURCES = \
200         evalue_read.c \
201         evalue_read.h \
202         test.c
203 testlib_SOURCES = \
204         evalue_read.c \
205         evalue_read.h \
206         testlib.cc
207 barvinok_count_SOURCES = barvinok_count.c
208 barvinok_ehrhart_SOURCES = barvinok_ehrhart.cc
209 barvinok_union_SOURCES = barvinok_union.cc
210 if HAVE_OMEGA
211 BEEO_SOURCES = omega/Exit.cc omega/convert.cc omega/count.cc
212 else
213 BEEO_SOURCES = 
214 endif
215 if USE_FDSTREAM
216 FDSTREAM = fdstream.cc fdstream.h
217 endif
218 barvinok_enumerate_SOURCES = \
219         barvinok_enumerate.cc \
220         evalue_convert.cc \
221         evalue_convert.h \
222         $(FDSTREAM) \
223         skewed_genfun.cc \
224         skewed_genfun.h \
225         verify.h \
226         verify.c \
227         verif_ehrhart.h \
228         verif_ehrhart.c \
229         verify_series.h \
230         verify_series.cc
231 EXTRA_barvinok_enumerate_SOURCES = fdstream.cc fdstream.h
232 barvinok_enumerate_e_SOURCES = \
233         barvinok_enumerate_e.cc \
234         evalue_convert.cc \
235         evalue_convert.h \
236         $(FDSTREAM) \
237         skewed_genfun.cc \
238         skewed_genfun.h \
239         verify.h \
240         verify.c \
241         verif_ehrhart.h \
242         verif_ehrhart.c \
243         verify_series.h \
244         verify_series.cc \
245         $(BEEO_SOURCES)
246 EXTRA_barvinok_enumerate_e_SOURCES = fdstream.cc fdstream.h
247 if USE_PARKER
248     MONA_LIBS = -ldfa -lbdd -lmem
249     PARKER_LA = parker/libparker.la
250     PARKERLDFLAGS = -L$(MONAPATH)/DFA -L$(MONAPATH)/BDD -L$(MONAPATH)/Mem
251     PARKERCPPFLAGS = -I$(MONAPATH)/Mem -I$(MONAPATH)/DFA -I$(MONAPATH)/BDD
252 endif
253 barvinok_enumerate_e_CPPFLAGS = \
254         $(PARKERCPPFLAGS) @OMEGA_CPPFLAGS@ $(AM_CPPFLAGS)
255 barvinok_enumerate_e_LDFLAGS = $(PARKERLDFLAGS) @OMEGA_LDFLAGS@ @LDFLAGS@
256 barvinok_enumerate_e_LDADD = \
257         $(PARKER_LA) $(MONA_LIBS) @OMEGA_LIBS@ libbarvinok-core.la \
258         @POLYLIB_LIBS@ @PIPLIB_LIBS@
259 barvinok_bound_SOURCES = \
260         evalue_convert.cc \
261         evalue_convert.h \
262         evalue_read.c \
263         evalue_read.h \
264         $(FDSTREAM) \
265         bound.cc \
266         verify.h \
267         verify.c
268 EXTRA_barvinok_bound_SOURCES = fdstream.cc fdstream.h
269 barvinok_bound_LDADD = \
270         libbarvinok-core.la libbarvinok.la @POLYLIB_LIBS@ @PIPLIB_LIBS@
271 barvinok_summate_SOURCES = \
272         barvinok_summate.cc \
273         evalue_convert.cc \
274         evalue_convert.h \
275         evalue_read.c \
276         evalue_read.h \
277         $(FDSTREAM) \
278         verify.h \
279         verify.c
280 EXTRA_barvinok_summate_SOURCES = fdstream.cc fdstream.h
281 4coins_SOURCES = 4coins.cc
282 lexmin_SOURCES = \
283         lexmin.h \
284         lexmin.cc \
285         combine.c \
286         combine.h \
287         edomain.cc \
288         edomain.h \
289         evalue_util.cc \
290         evalue_util.h \
291         verify.h \
292         verify.c
293 test_approx_SOURCES = \
294         test_approx.c \
295         verify.h \
296         verify.c
297 test_bound_SOURCES = \
298         test_bound.cc \
299         evalue_convert.cc \
300         evalue_convert.h \
301         evalue_read.c \
302         evalue_read.h \
303         $(FDSTREAM) \
304         verify.h \
305         verify.c
306 EXTRA_test_bound_SOURCES = fdstream.cc fdstream.h
307 test_bound_LDADD = \
308         libbarvinok-core.la libbarvinok.la @POLYLIB_LIBS@ @PIPLIB_LIBS@
310 TESTFILES = $(shell find $(top_srcdir)/tests -type f ! -path '*CVS*')
312 EXTRA_DIST = \
313     ChangeLog \
314     $(TESTFILES) \
315     latte2polylib.pl \
316     NTL_5_3_2.patch \
317     basis_reduction_templ.c \
318     cdd94e-test \
319     polysign_cdd_template.cc \
320     barvinok/NTL.h.broken \
321     barvinok/NTL.h.normal \
322     barvinok/set.h.broken \
323     barvinok/set.h.normal \
324     doc/Internal.tex \
325     doc/applications.tex \
326     doc/barvinok.tex \
327     doc/omega.tex \
328     doc/polymake.tex \
329     doc/reports.tex \
330     doc/barvinok.bib \
331     doc/barvinok.gdf \
332     doc/chicago.bst \
333     doc/chicago.sty \
334     doc/mydefs.sty \
335     polymake/Makefile.in \
336     polymake/README \
337     polymake/autogen.sh \
338     polymake/configure.in \
339     polymake/convert.cc \
340     polymake/convert.h \
341     polymake/h_star_vector.cc \
342     polymake/lattice_points.cc
344 ACLOCAL_AMFLAGS = -I m4
346 install-data-local:
347         @test -z "$(pkgconfig_libdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfig_libdir)"
348         $(INSTALL_DATA) $(pkgconfig_libfile) "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
350 uninstall-local:
351         rm -f "$(DESTDIR)$(pkgconfig_libdir)/$(pkgconfig_libfile)"
353 dist-hook:
354         (cd $(distdir)/polymake; \
355             ./autogen.sh; rm -rf autogen.sh autom4te.cache)
356         (cd doc; make barvinok.pdf)
357         cp doc/barvinok.pdf $(distdir)/doc/
358         if test -f $(top_srcdir)/.git/HEAD; then \
359             echo @GIT_HEAD_VERSION@ > $(distdir)/GIT_HEAD_ID; \
360         else \
361             echo $(GIT_HEAD_ID) > $(distdir)/GIT_HEAD_ID; \
362         fi
364 dist-git: dist
365         mv $(distdir).tar.gz @GIT_HEAD_VERSION@.tar.gz
367 BEE_TESTDIRS = ehrhart_e ehrhart_e/scarf ehrhart_e/piplib
369 check: check-testlib check-enumerate check-enumerate_e check-test \
370         check-lexmin check-approx check-evalue check-euler check-lw
371 check-testlib: testlib$(EXEEXT)
372         ./testlib$(EXEEXT)
373 check-approx: test_approx$(EXEEXT)
374         @for i in $(top_srcdir)/tests/ehrhart/*; do \
375             if test -f $$i; then \
376                 echo $$i | ./test_approx$(EXEEXT) -q -r 10 || exit; \
377             fi \
378         done
379 check-evalue: @bv_barvinok_bound@ barvinok_summate$(EXEEXT)
380         @for i in $(top_srcdir)/tests/evalue/*; do \
381             if test -f $$i; then \
382                 echo $$i; \
383                 if test -n "@bv_barvinok_bound@"; then \
384                     ./barvinok_bound$(EXEEXT) -T < $$i || exit; \
385                     echo $$i | ./test_bound$(EXEEXT) -q || exit; \
386                 fi; \
387                 ./barvinok_summate$(EXEEXT) -T < $$i || exit; \
388             fi \
389         done
390 check-euler: barvinok_summate$(EXEEXT)
391         @for i in $(top_srcdir)/tests/euler/*; do \
392             if test -f $$i; then \
393                 echo $$i; \
394                 ./barvinok_summate$(EXEEXT) -T --summation=euler < $$i || exit; \
395             fi \
396         done
397 if HAVE_TOPCOM
398     TOPCOM_CD = '--chamber-decomposition=topcom'
399 endif
400 check-enumerate: barvinok_enumerate$(EXEEXT)
401         @for i in $(top_srcdir)/tests/ehrhart/*; do \
402             if test -f $$i; then \
403                 echo $$i; \
404                 for options in '' '--series' '--series --primal' $(TOPCOM_CD); do \
405                     for spec in 'random' 'bf' 'df'; do \
406                         opt="--specialization=$$spec $$options"; \
407                         echo "        $$opt"; \
408                         ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \
409                     done \
410                 done; \
411                 opt="--summation=bernoulli"; \
412                 echo "        $$opt"; \
413                 ./barvinok_enumerate$(EXEEXT) --verify $$opt < $$i || exit; \
414             fi \
415         done
416 check-enumerate_e: barvinok_enumerate_e$(EXEEXT)
417         @for dir in $(BEE_TESTDIRS); do \
418             for i in $(top_srcdir)/tests/$$dir/*; do \
419                 if test -f $$i; then \
420                     for options in '' '--pip' '--pip --omega'; do \
421                         for spec in 'random' 'bf' 'df'; do \
422                             opt="--specialization=$$spec $$options"; \
423                             echo $$i $$opt; \
424                             ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \
425                         done \
426                     done \
427                 fi \
428             done \
429         done
430         @for i in $(top_srcdir)/tests/ehrhart_e/scarf/*; do \
431             if test -f $$i; then \
432                 for spec in 'random' 'bf' 'df'; do \
433                     opt="--specialization=$$spec --scarf"; \
434                     echo $$i $$opt; \
435                     ./barvinok_enumerate_e$(EXEEXT) --verify $$opt < $$i || exit; \
436                 done; \
437                 echo $$i --series; \
438                 ./barvinok_enumerate_e$(EXEEXT) --verify --series < $$i || exit; \
439             fi \
440         done
441 check-test: test$(EXEEXT)
442         @for i in $(top_srcdir)/tests/*; do \
443             if test -f $$i; then \
444                 for options in '--index=10' '--primal --index=10'; do \
445                     for spec in 'random' 'bf' 'df' 'todd'; do \
446                         opt="--specialization=$$spec $$options"; \
447                         echo -n $$i $$opt; \
448                         ./test$(EXEEXT) $$opt < $$i || echo -n " NOT"; \
449                         echo " ok"; \
450                     done \
451                 done \
452             fi \
453         done
454 check-lw: test$(EXEEXT)
455         @for i in $(top_srcdir)/tests/lattice_width/*; do \
456             if test -f $$i; then \
457                 echo -n $$i; \
458                 ./test$(EXEEXT) < $$i || echo -n " NOT"; \
459                 echo " ok"; \
460             fi \
461         done
462 if HAVE_GLPK
463 check-lexmin: lexmin$(EXEEXT)
464         @for i in $(top_srcdir)/tests/lexmin/*; do \
465             if test -f $$i; then \
466                 for spec in 'random' 'bf' 'df'; do \
467                     opt="--specialization=$$spec"; \
468                     echo $$i $$opt; \
469                     ./lexmin$(EXEEXT) --verify $$opt < $$i || exit; \
470                 done \
471             fi \
472         done
473 else
474 check-lexmin:
475 endif
477 version.h: @GIT_HEAD@
478         echo '#define GIT_HEAD_ID "'@GIT_HEAD_VERSION@'"' > $@