summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Fabbro <bicatali@gentoo.org>2008-02-05 17:55:30 +0000
committerSebastien Fabbro <bicatali@gentoo.org>2008-02-05 17:55:30 +0000
commita453070e6479922986a538817f96ac4a6abd7adc (patch)
tree51863fd731da3e43f8a0976b74085bd4f3bd38aa
parentadded local use flags for sci-libs/metis (diff)
downloadhistorical-a453070e6479922986a538817f96ac4a6abd7adc.tar.gz
historical-a453070e6479922986a538817f96ac4a6abd7adc.tar.bz2
historical-a453070e6479922986a538817f96ac4a6abd7adc.zip
Initial import. Closing bug #53394.
Package-Manager: portage-2.1.4
-rw-r--r--sci-libs/metis/ChangeLog13
-rw-r--r--sci-libs/metis/Manifest18
-rw-r--r--sci-libs/metis/files/metis-4.0.1-autotools.patch66
-rw-r--r--sci-libs/metis/files/metis-5.0_pre2-autotools.patch534
-rw-r--r--sci-libs/metis/metadata.xml12
-rw-r--r--sci-libs/metis/metis-4.0.1.ebuild32
-rw-r--r--sci-libs/metis/metis-5.0_pre2.ebuild63
7 files changed, 738 insertions, 0 deletions
diff --git a/sci-libs/metis/ChangeLog b/sci-libs/metis/ChangeLog
new file mode 100644
index 000000000000..579eb82312b8
--- /dev/null
+++ b/sci-libs/metis/ChangeLog
@@ -0,0 +1,13 @@
+# ChangeLog for sci-libs/metis
+# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sci-libs/metis/ChangeLog,v 1.1 2008/02/05 17:55:29 bicatali Exp $
+
+*metis-5.0_pre2 (05 Feb 2008)
+*metis-4.0.1 (05 Feb 2008)
+
+ 05 Feb 2008; SĂ©bastien Fabbro <bicatali@gentoo.org>
+ +files/metis-4.0.1-autotools.patch, +files/metis-5.0_pre2-autotools.patch,
+ +metadata.xml, +metis-4.0.1.ebuild, +metis-5.0_pre2.ebuild:
+ Initial import. Closing bug #53394. Thanks Tiago Quintinho, Justin Bronder
+ for their work.
+
diff --git a/sci-libs/metis/Manifest b/sci-libs/metis/Manifest
new file mode 100644
index 000000000000..babb5abe8d07
--- /dev/null
+++ b/sci-libs/metis/Manifest
@@ -0,0 +1,18 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+AUX metis-4.0.1-autotools.patch 2509 RMD160 0596ad205da8e8c6d08753949c085548baaff13d SHA1 637d00f949f41dcceda69ace40d0b36bd6b013bf SHA256 88f26e11ceec1fee301e29cb25ab7ae6a1c82b8331fae01fe1c912434f2efacc
+AUX metis-5.0_pre2-autotools.patch 14953 RMD160 e251c3dc3f49ff8db269e2e7d7c0d8cdb1f57c23 SHA1 b0b6676a1c90f76c1ca50fc37426944cc6a23f1e SHA256 e4a66c4036850b4cc671f3dd53b9ae3a508240e7c8381b1e30afd0043c7f7463
+DIST metis-4.0.tar.gz 508601 RMD160 21dc1451b9385d292afa428f0c17e8283b00f6b7 SHA1 580568308e1fa40e5a7a77cacbf27f865d6c01af SHA256 60c792b3fd22684ef16e336d654466753365006b6f9932e031ded79a9b6bd352
+DIST metis-5.0pre2.tar.gz 1762166 RMD160 f73bc5c9b5b2458065dd2ebdc6aa3881541016c1 SHA1 7f94fac339b7bc52eb3e874b5046f563ee3c9e07 SHA256 3a81ee72ddcaa573afbec005e777a273717cb9d6475f381f07f78f89180f58aa
+EBUILD metis-4.0.1.ebuild 815 RMD160 488fe69c701bfea540a42caa1548175e3a519f0f SHA1 dc46b0434229aa0612ab74af80c17225b21a430b SHA256 9493f0510b5c9f208e7034bf85fdfe536d29545a114c5a2c889f8521cc95bfa8
+EBUILD metis-5.0_pre2.ebuild 1602 RMD160 29f4314182e6c7e015dec4d87956e834ece15d75 SHA1 363e4dfa0516be9a8df785de740d8e1732657e33 SHA256 fb067b2194928db9846b1711d26bf23f17b94bb406aa9ef871bfa4180c46da7a
+MISC ChangeLog 551 RMD160 23704e3db96a83112c147a9537faba731dd209dc SHA1 a18264302ce1d50ba972a9e8a37dc52277c71e55 SHA256 b08e4c5342d16fd744be46c70b9a26e480bd2d3a8c1b3e195579242bc46a40da
+MISC metadata.xml 513 RMD160 bc0c018b8844b7d882938fb4f51c3707fe5eb8af SHA1 1e036b838879d7b2d8a7e95bf622628470df4bea SHA256 a1b475d5c8575f5dff7e31ec60f7a95593c141f0c3e1ab032d8986725dc53719
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.7 (GNU/Linux)
+
+iD8DBQFHqKMa1ycZbhPLE2ARAvcdAJ0ZQebnFJk4Ni8MrAt91V5D58odBQCeIC+w
+UvzEZSo/wzauC1C9cVUvPOs=
+=ly1T
+-----END PGP SIGNATURE-----
diff --git a/sci-libs/metis/files/metis-4.0.1-autotools.patch b/sci-libs/metis/files/metis-4.0.1-autotools.patch
new file mode 100644
index 000000000000..4b2c7f9b1e88
--- /dev/null
+++ b/sci-libs/metis/files/metis-4.0.1-autotools.patch
@@ -0,0 +1,66 @@
+--- configure.ac 1970-01-01 01:00:00.000000000 +0100
++++ configure.ac 2008-01-30 21:47:22.597386731 +0000
+@@ -0,0 +1,9 @@
++# -*- Autoconf -*-
++AC_PREREQ(2.59)
++AC_INIT(metis,4.0.1,karypis@cs.umn.edu)
++AM_INIT_AUTOMAKE([foreign])
++AC_PROG_INSTALL
++AC_PROG_LIBTOOL
++AC_CHECK_LIB(m, sqrt)
++AC_CONFIG_FILES([Makefile Lib/Makefile Programs/Makefile Test/Makefile])
++AC_OUTPUT
+--- ./Lib/Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ ./Lib/Makefile.am 2008-01-31 15:03:42.814421420 +0000
+@@ -0,0 +1,16 @@
++include_HEADERS = defs.h macros.h metis.h proto.h rename.h struct.h
++pkgincludedir = $(includedir)/metis
++lib_LTLIBRARIES = libmetis.la
++libmetis_la_SOURCES = \
++ coarsen.c fm.c initpart.c match.c ccgraph.c memory.c \
++ pmetis.c pqueue.c refine.c util.c timing.c debug.c \
++ bucketsort.c graph.c stat.c kmetis.c kwayrefine.c \
++ kwayfm.c balance.c ometis.c srefine.c sfm.c separator.c \
++ mincover.c mmd.c mesh.c meshpart.c frename.c fortran.c \
++ myqsort.c compress.c parmetis.c estmem.c \
++ mpmetis.c mcoarsen.c mmatch.c minitpart.c mbalance.c \
++ mrefine.c mutil.c mfm.c mkmetis.c mkwayrefine.c mkwayfmh.c \
++ mrefine2.c minitpart2.c mbalance2.c mfm2.c \
++ kvmetis.c kwayvolrefine.c kwayvolfm.c subdomains.c
++libmetis_la_LIBADD = -lm
++libmetis_la_LDFLAGS = -no-undefined -version-info 4:0:0
+--- ./Programs/Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ ./Programs/Makefile.am 2008-01-31 12:00:14.981124649 +0000
+@@ -0,0 +1,15 @@
++AM_CPPFLAGS = -I$(top_srcdir)/Lib
++LDADD = $(top_builddir)/Lib/libmetis.la -lm
++
++bin_PROGRAMS = pmetis kmetis oemetis onmetis mesh2dual mesh2nodal \
++ partdmesh partnmesh graphchk
++
++pmetis_SOURCES = pmetis.c io.c
++kmetis_SOURCES = kmetis.c io.c
++oemetis_SOURCES = oemetis.c io.c smbfactor.c
++onmetis_SOURCES = onmetis.c io.c smbfactor.c
++mesh2dual_SOURCES = mesh2dual.c io.c
++mesh2nodal_SOURCES = mesh2nodal.c io.c
++partdmesh_SOURCES = partdmesh.c io.c
++partnmesh_SOURCES = partnmesh.c io.c
++graphchk_SOURCES = graphchk.c io.c
+--- ./Test/Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ ./Test/Makefile.am 2008-01-31 12:37:59.532517099 +0000
+@@ -0,0 +1,7 @@
++AM_CPPFLAGS = -I$(top_srcdir)/Lib
++LDADD = $(top_builddir)/Lib/libmetis.la -lm
++check_PROGRAMS = mtest
++mtest_SOURCES = mtest.c ../Programs/io.c
++
++check-local: $(check_PROGRAMS)
++ - ./mtest ../Graphs/4elt.graph
+--- ./Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ ./Makefile.am 2008-01-30 21:15:58.990578962 +0000
+@@ -0,0 +1,4 @@
++SUBDIRS = Lib Programs Test
++EXTRA_DIST = CHANGES
++
++
diff --git a/sci-libs/metis/files/metis-5.0_pre2-autotools.patch b/sci-libs/metis/files/metis-5.0_pre2-autotools.patch
new file mode 100644
index 000000000000..8bbce5d0db1b
--- /dev/null
+++ b/sci-libs/metis/files/metis-5.0_pre2-autotools.patch
@@ -0,0 +1,534 @@
+--- configure.ac 1970-01-01 01:00:00.000000000 +0100
++++ configure.ac 2007-09-24 15:12:11.917289395 +0100
+@@ -0,0 +1,54 @@
++AC_INIT([metis], [5.0pre2], [metis@cs.umn.edu], [metis])
++AM_INIT_AUTOMAKE([foreign])
++
++AC_PROG_MAKE_SET
++AC_PROG_LIBTOOL
++
++AC_CHECK_LIB(m, [sqrt, pow, log])
++
++AC_ARG_ENABLE(openmp,
++ [AC_HELP_STRING([--enable-openmp],
++ [compile with openmp])],
++ [enable_openmp=$enableval],
++ [enable_openmp="yes"])
++AC_MSG_RESULT($enable_openmp)
++
++if test x$enable_openmp = xyes; then
++ AC_CHECK_HEADERS(omp.h)
++ OMP_CPPFLAGS=-D__OPENMP__
++ if test x$CC = xicc; then
++ OMP_CFLAGS="-openmp -openmp-report2"
++ OMP_LDFLAGS=-openmp
++ else
++ OMP_CFLAGS=-fopenmp
++ OMP_LDFLAGS=-lgomp
++ fi
++fi
++
++# very basic pcre check
++AC_ARG_ENABLE(pcre,
++ [AC_HELP_STRING([--enable-pcre],
++ [Enable PCRE regex support])],
++ [enable_pcre=$enableval],
++ [enable_pcre="yes"])
++AC_MSG_RESULT($enable_pcre)
++if test x$enable_pcre = xyes; then
++ AC_PATH_PROGS(PCRE_CONFIG, pcre-config, no)
++ if test "$PCRE_CONFIG" = "no"; then
++ AC_MSG_ERROR(Unable to find pcre-config in path for PCRE support)
++ else
++ AC_CHECK_HEADERS(pcre.h)
++ PCRE="yes"
++ PCRE_CPPFLAGS=-D__WITHPCRE__
++ PCRE_LDFLAGS=-lpcre
++ fi
++fi
++
++AC_CONFIG_FILES( \
++ Makefile \
++ GKlib/trunk/Makefile \
++ libmetis/Makefile \
++ programs/Makefile \
++ test/Makefile
++)
++AC_OUTPUT
+--- Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ Makefile.am 2007-09-24 15:12:11.921289623 +0100
+@@ -0,0 +1,3 @@
++SUBDIRS = GKlib/trunk libmetis programs test
++EXTRA_DIST = CHANGES.v4 CHANGES.v5
++include_HEADERS = include/metis.h
+--- GKlib/trunk/Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ GKlib/trunk/Makefile.am 2007-09-24 15:12:11.949291219 +0100
+@@ -0,0 +1,26 @@
++AM_CPPFLAGS = -DLINUX -D_FILE_OFFSET_BITS=6 $(PCRE_CPPFLAGS) $(OMP_CPPFLAGS)
++AM_CFLAGS = -std=c99 $(OMP_CFLAGS)
++
++noinst_LTLIBRARIES = libgklib.la
++noinst_HEADERS = GKlib.h
++
++libgklib_la_SOURCES = \
++ b64.c \
++ blas.c \
++ dfkvkselect.c \
++ dlmalloc.c \
++ error.c \
++ fs.c \
++ getopt.c \
++ htable.c \
++ io.c \
++ memory.c \
++ omp.c \
++ pdb.c \
++ seq.c \
++ sort.c \
++ string.c \
++ timers.c \
++ tokenizer.c \
++ util.c
++libgklib_la_LIBADD = $(OMP_LDFLAGS) $(PCRE_LDFLAGS)
+--- libmetis/smbfactor.c 1970-01-01 01:00:00.000000000 +0100
++++ libmetis/smbfactor.c 2007-09-24 15:12:11.949291219 +0100
+@@ -0,0 +1,385 @@
++/*
++ * Copyright 1997, Regents of the University of Minnesota
++ *
++ * smbfactor.c
++ *
++ * This file performs the symbolic factorization of a matrix
++ *
++ * Started 8/1/97
++ * George
++ *
++ * $Id: metis-5.0_pre2-autotools.patch,v 1.1 2008/02/05 17:55:30 bicatali Exp $
++ *
++ */
++
++#include <metislib.h>
++
++
++/*************************************************************************
++* This function sets up data structures for fill-in computations
++**************************************************************************/
++void ComputeFillIn(GraphType *graph, idxtype *iperm)
++{
++ idxtype i, j, k, nvtxs, maxlnz, maxsub;
++ idxtype *xadj, *adjncy;
++ idxtype *perm, *xlnz, *xnzsub, *nzsub;
++ double opc;
++
++/*
++ mprintf("\nSymbolic factorization... --------------------------------------------\n");
++*/
++
++ nvtxs = graph->nvtxs;
++ xadj = graph->xadj;
++ adjncy = graph->adjncy;
++
++ maxsub = 4*xadj[nvtxs];
++
++ /* Relabel the vertices so that it starts from 1 */
++ k = xadj[nvtxs];
++ for (i=0; i<k; i++)
++ adjncy[i]++;
++ for (i=0; i<nvtxs+1; i++)
++ xadj[i]++;
++
++ /* Allocate the required memory */
++ perm = idxmalloc(nvtxs+1, "ComputeFillIn: perm");
++ xlnz = idxmalloc(nvtxs+1, "ComputeFillIn: xlnz");
++ xnzsub = idxmalloc(nvtxs+1, "ComputeFillIn: xnzsub");
++ nzsub = idxmalloc(maxsub, "ComputeFillIn: nzsub");
++
++ /* Construct perm from iperm and change the numbering of iperm */
++ for (i=0; i<nvtxs; i++)
++ perm[iperm[i]] = i;
++ for (i=0; i<nvtxs; i++) {
++ iperm[i]++;
++ perm[i]++;
++ }
++
++ /*
++ * Call sparspak routine.
++ */
++ if (smbfct(nvtxs, xadj, adjncy, perm, iperm, xlnz, &maxlnz, xnzsub, nzsub, &maxsub)) {
++ gk_free((void **)&nzsub, LTERM);
++
++ maxsub = 4*maxsub;
++ nzsub = idxmalloc(maxsub, "ComputeFillIn: nzsub");
++ if (smbfct(nvtxs, xadj, adjncy, perm, iperm, xlnz, &maxlnz, xnzsub, nzsub, &maxsub))
++ errexit("MAXSUB is too small!");
++ }
++
++ opc = 0;
++ for (i=0; i<nvtxs; i++)
++ xlnz[i]--;
++ for (i=0; i<nvtxs; i++)
++ opc += (xlnz[i+1]-xlnz[i])*(xlnz[i+1]-xlnz[i]) - (xlnz[i+1]-xlnz[i]);
++
++ mprintf(" Nonzeros: %D, \tOperation Count: %6.4le\n", maxlnz, opc);
++
++
++ gk_free((void **)&perm, &xlnz, &xnzsub, &nzsub, LTERM);
++
++
++ /* Relabel the vertices so that it starts from 0 */
++ for (i=0; i<nvtxs; i++)
++ iperm[i]--;
++ for (i=0; i<nvtxs+1; i++)
++ xadj[i]--;
++ k = xadj[nvtxs];
++ for (i=0; i<k; i++)
++ adjncy[i]--;
++
++}
++
++
++
++/*************************************************************************
++* This function sets up data structures for fill-in computations
++**************************************************************************/
++idxtype ComputeFillIn2(GraphType *graph, idxtype *iperm)
++{
++ idxtype i, j, k, nvtxs, maxlnz, maxsub;
++ idxtype *xadj, *adjncy;
++ idxtype *perm, *xlnz, *xnzsub, *nzsub;
++ double opc;
++
++ nvtxs = graph->nvtxs;
++ xadj = graph->xadj;
++ adjncy = graph->adjncy;
++
++ maxsub = 4*xadj[nvtxs];
++
++ /* Relabel the vertices so that it starts from 1 */
++ k = xadj[nvtxs];
++ for (i=0; i<k; i++)
++ adjncy[i]++;
++ for (i=0; i<nvtxs+1; i++)
++ xadj[i]++;
++
++ /* Allocate the required memory */
++ perm = idxmalloc(nvtxs+1, "ComputeFillIn: perm");
++ xlnz = idxmalloc(nvtxs+1, "ComputeFillIn: xlnz");
++ xnzsub = idxmalloc(nvtxs+1, "ComputeFillIn: xnzsub");
++ nzsub = idxmalloc(maxsub, "ComputeFillIn: nzsub");
++
++ /* Construct perm from iperm and change the numbering of iperm */
++ for (i=0; i<nvtxs; i++)
++ perm[iperm[i]] = i;
++ for (i=0; i<nvtxs; i++) {
++ iperm[i]++;
++ perm[i]++;
++ }
++
++ /*
++ * Call sparspak routine.
++ */
++ if (smbfct(nvtxs, xadj, adjncy, perm, iperm, xlnz, &maxlnz, xnzsub, nzsub, &maxsub)) {
++ gk_free((void **)&nzsub, LTERM);
++
++ maxsub = 4*maxsub;
++ nzsub = idxmalloc(maxsub, "ComputeFillIn: nzsub");
++ if (smbfct(nvtxs, xadj, adjncy, perm, iperm, xlnz, &maxlnz, xnzsub, nzsub, &maxsub))
++ errexit("MAXSUB is too small!");
++ }
++
++ opc = 0;
++ for (i=0; i<nvtxs; i++)
++ xlnz[i]--;
++ for (i=0; i<nvtxs; i++)
++ opc += (xlnz[i+1]-xlnz[i])*(xlnz[i+1]-xlnz[i]) - (xlnz[i+1]-xlnz[i]);
++
++
++ gk_free((void **)&perm, &xlnz, &xnzsub, &nzsub, LTERM);
++
++
++ /* Relabel the vertices so that it starts from 0 */
++ for (i=0; i<nvtxs; i++)
++ iperm[i]--;
++ for (i=0; i<nvtxs+1; i++)
++ xadj[i]--;
++ k = xadj[nvtxs];
++ for (i=0; i<k; i++)
++ adjncy[i]--;
++
++ return maxlnz;
++
++}
++
++
++/*****************************************************************
++********** SMBFCT ..... SYMBOLIC FACTORIZATION *********
++******************************************************************
++* PURPOSE - THIS ROUTINE PERFORMS SYMBOLIC FACTORIZATION
++* ON A PERMUTED LINEAR SYSTEM AND IT ALSO SETS UP THE
++* COMPRESSED DATA STRUCTURE FOR THE SYSTEM.
++*
++* INPUT PARAMETERS -
++* NEQNS - NUMBER OF EQUATIONS.
++* (XADJ, ADJNCY) - THE ADJACENCY STRUCTURE.
++* (PERM, INVP) - THE PERMUTATION VECTOR AND ITS INVERSE.
++*
++* UPDATED PARAMETERS -
++* MAXSUB - SIZE OF THE SUBSCRIPT ARRAY NZSUB. ON RETURN,
++* IT CONTAINS THE NUMBER OF SUBSCRIPTS USED
++*
++* OUTPUT PARAMETERS -
++* XLNZ - INDEX INTO THE NONZERO STORAGE VECTOR LNZ.
++* (XNZSUB, NZSUB) - THE COMPRESSED SUBSCRIPT VECTORS.
++* MAXLNZ - THE NUMBER OF NONZEROS FOUND.
++*
++*******************************************************************/
++idxtype smbfct(idxtype neqns, idxtype *xadj, idxtype *adjncy, idxtype *perm, idxtype *invp,
++ idxtype *xlnz, idxtype *maxlnz, idxtype *xnzsub, idxtype *nzsub, idxtype *maxsub)
++{
++ /* Local variables */
++ idxtype node, rchm, mrgk, lmax, i, j, k, m, nabor, nzbeg, nzend;
++ idxtype kxsub, jstop, jstrt, mrkflg, inz, knz, flag;
++ idxtype *mrglnk, *marker, *rchlnk;
++
++ rchlnk = idxmalloc(neqns+1, "smbfct: rchlnk");
++ marker = idxsmalloc(neqns+1, 0, "smbfct: marker");
++ mrglnk = idxsmalloc(neqns+1, 0, "smbfct: mgrlnk");
++
++ /* Parameter adjustments */
++ --marker;
++ --mrglnk;
++ --rchlnk;
++ --nzsub;
++ --xnzsub;
++ --xlnz;
++ --invp;
++ --perm;
++ --adjncy;
++ --xadj;
++
++ /* Function Body */
++ flag = 0;
++ nzbeg = 1;
++ nzend = 0;
++ xlnz[1] = 1;
++
++ /* FOR EACH COLUMN KNZ COUNTS THE NUMBER OF NONZEROS IN COLUMN K ACCUMULATED IN RCHLNK. */
++ for (k = 1; k <= neqns; ++k) {
++ knz = 0;
++ mrgk = mrglnk[k];
++ mrkflg = 0;
++ marker[k] = k;
++ if (mrgk != 0)
++ marker[k] = marker[mrgk];
++ xnzsub[k] = nzend;
++ node = perm[k];
++
++ if (xadj[node] >= xadj[node+1]) {
++ xlnz[k+1] = xlnz[k];
++ continue;
++ }
++
++ /* USE RCHLNK TO LINK THROUGH THE STRUCTURE OF A(*,K) BELOW DIAGONAL */
++ rchlnk[k] = neqns+1;
++ for (j=xadj[node]; j<xadj[node+1]; j++) {
++ nabor = invp[adjncy[j]];
++ if (nabor <= k)
++ continue;
++ rchm = k;
++
++ do {
++ m = rchm;
++ rchm = rchlnk[m];
++ } while (rchm <= nabor);
++
++ knz++;
++ rchlnk[m] = nabor;
++ rchlnk[nabor] = rchm;
++ if (marker[nabor] != marker[k])
++ mrkflg = 1;
++ }
++
++ /* TEST FOR MASS SYMBOLIC ELIMINATION */
++ lmax = 0;
++ if (mrkflg != 0 || mrgk == 0 || mrglnk[mrgk] != 0)
++ goto L350;
++ xnzsub[k] = xnzsub[mrgk] + 1;
++ knz = xlnz[mrgk + 1] - (xlnz[mrgk] + 1);
++ goto L1400;
++
++
++ /* LINK THROUGH EACH COLUMN I THAT AFFECTS L(*,K) */
++L350:
++ i = k;
++ while ((i = mrglnk[i]) != 0) {
++ inz = xlnz[i+1] - (xlnz[i]+1);
++ jstrt = xnzsub[i] + 1;
++ jstop = xnzsub[i] + inz;
++
++ if (inz > lmax) {
++ lmax = inz;
++ xnzsub[k] = jstrt;
++ }
++
++ /* MERGE STRUCTURE OF L(*,I) IN NZSUB INTO RCHLNK. */
++ rchm = k;
++ for (j = jstrt; j <= jstop; ++j) {
++ nabor = nzsub[j];
++ do {
++ m = rchm;
++ rchm = rchlnk[m];
++ } while (rchm < nabor);
++
++ if (rchm != nabor) {
++ knz++;
++ rchlnk[m] = nabor;
++ rchlnk[nabor] = rchm;
++ rchm = nabor;
++ }
++ }
++ }
++
++ /* CHECK IF SUBSCRIPTS DUPLICATE THOSE OF ANOTHER COLUMN */
++ if (knz == lmax)
++ goto L1400;
++
++ /* OR IF TAIL OF K-1ST COLUMN MATCHES HEAD OF KTH */
++ if (nzbeg > nzend)
++ goto L1200;
++
++ i = rchlnk[k];
++ for (jstrt = nzbeg; jstrt <= nzend; ++jstrt) {
++ if (nzsub[jstrt] < i)
++ continue;
++
++ if (nzsub[jstrt] == i)
++ goto L1000;
++ else
++ goto L1200;
++ }
++ goto L1200;
++
++L1000:
++ xnzsub[k] = jstrt;
++ for (j = jstrt; j <= nzend; ++j) {
++ if (nzsub[j] != i)
++ goto L1200;
++
++ i = rchlnk[i];
++ if (i > neqns)
++ goto L1400;
++ }
++ nzend = jstrt - 1;
++
++ /* COPY THE STRUCTURE OF L(*,K) FROM RCHLNK TO THE DATA STRUCTURE (XNZSUB, NZSUB) */
++L1200:
++ nzbeg = nzend + 1;
++ nzend += knz;
++
++ if (nzend > *maxsub) {
++ flag = 1; /* Out of memory */
++ break;
++ }
++
++ i = k;
++ for (j=nzbeg; j<=nzend; ++j) {
++ i = rchlnk[i];
++ nzsub[j] = i;
++ marker[i] = k;
++ }
++ xnzsub[k] = nzbeg;
++ marker[k] = k;
++
++ /*
++ * UPDATE THE VECTOR MRGLNK. NOTE COLUMN L(*,K) JUST FOUND
++ * IS REQUIRED TO DETERMINE COLUMN L(*,J), WHERE
++ * L(J,K) IS THE FIRST NONZERO IN L(*,K) BELOW DIAGONAL.
++ */
++L1400:
++ if (knz > 1) {
++ kxsub = xnzsub[k];
++ i = nzsub[kxsub];
++ mrglnk[k] = mrglnk[i];
++ mrglnk[i] = k;
++ }
++
++ xlnz[k + 1] = xlnz[k] + knz;
++ }
++
++ if (flag == 0) {
++ *maxlnz = xlnz[neqns] - 1;
++ *maxsub = xnzsub[neqns];
++ xnzsub[neqns + 1] = xnzsub[neqns];
++ }
++
++ marker++;
++ mrglnk++;
++ rchlnk++;
++ nzsub++;
++ xnzsub++;
++ xlnz++;
++ invp++;
++ perm++;
++ adjncy++;
++ xadj++;
++ gk_free((void **)&rchlnk, &mrglnk, &marker, LTERM);
++
++ return flag;
++
++}
++
+--- libmetis/Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ libmetis/Makefile.am 2007-09-24 15:12:11.933290307 +0100
+@@ -0,0 +1,16 @@
++AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/GKlib/trunk -DLINUX -DUNIX -D_FILE_OFFSET_BITS=64
++lib_LTLIBRARIES = libmetis.la
++libmetis_la_SOURCES= \
++ balance.c bucketsort.c ccgraph.c checkgraph.c cmetis.c \
++ coarsen.c compress.c debug.c estmem.c fm.c fortran.c \
++ frename.c graph.c initpart.c kfmetis.c kmetis.c kvmetis.c \
++ kwayfm.c kwayrefine.c kwayvolfm.c kwayvolrefine.c match.c \
++ mbalance.c mbalance2.c mcoarsen.c memory.c mesh.c meshpart.c \
++ mfm.c mfm2.c mincover.c minitpart.c minitpart2.c mkmetis.c \
++ mkwayfmh.c mkwayrefine.c mmatch.c mmd.c mpmetis.c mrefine.c \
++ mrefine2.c mrkmetis.c mutil.c myqsort.c ometis.c parmetis.c \
++ pmetis.c pqueue.c refine.c rkmetis.c separator.c sfm.c \
++ srefine.c stat.c streamio.c subdomains.c timing.c util.c \
++ smbfactor.c
++
++libmetis_la_LIBADD = $(top_builddir)/GKlib/trunk/libgklib.la
+--- programs/Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ programs/Makefile.am 2007-09-24 15:12:11.933290307 +0100
+@@ -0,0 +1,19 @@
++AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/GKlib/trunk -DLINUX -DUNIX -D_FILE_OFFSET_BITS=64
++bin_PROGRAMS = cmetis graphchk kfmetis kmetis mesh2dual mesh2nodal metis \
++ oemetis onmetis partdmesh partnmesh pmetis
++
++# Differing from upstream, a lot of these get smbfactor.c as we need
++# ComputeFillIn2, which is referenced in proto.h <- metisbin.h
++LDADD = $(top_builddir)/libmetis/libmetis.la
++cmetis_SOURCES = cmetis.c io.c cmdline_cmetis.c
++graphchk_SOURCES = graphchk.c io.c
++kfmetis_SOURCES = kfmetis.c io.c cmdline_kfmetis.c
++kmetis_SOURCES = kmetis.c io.c
++mesh2dual_SOURCES = mesh2dual.c io.c
++mesh2nodal_SOURCES = mesh2nodal.c io.c
++metis_SOURCES = metis.c io.c
++oemetis_SOURCES = oemetis.c io.c
++onmetis_SOURCES = onmetis.c io.c
++partdmesh_SOURCES = partdmesh.c io.c
++partnmesh_SOURCES = partnmesh.c io.c
++pmetis_SOURCES = pmetis.c io.c cmdline_pmetis.c
+--- test/Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ test/Makefile.am 2007-09-24 15:45:23.683980202 +0100
+@@ -0,0 +1,10 @@
++AM_CPPFLAGS = \
++ -I$(top_srcdir)/include \
++ -I$(top_srcdir)/libmetis \
++ -I$(top_srcdir)/programs \
++ -I$(top_srcdir)/GKlib/trunk \
++ -DLINUX -DUNIX -D_FILE_OFFSET_BITS=64
++
++check_PROGRAMS = mtest
++mtest_SOURCES = mtest.c $(top_srcdir)/programs/io.c
++mtest_LDADD = $(top_builddir)/libmetis/libmetis.la
diff --git a/sci-libs/metis/metadata.xml b/sci-libs/metis/metadata.xml
new file mode 100644
index 000000000000..4fffa58f37a2
--- /dev/null
+++ b/sci-libs/metis/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>sci</herd>
+<longdescription lang="en">
+ METIS is a set of serial programs for partitioning graphs,
+ partitioning finite element meshes, and producing fill reducing
+ orderings for sparse matrices. The algorithms implemented in METIS are
+ based on the multilevel recursive-bisection, multilevel k-way, and
+ multi-constraint partitioning schemes.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-libs/metis/metis-4.0.1.ebuild b/sci-libs/metis/metis-4.0.1.ebuild
new file mode 100644
index 000000000000..3b9dc41a69d6
--- /dev/null
+++ b/sci-libs/metis/metis-4.0.1.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sci-libs/metis/metis-4.0.1.ebuild,v 1.1 2008/02/05 17:55:29 bicatali Exp $
+
+inherit autotools eutils
+
+MYP=${PN}-4.0
+DESCRIPTION="A package for unstructured serial graph partitioning"
+HOMEPAGE="http://www-users.cs.umn.edu/~karypis/metis/metis/index.html"
+SRC_URI="http://glaros.dtc.umn.edu/gkhome/fetch/sw/${PN}/${MYP}.tar.gz"
+
+KEYWORDS="~amd64 ~x86"
+LICENSE="free-noncomm"
+
+IUSE="doc"
+SLOT="4"
+
+DEPEND=""
+S="${WORKDIR}/${MYP}"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${P}-autotools.patch
+ eautoreconf
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "emake install failed"
+ dodoc CHANGES || die "dodoc failed"
+ use doc && dodoc Doc/manual.ps
+}
diff --git a/sci-libs/metis/metis-5.0_pre2.ebuild b/sci-libs/metis/metis-5.0_pre2.ebuild
new file mode 100644
index 000000000000..2ad773d103b9
--- /dev/null
+++ b/sci-libs/metis/metis-5.0_pre2.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sci-libs/metis/metis-5.0_pre2.ebuild,v 1.1 2008/02/05 17:55:29 bicatali Exp $
+
+inherit autotools eutils
+
+MY_PV=${PV/_/}
+
+DESCRIPTION="A package for unstructured serial graph partitioning"
+HOMEPAGE="http://www-users.cs.umn.edu/~karypis/metis/metis/index.html"
+SRC_URI="http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-${MY_PV}.tar.gz"
+
+KEYWORDS="~amd64 ~x86"
+LICENSE="free-noncomm"
+
+IUSE="pcre openmp int64 threads"
+SLOT="5"
+
+DEPEND="pcre? ( dev-libs/libpcre )
+ openmp? ( || ( >=sys-devel/gcc-4.2 >=dev-lang/icc-9 ) )"
+
+S="${WORKDIR}/metis-${MY_PV}"
+
+pkg_setup() {
+ if use openmp \
+ && [[ $(tc-getCC) == *gcc ]] \
+ && [[ $(gcc-major-version)$(gcc-minor-version) -lt 42 ]]; then
+ eerror "You need gcc >= 4.2 to use openmp features."
+ eerror "Please use gcc-config to switch gcc version >= 4.2"
+ die "setup gcc failed"
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${P}-autotools.patch
+ if use int64; then
+ sed -e 's/\(#define IDXTYPEWIDTH\).*32/\1 64/' \
+ -i include/metis.h \
+ || die "sed for int64 failed"
+ fi
+ if use threads; then
+ sed -e 's/\(#define HAVE_THREADLOCALSTORAGE\).*0/\1 1/' \
+ -i include/metis.h \
+ || die "sed for threads failed"
+ fi
+ eautoreconf
+}
+
+src_compile() {
+ econf \
+ $(use_enable pcre) \
+ $(use_enable openmp) \
+ || die "econf failed"
+ emake || die "emake failed"
+}
+
+
+src_install() {
+ emake DESTDIR="${D}" install || die "emake install failed"
+ dodoc CHANGES.v5 || die "dodoc failed"
+}