Added cddlib-094h from http://www.inf.ethz.ch/personal/fukudak/cdd_home/

Change-Id: I64519509269e434b1b9ea87c3fe0805e711c0ac9
diff --git a/third_party/cddlib/src/Makefile.am b/third_party/cddlib/src/Makefile.am
new file mode 100644
index 0000000..17f8625
--- /dev/null
+++ b/third_party/cddlib/src/Makefile.am
@@ -0,0 +1,34 @@
+bin_PROGRAMS = \
+scdd \
+lcdd \
+redcheck \
+fourier \
+projection \
+adjacency \
+allfaces \
+testcdd1 \
+testshoot \
+testcdd2 \
+testlp1 \
+testlp2 \
+testlp3
+#cddmathlink
+
+scdd_SOURCES                   = simplecdd.c
+lcdd_SOURCES                   = lcdd.c
+redcheck_SOURCES               = redcheck.c
+fourier_SOURCES                = fourier.c
+projection_SOURCES             = projection.c
+adjacency_SOURCES              = adjacency.c
+allfaces_SOURCES               = allfaces.c
+testcdd1_SOURCES               = testcdd1.c
+testshoot_SOURCES              = testshoot.c
+testcdd2_SOURCES               = testcdd2.c
+testlp1_SOURCES                = testlp1.c
+testlp2_SOURCES                = testlp2.c
+testlp3_SOURCES                = testlp3.c
+# cddmathlink_SOURCES                = cddmathlink.c cddmlio.h cddmlio.c
+
+LDADD        = ../lib-src/libcdd.la
+INCLUDES     = -I../lib-src
+AM_CPPFLAGS  = -UGMPRATIONAL
diff --git a/third_party/cddlib/src/Makefile.in b/third_party/cddlib/src/Makefile.in
new file mode 100644
index 0000000..8385e4d
--- /dev/null
+++ b/third_party/cddlib/src/Makefile.in
@@ -0,0 +1,584 @@
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = scdd$(EXEEXT) lcdd$(EXEEXT) redcheck$(EXEEXT) \
+	fourier$(EXEEXT) projection$(EXEEXT) adjacency$(EXEEXT) \
+	allfaces$(EXEEXT) testcdd1$(EXEEXT) testshoot$(EXEEXT) \
+	testcdd2$(EXEEXT) testlp1$(EXEEXT) testlp2$(EXEEXT) \
+	testlp3$(EXEEXT)
+subdir = src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_adjacency_OBJECTS = adjacency.$(OBJEXT)
+adjacency_OBJECTS = $(am_adjacency_OBJECTS)
+adjacency_LDADD = $(LDADD)
+adjacency_DEPENDENCIES = ../lib-src/libcdd.la
+am_allfaces_OBJECTS = allfaces.$(OBJEXT)
+allfaces_OBJECTS = $(am_allfaces_OBJECTS)
+allfaces_LDADD = $(LDADD)
+allfaces_DEPENDENCIES = ../lib-src/libcdd.la
+am_fourier_OBJECTS = fourier.$(OBJEXT)
+fourier_OBJECTS = $(am_fourier_OBJECTS)
+fourier_LDADD = $(LDADD)
+fourier_DEPENDENCIES = ../lib-src/libcdd.la
+am_lcdd_OBJECTS = lcdd.$(OBJEXT)
+lcdd_OBJECTS = $(am_lcdd_OBJECTS)
+lcdd_LDADD = $(LDADD)
+lcdd_DEPENDENCIES = ../lib-src/libcdd.la
+am_projection_OBJECTS = projection.$(OBJEXT)
+projection_OBJECTS = $(am_projection_OBJECTS)
+projection_LDADD = $(LDADD)
+projection_DEPENDENCIES = ../lib-src/libcdd.la
+am_redcheck_OBJECTS = redcheck.$(OBJEXT)
+redcheck_OBJECTS = $(am_redcheck_OBJECTS)
+redcheck_LDADD = $(LDADD)
+redcheck_DEPENDENCIES = ../lib-src/libcdd.la
+am_scdd_OBJECTS = simplecdd.$(OBJEXT)
+scdd_OBJECTS = $(am_scdd_OBJECTS)
+scdd_LDADD = $(LDADD)
+scdd_DEPENDENCIES = ../lib-src/libcdd.la
+am_testcdd1_OBJECTS = testcdd1.$(OBJEXT)
+testcdd1_OBJECTS = $(am_testcdd1_OBJECTS)
+testcdd1_LDADD = $(LDADD)
+testcdd1_DEPENDENCIES = ../lib-src/libcdd.la
+am_testcdd2_OBJECTS = testcdd2.$(OBJEXT)
+testcdd2_OBJECTS = $(am_testcdd2_OBJECTS)
+testcdd2_LDADD = $(LDADD)
+testcdd2_DEPENDENCIES = ../lib-src/libcdd.la
+am_testlp1_OBJECTS = testlp1.$(OBJEXT)
+testlp1_OBJECTS = $(am_testlp1_OBJECTS)
+testlp1_LDADD = $(LDADD)
+testlp1_DEPENDENCIES = ../lib-src/libcdd.la
+am_testlp2_OBJECTS = testlp2.$(OBJEXT)
+testlp2_OBJECTS = $(am_testlp2_OBJECTS)
+testlp2_LDADD = $(LDADD)
+testlp2_DEPENDENCIES = ../lib-src/libcdd.la
+am_testlp3_OBJECTS = testlp3.$(OBJEXT)
+testlp3_OBJECTS = $(am_testlp3_OBJECTS)
+testlp3_LDADD = $(LDADD)
+testlp3_DEPENDENCIES = ../lib-src/libcdd.la
+am_testshoot_OBJECTS = testshoot.$(OBJEXT)
+testshoot_OBJECTS = $(am_testshoot_OBJECTS)
+testshoot_LDADD = $(LDADD)
+testshoot_DEPENDENCIES = ../lib-src/libcdd.la
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(adjacency_SOURCES) $(allfaces_SOURCES) $(fourier_SOURCES) \
+	$(lcdd_SOURCES) $(projection_SOURCES) $(redcheck_SOURCES) \
+	$(scdd_SOURCES) $(testcdd1_SOURCES) $(testcdd2_SOURCES) \
+	$(testlp1_SOURCES) $(testlp2_SOURCES) $(testlp3_SOURCES) \
+	$(testshoot_SOURCES)
+DIST_SOURCES = $(adjacency_SOURCES) $(allfaces_SOURCES) \
+	$(fourier_SOURCES) $(lcdd_SOURCES) $(projection_SOURCES) \
+	$(redcheck_SOURCES) $(scdd_SOURCES) $(testcdd1_SOURCES) \
+	$(testcdd2_SOURCES) $(testlp1_SOURCES) $(testlp2_SOURCES) \
+	$(testlp3_SOURCES) $(testshoot_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+#cddmathlink
+scdd_SOURCES = simplecdd.c
+lcdd_SOURCES = lcdd.c
+redcheck_SOURCES = redcheck.c
+fourier_SOURCES = fourier.c
+projection_SOURCES = projection.c
+adjacency_SOURCES = adjacency.c
+allfaces_SOURCES = allfaces.c
+testcdd1_SOURCES = testcdd1.c
+testshoot_SOURCES = testshoot.c
+testcdd2_SOURCES = testcdd2.c
+testlp1_SOURCES = testlp1.c
+testlp2_SOURCES = testlp2.c
+testlp3_SOURCES = testlp3.c
+# cddmathlink_SOURCES                = cddmathlink.c cddmlio.h cddmlio.c
+LDADD = ../lib-src/libcdd.la
+INCLUDES = -I../lib-src
+AM_CPPFLAGS = -UGMPRATIONAL
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  if test -f $$p \
+	     || test -f $$p1 \
+	  ; then \
+	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+	  else :; fi; \
+	done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
+	done
+
+clean-binPROGRAMS:
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+adjacency$(EXEEXT): $(adjacency_OBJECTS) $(adjacency_DEPENDENCIES) 
+	@rm -f adjacency$(EXEEXT)
+	$(LINK) $(adjacency_OBJECTS) $(adjacency_LDADD) $(LIBS)
+allfaces$(EXEEXT): $(allfaces_OBJECTS) $(allfaces_DEPENDENCIES) 
+	@rm -f allfaces$(EXEEXT)
+	$(LINK) $(allfaces_OBJECTS) $(allfaces_LDADD) $(LIBS)
+fourier$(EXEEXT): $(fourier_OBJECTS) $(fourier_DEPENDENCIES) 
+	@rm -f fourier$(EXEEXT)
+	$(LINK) $(fourier_OBJECTS) $(fourier_LDADD) $(LIBS)
+lcdd$(EXEEXT): $(lcdd_OBJECTS) $(lcdd_DEPENDENCIES) 
+	@rm -f lcdd$(EXEEXT)
+	$(LINK) $(lcdd_OBJECTS) $(lcdd_LDADD) $(LIBS)
+projection$(EXEEXT): $(projection_OBJECTS) $(projection_DEPENDENCIES) 
+	@rm -f projection$(EXEEXT)
+	$(LINK) $(projection_OBJECTS) $(projection_LDADD) $(LIBS)
+redcheck$(EXEEXT): $(redcheck_OBJECTS) $(redcheck_DEPENDENCIES) 
+	@rm -f redcheck$(EXEEXT)
+	$(LINK) $(redcheck_OBJECTS) $(redcheck_LDADD) $(LIBS)
+scdd$(EXEEXT): $(scdd_OBJECTS) $(scdd_DEPENDENCIES) 
+	@rm -f scdd$(EXEEXT)
+	$(LINK) $(scdd_OBJECTS) $(scdd_LDADD) $(LIBS)
+testcdd1$(EXEEXT): $(testcdd1_OBJECTS) $(testcdd1_DEPENDENCIES) 
+	@rm -f testcdd1$(EXEEXT)
+	$(LINK) $(testcdd1_OBJECTS) $(testcdd1_LDADD) $(LIBS)
+testcdd2$(EXEEXT): $(testcdd2_OBJECTS) $(testcdd2_DEPENDENCIES) 
+	@rm -f testcdd2$(EXEEXT)
+	$(LINK) $(testcdd2_OBJECTS) $(testcdd2_LDADD) $(LIBS)
+testlp1$(EXEEXT): $(testlp1_OBJECTS) $(testlp1_DEPENDENCIES) 
+	@rm -f testlp1$(EXEEXT)
+	$(LINK) $(testlp1_OBJECTS) $(testlp1_LDADD) $(LIBS)
+testlp2$(EXEEXT): $(testlp2_OBJECTS) $(testlp2_DEPENDENCIES) 
+	@rm -f testlp2$(EXEEXT)
+	$(LINK) $(testlp2_OBJECTS) $(testlp2_LDADD) $(LIBS)
+testlp3$(EXEEXT): $(testlp3_OBJECTS) $(testlp3_DEPENDENCIES) 
+	@rm -f testlp3$(EXEEXT)
+	$(LINK) $(testlp3_OBJECTS) $(testlp3_LDADD) $(LIBS)
+testshoot$(EXEEXT): $(testshoot_OBJECTS) $(testshoot_DEPENDENCIES) 
+	@rm -f testshoot$(EXEEXT)
+	$(LINK) $(testshoot_OBJECTS) $(testshoot_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adjacency.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/allfaces.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fourier.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lcdd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/projection.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/redcheck.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simplecdd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcdd1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcdd2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testlp1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testlp2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testlp3.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testshoot.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+	for dir in "$(DESTDIR)$(bindir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+	clean-generic clean-libtool ctags distclean distclean-compile \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-binPROGRAMS install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+	pdf pdf-am ps ps-am tags uninstall uninstall-am \
+	uninstall-binPROGRAMS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/third_party/cddlib/src/adjacency.c b/third_party/cddlib/src/adjacency.c
new file mode 100644
index 0000000..de287b4
--- /dev/null
+++ b/third_party/cddlib/src/adjacency.c
@@ -0,0 +1,161 @@
+/* adjacency.c: Test program to call the cdd library cddlib
+   written by Komei Fukuda, fukuda@ifor.math.ethz.ch
+   Version 0.93, July 18, 2003
+   Standard ftp site: ftp.ifor.math.ethz.ch, Directory: pub/fukuda/cdd
+*/
+
+/*  This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "setoper.h"
+#include "cdd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+dd_boolean SetInputFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+  success=dd_FALSE;
+
+  if ( ( *f = fopen(fname, "r") )!= NULL) {
+    printf("input file %s is open\n", fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The input file %s not found\n",fname);
+  }
+  return success;
+}
+
+dd_boolean SetWriteFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+
+  if ( (*f = fopen(fname, "w")) != NULL){
+    printf("output file %s is open\n",fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The output file %s cannot be opened\n",fname);
+  }
+  return success;
+}
+
+
+int main(int argc, char *argv[])
+{
+  dd_MatrixPtr M=NULL,M2=NULL,M3=NULL;
+  dd_SetFamilyPtr A=NULL;
+  dd_colrange d;
+  dd_ErrorType err=dd_NoError;
+  dd_rowset redrows,linrows,ignoredrows, basisrows;
+  dd_colset ignoredcols, basiscols;
+  long rank;
+  mytype val;
+  time_t starttime, endtime;
+  dd_DataFileType inputfile;
+  FILE *reading=NULL;
+
+  dd_set_global_constants();  /* First, this must be called. */
+
+  dd_init(val);
+  if (argc>1) strcpy(inputfile,argv[1]);
+  if (argc<=1 || !SetInputFile(&reading,argv[1])){
+    dd_WriteProgramDescription(stdout);
+    fprintf(stdout,"\ncddlib test program to remove redundancy and compute adjacency of the resulting representation.\n");
+    dd_SetInputFile(&reading,inputfile, &err);
+  }
+  if (err==dd_NoError) {
+    M=dd_PolyFile2Matrix(reading, &err);
+  }
+  else {
+    fprintf(stderr,"Input file not found\n");
+    goto _L99;
+  }
+
+  if (err!=dd_NoError) goto _L99;
+
+  if (M->representation==dd_Generator) d=M->colsize+1; else d=M->colsize;
+
+  fprintf(stdout, "redundant rows:\n");
+  time(&starttime);
+  redrows=dd_RedundantRows(M, &err);
+  time(&endtime);
+  set_fwrite(stdout, redrows);
+  dd_WriteTimes(stdout,starttime,endtime);
+
+  M2=dd_MatrixSubmatrix(M, redrows);
+
+  fprintf(stdout, "Implicit linearity (after removal of redundant rows): ");
+  linrows=dd_ImplicitLinearityRows(M2, &err);
+
+  if (M->representation==dd_Generator)
+    fprintf(stdout," %ld  ", set_card(linrows));
+  else 
+    fprintf(stdout," %ld  ", set_card(linrows));
+  set_fwrite(stdout,linrows);
+  set_uni(M2->linset, M2->linset, linrows); 
+      /* add the implicit linrows to the explicit linearity rows */
+
+  printf("\nNonredundant representation (except possibly for the linearity part):\n");
+  dd_WriteMatrix(stdout, M2);
+
+  /* To remove redundancy of the linearity part, 
+     we need to compute the rank and a basis of the linearity part. */
+  set_initialize(&ignoredrows, M2->rowsize);
+  set_initialize(&ignoredcols, M2->colsize);
+  set_compl(ignoredrows, M2->linset);
+  rank=dd_MatrixRank(M2,ignoredrows,ignoredcols, &basisrows, &basiscols);
+  set_diff(ignoredrows, M2->linset, basisrows);
+  M3=dd_MatrixSubmatrix(M2, ignoredrows);
+  if (rank>0){
+    if (set_card(ignoredrows)) {
+       fprintf(stdout,"\nThe following %ld linearity rows are dependent and unnecessary:", set_card(ignoredrows));
+       set_fwrite(stdout,ignoredrows);
+    }
+  } else
+    fprintf(stdout,"\nThe linearity rows are independent and thus minimal\n");  
+
+  printf("Nonredundant representation (= minimal representation):\n");
+  dd_WriteMatrix(stdout, M3);
+
+  printf("\nAdjacency of the minimal representation:\n");
+  A=dd_Matrix2Adjacency(M3, &err);
+  dd_WriteSetFamily(stdout, A);
+  
+  dd_clear(val);
+  set_free(linrows);
+  set_free(basisrows);
+  set_free(basiscols);
+  set_free(ignoredrows);
+  set_free(ignoredcols);
+  set_free(redrows);
+  
+  if (A!=NULL) dd_FreeSetFamily(A);
+  dd_FreeMatrix(M);
+  dd_FreeMatrix(M2);
+  dd_FreeMatrix(M3);
+
+_L99:;
+  if (err!=dd_NoError) dd_WriteErrorMessages(stderr,err);
+  dd_free_global_constants();  /* At the end, this should be called. */
+  return 0;
+}
+
+
+/* end of adjacency.c */
diff --git a/third_party/cddlib/src/allfaces.c b/third_party/cddlib/src/allfaces.c
new file mode 100644
index 0000000..542f1c2
--- /dev/null
+++ b/third_party/cddlib/src/allfaces.c
@@ -0,0 +1,183 @@
+/* allfaces.c: Test program to call the cdd library cddlib
+   written by Komei Fukuda, fukuda@ifor.math.ethz.ch
+   Version 0.94, August 4, 2005
+   Standard ftp site: ftp.ifor.math.ethz.ch, Directory: pub/fukuda/cdd
+*/
+
+/*  This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "setoper.h"
+#include "cdd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+dd_boolean SetInputFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+  success=dd_FALSE;
+
+  if ( ( *f = fopen(fname, "r") )!= NULL) {
+    printf("input file %s is open\n", fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The input file %s not found\n",fname);
+  }
+  return success;
+}
+
+dd_boolean SetWriteFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+
+  if ( (*f = fopen(fname, "w")) != NULL){
+    printf("output file %s is open\n",fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The output file %s cannot be opened\n",fname);
+  }
+  return success;
+}
+
+dd_boolean FaceEnum(dd_MatrixPtr M, dd_rowset R, dd_rowset S, dd_boolean rip, dd_colrange mindim)
+{
+  dd_ErrorType err;
+  dd_rowset LL, ImL, RR, SS, Lbasis;
+  dd_rowrange i,iprev=0;
+  dd_colrange j,dim;
+  dd_LPSolutionPtr lps=NULL;
+  dd_boolean success=dd_FALSE;
+
+  set_initialize(&LL, M->rowsize);
+  set_initialize(&RR, M->rowsize);
+  set_initialize(&SS, M->rowsize);
+  set_copy(LL, M->linset); /* rememer the linset. */
+  set_copy(RR, R); /* copy of R. */
+  set_copy(SS, S); /* copy of S. */
+  if (dd_ExistsRestrictedFace(M, R, S, &err)){
+    set_uni(M->linset, M->linset, R);
+	dd_FindRelativeInterior(M, &ImL, &Lbasis, &lps, &err);
+	dim=M->colsize - set_card(Lbasis)-1;
+    set_uni(M->linset, M->linset, ImL);
+	fprintf(stdout,"%ld: ", dim); set_fwrite(stdout,M->linset);
+	if (rip){
+    	/* Write an interior point. */
+	  printf("RIP: (");
+	  for (j=1; j <(lps->d)-1; j++) {
+	    dd_WriteNumber(stdout,lps->sol[j]);
+	  }
+	  printf(")\n");
+	}
+	dd_FreeLPSolution(lps);
+	set_free(ImL);
+	set_free(Lbasis);
+   
+    if (dim>mindim){
+	  for (i=1; i<=M->rowsize; i++){
+	    if (!set_member(i, M->linset) && !set_member(i, S)){
+		  set_addelem(RR, i);
+		  if (iprev) {
+		    set_delelem(RR,iprev);
+		    set_delelem(M->linset,iprev);
+		    set_addelem(SS, iprev);
+		  }
+		  iprev=i;
+		  FaceEnum(M, RR, SS, rip, mindim);
+		}
+	  }
+	}
+  } else if (err!=dd_NoError) goto _L99;
+  success=dd_TRUE;
+
+_L99:
+  set_copy(M->linset, LL); /* restore the linset */
+  set_free(LL);
+  set_free(RR);
+  set_free(SS);
+  return success;
+}
+
+
+
+int main(int argc, char *argv[])
+{
+  dd_MatrixPtr M=NULL;
+  dd_rowrange m;
+  dd_ErrorType err=dd_NoError;
+  dd_rowset R, S;
+  dd_DataFileType inputfile;
+  FILE *reading=NULL;
+  char ch;
+  dd_colrange mindim;
+  dd_boolean rip=dd_FALSE;
+  
+  
+  dd_set_global_constants();  /* First, this must be called. */
+
+  if (argc>1) strcpy(inputfile,argv[1]);
+  if (argc<=1 || !SetInputFile(&reading,argv[1])){
+    dd_WriteProgramDescription(stdout);
+    fprintf(stdout,"\ncddlib test program to list all faces of an H-polyhedron.\n");
+    dd_SetInputFile(&reading,inputfile, &err);
+  }
+  if (err==dd_NoError) {
+    M=dd_PolyFile2Matrix(reading, &err);
+  }
+  else {
+    fprintf(stderr,"Input file not found\n");
+    goto _L99;
+  }
+
+  if (err!=dd_NoError) goto _L99;
+  
+  if (M->representation==dd_Generator){
+    printf("The input is V-representation.  Consider it as H-representation (N)? ");
+    ch=getchar(); getchar();
+    if (ch!='y' && ch!='Y') goto _L99;
+  }
+
+  m=M->rowsize;
+  
+  set_initialize(&R, M->rowsize); 
+  set_initialize(&S, M->rowsize); 
+  
+  printf("Output relative interior points (N)? ");
+  ch=getchar();
+  if (ch=='y' || ch=='Y') rip=dd_TRUE;
+  printf("Minimum dimension of faces to list (0..%ld) ? ",M->colsize-1);
+  scanf("%ld", &mindim);
+  if (mindim>=M->colsize) mindim=M->colsize-1;
+  printf("Minimum dimension is set to %ld.", mindim);
+
+  printf("\n--- FaceEnum (dim: active set) ---\nbegin\n");
+  FaceEnum(M, R, S, rip, mindim);
+  fprintf(stderr,"end\nFaceEnum completed.\n");
+
+  dd_FreeMatrix(M);
+  set_free(R);
+  set_free(S);
+_L99:;
+  if (err!=dd_NoError) dd_WriteErrorMessages(stderr,err);
+  dd_free_global_constants();  /* At the end, this should be called. */
+  return 0;
+}
+
+
+/* end of allfaces.c */
diff --git a/third_party/cddlib/src/fourier.c b/third_party/cddlib/src/fourier.c
new file mode 100644
index 0000000..bff5dd5
--- /dev/null
+++ b/third_party/cddlib/src/fourier.c
@@ -0,0 +1,132 @@
+/* fourier.c: Test program to call the cdd library cddlib
+   written by Komei Fukuda, fukuda@ifor.math.ethz.ch
+   Version 0.94, August 4, 2005
+   Standard ftp site: ftp.ifor.math.ethz.ch, Directory: pub/fukuda/cdd
+*/
+
+/*  This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "setoper.h"
+#include "cdd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+dd_boolean SetInputFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+  success=dd_FALSE;
+
+  if ( ( *f = fopen(fname, "r") )!= NULL) {
+    printf("input file %s is open\n", fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The input file %s not found\n",fname);
+  }
+  return success;
+}
+
+dd_boolean SetWriteFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+
+  if ( (*f = fopen(fname, "w")) != NULL){
+    printf("output file %s is open\n",fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The output file %s cannot be opened\n",fname);
+  }
+  return success;
+}
+
+
+int main(int argc, char *argv[])
+{
+  dd_MatrixPtr M=NULL,M1=NULL,M2=NULL;
+  dd_colrange j,s,d;
+  dd_ErrorType err=dd_NoError;
+  dd_rowset redset,impl_linset;
+  dd_rowindex newpos;
+  mytype val;
+  dd_DataFileType inputfile;
+  FILE *reading=NULL;
+
+  dd_set_global_constants();  /* First, this must be called. */
+
+  dd_init(val);
+  if (argc>1) strcpy(inputfile,argv[1]);
+  if (argc<=1 || !SetInputFile(&reading,argv[1])){
+    dd_WriteProgramDescription(stdout);
+    fprintf(stdout,"\ncddlib test program to apply Fourier's Elimination to an H-polyhedron.\n");
+    dd_SetInputFile(&reading,inputfile, &err);
+  }
+  if (err==dd_NoError) {
+    M=dd_PolyFile2Matrix(reading, &err);
+  }
+  else {
+    fprintf(stderr,"Input file not found\n");
+    goto _L99;
+  }
+
+  if (err!=dd_NoError) goto _L99;
+
+  d=M->colsize;
+  M2=dd_CopyMatrix(M);
+
+  printf("How many variables to elminate? (max %ld): ",d-1);
+  scanf("%ld",&s);
+  
+  if (s>0 && s < d){
+    for (j=1; j<=s; j++){
+      M1=dd_FourierElimination(M2, &err);
+      printf("\nRemove the variable %ld.  The resulting redundant system.\n",d-j);
+      dd_WriteMatrix(stdout, M1);
+
+      dd_MatrixCanonicalize(&M1, &impl_linset, &redset, &newpos, &err);
+      if (err!=dd_NoError) goto _L99;
+
+      fprintf(stdout, "\nRedundant rows: ");
+      set_fwrite(stdout, redset);
+
+      dd_FreeMatrix(M2);
+      M2=M1;
+      set_free(redset);
+      set_free(impl_linset);
+      free(newpos);
+    }
+
+    printf("\nNonredundant representation:\n");
+    dd_WriteMatrix(stdout, M1);
+  } else {
+    printf("Value out of range\n");
+  }
+
+  dd_FreeMatrix(M);
+  dd_FreeMatrix(M1);
+  dd_clear(val);
+
+_L99:;
+  /* if (err!=dd_NoError) dd_WriteErrorMessages(stderr,err); */
+  dd_free_global_constants();  /* At the end, this should be called. */
+  return 0;
+}
+
+
+/* end of fourier.c */
diff --git a/third_party/cddlib/src/lcdd.c b/third_party/cddlib/src/lcdd.c
new file mode 100644
index 0000000..c5f23df
--- /dev/null
+++ b/third_party/cddlib/src/lcdd.c
@@ -0,0 +1,60 @@
+/* lcdd.c: Main test program to call the cdd library cddlib
+   written by Komei Fukuda, fukuda@ifor.math.ethz.ch
+   and  David Avis, avis@mutt.cs.mcgill.ca
+   Version 0.94, August 4, 2005
+   Standard ftp site: ftp.ifor.math.ethz.ch, Directory: pub/fukuda/cdd
+*/
+
+/*  This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+/*  This program behaves like lrs by David Avis.
+    Usage: lcdd filein fileout
+           lcdd filein          output to stdout
+           lcdd                 input stdin, output stdout
+
+    This allows things like
+    lcdd file | lcdd    (should give a minimal rep of the input file on stdout)
+    lcdd file | lrs
+    lcdd < filein
+*/
+
+#include "setoper.h"
+#include "cdd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+
+int main(int argc, char *argv[])
+{
+  dd_ErrorType err;
+
+  dd_set_global_constants();  /* First, this must be called. */
+  dd_log=dd_TRUE; /* Output log */
+
+  if (argc > 2)  
+    dd_DDFile2File(argv[1],argv[2],&err);
+
+  else if (argc > 1)
+    dd_DDFile2File(argv[1],"**stdout",&err);
+  else
+    dd_DDFile2File("**stdin","**stdout",&err);
+  return 0;
+}
+
+/* end of lcdd.c */
diff --git a/third_party/cddlib/src/minkowski.c b/third_party/cddlib/src/minkowski.c
new file mode 100644
index 0000000..22c5905
--- /dev/null
+++ b/third_party/cddlib/src/minkowski.c
@@ -0,0 +1,157 @@
+/* minkowski.c: Main test program to call the cdd library cddlib
+   written by Komei Fukuda, fukuda@ifor.math.ethz.ch
+   Version 0.93, July 15, 2003
+   Standard ftp site: ftp.ifor.math.ethz.ch, Directory: pub/fukuda/cdd
+*/
+
+/*  This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "setoper.h"
+#include "cdd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+dd_boolean SetInputFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+  success=dd_FALSE;
+
+  if ( ( *f = fopen(fname, "r") )!= NULL) {
+    printf("input file %s is open\n", fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The input file %s not found\n",fname);
+  }
+  return success;
+}
+
+dd_boolean SetWriteFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+
+  if ( (*f = fopen(fname, "w")) != NULL){
+    printf("output file %s is open\n",fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The output file %s cannot be opened\n",fname);
+  }
+  return success;
+}
+
+
+int main(int argc, char *argv[])
+{
+  dd_PolyhedraPtr poly;
+  dd_LPPtr lp;
+  dd_MatrixPtr M,A;
+  dd_ErrorType err=dd_NoError;
+  dd_DataFileType inputfile,outputfile;
+  FILE *reading=NULL, *writing;
+
+  dd_set_global_constants();  /* First, this must be called. */
+
+  if (argc>1) strcpy(inputfile,argv[1]);
+  if (argc<=1 || !SetInputFile(&reading,argv[1])){
+    dd_WriteProgramDescription(stdout);
+    dd_SetInputFile(&reading,inputfile, &err);
+  }
+  if (err==dd_NoError) {
+    M=dd_PolyFile2Matrix(reading, &err);
+  }
+  else {
+    printf("Input file not found\n");
+    goto _L99;
+  }
+
+  if (err!=dd_NoError) goto _L99;
+
+  if (M->objective==dd_LPnone){ /* do representation conversion */
+    poly=dd_DDMatrix2Poly2(M, dd_LexMin, &err);
+    /* equivalent to poly=dd_DDMatrix2Poly2(M, &err) when the second argument is set to dd_LexMin. */
+    if (err!=dd_NoError) goto _L99;
+
+    dd_SetWriteFileName(inputfile, outputfile, 'o', poly->representation);
+    SetWriteFile(&writing, outputfile);
+    dd_WriteProgramDescription(writing);
+    dd_WriteRunningMode(writing, poly);
+    switch (poly->representation) {
+    case dd_Inequality:
+      fprintf(writing, "ext_file: Generators\n");
+      A=dd_CopyGenerators(poly);
+      dd_WriteMatrix(writing,A);
+      dd_FreeMatrix(A);
+      break;
+
+    case dd_Generator:
+      fprintf(writing, "ine_file: Inequalities\n");
+      A=dd_CopyInequalities(poly);
+      dd_WriteMatrix(writing,A);
+      dd_FreeMatrix(A);
+      break;
+
+    default:
+      break;
+    }
+    dd_WriteDDTimes(writing,poly);
+    fclose(writing);
+
+    dd_SetWriteFileName(inputfile, outputfile, 'a', poly->representation);
+    SetWriteFile(&writing, outputfile);
+    dd_WriteAdjacency(writing,poly);
+    fclose(writing);
+
+    dd_SetWriteFileName(inputfile, outputfile, 'j', poly->representation);
+    SetWriteFile(&writing, outputfile);
+    dd_WriteInputAdjacency(writing,poly);
+    fclose(writing);
+
+    dd_SetWriteFileName(inputfile, outputfile, 'i', poly->representation);
+    SetWriteFile(&writing, outputfile);
+    dd_WriteIncidence(writing,poly);
+    fclose(writing);
+
+    dd_SetWriteFileName(inputfile, outputfile, 'n', poly->representation);
+    SetWriteFile(&writing, outputfile);
+    dd_WriteInputIncidence(writing,poly);
+    fclose(writing);
+
+    dd_FreeMatrix(M);
+    dd_FreePolyhedra(poly);
+
+  } else { /* solve the LP */
+    lp=dd_Matrix2LP(M, &err);  if (err!=dd_NoError) goto _L99;
+    dd_LPSolve(lp,dd_DualSimplex,&err);  if (err!=dd_NoError) goto _L99;
+
+    dd_SetWriteFileName(inputfile, outputfile, 's', M->representation);
+    SetWriteFile(&writing, outputfile);
+    dd_WriteLPResult(writing, lp, err);
+    fclose(writing);
+
+    dd_FreeMatrix(M);
+    dd_FreeLPData(lp);
+  }
+_L99:
+  if (err!=dd_NoError) dd_WriteErrorMessages(stdout,err);
+  return 0;
+}
+
+
+/* end of simplecdd.c */
diff --git a/third_party/cddlib/src/projection.c b/third_party/cddlib/src/projection.c
new file mode 100644
index 0000000..327d986
--- /dev/null
+++ b/third_party/cddlib/src/projection.c
@@ -0,0 +1,131 @@
+/* projection.c: Test program to call the cdd library cddlib
+   written by Komei Fukuda, fukuda@ifor.math.ethz.ch
+   Version 0.94, July 27,  2005
+   Standard ftp site: ftp.ifor.math.ethz.ch, Directory: pub/fukuda/cdd
+*/
+
+/*  This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "setoper.h"
+#include "cdd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+dd_boolean SetInputFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+  success=dd_FALSE;
+
+  if ( ( *f = fopen(fname, "r") )!= NULL) {
+    printf("input file %s is open\n", fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The input file %s not found\n",fname);
+  }
+  return success;
+}
+
+dd_boolean SetWriteFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+
+  if ( (*f = fopen(fname, "w")) != NULL){
+    printf("output file %s is open\n",fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The output file %s cannot be opened\n",fname);
+  }
+  return success;
+}
+
+
+int main(int argc, char *argv[])
+{
+  dd_MatrixPtr M=NULL,M1=NULL;
+  dd_colrange j,s,t,d;
+  dd_ErrorType err=dd_NoError;
+  dd_rowset redset,impl_linset;
+  dd_colset delset;
+  dd_rowindex newpos;
+  mytype val;
+  dd_DataFileType inputfile;
+  FILE *reading=NULL;
+
+  dd_set_global_constants();  /* First, this must be called. */
+
+  dd_init(val);
+  if (argc>1) strcpy(inputfile,argv[1]);
+  if (argc<=1 || !SetInputFile(&reading,argv[1])){
+    dd_WriteProgramDescription(stdout);
+    fprintf(stdout,"\ncddlib test program to apply the Block Elimination to an H-polyhedron.\n");
+    dd_SetInputFile(&reading,inputfile, &err);
+  }
+  if (err==dd_NoError) {
+    M=dd_PolyFile2Matrix(reading, &err);
+  }
+  else {
+    fprintf(stderr,"Input file not found\n");
+    goto _L99;
+  }
+
+  if (err!=dd_NoError) goto _L99;
+
+  d=M->colsize;
+  set_initialize(&delset, d);
+
+  printf("How many variables to elminate? (max %ld): ",d-1);
+  scanf("%ld",&s);
+
+  for (j=1; j<=s; j++){
+    printf("\n%ld th deletion variable): ",j);
+    scanf("%ld",&t);
+    set_addelem(delset, t+1);
+  }
+  
+  M1=dd_BlockElimination(M, delset, &err);
+
+  dd_WriteMatrix(stdout, M1);
+
+  dd_MatrixCanonicalize(&M1,&impl_linset,&redset,&newpos,&err);
+
+  if (err!=dd_NoError) goto _L99;
+
+  fprintf(stdout, "\nRedundant rows: ");
+  set_fwrite(stdout, redset);
+  fprintf(stdout, "\n");
+
+  dd_WriteMatrix(stdout, M1);
+
+  dd_FreeMatrix(M);
+  dd_FreeMatrix(M1);
+  set_free(delset);
+  set_free(redset);
+  set_free(impl_linset);
+  free(newpos);
+
+_L99:;
+  /* if (err!=dd_NoError) dd_WriteErrorMessages(stderr,err); */
+  dd_free_global_constants();  /* At the end, this should be called. */
+  return 0;
+}
+
+
+/* end of projection.c */
diff --git a/third_party/cddlib/src/redcheck.c b/third_party/cddlib/src/redcheck.c
new file mode 100644
index 0000000..f4391fe
--- /dev/null
+++ b/third_party/cddlib/src/redcheck.c
@@ -0,0 +1,125 @@
+/* redcheck.c: Test program to call the cdd library cddlib
+   written by Komei Fukuda, fukuda@ifor.math.ethz.ch
+   Version 0.94, April 4, 2005
+   Standard ftp site: ftp.ifor.math.ethz.ch, Directory: pub/fukuda/cdd
+*/
+
+/*  This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "setoper.h"
+#include "cdd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+dd_boolean SetInputFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+  success=dd_FALSE;
+
+  if ( ( *f = fopen(fname, "r") )!= NULL) {
+    printf("input file %s is open\n", fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The input file %s not found\n",fname);
+  }
+  return success;
+}
+
+dd_boolean SetWriteFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+
+  if ( (*f = fopen(fname, "w")) != NULL){
+    printf("output file %s is open\n",fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The output file %s cannot be opened\n",fname);
+  }
+  return success;
+}
+
+
+int main(int argc, char *argv[])
+{
+  dd_MatrixPtr M=NULL;
+  dd_rowrange i,m;
+  dd_ErrorType err=dd_NoError;
+  dd_rowindex newpos;
+  dd_rowset impl_linset,redset;
+  time_t starttime, endtime;
+  dd_DataFileType inputfile;
+  FILE *reading=NULL;
+
+  dd_set_global_constants();  /* First, this must be called. */
+
+  if (argc>1) strcpy(inputfile,argv[1]);
+  if (argc<=1 || !SetInputFile(&reading,argv[1])){
+    dd_WriteProgramDescription(stdout);
+    fprintf(stdout,"\ncddlib test program to check redundancy of an H/V-representation.\n");
+    dd_SetInputFile(&reading,inputfile, &err);
+  }
+  if (err==dd_NoError) {
+    M=dd_PolyFile2Matrix(reading, &err);
+  }
+  else {
+    fprintf(stderr,"Input file not found\n");
+    goto _L99;
+  }
+
+  if (err!=dd_NoError) goto _L99;
+
+  m=M->rowsize;
+  fprintf(stdout, "Canonicalize the matrix.\n");
+    
+  time(&starttime);
+  dd_MatrixCanonicalize(&M, &impl_linset, &redset, &newpos, &err);
+  time(&endtime);
+  
+  if (err!=dd_NoError) goto _L99;
+
+  fprintf(stdout, "Implicit linearity rows are:"); set_fwrite(stdout, impl_linset);
+
+  fprintf(stdout, "\nRedundant rows are:"); set_fwrite(stdout, redset);
+  fprintf(stdout, "\n");
+  
+  fprintf(stdout, "Nonredundant representation:\n");
+  fprintf(stdout, "The new row positions are as follows (orig:new).\nEach redundant row has the new number 0.\nEach deleted duplicated row has a number nagative of the row that\nrepresents its equivalence class.\n");
+  
+  for (i=1; i<=m; i++){
+   fprintf(stdout, " %ld:%ld",i, newpos[i]); 
+  }
+  fprintf(stdout, "\n");
+  dd_WriteMatrix(stdout, M);
+  
+  dd_WriteTimes(stdout,starttime,endtime);
+
+  set_free(redset);
+  set_free(impl_linset);
+  dd_FreeMatrix(M);
+  free(newpos);
+
+_L99:;
+  if (err!=dd_NoError) dd_WriteErrorMessages(stderr,err);
+  return 0;
+}
+
+
+/* end of redcheck.c */
diff --git a/third_party/cddlib/src/redexter.c b/third_party/cddlib/src/redexter.c
new file mode 100644
index 0000000..c9b033e
--- /dev/null
+++ b/third_party/cddlib/src/redexter.c
@@ -0,0 +1,160 @@
+/* redexter.c: Test program to call the cdd library cddlib
+   written by Komei Fukuda, fukuda@ifor.math.ethz.ch
+   Version 0.94, November 21, 2005
+   Standard ftp site: ftp.ifor.math.ethz.ch, Directory: pub/fukuda/cdd
+*/
+
+/*  This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "setoper.h"
+#include "cdd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+dd_boolean SetInputFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+  success=dd_FALSE;
+
+  if ( ( *f = fopen(fname, "r") )!= NULL) {
+    printf("input file %s is open\n", fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The input file %s not found\n",fname);
+  }
+  return success;
+}
+
+dd_boolean SetWriteFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+
+  if ( (*f = fopen(fname, "w")) != NULL){
+    printf("output file %s is open\n",fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The output file %s cannot be opened\n",fname);
+  }
+  return success;
+}
+
+
+int main(int argc, char *argv[])
+{
+  dd_MatrixPtr M1=NULL,M2=NULL,M2row=NULL,M1plus=NULL;
+  dd_colrange d1;
+  dd_rowrange i,m1,m2,m1plus;
+  dd_ErrorType err=dd_NoError,err1=dd_NoError,err2=dd_NoError;
+  dd_rowset delset,rowset2;
+  dd_Arow cvec; /* certificate */  
+
+  time_t starttime, endtime;
+  dd_DataFileType inputfile1,inputfile2;
+  FILE *reading1=NULL,*reading2=NULL;
+
+  dd_set_global_constants();  /* First, this must be called. */
+
+  dd_WriteProgramDescription(stdout);
+  fprintf(stdout,"\ncddlib test program to check redundancy of additional data.\n");
+  if (argc>2){
+    strcpy(inputfile1,argv[1]);
+    strcpy(inputfile2,argv[2]);
+  }
+  /* 
+  if (argc<=2){
+    fprintf(stdout,"\nUsage:\n   redexter file1 file2\n");
+	goto _L99;
+  }
+  */
+  if (!SetInputFile(&reading1,argv[1])){
+    fprintf(stdout,"\nSpecify file1.\n");
+    dd_SetInputFile(&reading1,inputfile1, &err1);
+  }
+  if (!SetInputFile(&reading2,argv[2])){
+    fprintf(stdout,"\nSpecify the secondary file.\n");
+    dd_SetInputFile(&reading2,inputfile2, &err2);
+  }
+  if ((err1==dd_NoError) && (err2==dd_NoError)) {
+    M1=dd_PolyFile2Matrix(reading1, &err1);
+    M2=dd_PolyFile2Matrix(reading2, &err2);
+  }
+  else {
+    fprintf(stderr,"Input file(s) not found\n");
+    goto _L99;
+  }
+
+  if ((err1!=dd_NoError) || (err2!=dd_NoError)) goto _L99;
+
+  m1=M1->rowsize;
+  m2=M2->rowsize;
+  set_initialize(&delset,m2);
+  m1plus=m1+1;
+  if (M1->representation==dd_Generator){
+    d1=(M1->colsize)+1;
+  } else {
+    d1=M1->colsize;
+  }
+  dd_InitializeArow(d1,&cvec);
+
+  fprintf(stdout, "\nThe first matrix\n");
+  dd_WriteMatrix(stdout, M1);
+  fprintf(stdout, "\nThe second matrix\n");
+  dd_WriteMatrix(stdout, M2);
+  
+  printf("\nChecking whether each row of the second matrix is redundant w.r.t. the first.\n");
+
+  time(&starttime);
+
+  for (i=1; i<=m2; i++){
+    set_initialize(&rowset2,m2);
+	set_addelem(rowset2, i);
+    set_compl(delset, rowset2);
+    M2row=dd_MatrixSubmatrix(M2, delset);
+	M1plus=dd_MatrixAppend(M1,M2row); 
+	
+    if (dd_Redundant(M1plus, m1plus, cvec, &err)) {
+	  printf("%ld-th row: redundant\n", i);
+	} else {
+	  printf("%ld-th row: non-redundant\n A certificate:", i);
+	  dd_WriteArow(stdout, cvec, d1);
+	}
+
+    dd_FreeMatrix(M1plus);
+	dd_FreeMatrix(M2row);
+    set_free(rowset2);
+  }
+
+  time(&endtime);
+
+  dd_WriteTimes(stdout,starttime,endtime);
+
+  set_free(delset);
+  dd_FreeMatrix(M1);
+  dd_FreeMatrix(M2);
+
+_L99:;
+  if (err1!=dd_NoError) dd_WriteErrorMessages(stderr,err1);
+  if (err2!=dd_NoError) dd_WriteErrorMessages(stderr,err2);
+  return 0;
+}
+
+
+/* end of redexter.c */
diff --git a/third_party/cddlib/src/redundancies.c b/third_party/cddlib/src/redundancies.c
new file mode 100644
index 0000000..15d5eb8
--- /dev/null
+++ b/third_party/cddlib/src/redundancies.c
@@ -0,0 +1,121 @@
+/* redcheck.c: Test program to call the cdd library cddlib
+   written by Komei Fukuda, fukuda@ifor.math.ethz.ch
+   Version 0.94, April 12, 2012
+   Standard ftp site: ftp.ifor.math.ethz.ch, Directory: pub/fukuda/cdd
+*/
+
+/*  This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "setoper.h"
+#include "cdd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+dd_boolean SetInputFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+  success=dd_FALSE;
+
+  if ( ( *f = fopen(fname, "r") )!= NULL) {
+    printf("input file %s is open\n", fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The input file %s not found\n",fname);
+  }
+  return success;
+}
+
+dd_boolean SetWriteFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+
+  if ( (*f = fopen(fname, "w")) != NULL){
+    printf("output file %s is open\n",fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The output file %s cannot be opened\n",fname);
+  }
+  return success;
+}
+
+
+int main(int argc, char *argv[])
+{
+  dd_MatrixPtr M=NULL,M2=NULL;
+  dd_ErrorType err=dd_NoError;
+  dd_rowset redrows,linrows;
+  mytype val;
+  dd_DataFileType inputfile;
+  FILE *reading=NULL;
+  time_t starttime,endtime;
+  
+  dd_set_global_constants();  /* First, this must be called. */
+
+  dd_init(val);
+  if (argc>1) strcpy(inputfile,argv[1]);
+  if (argc<=1 || !SetInputFile(&reading,argv[1])){
+    dd_WriteProgramDescription(stdout);
+    fprintf(stdout,"\ncddlib test program to check redundancy of an H/V-representation.\n");
+    dd_SetInputFile(&reading,inputfile, &err);
+  }
+  if (err==dd_NoError) {
+    M=dd_PolyFile2Matrix(reading, &err);
+  }
+  else {
+    fprintf(stderr,"Input file not found\n");
+    goto _L99;
+  }
+
+  if (err!=dd_NoError) goto _L99;
+
+  time(&starttime);
+  fprintf(stdout, "redundant rows: ");
+  redrows=dd_RedundantRows(M, &err);
+  set_fwrite(stdout, redrows);
+
+  M2=dd_MatrixSubmatrix(M, redrows);
+
+  fprintf(stdout, "Implicit linearity (after removal of redundant rows): ");
+  linrows=dd_ImplicitLinearityRows(M2, &err);
+
+  if (M->representation==dd_Generator)
+    fprintf(stdout," %ld  ", set_card(linrows));
+  else 
+    fprintf(stdout," %ld  ", set_card(linrows));
+  set_fwrite(stdout,linrows);
+  set_uni(M2->linset, M2->linset, linrows); 
+      /* add the implicit linrows to the given linearity rows */
+
+  time(&endtime);
+  printf("\nNonredundant representation (except for the linearity part):\n");
+  dd_WriteMatrix(stdout, M2);
+  dd_WriteTimes(stdout,starttime,endtime);
+
+  dd_FreeMatrix(M);
+  dd_FreeMatrix(M2);
+
+_L99:;
+  if (err!=dd_NoError) dd_WriteErrorMessages(stderr,err);
+  return 0;
+}
+
+
+/* end of redcheck.c */
diff --git a/third_party/cddlib/src/redundancies_clarkson.c b/third_party/cddlib/src/redundancies_clarkson.c
new file mode 100644
index 0000000..b02f16b
--- /dev/null
+++ b/third_party/cddlib/src/redundancies_clarkson.c
@@ -0,0 +1,121 @@
+/* redcheck.c: Test program to call the cdd library cddlib
+   written by Komei Fukuda, fukuda@ifor.math.ethz.ch
+   Version 0.94, April 12, 2012
+   Standard ftp site: ftp.ifor.math.ethz.ch, Directory: pub/fukuda/cdd
+*/
+
+/*  This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "setoper.h"
+#include "cdd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+dd_boolean SetInputFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+  success=dd_FALSE;
+
+  if ( ( *f = fopen(fname, "r") )!= NULL) {
+    printf("input file %s is open\n", fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The input file %s not found\n",fname);
+  }
+  return success;
+}
+
+dd_boolean SetWriteFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+
+  if ( (*f = fopen(fname, "w")) != NULL){
+    printf("output file %s is open\n",fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The output file %s cannot be opened\n",fname);
+  }
+  return success;
+}
+
+
+int main(int argc, char *argv[])
+{
+  dd_MatrixPtr M=NULL,M2=NULL;
+  dd_ErrorType err=dd_NoError;
+  dd_rowset redrows,linrows;
+  mytype val;
+  dd_DataFileType inputfile;
+  FILE *reading=NULL;
+  time_t starttime,endtime;
+
+  dd_set_global_constants();  /* First, this must be called. */
+
+  dd_init(val);
+  if (argc>1) strcpy(inputfile,argv[1]);
+  if (argc<=1 || !SetInputFile(&reading,argv[1])){
+    dd_WriteProgramDescription(stdout);
+    fprintf(stdout,"\ncddlib test program to check redundancy of an H/V-representation\nby Clarkson's algorithm.");
+    dd_SetInputFile(&reading,inputfile, &err);
+  }
+  if (err==dd_NoError) {
+    M=dd_PolyFile2Matrix(reading, &err);
+  }
+  else {
+    fprintf(stderr,"Input file not found\n");
+    goto _L99;
+  }
+
+  if (err!=dd_NoError) goto _L99;
+
+  time(&starttime);
+  fprintf(stdout, "redundant rows: ");
+  redrows=dd_RedundantRowsViaShooting(M, &err);
+  set_fwrite(stdout, redrows);
+
+  M2=dd_MatrixSubmatrix(M, redrows);
+
+  fprintf(stdout, "Implicit linearity (after removal of redundant rows): ");
+  linrows=dd_ImplicitLinearityRows(M2, &err);
+
+  if (M->representation==dd_Generator)
+    fprintf(stdout," %ld  ", set_card(linrows));
+  else 
+    fprintf(stdout," %ld  ", set_card(linrows));
+  set_fwrite(stdout,linrows);
+  set_uni(M2->linset, M2->linset, linrows); 
+      /* add the implicit linrows to the given linearity rows */
+
+  time(&endtime);
+  printf("\nNonredundant representation (except for the linearity part):\n");
+  dd_WriteMatrix(stdout, M2);
+  dd_WriteTimes(stdout,starttime,endtime);
+
+  dd_FreeMatrix(M);
+  dd_FreeMatrix(M2);
+
+_L99:;
+  if (err!=dd_NoError) dd_WriteErrorMessages(stderr,err);
+  return 0;
+}
+
+
+/* end of redcheck.c */
diff --git a/third_party/cddlib/src/simplecdd.c b/third_party/cddlib/src/simplecdd.c
new file mode 100644
index 0000000..fe800a2
--- /dev/null
+++ b/third_party/cddlib/src/simplecdd.c
@@ -0,0 +1,158 @@
+/* simplecdd.c: Main test program to call the cdd library cddlib
+   written by Komei Fukuda, fukuda@ifor.math.ethz.ch
+   Version 0.94, Aug. 4, 2005
+   Standard ftp site: ftp.ifor.math.ethz.ch, Directory: pub/fukuda/cdd
+*/
+
+/*  This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "setoper.h"
+#include "cdd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+dd_boolean SetInputFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+  success=dd_FALSE;
+
+  if ( ( *f = fopen(fname, "r") )!= NULL) {
+    printf("input file %s is open\n", fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The input file %s not found\n",fname);
+  }
+  return success;
+}
+
+dd_boolean SetWriteFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+
+  if ( (*f = fopen(fname, "w")) != NULL){
+    printf("output file %s is open\n",fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The output file %s cannot be opened\n",fname);
+  }
+  return success;
+}
+
+
+int main(int argc, char *argv[])
+{
+  dd_PolyhedraPtr poly;
+  dd_LPPtr lp;
+  dd_MatrixPtr M,A;
+  dd_ErrorType err=dd_NoError;
+  dd_DataFileType inputfile,outputfile;
+  FILE *reading=NULL, *writing;
+
+  dd_set_global_constants();  /* First, this must be called. */
+  dd_log=dd_TRUE;  /* output log */
+
+  if (argc>1) strcpy(inputfile,argv[1]);
+  if (argc<=1 || !SetInputFile(&reading,argv[1])){
+    dd_WriteProgramDescription(stdout);
+    dd_SetInputFile(&reading,inputfile, &err);
+  }
+  if (err==dd_NoError) {
+    M=dd_PolyFile2Matrix(reading, &err);
+  }
+  else {
+    printf("Input file not found\n");
+    goto _L99;
+  }
+
+  if (err!=dd_NoError) goto _L99;
+
+  if (M->objective==dd_LPnone){ /* do representation conversion */
+    poly=dd_DDMatrix2Poly2(M, dd_LexMin, &err);
+    /* equivalent to poly=dd_DDMatrix2Poly2(M, &err) when the second argument is set to dd_LexMin. */
+    if (err!=dd_NoError) goto _L99;
+
+    dd_SetWriteFileName(inputfile, outputfile, 'o', poly->representation);
+    SetWriteFile(&writing, outputfile);
+    dd_WriteProgramDescription(writing);
+    dd_WriteRunningMode(writing, poly);
+    switch (poly->representation) {
+    case dd_Inequality:
+      fprintf(writing, "ext_file: Generators\n");
+      A=dd_CopyGenerators(poly);
+      dd_WriteMatrix(writing,A);
+      dd_FreeMatrix(A);
+      break;
+
+    case dd_Generator:
+      fprintf(writing, "ine_file: Inequalities\n");
+      A=dd_CopyInequalities(poly);
+      dd_WriteMatrix(writing,A);
+      dd_FreeMatrix(A);
+      break;
+
+    default:
+      break;
+    }
+    dd_WriteDDTimes(writing,poly);
+    fclose(writing);
+
+    dd_SetWriteFileName(inputfile, outputfile, 'a', poly->representation);
+    SetWriteFile(&writing, outputfile);
+    dd_WriteAdjacency(writing,poly);
+    fclose(writing);
+
+    dd_SetWriteFileName(inputfile, outputfile, 'j', poly->representation);
+    SetWriteFile(&writing, outputfile);
+    dd_WriteInputAdjacency(writing,poly);
+    fclose(writing);
+
+    dd_SetWriteFileName(inputfile, outputfile, 'i', poly->representation);
+    SetWriteFile(&writing, outputfile);
+    dd_WriteIncidence(writing,poly);
+    fclose(writing);
+
+    dd_SetWriteFileName(inputfile, outputfile, 'n', poly->representation);
+    SetWriteFile(&writing, outputfile);
+    dd_WriteInputIncidence(writing,poly);
+    fclose(writing);
+
+    dd_FreeMatrix(M);
+    dd_FreePolyhedra(poly);
+
+  } else { /* solve the LP */
+    lp=dd_Matrix2LP(M, &err);  if (err!=dd_NoError) goto _L99;
+    dd_LPSolve(lp,dd_DualSimplex,&err);  if (err!=dd_NoError) goto _L99;
+
+    dd_SetWriteFileName(inputfile, outputfile, 's', M->representation);
+    SetWriteFile(&writing, outputfile);
+    dd_WriteLPResult(writing, lp, err);
+    fclose(writing);
+
+    dd_FreeMatrix(M);
+    dd_FreeLPData(lp);
+  }
+_L99:
+  if (err!=dd_NoError) dd_WriteErrorMessages(stdout,err);
+  return 0;
+}
+
+
+/* end of simplecdd.c */
diff --git a/third_party/cddlib/src/testcdd1.c b/third_party/cddlib/src/testcdd1.c
new file mode 100644
index 0000000..8f1355f
--- /dev/null
+++ b/third_party/cddlib/src/testcdd1.c
@@ -0,0 +1,105 @@
+/* testcdd1.c: Main test program to call the cdd library cddlib
+   written by Komei Fukuda, fukuda@ifor.math.ethz.ch
+   Version 0.93, July 9, 2003
+   Standard ftp site: ftp.ifor.math.ethz.ch, Directory: pub/fukuda/cdd
+*/
+
+/*  This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "setoper.h"
+#include "cdd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+dd_boolean SetInputFile(FILE **f, char *fname)
+{
+  dd_boolean success=dd_FALSE;
+
+  if ( ( *f = fopen(fname, "r") )!= NULL) {
+    printf("input file %s is open\n", fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The input file %s not found\n",fname);
+  }
+  return success;
+}
+
+int main(int argc, char *argv[])
+{
+  dd_PolyhedraPtr poly;
+  dd_MatrixPtr M;
+  dd_ErrorType err;
+  dd_DataFileType inputfile;
+  FILE *reading=NULL;
+  dd_MatrixPtr A, G;
+  dd_SetFamilyPtr GI,GA;
+
+  dd_set_global_constants();  /* First, this must be called. */
+
+  dd_SetInputFile(&reading,inputfile, &err);
+  if (err==dd_NoError) {
+    M=dd_PolyFile2Matrix(reading, &err);
+  }
+  else {
+    printf("Input file not found\n");
+    goto _L99;
+  }
+
+  if (err==dd_NoError) {
+    poly=dd_DDMatrix2Poly(M, &err); /* compute the second representation */
+    if (err!=dd_NoError) {
+      dd_WriteErrorMessages(stdout,err);  goto _L99;
+    }
+    A=dd_CopyInequalities(poly);
+    G=dd_CopyGenerators(poly);
+    GI=dd_CopyIncidence(poly);
+    GA=dd_CopyAdjacency(poly);
+
+    if (poly->representation==dd_Inequality) {
+      printf("\nInput is an H-representation\n");
+    } else {
+      printf("\nInput is a V-representation\n");
+    }
+    dd_WriteMatrix(stdout,A); printf("\n");
+    dd_WriteMatrix(stdout,G);
+
+    printf("\nHere is the incidence list:\n");
+    dd_WriteSetFamily(stdout,GI);
+
+    printf("\nHere is the adjacency list:\n");
+    dd_WriteSetFamily(stdout,GA);
+
+    dd_FreePolyhedra(poly);
+    /* This is to remove all the space allocated for poly. */
+    dd_FreeMatrix(M);
+    dd_FreeMatrix(A);
+    dd_FreeMatrix(G);
+    dd_FreeSetFamily(GI);
+    dd_FreeSetFamily(GA);
+  } else {
+    dd_WriteErrorMessages(stdout,err);
+  }
+_L99:
+  dd_free_global_constants();  /* At the end, this must be called. */
+  return 0;
+}
+
+
+/* end of testcdd1.c */
diff --git a/third_party/cddlib/src/testcdd2.c b/third_party/cddlib/src/testcdd2.c
new file mode 100644
index 0000000..950120f
--- /dev/null
+++ b/third_party/cddlib/src/testcdd2.c
@@ -0,0 +1,92 @@
+/* testcdd2.c: Main test program to call the cdd library cddlib
+   written by Komei Fukuda, fukuda@ifor.math.ethz.ch
+   Version 0.90c, June 12, 2000
+   Standard ftp site: ftp.ifor.math.ethz.ch, Directory: pub/fukuda/cdd
+*/
+
+/*  This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "setoper.h"
+#include "cdd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+int main(int argc, char *argv[])
+{
+  dd_PolyhedraPtr poly;
+  dd_MatrixPtr A, B, G;
+  dd_rowrange m; 
+  dd_colrange d;
+  dd_ErrorType err;
+
+  dd_set_global_constants();  /* First, this must be called to use cddlib. */
+
+  m=4; d=3;
+  A=dd_CreateMatrix(m,d);
+  dd_set_si(A->matrix[0][0],7); dd_set_si(A->matrix[0][1],-3); dd_set_si(A->matrix[0][2], 0);
+  dd_set_si(A->matrix[1][0],7); dd_set_si(A->matrix[1][1], 0); dd_set_si(A->matrix[1][2],-3);
+  dd_set_si(A->matrix[2][0],1); dd_set_si(A->matrix[2][1], 1); dd_set_si(A->matrix[2][2], 0);
+  dd_set_si(A->matrix[3][0],1); dd_set_si(A->matrix[3][1], 0); dd_set_si(A->matrix[3][2], 1);
+  /* 7 - 3 x1          >= 0
+     7         - 3x2   >= 0
+     1 +   x1          >= 0
+     1         +  x2   >= 0
+  */
+  A->representation=dd_Inequality;
+  poly=dd_DDMatrix2Poly(A, &err);  /* compute the second (generator) representation */
+  if (err!=dd_NoError) goto _L99;
+  printf("\nInput is H-representation:\n");
+  G=dd_CopyGenerators(poly);
+  dd_WriteMatrix(stdout,A);  printf("\n");
+  dd_WriteMatrix(stdout,G);
+  dd_FreeMatrix(A);
+  dd_FreeMatrix(G);
+
+  /* Add inequalities:
+     7 +  x1   -3x2   = 0
+     7 - 3x1   + x2   >= 0
+  */
+  m=2;
+  B=dd_CreateMatrix(m,d);
+  dd_set_si(B->matrix[0][0],7); dd_set_si(B->matrix[0][1], 1); dd_set_si(B->matrix[0][2],-3);
+  dd_set_si(B->matrix[1][0],7); dd_set_si(B->matrix[1][1],-3); dd_set_si(B->matrix[1][2], 1);
+  set_addelem(B->linset,1); /* setting the first to be equality */
+
+  dd_DDInputAppend(&poly,B, &err); /* append the two inequalities and compute the generators */
+  if (err!=dd_NoError) goto _L99;
+  A=dd_CopyInequalities(poly);  /* get the inequalities (=input). */
+  G=dd_CopyGenerators(poly);  /* get the generators (=output). */
+  printf("\nNew H-representation with added inequalities:\n");
+  dd_WriteMatrix(stdout,A);  printf("\n");
+  dd_WriteMatrix(stdout,G);
+
+  dd_FreeMatrix(A);
+  dd_FreeMatrix(B);
+  dd_FreeMatrix(G);
+  dd_FreePolyhedra(poly);
+
+_L99:
+  if (err!=dd_NoError) dd_WriteErrorMessages(stdout,err);
+
+  dd_free_global_constants();  /* At the end, this must be called. */
+  return 0;
+}
+
+
+/* end of testcdd2.c */
diff --git a/third_party/cddlib/src/testlp1.c b/third_party/cddlib/src/testlp1.c
new file mode 100644
index 0000000..d962bfb
--- /dev/null
+++ b/third_party/cddlib/src/testlp1.c
@@ -0,0 +1,132 @@
+/* testlp1.c: Main test program to call the cdd lp library
+   written by Komei Fukuda, fukuda@ifor.math.ethz.ch
+   Version 0.94, August 4, 2005
+   Standard ftp site: ftp.ifor.math.ethz.ch, Directory: pub/fukuda/cdd
+*/
+
+/*  This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "setoper.h"
+#include "cdd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+FILE *reading, *writing;
+
+int main(int argc, char *argv[])
+{
+  /* The original LP data  m x n matrix 
+     = | b   -A  |
+       | c0  c^T |,
+   
+  where the LP to be solved is to
+  maximize  c^T x  +   c0
+  subj. to
+            A   x  <=  b.
+  */
+        
+  dd_ErrorType error=dd_NoError;
+  dd_MatrixPtr M,G;
+  dd_LPSolverType solver=dd_DualSimplex;  /* either DualSimplex or CrissCross */
+  dd_LPPtr lp;   /* pointer to LP data structure that is not visible by user. */
+  dd_LPSolutionPtr  lps1;
+  dd_colrange j;
+  dd_rowset ImL, Lbasis;
+
+  dd_PolyhedraPtr poly;
+  dd_DataFileType inputfile;
+  int ans;
+
+  dd_set_global_constants(); /* First, this must be called once to use cddlib. */
+
+  printf("Welcome to cddlib %s\n",dd_DDVERSION);
+
+  while (error==dd_NoError) {
+
+/* Input an LP using the cdd library  */
+    dd_SetInputFile(&reading,inputfile,&error);
+    if (error!=dd_NoError) goto _L99;
+    M=dd_PolyFile2Matrix(reading, &error);
+    if (error!=dd_NoError) goto _L99;
+    /* dd_WriteMatrix(stdout, M);  */
+    lp=dd_Matrix2LP(M, &error);
+    if (error!=dd_NoError) goto _L99;
+	
+
+/* Solve the LP by cdd LP solver. */
+    printf("\n--- Running dd_LPSolve ---\n");
+    dd_LPSolve(lp,solver,&error);
+    if (error!=dd_NoError) goto _L99;
+
+    /* Write the LP solutions by cdd LP reporter. */
+    dd_WriteLPResult(stdout, lp, error);
+
+/* Generate all vertices of the feasible reagion */
+    printf("\nDo you want to compute the generator representation (y/n)? ");
+    ans=getchar();
+    if (ans=='y' || ans=='Y'){
+      poly=dd_DDMatrix2Poly(M, &error);
+      G=dd_CopyGenerators(poly);
+      printf("\nGenerators (All the vertices of the feasible region if bounded.)\n");
+      dd_WriteMatrix(stdout,G);
+
+      /* Free allocated spaces. */
+      dd_FreeMatrix(G);
+      dd_FreePolyhedra(poly);
+    }
+
+/* Find an interior point with cdd LP library. */
+    printf("\nDo you want to find a relative interior point (y/n)? ");
+    ans=getchar(); ans=getchar();
+    if (ans=='y' || ans=='Y'){
+      printf("\n--- Running dd_FindRelativeInteriorPoint ---\n");
+	  dd_FindRelativeInterior(M, &ImL, &Lbasis, &lps1, &error);
+      if (error!=dd_NoError) goto _L99;
+
+      /* Write an interior point. */
+      if (dd_Positive(lps1->optvalue)){
+        printf("A relative interior point found: (");
+        for (j=1; j <(lps1->d)-1; j++) {
+          dd_WriteNumber(stdout,lps1->sol[j]);
+        }
+        printf(")\nThe dimension of the region = ");
+		printf("%ld\n",M->colsize-set_card(Lbasis)-1);
+		if (set_card(ImL)>0) {
+		  printf("Implicit equations: "); set_write(ImL); printf("\n");
+		}
+      } else {
+        printf("The feasible region is empty.\n");
+	  }
+	  dd_FreeLPSolution(lps1);
+	  set_free(ImL);
+	  set_free(Lbasis);
+    }
+
+/* Free allocated spaces. */
+    dd_FreeMatrix(M);
+    dd_FreeLPData(lp);
+  }
+_L99:;
+  fclose(reading);
+  if (error!=dd_NoError) dd_WriteErrorMessages(stdout, error);
+  dd_free_global_constants();  /* At the end, this should be called. */
+  return 0;
+}
+
+/* end of testlp1.c */
diff --git a/third_party/cddlib/src/testlp2.c b/third_party/cddlib/src/testlp2.c
new file mode 100644
index 0000000..190f539
--- /dev/null
+++ b/third_party/cddlib/src/testlp2.c
@@ -0,0 +1,124 @@
+/* testlp2.c: Main test program to call the cdd lp library
+   written by Komei Fukuda, fukuda@ifor.math.ethz.ch
+   Version 0.93a, July 23, 2003
+   Standard ftp site: ftp.ifor.math.ethz.ch, Directory: pub/fukuda/cdd
+*/
+
+/*  This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "setoper.h"
+#include "cdd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+FILE *reading, *writing;
+
+int main(int argc, char *argv[])
+{
+  /* The original LP data m x n matrix 
+     = | b   -A  |
+       | c0  c^T |,
+   
+  where the LP to be solved is to
+  maximize  c^T x  +   c0
+  subj. to
+            A   x  <=  b.
+  */
+        
+  dd_ErrorType error=dd_NoError;
+  dd_LPSolverType solver;  /* either DualSimplex or CrissCross */
+  dd_LPPtr lp;   
+
+  dd_rowrange m;
+  dd_colrange n;
+  dd_NumberType numb;
+  dd_MatrixPtr A;
+  dd_ErrorType err;
+
+
+/* Define an LP  */
+/*
+  max  0 + 3 x1 + 4 x2 
+  s.t.
+       4/3 - 2 x1 -   x2  >= 0
+       2/3        -   x2  >= 0
+               x1         >= 0
+                      x2  >= 0
+
+  For this LP, we set up a matrix A as 4 x 3 matrix and a row vector:
+
+      4/3  -2  -1   <- 1st constraint
+      2/3   0  -1
+      0     1   0
+      0     0   1   <- last constraint
+
+      0     3   4   <- objective row
+*/
+
+  dd_set_global_constants();
+    
+  numb=dd_Real;   /* set a number type */
+  m=4;    /* number of rows  */
+  n=3;    /* number of columns */
+  A=dd_CreateMatrix(m,n);
+  dd_set_si2(A->matrix[0][0],4,3); dd_set_si(A->matrix[0][1],-2); dd_set_si(A->matrix[0][2],-1);
+  dd_set_si2(A->matrix[1][0],2,3); dd_set_si(A->matrix[1][1], 0); dd_set_si(A->matrix[1][2],-1);
+  dd_set_si(A->matrix[2][0],0); dd_set_si(A->matrix[2][1], 1); dd_set_si(A->matrix[2][2], 0);
+  dd_set_si(A->matrix[3][0],0); dd_set_si(A->matrix[3][1], 0); dd_set_si(A->matrix[3][2], 1);
+
+  dd_set_si(A->rowvec[0],0);    dd_set_si(A->rowvec[1], 3); dd_set_si(A->rowvec[2], 4);
+
+  A->objective=dd_LPmax;
+  lp=dd_Matrix2LP(A, &err); /* load an LP */
+  if (lp==NULL) goto _L99;
+
+/* Print the LP. */
+  printf("\n--- LP to be solved  ---\n");
+  dd_WriteLP(stdout, lp);
+
+/* Solve the LP by cdd LP solver. */
+  printf("\n--- Running dd_LPSolve ---\n");
+  solver=dd_DualSimplex;
+  dd_LPSolve(lp, solver, &error);  /* Solve the LP */
+  if (error!=dd_NoError) goto _L99;
+
+/* Write the LP solutions by cdd LP reporter. */
+  dd_WriteLPResult(stdout, lp, error);
+
+/* Free allocated spaces. */
+  dd_FreeLPData(lp);
+  dd_FreeMatrix(A);
+
+_L99:;
+  if (error!=dd_NoError) dd_WriteErrorMessages(stdout, error);
+  dd_free_global_constants();  /* At the end, this should be called. */
+  return 0;
+}
+
+/* end of testlp2.c */
+
+/* The dual LP is
+
+  min  0 + 4 y1 + 2 y2
+  s.t.
+      -3 + 2 y1        >= 0
+      -4     y1 +   y2 >= 0
+             y1        >= 0
+                    y2 >= 0
+*/
diff --git a/third_party/cddlib/src/testlp3.c b/third_party/cddlib/src/testlp3.c
new file mode 100644
index 0000000..2dd1c73
--- /dev/null
+++ b/third_party/cddlib/src/testlp3.c
@@ -0,0 +1,147 @@
+/* testlp3.c: Main test program to call the cdd lp library
+   written by Komei Fukuda, fukuda@ifor.math.ethz.ch
+   Version 0.93b, October 30, 2003
+   Standard ftp site: ftp.ifor.math.ethz.ch, Directory: pub/fukuda/cdd
+*/
+
+/*  This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "setoper.h"
+#include "cdd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+FILE *reading, *writing;
+
+
+void SetWriteFile(FILE **f)
+{
+  char *fname;
+  fname="testlp.out";
+  *f = fopen(fname, "w");
+  printf("file %s is open\n",fname);
+}
+
+
+int main(int argc, char *argv[])
+{
+  /* The original LP data m x n matrix 
+     = | b   -A  |
+       | c0  c^T |,
+   
+  where the LP to be solved is to
+  maximize  c^T x  +   c0
+  subj. to
+            A   x  <=  b.
+  */
+        
+  dd_ErrorType err=dd_NoError;
+  dd_LPSolverType solver=dd_DualSimplex; 
+     /* either DualSimplex or CrissCross */
+  dd_LPPtr lp,lp1;   
+    /* pointer to LP data structure that is not visible by user. */
+  dd_LPSolutionPtr lps,lps1; 
+    /* pointer to LP solution data that is visible by user. */
+
+  dd_MatrixPtr M;
+  dd_colrange j;
+  dd_DataFileType inputfile;
+
+  dd_set_global_constants();
+
+  printf("\n--- Solving an LP with dd_LPSolve, and Finding an Interior Point  ---\n");
+
+/* Input an LP using the cdd library  */
+  dd_SetInputFile(&reading,inputfile,&err);
+  if (err!=dd_NoError) goto _L99;
+  M=dd_PolyFile2Matrix(reading, &err);
+  if (err!=dd_NoError) goto _L99;
+  /* dd_WriteMatrix(stdout, M);  */
+  lp=dd_Matrix2LP(M, &err);
+  if (err!=dd_NoError) goto _L99;
+
+/* Solve the LP by cdd LP solver. */
+  printf("\n--- Running dd_LPSolve ---\n");
+  solver=dd_DualSimplex;
+  dd_LPSolve(lp, solver, &err);  /* Solve the LP */
+  if (err!=dd_NoError) goto _L99;
+
+/* Write the LP solutions by cdd LP reporter. */
+/*  dd_WriteLPResult(stdout, lp, err); */
+/*  dd_WriteLPResult(writing, lp, err); */
+
+/* One can access the solutions by loading them.  See dd_WriteLPResult
+   for outputing the results correctly. */
+  lps=dd_CopyLPSolution(lp);
+  if (lps->LPS==dd_Optimal){
+    printf("Optimal solution found:\n");
+    printf("  primal_solution\n");
+    for (j=1; j<lps->d; j++) {
+      printf("  %3ld : ",j);
+      dd_WriteNumber(stdout,lps->sol[j]);
+      printf("\n");
+    }
+    printf("  dual_solution\n");
+    for (j=1; j<lps->d; j++){
+      if (lps->nbindex[j+1]>0) {
+        printf("  %3ld : ",lps->nbindex[j+1]);
+        dd_WriteNumber(stdout,lps->dsol[j]); printf("\n");
+      }
+    }
+    printf("  optimal_value : "); dd_WriteNumber(stdout,lps->optvalue);
+    printf("\n");
+  }
+
+/* Find an interior point with cdd LP library. */
+  printf("\n--- Running dd_FindInteriorPoint ---\n");
+  lp1=dd_MakeLPforInteriorFinding(lp);
+  printf("The LP to be solved for finding an interior point:\n");  
+  dd_WriteLP(stdout,lp1);
+  dd_LPSolve(lp1,solver,&err);
+  if (err!=dd_NoError) goto _L99;
+
+  /* Write an interior point. */
+  lps1=dd_CopyLPSolution(lp1);
+  if (dd_Positive(lps1->optvalue)){
+    printf("\nAn interior point found: (");
+    for (j=1; j <(lps1->d)-1; j++) {
+      dd_WriteNumber(stdout,lps1->sol[j]);
+    }
+    printf(")\n");
+  }
+  if (dd_Negative(lps1->optvalue)) 
+    printf("\nThe feasible region is empty.\n");
+  if (dd_EqualToZero(lps1->optvalue)) 
+    printf("\nThe feasible region is nonempty but has no interior point.\n");
+
+/* Free allocated spaces. */
+  dd_FreeLPSolution(lps);
+  dd_FreeLPData(lp);
+  dd_FreeLPSolution(lps1);
+  dd_FreeLPData(lp1);
+  dd_FreeMatrix(M);
+
+_L99:;
+  if (err!=dd_NoError) dd_WriteErrorMessages(stdout, err);
+  dd_free_global_constants();  /* At the end, this should be called. */
+  return 0;
+}
+
+/* end of testlp3.c */
+
diff --git a/third_party/cddlib/src/testshoot.c b/third_party/cddlib/src/testshoot.c
new file mode 100644
index 0000000..d963c6f
--- /dev/null
+++ b/third_party/cddlib/src/testshoot.c
@@ -0,0 +1,158 @@
+/* testshoot.c: Main test program to call the cdd lp library
+   written by Komei Fukuda, fukuda@ifor.math.ethz.ch
+   Version 0.92, August 24, 2001
+   Standard ftp site: ftp.ifor.math.ethz.ch, Directory: pub/fukuda/cdd
+*/
+
+/*  This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "setoper.h"
+#include "cdd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+FILE *reading, *writing;
+
+
+void SetWriteFile(FILE **f)
+{
+  char *fname;
+  fname="testlp.out";
+  *f = fopen(fname, "w");
+  printf("file %s is open\n",fname);
+}
+
+
+int main(int argc, char *argv[])
+{
+  /* The original LP data m x n matrix 
+     = | b   -A  |
+       | c0  c^T |,
+   
+  where the LP to be solved is to
+  maximize  c^T x  +   c0
+  subj. to
+            A   x  <=  b.
+  */
+        
+  dd_ErrorType err=dd_NoError;
+  dd_LPSolverType solver=dd_DualSimplex; 
+     /* either DualSimplex or CrissCross */
+  dd_LPPtr lp,lp1;   
+    /* pointer to LP data structure that is not visible by user. */
+  dd_LPSolutionPtr lps1; 
+    /* pointer to LP solution data that is visible by user. */
+
+  dd_rowrange i,m;
+  dd_colrange d;
+  dd_NumberType numb;
+  dd_MatrixPtr A;
+  dd_Arow r;
+  dd_colrange j;
+  int iter;
+
+/* Define an LP  */
+/*
+  max  0 + x1 + x2 
+  s.t.
+       1        -   x2  >= 0
+       1 -   x1         >= 0
+             x1         >= 0
+                    x2  >= 0
+       2 -   x1 -   x2  >= 0
+
+  For this LP, we set up a matrix A as 4 x 3 matrix and a row vector:
+
+      1   0  -1   <- 1st constraint
+      1  -1   0
+      0   1   0
+      0   0   1 
+      2  -1  -1   <- last constraint
+
+      0   1   1   <- objective row
+*/
+
+  dd_set_global_constants();
+    
+  numb=dd_Real;   /* set a number type */
+  m=5;    /* number of rows  */
+  d=3;    /* number of columns */
+  A=dd_CreateMatrix(m,d);
+  dd_set_si(A->matrix[0][0],1); dd_set_si(A->matrix[0][1], 0); dd_set_si(A->matrix[0][2],-1);
+  dd_set_si(A->matrix[1][0],1); dd_set_si(A->matrix[1][1],-1); dd_set_si(A->matrix[1][2], 0);
+  dd_set_si(A->matrix[2][0],0); dd_set_si(A->matrix[2][1], 1); dd_set_si(A->matrix[2][2], 0);
+  dd_set_si(A->matrix[3][0],0); dd_set_si(A->matrix[3][1], 0); dd_set_si(A->matrix[3][2], 1);
+  dd_set_si(A->matrix[4][0],2); dd_set_si(A->matrix[4][1],-1); dd_set_si(A->matrix[4][2],-1);
+
+  dd_set_si(A->rowvec[0],0);    dd_set_si(A->rowvec[1], 1); dd_set_si(A->rowvec[2], 1);
+
+  A->objective=dd_LPmax;
+  lp=dd_Matrix2LP(A, &err); /* load an LP */
+  if (lp==NULL) goto _L99;
+
+/* Find an interior point with cdd LP library. */
+    printf("\n--- Running dd_FindInteriorPoint ---\n");
+    lp1=dd_MakeLPforInteriorFinding(lp);
+    dd_LPSolve(lp1,solver,&err);
+    if (err!=dd_NoError) goto _L99;
+
+    /* Write an interior point. */
+    lps1=dd_CopyLPSolution(lp1);
+    if (dd_Positive(lps1->optvalue)){
+      printf("An interior point found: (");
+      for (j=1; j <(lps1->d)-1; j++) {
+        dd_WriteNumber(stdout,lps1->sol[j]);
+      }
+      printf(")\n");
+    }
+    if (dd_Negative(lps1->optvalue)) 
+      printf("The feasible region is empty.\n");
+    if (dd_EqualToZero(lps1->optvalue)) 
+      printf("The feasible region is nonempty but has no interior point.\n");
+
+/* Do shootings from the interior point. */
+
+  dd_InitializeArow(d, &r);
+
+  printf("Shooting test from the point:");
+  dd_WriteArow(stdout,lps1->sol,d);  printf("\n");
+
+  for (iter=1; iter<=3; iter++){
+    dd_set_si(r[0],0); dd_set_si(r[1], 9998+iter); dd_set_si(r[2], 10000);
+    printf("Shooting to the direction:");
+    dd_WriteArow(stdout,r,d);  printf("\n");
+    i=dd_RayShooting(A, lps1->sol, r);
+    printf("The first hyperplane hit: %ld.\n\n", i);
+  }
+
+/* Free allocated spaces. */
+  dd_FreeLPData(lp);
+  dd_FreeLPSolution(lps1);
+  dd_FreeLPData(lp1);
+  dd_FreeArow(d, r);
+  dd_FreeMatrix(A);
+
+_L99:;
+  if (err!=dd_NoError) dd_WriteErrorMessages(stdout, err);
+  dd_free_global_constants();  /* At the end, this should be called. */
+  return 0;
+}
+
+/* end of testlp3.c */
+
diff --git a/third_party/cddlib/src/testuniq.c b/third_party/cddlib/src/testuniq.c
new file mode 100644
index 0000000..6bb1a19
--- /dev/null
+++ b/third_party/cddlib/src/testuniq.c
@@ -0,0 +1,165 @@
+/* uniqtest.c: Test program to call the cdd library cddlib
+   written by Komei Fukuda, fukuda@ifor.math.ethz.ch
+   Version 0.93c, Nov. 14, 2003
+   Standard ftp site: ftp.ifor.math.ethz.ch, Directory: pub/fukuda/cdd
+*/
+
+/*  This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "setoper.h"
+#include "cdd.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+dd_boolean SetInputFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+  success=dd_FALSE;
+
+  if ( ( *f = fopen(fname, "r") )!= NULL) {
+    printf("input file %s is open\n", fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The input file %s not found\n",fname);
+  }
+  return success;
+}
+
+dd_boolean SetWriteFile(FILE **f, dd_DataFileType fname)
+{
+  dd_boolean success=dd_FALSE;
+
+  if ( (*f = fopen(fname, "w")) != NULL){
+    printf("output file %s is open\n",fname);
+    success=dd_TRUE;
+  }
+  else{
+    printf("The output file %s cannot be opened\n",fname);
+  }
+  return success;
+}
+
+
+int main(int argc, char *argv[])
+{
+  dd_MatrixPtr M=NULL,M1=NULL,M2=NULL;
+  dd_rowrange i;
+  dd_colrange d;
+  dd_ErrorType err=dd_NoError;
+  dd_rowset redrows,linrows,posset;
+  dd_rowindex newpos=NULL, newpos1=NULL, newpos2=NULL;
+  mytype val;
+  dd_DataFileType inputfile;
+  FILE *reading=NULL;
+  int foi;
+  dd_Arow certificate;
+
+  dd_set_global_constants();  /* First, this must be called. */
+
+  dd_init(val);
+  if (argc>1) strcpy(inputfile,argv[1]);
+  if (argc<=1 || !SetInputFile(&reading,argv[1])){
+    dd_WriteProgramDescription(stdout);
+    fprintf(stdout,"\ncddlib test program to remove duplicates.\n");
+    dd_SetInputFile(&reading,inputfile, &err);
+  }
+  if (err==dd_NoError) {
+    M=dd_PolyFile2Matrix(reading, &err);
+  }
+  else {
+    fprintf(stderr,"Input file not found\n");
+    goto _L99;
+  }
+
+  if (err!=dd_NoError) goto _L99;
+
+  d=M->colsize;
+  
+  /* 
+  printf("\nInput Matrix.\n");
+  dd_WriteMatrix(stdout, M); 
+  */
+ 
+  M1=dd_MatrixSortedUniqueCopy(M,&newpos1);
+  printf("\nSort and remove duplicates with dd_MatrixSortedUniqueCopy.\n");
+  printf(" Row index changes -- original:new\n");
+  for (i=1;i<=M->rowsize; i++){
+    printf(" %ld:%ld",i,newpos1[i]);
+  }
+  printf("\n");
+  /* dd_WriteMatrix(stdout, M1); */
+
+  dd_InitializeArow(M1->colsize+2, &certificate);
+  fprintf(stdout, "\nCheck whether the system contains an implicit linearity.\n");
+  foi=dd_FreeOfImplicitLinearity(M1, certificate, &posset, &err);
+  switch (foi) {
+    case 1:
+         fprintf(stdout, "  It is free of implicit linearity.\n");
+      break;
+      
+    case 0:
+         fprintf(stdout, "  It is not free of implicit linearity.\n");
+      break;
+
+    case -1:
+         fprintf(stdout, "  The input system is trivial (i.e. the empty H-polytope or the V-rep of the whole space.\n");
+      break;
+  }
+
+
+  fprintf(stdout, "\nOne can then remove nontrivial redundant rows with dd_RedundantRows.\n Redundant rows:\n");
+  redrows=dd_RedundantRowsWithPresorting(M1, &err);
+  /* redrows=dd_RedundantRows(M1, &err);  */
+  set_fwrite(stdout, redrows);
+  printf("\n");
+
+  M2=dd_MatrixSubmatrix2(M1, redrows, &newpos);
+  dd_FreeMatrix(M1);
+  set_free(redrows);
+  free(newpos);
+  
+  fprintf(stdout, " Implicit linearity (after removal of redundant rows): ");
+  linrows=dd_ImplicitLinearityRows(M2, &err);
+
+  if (M->representation==dd_Generator)
+    fprintf(stdout," %ld  ", set_card(linrows));
+  else 
+    fprintf(stdout," %ld  ", set_card(linrows));
+  set_fwrite(stdout,linrows);
+  set_uni(M2->linset, M2->linset, linrows); 
+    /* add the implicit linrows to the given linearity rows */
+
+  printf("\nNonredundant representation (except for the linearity part):\n");
+  dd_WriteMatrix(stdout, M2);
+  dd_WriteLPStats(stdout);
+  set_free(linrows);
+
+  dd_FreeMatrix(M);
+  dd_FreeMatrix(M2);
+  dd_clear(val);
+  free(newpos1); free(newpos2);
+
+_L99:;
+  /* if (err!=dd_NoError) dd_WriteErrorMessages(stderr,err); */
+  return 0;
+}
+
+
+/* end of uniqtest.c */