diff options
author | 2010-11-08 23:19:56 +0000 | |
---|---|---|
committer | 2010-11-08 23:19:56 +0000 | |
commit | 92b2fd92868232dd7b4fbd6cf8954725c1afd9d4 (patch) | |
tree | 7a095da52d6cbb016399371238d063d99c1e6c66 /sci-libs/cddlib | |
parent | Automated update of use.local.desc (diff) | |
download | historical-92b2fd92868232dd7b4fbd6cf8954725c1afd9d4.tar.gz historical-92b2fd92868232dd7b4fbd6cf8954725c1afd9d4.tar.bz2 historical-92b2fd92868232dd7b4fbd6cf8954725c1afd9d4.zip |
new package: sci-libs/cddlib imported from science overlay. Fixes bug #230423.
Package-Manager: portage-2.1.9.24/cvs/Linux i686
Diffstat (limited to 'sci-libs/cddlib')
-rw-r--r-- | sci-libs/cddlib/ChangeLog | 13 | ||||
-rw-r--r-- | sci-libs/cddlib/Manifest | 17 | ||||
-rw-r--r-- | sci-libs/cddlib/cddlib-094f-r2.ebuild | 44 | ||||
-rw-r--r-- | sci-libs/cddlib/files/cdd_both_reps.c | 255 | ||||
-rw-r--r-- | sci-libs/cddlib/files/cddlib-094f-add-cdd_both_reps-binary.patch | 41 | ||||
-rw-r--r-- | sci-libs/cddlib/files/cddlib-094f-use-libtool.patch | 54 | ||||
-rw-r--r-- | sci-libs/cddlib/metadata.xml | 23 |
7 files changed, 447 insertions, 0 deletions
diff --git a/sci-libs/cddlib/ChangeLog b/sci-libs/cddlib/ChangeLog new file mode 100644 index 000000000000..ed38d096f50a --- /dev/null +++ b/sci-libs/cddlib/ChangeLog @@ -0,0 +1,13 @@ +# ChangeLog for sci-libs/cddlib +# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/sci-libs/cddlib/ChangeLog,v 1.1 2010/11/08 23:19:56 tomka Exp $ + +*cddlib-094f-r2 (08 Nov 2010) + + 08 Nov 2010; Thomas Kahle <tomka@gentoo.org> +cddlib-094f-r2.ebuild, + +files/cddlib-094f-add-cdd_both_reps-binary.patch, + +files/cddlib-094f-use-libtool.patch, +files/cdd_both_reps.c, + +metadata.xml: + new package imported from science overlay. Fixes bug #230423 + Thanks to everyone on {sage,science}@g.o for contributions to this ebuild. + diff --git a/sci-libs/cddlib/Manifest b/sci-libs/cddlib/Manifest new file mode 100644 index 000000000000..a365c2c8d6e7 --- /dev/null +++ b/sci-libs/cddlib/Manifest @@ -0,0 +1,17 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +AUX cdd_both_reps.c 6439 RMD160 a46e70670b54fd475b6c775c2399466ec81fe5c6 SHA1 3b100131a2aee92b4a423b42338f84c2e7235b40 SHA256 a0a799dfffd38447cf4e513e92780ca89429abf0c2ea6d983811fdf856613e65 +AUX cddlib-094f-add-cdd_both_reps-binary.patch 1208 RMD160 d2baaf2485edc1e8e23b49b160a160da0545c1c1 SHA1 593dcdf79519c84de3b2255b83f9687d7aba7f45 SHA256 71d72d7e5cb6644cf887322c82d037bc418132b99a6644dd7e63d07d063ec067 +AUX cddlib-094f-use-libtool.patch 1704 RMD160 e707b7374a46ada13beea1dbba9bb7ac2b845aad SHA1 aa1851b13964d2a52cb0b11fee3ab35deaca6d14 SHA256 90d9e9695b11ecf8a924c990f4ee1c1dd2ed6c856b127527150cabf84fb00e7c +DIST cddlib-094f.tar.gz 1530224 RMD160 b3b967942523267d155a18bc39a8cb3849b4f221 SHA1 1d003e88898eb259be2524da7bb1590a0a5bbdb1 SHA256 b01b6e8b7aedcfe59aecd253ad2b76e61e69847f0a681a85d2976e8e6c241846 +EBUILD cddlib-094f-r2.ebuild 1180 RMD160 36be1fa34b1116b51f5a9968451f00f47d31fc9c SHA1 155223f7cff074700a5e4b50cad97f32fe395042 SHA256 042072df8f3f081fc49a8a021a76156709ac6bee56f54d0ab0052c7ed6dec021 +MISC ChangeLog 579 RMD160 70abcca93e62857e36990eb0851087ad72d4133a SHA1 695fd6ac061b4bb4cccedb2d7a528d569ecc7810 SHA256 4354857a8ac2f4bb8b48dc68815f34b88c98bbc7ee74f3e6d45a20f33d92adb0 +MISC metadata.xml 966 RMD160 d6b48f1679ac7ecdd9b6e96734d05bf289935c4e SHA1 7caacf4d529ff3e92649d38afedf8d514c64def6 SHA256 f1c6e562ba9dba0c83a5c595846bfa93f9dbae9ad05988fdaf3ea70ee06ff475 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2.0.16 (GNU/Linux) + +iEYEARECAAYFAkzYhaIACgkQnZsgo/h8kNajiwCfSJBMDs0cjcuUe15XYvzWV1Iy +EPAAn1t245ZGVnqRpSgHU1QgvD5AThLk +=Tk6D +-----END PGP SIGNATURE----- diff --git a/sci-libs/cddlib/cddlib-094f-r2.ebuild b/sci-libs/cddlib/cddlib-094f-r2.ebuild new file mode 100644 index 000000000000..d4172763308f --- /dev/null +++ b/sci-libs/cddlib/cddlib-094f-r2.ebuild @@ -0,0 +1,44 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sci-libs/cddlib/cddlib-094f-r2.ebuild,v 1.1 2010/11/08 23:19:56 tomka Exp $ + +EAPI="3" + +inherit autotools-utils + +DESCRIPTION="C implementation of the Double Description Method of Motzkin et al." +HOMEPAGE="http://www.ifor.math.ethz.ch/~fukuda/cdd_home/" +SRC_URI="ftp://ftp.ifor.math.ethz.ch/pub/fukuda/cdd/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux" +IUSE="doc static-libs" + +DEPEND=">=dev-libs/gmp-4.2.2" +RDEPEND="${DEPEND}" + +AUTOTOOLS_IN_SOURCE_BUILD="1" +DOCS=( ChangeLog README ) +PATCHES=( + "${FILESDIR}"/${PN}-094f-use-libtool.patch + "${FILESDIR}"/${PN}-094f-add-cdd_both_reps-binary.patch +) + +src_prepare() { + autotools-utils_src_prepare + eautoreconf + + cp "${FILESDIR}"/cdd_both_reps.c "${S}"/src/ \ + || die "failed to copy source file" + ln -s "${S}"/src/cdd_both_reps.c "${S}"/src-gmp/cdd_both_reps.c \ + || die "failed to make symbolic link to source file" +} + +src_install() { + if use doc ; then + DOCS=( ${DOCS[@]} doc/cddlibman.pdf doc/cddlibman.ps ) + fi + + autotools-utils_src_install +} diff --git a/sci-libs/cddlib/files/cdd_both_reps.c b/sci-libs/cddlib/files/cdd_both_reps.c new file mode 100644 index 000000000000..3de4247e3016 --- /dev/null +++ b/sci-libs/cddlib/files/cdd_both_reps.c @@ -0,0 +1,255 @@ +/* cdd_both_reps.c: compute reduced H and V representation of polytope + by Volker Braun <vbraun@stp.dias.ie> + + The input is taken from stdin and can be either a + H or V representation, not necessarily reduced. + + based on testcdd1.c, redcheck.c, and of course the cdd library + written by Komei Fukuda, fukuda@ifor.math.ethz.ch + 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> + + + + + +void compute_adjacency(dd_MatrixPtr Rep, dd_ErrorType* err_ptr) +{ + dd_SetFamilyPtr AdjacencyGraph; + if (*err_ptr != dd_NoError) return; + + switch (Rep->representation) { + case dd_Inequality: + printf("Facet graph\n"); + break; + case dd_Generator: + printf("Vertex graph\n"); + break; + case dd_Unspecified: + printf("unknown representation type!\n"); + default: + printf("This should be unreachable!\n"); + exit(2); + } + + /* Output adjacency of vertices/rays/lines */ + if (Rep->rowsize > 0) { /* workaround for bug with empty polyhedron */ + /* compute adjacent vertices/rays/lines */ + AdjacencyGraph = dd_Matrix2Adjacency(Rep, err_ptr); + if (*err_ptr == dd_NoError) { + dd_WriteSetFamily(stdout,AdjacencyGraph); + dd_FreeSetFamily(AdjacencyGraph); + } + } else { + printf("begin\n"); + printf(" 0 0\n"); + printf("end\n"); + } + + printf("\n"); +} + + +void minimal_Vrep_Hrep(dd_MatrixPtr M, + dd_MatrixPtr* Vrep_ptr, dd_MatrixPtr* Hrep_ptr, + dd_ErrorType* err_ptr) +{ + dd_PolyhedraPtr poly; + dd_rowindex newpos; + dd_rowset impl_linset,redset; + dd_MatrixPtr Vrep, Hrep; + + if (*err_ptr != dd_NoError) return; + + /* compute the second representation */ + poly = dd_DDMatrix2Poly(M, err_ptr); + if (*err_ptr != dd_NoError) return; + + if (*err_ptr == dd_NoError) { + /* compute canonical H-representation */ + Hrep = dd_CopyInequalities(poly); + if (Hrep->rowsize > 0) { /* workaround for bug with empty matrix */ + dd_MatrixCanonicalize(&Hrep, &impl_linset, &redset, &newpos, err_ptr); + if (*err_ptr == dd_NoError) { + set_free(redset); + set_free(impl_linset); + free(newpos); + } + } + if (*err_ptr == dd_NoError) (*Hrep_ptr) = Hrep; + } + + if (*err_ptr == dd_NoError) { + /* compute canonical V-representation */ + Vrep = dd_CopyGenerators(poly); + if (Vrep->rowsize > 0) { /* workaround for bug with empty matrix */ + dd_MatrixCanonicalize(&Vrep, &impl_linset, &redset, &newpos, err_ptr); + if (*err_ptr == dd_NoError) { + set_free(redset); + set_free(impl_linset); + free(newpos); + } + } + if (*err_ptr == dd_NoError) (*Vrep_ptr) = Vrep; + } + + dd_FreePolyhedra(poly); +} + + +void print_both_reps(dd_MatrixPtr Vrep, dd_MatrixPtr Hrep) +{ + /* Output V-representation */ + dd_WriteMatrix(stdout,Vrep); + printf("\n"); + + /* Output H-representation */ + dd_WriteMatrix(stdout,Hrep); + printf("\n"); +} + + +void compute_both_reps(dd_MatrixPtr M, dd_ErrorType* err_ptr) +{ + dd_MatrixPtr Vrep, Hrep; + minimal_Vrep_Hrep(M, &Vrep, &Hrep, err_ptr); + if (*err_ptr != dd_NoError) return; + + print_both_reps(Vrep, Hrep); + dd_FreeMatrix(Hrep); + dd_FreeMatrix(Vrep); +} + + +void compute_all(dd_MatrixPtr M, dd_ErrorType* err_ptr) +{ + dd_MatrixPtr Vrep, Hrep; + minimal_Vrep_Hrep(M, &Vrep, &Hrep, err_ptr); + if (*err_ptr != dd_NoError) return; + + print_both_reps(Vrep, Hrep); + compute_adjacency(Vrep, err_ptr); + compute_adjacency(Hrep, err_ptr); + dd_FreeMatrix(Hrep); + dd_FreeMatrix(Vrep); +} + + + +void usage(char *name) +{ + printf("No known option specified, I don't know what to do!\n" + "Usage:\n" + "%s --option\n" + "where --option is precisely one of the following:\n\n" + " --all: Compute everything.\n" + " This will compute minimal H-,V-representation and vertex and facet graph.\n" + "\n" + " --reps: Compute both a minimal H- and minimal V-representation.\n" + "\n" + " --adjacency: Compute adjacency information only.\n" + " The input is assumed to be a minimal representation, as, for example, computed\n" + " by --reps. Warning, you will not get the correct answer if the input\n" + " representation is not minimal! The output is the vertex or facet graph,\n" + " depending on the input.\n" + "\n" + "The input data is a H- or V-representation in cdd's ine/ext format and\n" + "is in each case read from stdin.\n", + name); +} + + +enum command_line_arguments { ALL, REPS, ADJACENCY }; + + +int parse_arguments(char* arg, enum command_line_arguments* option) +{ + if (strcmp(arg,"--all")==0) { + *option = ALL; + return 0; + } + if (strcmp(arg,"--reps")==0) { + *option = REPS; + return 0; + } + if (strcmp(arg,"--adjacency")==0) { + *option = ADJACENCY; + return 0; + } + printf("Unknown option: %s\n", arg); + return 1; +} + + +int main(int argc, char *argv[]) +{ + dd_ErrorType err=dd_NoError; + dd_MatrixPtr M; + enum command_line_arguments option; + + if (argc!=2 || parse_arguments(argv[1],&option)) { + usage(argv[0]); + return 0; + } + + dd_set_global_constants(); + + /* Read data from stdin */ + M = dd_PolyFile2Matrix(stdin, &err); + if (err != dd_NoError) { + printf("I was unable to parse the input data!\n"); + dd_WriteErrorMessages(stdout,err); + dd_free_global_constants(); + return 1; + } + + switch (option) { + case ALL: + compute_all(M,&err); + break; + case REPS: + compute_both_reps(M,&err); + break; + case ADJACENCY: + compute_adjacency(M,&err); + break; + default: + printf("unreachable option %d\n", option); + exit(3); /* unreachable */ + } + + /* cleanup */ + dd_FreeMatrix(M); + if (err != dd_NoError) { + dd_WriteErrorMessages(stdout,err); + } + + dd_free_global_constants(); + return 0; +} + + + diff --git a/sci-libs/cddlib/files/cddlib-094f-add-cdd_both_reps-binary.patch b/sci-libs/cddlib/files/cddlib-094f-add-cdd_both_reps-binary.patch new file mode 100644 index 000000000000..3c7392db7244 --- /dev/null +++ b/sci-libs/cddlib/files/cddlib-094f-add-cdd_both_reps-binary.patch @@ -0,0 +1,41 @@ +--- src-gmp/Makefile.am 2009-01-26 09:30:16.000000000 +0000 ++++ src-gmp/Makefile.am 2009-10-04 10:36:17.000000000 +0100 +@@ -11,7 +11,8 @@ + testcdd2_gmp \ + testlp1_gmp \ + testlp2_gmp \ +-testlp3_gmp ++testlp3_gmp \ ++cdd_both_reps_gmp + #cddmathlink + + scdd_gmp_SOURCES = simplecdd.c +@@ -27,6 +28,7 @@ + testlp1_gmp_SOURCES = testlp1.c + testlp2_gmp_SOURCES = testlp2.c + testlp3_gmp_SOURCES = testlp3.c ++cdd_both_reps_gmp_SOURCES = cdd_both_reps.c + # cddmathlink_SOURCES = cddmathlink.c cddmlio.h cddmlio.c + + LDADD = ../lib-src-gmp/libcddgmp.a +--- src/Makefile.am 2009-01-26 09:30:03.000000000 +0000 ++++ src/Makefile.am 2009-10-04 10:36:17.000000000 +0100 +@@ -11,7 +11,8 @@ + testcdd2 \ + testlp1 \ + testlp2 \ +-testlp3 ++testlp3 \ ++cdd_both_reps + #cddmathlink + + scdd_SOURCES = simplecdd.c +@@ -27,6 +28,7 @@ + testlp1_SOURCES = testlp1.c + testlp2_SOURCES = testlp2.c + testlp3_SOURCES = testlp3.c ++cdd_both_reps_SOURCES = cdd_both_reps.c + # cddmathlink_SOURCES = cddmathlink.c cddmlio.h cddmlio.c + + LDADD = ../lib-src/libcdd.a + diff --git a/sci-libs/cddlib/files/cddlib-094f-use-libtool.patch b/sci-libs/cddlib/files/cddlib-094f-use-libtool.patch new file mode 100644 index 000000000000..219f6d9eb371 --- /dev/null +++ b/sci-libs/cddlib/files/cddlib-094f-use-libtool.patch @@ -0,0 +1,54 @@ +--- configure.in.orig 2008-02-07 09:57:13.000000000 +1300 ++++ configure.in 2008-05-26 08:59:21.000000000 +1200 +@@ -7,7 +7,7 @@ + dnl Checks for programs. + AC_PROG_CC + AC_PROG_INSTALL +-AC_PROG_RANLIB ++AC_PROG_LIBTOOL + + dnl Checks for libraries. + dnl Replace `main' with a function in -lg: +--- lib-src-gmp/Makefile.am.orig 2008-02-07 09:57:13.000000000 +1300 ++++ lib-src-gmp/Makefile.am 2008-05-26 08:55:35.000000000 +1200 +@@ -1,6 +1,6 @@ +-lib_LIBRARIES = libcddgmp.a ++lib_LTLIBRARIES = libcddgmp.la + +-libcddgmp_a_SOURCES = \ ++libcddgmp_la_SOURCES = \ + cddcore.c \ + cddlp.c \ + cddmp.c \ +--- lib-src/Makefile.am.orig 2008-02-07 09:57:14.000000000 +1300 ++++ lib-src/Makefile.am 2008-05-26 08:56:38.000000000 +1200 +@@ -1,6 +1,6 @@ +-lib_LIBRARIES = libcdd.a ++lib_LTLIBRARIES = libcdd.la + +-libcdd_a_SOURCES = \ ++libcdd_la_SOURCES = \ + cddcore.c \ + cddlp.c \ + cddmp.c \ +--- src/Makefile.am.orig 2008-02-07 09:57:15.000000000 +1300 ++++ src/Makefile.am 2008-05-26 08:57:49.000000000 +1200 +@@ -29,6 +29,6 @@ + testlp3_SOURCES = testlp3.c + # cddmathlink_SOURCES = cddmathlink.c cddmlio.h cddmlio.c + +-LDADD = ../lib-src/libcdd.a ++LDADD = ../lib-src/libcdd.la + INCLUDES = -I../lib-src + AM_CPPFLAGS = -UGMPRATIONAL +--- src-gmp/Makefile.am.orig 2008-02-07 09:57:14.000000000 +1300 ++++ src-gmp/Makefile.am 2008-05-26 08:58:35.000000000 +1200 +@@ -29,7 +29,7 @@ + testlp3_gmp_SOURCES = testlp3.c + # cddmathlink_SOURCES = cddmathlink.c cddmlio.h cddmlio.c + +-LDADD = ../lib-src-gmp/libcddgmp.a ++LDADD = ../lib-src-gmp/libcddgmp.la + AM_LDFLAGS = -L$(gmplibdir) + INCLUDES = -I../lib-src-gmp + INCLUDES += -I$(gmpincludedir) diff --git a/sci-libs/cddlib/metadata.xml b/sci-libs/cddlib/metadata.xml new file mode 100644 index 000000000000..bd4ad9cac933 --- /dev/null +++ b/sci-libs/cddlib/metadata.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <herd>sci</herd> +<longdescription lang="en"> +The C-library cddlib is a C implementation of the Double Description +Method of Motzkin et al. for generating all vertices (i.e. extreme points) +and extreme rays of a general convex polyhedron in R^d given by a system +of linear inequalities: + + P = { x=(x1, ..., xd)^T : b - A x >= 0 } + +where A is a given m x d real matrix, b is a given m-vector +and 0 is the m-vector of all zeros. + +The program can be used for the reverse operation (i.e. convex hull +computation). This means that one can move back and forth between +an inequality representation and a generator (i.e. vertex and ray) +representation of a polyhedron with cdd. Also, cdd can solve a linear +programming problem, i.e. a problem of maximizing and minimizing +a linear function over P. +</longdescription> +</pkgmetadata> |