aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbicatali <bicatali@32389bae-6d03-0410-99cf-db05cde120eb>2007-09-24 15:59:16 +0000
committerbicatali <bicatali@32389bae-6d03-0410-99cf-db05cde120eb>2007-09-24 15:59:16 +0000
commit7a9570228e3385a2f40272396b4cf2fbd8f9bce7 (patch)
tree202a50899d96aaedb95269a54e4daa5bd2dc864f
parentrevert acml (diff)
downloadsci-7a9570228e3385a2f40272396b4cf2fbd8f9bce7.tar.gz
sci-7a9570228e3385a2f40272396b4cf2fbd8f9bce7.tar.bz2
sci-7a9570228e3385a2f40272396b4cf2fbd8f9bce7.zip
added cholmod and metis
git-svn-id: http://overlays.gentoo.org/svn/proj/science/overlay@744 32389bae-6d03-0410-99cf-db05cde120eb
-rw-r--r--sci-libs/cholmod/Manifest12
-rw-r--r--sci-libs/cholmod/cholmod-1.5.0.ebuild52
-rw-r--r--sci-libs/cholmod/files/cholmod-1.5.0-autotools.patch569
-rw-r--r--sci-libs/cholmod/files/digest-cholmod-1.5.03
-rw-r--r--sci-libs/metis/Manifest12
-rw-r--r--sci-libs/metis/files/digest-metis-5.0_pre23
-rw-r--r--sci-libs/metis/files/metis-5.0_pre2-autotools.patch1596
-rw-r--r--sci-libs/metis/metis-5.0_pre2.ebuild63
8 files changed, 2310 insertions, 0 deletions
diff --git a/sci-libs/cholmod/Manifest b/sci-libs/cholmod/Manifest
new file mode 100644
index 000000000..0165f0f54
--- /dev/null
+++ b/sci-libs/cholmod/Manifest
@@ -0,0 +1,12 @@
+AUX cholmod-1.5.0-autotools.patch 19486 RMD160 b722d7f7f5ce1e127c8b21488953c138c95f042b SHA1 7be8a963b720d1b9dafa30637000eae589dca715 SHA256 3d9fc9bc55cd81c80a1e8eeea1cf0eaf79b92201876c21411d0edca1bb6e071f
+MD5 d61d460a5ca2744ec18e2822510a13a4 files/cholmod-1.5.0-autotools.patch 19486
+RMD160 b722d7f7f5ce1e127c8b21488953c138c95f042b files/cholmod-1.5.0-autotools.patch 19486
+SHA256 3d9fc9bc55cd81c80a1e8eeea1cf0eaf79b92201876c21411d0edca1bb6e071f files/cholmod-1.5.0-autotools.patch 19486
+DIST CHOLMOD-1.5.0.tar.gz 1090186 RMD160 f0788e2a7cd4d4f013c292089fbb0cc3248a0f6a SHA1 8e556aa31e67326f9500baea024e61db33a6b9b3 SHA256 d586ee43a9cbbd29b6303124a6be5ebbb459cadfce315524dbd1c2ce31c5f9a1
+EBUILD cholmod-1.5.0.ebuild 1190 RMD160 7e8eaf8cc5efc0560bc46e7cb73c335d9283bae3 SHA1 920c43cf6b9417dcab6fab000d3d6aa01810816d SHA256 3830ccc6a36676a97c0386d176f8d4ea1932fe1c909913793ddbf461714f783b
+MD5 c56d339101a35a37557a1dc185ba114c cholmod-1.5.0.ebuild 1190
+RMD160 7e8eaf8cc5efc0560bc46e7cb73c335d9283bae3 cholmod-1.5.0.ebuild 1190
+SHA256 3830ccc6a36676a97c0386d176f8d4ea1932fe1c909913793ddbf461714f783b cholmod-1.5.0.ebuild 1190
+MD5 c1729053fde70e30f5ce17a7693fc3b5 files/digest-cholmod-1.5.0 244
+RMD160 2ba2625998bf8d033956ea8f6653b224ddc83b81 files/digest-cholmod-1.5.0 244
+SHA256 edf3eb5a6e8c84a9273fe8682f86b04e1244a770558f64c8a1ac27091e1f3e5c files/digest-cholmod-1.5.0 244
diff --git a/sci-libs/cholmod/cholmod-1.5.0.ebuild b/sci-libs/cholmod/cholmod-1.5.0.ebuild
new file mode 100644
index 000000000..7a7ebbbcb
--- /dev/null
+++ b/sci-libs/cholmod/cholmod-1.5.0.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit autotools eutils
+
+MY_PN=CHOLMOD
+
+DESCRIPTION="Sparse Cholesky factorization and update/downdate library"
+HOMEPAGE="http://www.cise.ufl.edu/research/sparse/cholmod"
+SRC_URI="http://www.cise.ufl.edu/research/sparse/${PN}/${MY_PN}-${PV}.tar.gz"
+
+LICENSE="LGPL-2 GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc metis"
+DEPEND="virtual/lapack
+ sci-libs/amd
+ sci-libs/colamd
+ metis? ( sci-libs/camd sci-libs/ccolamd sci-libs/metis )"
+
+S="${WORKDIR}/${MY_PN}"
+
+src_unpack() {
+ unpack "${A}"
+ cd "${S}"
+ epatch "${FILESDIR}"/${P}-autotools.patch
+ eautoreconf
+}
+
+src_compile() {
+ econf \
+ --with-blas="$(pkg-config --libs blas)" \
+ --with-lapack="$(pkg-config --libs lapack)" \
+ $(use_enable metis) \
+ || die "econf failed"
+ emake || die "emake failed"
+}
+
+src_test() {
+ cd "${S}"/Demo
+ emake test || die "emake test failed"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "emake install failed"
+ dodoc README.txt Doc/ChangeLog || die "dodoc failed"
+ if use doc; then
+ insinto /usr/share/doc/${PF}
+ doins Doc/UserGuide.pdf || die "pdf install failed"
+ fi
+}
diff --git a/sci-libs/cholmod/files/cholmod-1.5.0-autotools.patch b/sci-libs/cholmod/files/cholmod-1.5.0-autotools.patch
new file mode 100644
index 000000000..0bbbaf397
--- /dev/null
+++ b/sci-libs/cholmod/files/cholmod-1.5.0-autotools.patch
@@ -0,0 +1,569 @@
+--- configure.ac 1970-01-01 01:00:00.000000000 +0100
++++ configure.ac 2007-09-24 16:48:13.116732815 +0100
+@@ -0,0 +1,69 @@
++AC_PREREQ(2.59)
++AC_INIT(cholmod, 1.5.0, davis@cise.ufl.edu)
++AM_INIT_AUTOMAKE([foreign])
++
++AC_PROG_INSTALL
++AC_PROG_LIBTOOL
++
++AC_CHECK_LIB(m, sqrt)
++AC_CHECK_HEADERS(UFconfig.h)
++
++AC_ARG_ENABLE(metis,
++ [AC_HELP_STRING([--enable-metis],
++ [link against and use metis package])],
++ [enable_metis=$enableval],
++ [enable_metis="yes"])
++AC_MSG_RESULT($enable_metis)
++
++# By default, cholmod will build with support for metis
++# Makefiles need to know for linking.
++if test x$enable_metis = xno; then
++ AC_DEFINE(NPARTITION)
++else
++ AC_CHECK_HEADERS(metis.h)
++ AC_CHECK_LIB(metis, libmetis__InitTimers, [], \
++ [AC_MSG_ERROR([Cannot find libmetis])])
++
++ AC_CHECK_HEADERS(ccolamd.h)
++ AC_CHECK_LIB(ccolamd, ccolamd_report, [], \
++ [AC_MSG_ERROR([Cannot find libccolamd])])
++
++ AC_CHECK_HEADERS(camd.h)
++ AC_CHECK_LIB(camd, camd_info, [], \
++ [AC_MSG_ERROR([Cannot find libcamd])])
++fi
++AM_CONDITIONAL([ENABLE_METIS], [test x$enable_metis = xyes])
++
++AC_CHECK_HEADERS(amd.h)
++AC_CHECK_LIB(amd, amd_info, [], \
++ [AC_MSG_ERROR([Cannot find libamd])])
++
++AC_CHECK_HEADERS(colamd.h)
++AC_CHECK_LIB(colamd, colamd_recommended, [], \
++ [AC_MSG_ERROR([Cannot find libcolamd])])
++
++sinclude(acx_blas.m4)
++sinclude(acx_lapack.m4)
++
++ACX_LAPACK
++
++if test x"$BLAS_LIBS" = x; then
++ AC_MSG_ERROR([Cannot find blas libraries])
++fi
++
++if test x"$LAPACK_LIBS" = x; then
++ AC_MSG_ERROR([Cannot find lapack libraries])
++fi
++
++AC_CONFIG_FILES(
++ Makefile \
++ Check/Makefile \
++ Cholesky/Makefile \
++ Core/Makefile \
++ Include/Makefile \
++ MatrixOps/Makefile \
++ Modify/Makefile \
++ Partition/Makefile \
++ Supernodal/Makefile \
++ Demo/Makefile)
++AC_OUTPUT
+--- Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ Makefile.am 2007-09-24 14:03:45.960027014 +0100
+@@ -0,0 +1,27 @@
++SUBDIRS = Include Check Cholesky Core MatrixOps Modify Partition Supernodal Demo
++EXTRA_DIST = README.txt
++
++lib_LTLIBRARIES = libcholmod.la
++
++# We're just dumping all the libraries into one, no real source code.
++libcholmod_la_SOURCES =
++libcholmod_la_LIBADD = \
++ $(LAPACK_LIBS) $(BLAS_LIBS) -lcolamd -lamd \
++ $(top_builddir)/Check/libcheck.la \
++ $(top_builddir)/Core/libcore.la \
++ $(top_builddir)/MatrixOps/libmops.la \
++ $(top_builddir)/Supernodal/libsnod.la \
++ $(top_builddir)/Modify/libmodify.la \
++ $(top_builddir)/Check/libcheckl.la \
++ $(top_builddir)/Core/libcorel.la \
++ $(top_builddir)/MatrixOps/libmopsl.la \
++ $(top_builddir)/Supernodal/libsnodl.la \
++ $(top_builddir)/Modify/libmodifyl.la \
++ $(top_builddir)/Partition/libpart.la \
++ $(top_builddir)/Partition/libpartl.la \
++ $(top_builddir)/Cholesky/libcholesky.la \
++ $(top_builddir)/Cholesky/libcholeskyl.la
++
++if ENABLE_METIS
++ libcholmod_la_LIBADD = -lmetis -lccolamd -lcamd
++endif
+--- Check/Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ Check/Makefile.am 2007-09-24 16:55:11.720587690 +0100
+@@ -0,0 +1,5 @@
++AM_CPPFLAGS = -I$(top_srcdir)/Include
++noinst_LTLIBRARIES = libcheck.la libcheckl.la
++libcheck_la_SOURCES = cholmod_check.c cholmod_read.c cholmod_write.c
++libcheckl_la_SOURCES = $(libcheck_la_SOURCES)
++libcheckl_la_CPPFLAGS = $(AM_CPPFLAGS) -DDLONG
+--- Cholesky/Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ Cholesky/Makefile.am 2007-09-21 17:11:30.694963872 +0100
+@@ -0,0 +1,17 @@
++AM_CPPFLAGS = -I$(top_srcdir)/Include
++noinst_LTLIBRARIES = libcholesky.la libcholeskyl.la
++libcholesky_la_SOURCES = cholmod_amd.c \
++ cholmod_analyze.c \
++ cholmod_colamd.c \
++ cholmod_etree.c \
++ cholmod_factorize.c \
++ cholmod_postorder.c \
++ cholmod_rcond.c \
++ cholmod_resymbol.c \
++ cholmod_rowcolcounts.c \
++ cholmod_rowfac.c \
++ cholmod_solve.c \
++ cholmod_spsolve.c
++
++libcholeskyl_la_SOURCES = $(libcholesky_la_SOURCES)
++libcholeskyl_la_CPPFLAGS = $(AM_CPPFLAGS) -DDLONG
+--- Core/Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ Core/Makefile.am 2007-09-24 14:00:31.588950438 +0100
+@@ -0,0 +1,19 @@
++AM_CPPFLAGS = -I$(top_srcdir)/Include
++noinst_LTLIBRARIES = libcore.la libcorel.la
++libcore_la_SOURCES = cholmod_aat.c \
++ cholmod_add.c \
++ cholmod_band.c \
++ cholmod_change_factor.c \
++ cholmod_common.c \
++ cholmod_complex.c \
++ cholmod_copy.c \
++ cholmod_dense.c \
++ cholmod_error.c \
++ cholmod_factor.c \
++ cholmod_memory.c \
++ cholmod_sparse.c \
++ cholmod_transpose.c \
++ cholmod_triplet.c
++
++libcorel_la_SOURCES = $(libcore_la_SOURCES)
++libcorel_la_CPPFLAGS = $(AM_CPPFLAGS) -DDLONG
+--- Demo/Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ Demo/Makefile.am 2007-09-24 13:59:52.498722813 +0100
+@@ -0,0 +1,24 @@
++AM_CPPFLAGS = -I$(top_srcdir)/Include
++LDADD = $(top_builddir)/libcholmod.la $(LAPACK_LIBS) $(BLAS_LIBS)
++
++if ENABLE_METIS
++ LDADD += $(METIS_LIBS)
++endif
++
++check_PROGRAMS = cholmod_demo cholmod_l_demo cholmod_simple
++cholmod_demo_SOURCES = cholmod_demo.c
++cholmod_l_demo_SOURCES = cholmod_l_demo.c
++cholmod_simple_SOURCES = cholmod_simple.c
++
++test: check
++ ./cholmod_demo < Matrix/bcsstk01.tri || exit 1
++ ./cholmod_l_demo < Matrix/bcsstk01.tri || exit 1
++ ./cholmod_demo < Matrix/lp_afiro.tri || exit 1
++ ./cholmod_l_demo < Matrix/lp_afiro.tri || exit 1
++ ./cholmod_demo < Matrix/can___24.mtx || exit 1
++ ./cholmod_l_demo < Matrix/can___24.mtx || exit 1
++ ./cholmod_demo < Matrix/c.tri || exit 1
++ ./cholmod_l_demo < Matrix/c.tri || exit 1
++ ./cholmod_simple < Matrix/c.tri || exit 1
++ ./cholmod_simple < Matrix/can___24.mtx || exit 1
++ ./cholmod_simple < Matrix/bcsstk01.tri || exit 1
+--- Include/Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ Include/Makefile.am 2007-09-24 16:31:54.456722842 +0100
+@@ -0,0 +1,15 @@
++include_HEADERS = \
++ cholmod.h \
++ cholmod_blas.h \
++ cholmod_check.h \
++ cholmod_cholesky.h \
++ cholmod_complexity.h \
++ cholmod_config.h \
++ cholmod_core.h \
++ cholmod_internal.h \
++ cholmod_io64.h \
++ cholmod_matrixops.h \
++ cholmod_modify.h \
++ cholmod_partition.h \
++ cholmod_supernodal.h \
++ cholmod_template.h
+--- MatrixOps/Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ MatrixOps/Makefile.am 2007-09-21 17:18:50.316016449 +0100
+@@ -0,0 +1,14 @@
++AM_CPPFLAGS = -I$(top_srcdir)/Include
++noinst_LTLIBRARIES = libmops.la libmopsl.la
++libmops_la_SOURCES = cholmod_drop.c \
++ cholmod_horzcat.c \
++ cholmod_norm.c \
++ cholmod_scale.c \
++ cholmod_sdmult.c \
++ cholmod_ssmult.c \
++ cholmod_submatrix.c \
++ cholmod_symmetry.c \
++ cholmod_vertcat.c
++
++libmopsl_la_SOURCES = $(libmops_la_SOURCES)
++libmopsl_la_CPPFLAGS = $(AM_CPPFLAGS) -DDLONG
+--- Modify/Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ Modify/Makefile.am 2007-09-21 17:20:50.058840203 +0100
+@@ -0,0 +1,5 @@
++AM_CPPFLAGS = -I$(top_srcdir)/Include
++noinst_LTLIBRARIES = libmodify.la libmodifyl.la
++libmodify_la_SOURCES = cholmod_rowadd.c cholmod_updown.c cholmod_rowdel.c
++libmodifyl_la_SOURCES = $(libmodify_la_SOURCES)
++libmodifyl_la_CPPFLAGS = $(AM_CPPFLAGS) -DDLONG
+--- Partition/Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ Partition/Makefile.am 2007-09-21 17:21:25.832878849 +0100
+@@ -0,0 +1,6 @@
++AM_CPPFLAGS = -I$(top_srcdir)/Include
++noinst_LTLIBRARIES = libpart.la libpartl.la
++libpart_la_SOURCES = cholmod_camd.c cholmod_csymamd.c cholmod_nesdis.c cholmod_ccolamd.c cholmod_metis.c
++
++libpartl_la_SOURCES = $(libpart_la_SOURCES)
++libpartl_la_CPPFLAGS = $(AM_CPPFLAGS) -DDLONG
+--- Supernodal/Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ Supernodal/Makefile.am 2007-09-21 17:21:55.906592653 +0100
+@@ -0,0 +1,5 @@
++AM_CPPFLAGS = -I$(top_srcdir)/Include
++noinst_LTLIBRARIES = libsnod.la libsnodl.la
++libsnod_la_SOURCES = cholmod_super_numeric.c cholmod_super_symbolic.c cholmod_super_solve.c
++libsnodl_la_SOURCES = $(libsnod_la_SOURCES)
++libsnodl_la_CPPFLAGS = $(AM_CPPFLAGS) -DDLONG
+--- acx_blas.m4 1970-01-01 01:00:00.000000000 +0100
++++ acx_blas.m4 2007-08-04 22:50:48.000000000 +0100
+@@ -0,0 +1,191 @@
++##### http://autoconf-archive.cryp.to/acx_blas.html
++#
++# SYNOPSIS
++#
++# ACX_BLAS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
++#
++# DESCRIPTION
++#
++# This macro looks for a library that implements the BLAS
++# linear-algebra interface (see http://www.netlib.org/blas/). On
++# success, it sets the BLAS_LIBS output variable to hold the
++# requisite library linkages.
++#
++# To link with BLAS, you should link with:
++#
++# $BLAS_LIBS $LIBS $FLIBS
++#
++# in that order. FLIBS is the output variable of the
++# AC_F77_LIBRARY_LDFLAGS macro (called if necessary by ACX_BLAS), and
++# is sometimes necessary in order to link with F77 libraries. Users
++# will also need to use AC_F77_DUMMY_MAIN (see the autoconf manual),
++# for the same reason.
++#
++# Many libraries are searched for, from ATLAS to CXML to ESSL. The
++# user may also use --with-blas=<lib> in order to use some specific
++# BLAS library <lib>. In order to link successfully, however, be
++# aware that you will probably need to use the same Fortran compiler
++# (which can be set via the F77 env. var.) as was used to compile the
++# BLAS library.
++#
++# ACTION-IF-FOUND is a list of shell commands to run if a BLAS
++# library is found, and ACTION-IF-NOT-FOUND is a list of commands to
++# run it if it is not found. If ACTION-IF-FOUND is not specified, the
++# default action will define HAVE_BLAS.
++#
++# This macro requires autoconf 2.50 or later.
++#
++# LAST MODIFICATION
++#
++# 2007-07-29
++#
++# COPYLEFT
++#
++# Copyright (c) 2007 Steven G. Johnson <stevenj@alum.mit.edu>
++#
++# 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 3 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, see
++# <http://www.gnu.org/licenses/>.
++#
++# As a special exception, the respective Autoconf Macro's copyright
++# owner gives unlimited permission to copy, distribute and modify the
++# configure scripts that are the output of Autoconf when processing
++# the Macro. You need not follow the terms of the GNU General Public
++# License when using or distributing such scripts, even though
++# portions of the text of the Macro appear in them. The GNU General
++# Public License (GPL) does govern all other use of the material that
++# constitutes the Autoconf Macro.
++#
++# This special exception to the GPL applies to versions of the
++# Autoconf Macro released by the Autoconf Macro Archive. When you
++# make and distribute a modified version of the Autoconf Macro, you
++# may extend this special exception to the GPL to apply to your
++# modified version as well.
++
++AC_DEFUN([ACX_BLAS], [
++AC_PREREQ(2.50)
++AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])
++acx_blas_ok=no
++
++AC_ARG_WITH(blas,
++ [AC_HELP_STRING([--with-blas=<lib>], [use BLAS library <lib>])])
++case $with_blas in
++ yes | "") ;;
++ no) acx_blas_ok=disable ;;
++ -* | */* | *.a | *.so | *.so.* | *.o) BLAS_LIBS="$with_blas" ;;
++ *) BLAS_LIBS="-l$with_blas" ;;
++esac
++
++# Get fortran linker names of BLAS functions to check for.
++AC_F77_FUNC(sgemm)
++AC_F77_FUNC(dgemm)
++
++acx_blas_save_LIBS="$LIBS"
++LIBS="$LIBS $FLIBS"
++
++# First, check BLAS_LIBS environment variable
++if test $acx_blas_ok = no; then
++if test "x$BLAS_LIBS" != x; then
++ save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS"
++ AC_MSG_CHECKING([for $sgemm in $BLAS_LIBS])
++ AC_TRY_LINK_FUNC($sgemm, [acx_blas_ok=yes], [BLAS_LIBS=""])
++ AC_MSG_RESULT($acx_blas_ok)
++ LIBS="$save_LIBS"
++fi
++fi
++
++# BLAS linked to by default? (happens on some supercomputers)
++if test $acx_blas_ok = no; then
++ save_LIBS="$LIBS"; LIBS="$LIBS"
++ AC_CHECK_FUNC($sgemm, [acx_blas_ok=yes])
++ LIBS="$save_LIBS"
++fi
++
++# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
++if test $acx_blas_ok = no; then
++ AC_CHECK_LIB(atlas, ATL_xerbla,
++ [AC_CHECK_LIB(f77blas, $sgemm,
++ [AC_CHECK_LIB(cblas, cblas_dgemm,
++ [acx_blas_ok=yes
++ BLAS_LIBS="-lcblas -lf77blas -latlas"],
++ [], [-lf77blas -latlas])],
++ [], [-latlas])])
++fi
++
++# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
++if test $acx_blas_ok = no; then
++ AC_CHECK_LIB(blas, $sgemm,
++ [AC_CHECK_LIB(dgemm, $dgemm,
++ [AC_CHECK_LIB(sgemm, $sgemm,
++ [acx_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"],
++ [], [-lblas])],
++ [], [-lblas])])
++fi
++
++# BLAS in Alpha CXML library?
++if test $acx_blas_ok = no; then
++ AC_CHECK_LIB(cxml, $sgemm, [acx_blas_ok=yes;BLAS_LIBS="-lcxml"])
++fi
++
++# BLAS in Alpha DXML library? (now called CXML, see above)
++if test $acx_blas_ok = no; then
++ AC_CHECK_LIB(dxml, $sgemm, [acx_blas_ok=yes;BLAS_LIBS="-ldxml"])
++fi
++
++# BLAS in Sun Performance library?
++if test $acx_blas_ok = no; then
++ if test "x$GCC" != xyes; then # only works with Sun CC
++ AC_CHECK_LIB(sunmath, acosp,
++ [AC_CHECK_LIB(sunperf, $sgemm,
++ [BLAS_LIBS="-xlic_lib=sunperf -lsunmath"
++ acx_blas_ok=yes],[],[-lsunmath])])
++ fi
++fi
++
++# BLAS in SCSL library? (SGI/Cray Scientific Library)
++if test $acx_blas_ok = no; then
++ AC_CHECK_LIB(scs, $sgemm, [acx_blas_ok=yes; BLAS_LIBS="-lscs"])
++fi
++
++# BLAS in SGIMATH library?
++if test $acx_blas_ok = no; then
++ AC_CHECK_LIB(complib.sgimath, $sgemm,
++ [acx_blas_ok=yes; BLAS_LIBS="-lcomplib.sgimath"])
++fi
++
++# BLAS in IBM ESSL library? (requires generic BLAS lib, too)
++if test $acx_blas_ok = no; then
++ AC_CHECK_LIB(blas, $sgemm,
++ [AC_CHECK_LIB(essl, $sgemm,
++ [acx_blas_ok=yes; BLAS_LIBS="-lessl -lblas"],
++ [], [-lblas $FLIBS])])
++fi
++
++# Generic BLAS library?
++if test $acx_blas_ok = no; then
++ AC_CHECK_LIB(blas, $sgemm, [acx_blas_ok=yes; BLAS_LIBS="-lblas"])
++fi
++
++AC_SUBST(BLAS_LIBS)
++
++LIBS="$acx_blas_save_LIBS"
++
++# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
++if test x"$acx_blas_ok" = xyes; then
++ ifelse([$1],,AC_DEFINE(HAVE_BLAS,1,[Define if you have a BLAS library.]),[$1])
++ :
++else
++ acx_blas_ok=no
++ $2
++fi
++])dnl ACX_BLAS
+--- acx_lapack.m4 1970-01-01 01:00:00.000000000 +0100
++++ acx_lapack.m4 2007-08-04 22:50:48.000000000 +0100
+@@ -0,0 +1,133 @@
++##### http://autoconf-archive.cryp.to/acx_lapack.html
++#
++# SYNOPSIS
++#
++# ACX_LAPACK([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
++#
++# DESCRIPTION
++#
++# This macro looks for a library that implements the LAPACK
++# linear-algebra interface (see http://www.netlib.org/lapack/). On
++# success, it sets the LAPACK_LIBS output variable to hold the
++# requisite library linkages.
++#
++# To link with LAPACK, you should link with:
++#
++# $LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS
++#
++# in that order. BLAS_LIBS is the output variable of the ACX_BLAS
++# macro, called automatically. FLIBS is the output variable of the
++# AC_F77_LIBRARY_LDFLAGS macro (called if necessary by ACX_BLAS), and
++# is sometimes necessary in order to link with F77 libraries. Users
++# will also need to use AC_F77_DUMMY_MAIN (see the autoconf manual),
++# for the same reason.
++#
++# The user may also use --with-lapack=<lib> in order to use some
++# specific LAPACK library <lib>. In order to link successfully,
++# however, be aware that you will probably need to use the same
++# Fortran compiler (which can be set via the F77 env. var.) as was
++# used to compile the LAPACK and BLAS libraries.
++#
++# ACTION-IF-FOUND is a list of shell commands to run if a LAPACK
++# library is found, and ACTION-IF-NOT-FOUND is a list of commands to
++# run it if it is not found. If ACTION-IF-FOUND is not specified, the
++# default action will define HAVE_LAPACK.
++#
++# LAST MODIFICATION
++#
++# 2007-07-29
++#
++# COPYLEFT
++#
++# Copyright (c) 2007 Steven G. Johnson <stevenj@alum.mit.edu>
++#
++# 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 3 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, see
++# <http://www.gnu.org/licenses/>.
++#
++# As a special exception, the respective Autoconf Macro's copyright
++# owner gives unlimited permission to copy, distribute and modify the
++# configure scripts that are the output of Autoconf when processing
++# the Macro. You need not follow the terms of the GNU General Public
++# License when using or distributing such scripts, even though
++# portions of the text of the Macro appear in them. The GNU General
++# Public License (GPL) does govern all other use of the material that
++# constitutes the Autoconf Macro.
++#
++# This special exception to the GPL applies to versions of the
++# Autoconf Macro released by the Autoconf Macro Archive. When you
++# make and distribute a modified version of the Autoconf Macro, you
++# may extend this special exception to the GPL to apply to your
++# modified version as well.
++
++AC_DEFUN([ACX_LAPACK], [
++AC_REQUIRE([ACX_BLAS])
++acx_lapack_ok=no
++
++AC_ARG_WITH(lapack,
++ [AC_HELP_STRING([--with-lapack=<lib>], [use LAPACK library <lib>])])
++case $with_lapack in
++ yes | "") ;;
++ no) acx_lapack_ok=disable ;;
++ -* | */* | *.a | *.so | *.so.* | *.o) LAPACK_LIBS="$with_lapack" ;;
++ *) LAPACK_LIBS="-l$with_lapack" ;;
++esac
++
++# Get fortran linker name of LAPACK function to check for.
++AC_F77_FUNC(cheev)
++
++# We cannot use LAPACK if BLAS is not found
++if test "x$acx_blas_ok" != xyes; then
++ acx_lapack_ok=noblas
++fi
++
++# First, check LAPACK_LIBS environment variable
++if test "x$LAPACK_LIBS" != x; then
++ save_LIBS="$LIBS"; LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS"
++ AC_MSG_CHECKING([for $cheev in $LAPACK_LIBS])
++ AC_TRY_LINK_FUNC($cheev, [acx_lapack_ok=yes], [LAPACK_LIBS=""])
++ AC_MSG_RESULT($acx_lapack_ok)
++ LIBS="$save_LIBS"
++ if test acx_lapack_ok = no; then
++ LAPACK_LIBS=""
++ fi
++fi
++
++# LAPACK linked to by default? (is sometimes included in BLAS lib)
++if test $acx_lapack_ok = no; then
++ save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS $FLIBS"
++ AC_CHECK_FUNC($cheev, [acx_lapack_ok=yes])
++ LIBS="$save_LIBS"
++fi
++
++# Generic LAPACK library?
++for lapack in lapack lapack_rs6k; do
++ if test $acx_lapack_ok = no; then
++ save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS"
++ AC_CHECK_LIB($lapack, $cheev,
++ [acx_lapack_ok=yes; LAPACK_LIBS="-l$lapack"], [], [$FLIBS])
++ LIBS="$save_LIBS"
++ fi
++done
++
++AC_SUBST(LAPACK_LIBS)
++
++# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
++if test x"$acx_lapack_ok" = xyes; then
++ ifelse([$1],,AC_DEFINE(HAVE_LAPACK,1,[Define if you have LAPACK library.]),[$1])
++ :
++else
++ acx_lapack_ok=no
++ $2
++fi
++])dnl ACX_LAPACK
diff --git a/sci-libs/cholmod/files/digest-cholmod-1.5.0 b/sci-libs/cholmod/files/digest-cholmod-1.5.0
new file mode 100644
index 000000000..31af2da3f
--- /dev/null
+++ b/sci-libs/cholmod/files/digest-cholmod-1.5.0
@@ -0,0 +1,3 @@
+MD5 1e247ed94c78f900ddcdd53c1f4803cb CHOLMOD-1.5.0.tar.gz 1090186
+RMD160 f0788e2a7cd4d4f013c292089fbb0cc3248a0f6a CHOLMOD-1.5.0.tar.gz 1090186
+SHA256 d586ee43a9cbbd29b6303124a6be5ebbb459cadfce315524dbd1c2ce31c5f9a1 CHOLMOD-1.5.0.tar.gz 1090186
diff --git a/sci-libs/metis/Manifest b/sci-libs/metis/Manifest
new file mode 100644
index 000000000..6c349799f
--- /dev/null
+++ b/sci-libs/metis/Manifest
@@ -0,0 +1,12 @@
+AUX metis-5.0_pre2-autotools.patch 44751 RMD160 8c9240bea3c11a8ec05158b06023cd27bb41d9dc SHA1 c4f1e06f2045cb5f6161705170f65a478ce80620 SHA256 07098f718410c1ed7adfd1a66f4f9199cd5225a1adc04ea5715d1ac063e6c3fe
+MD5 4faf1d549207d4ded4fb34a8505fc2ed files/metis-5.0_pre2-autotools.patch 44751
+RMD160 8c9240bea3c11a8ec05158b06023cd27bb41d9dc files/metis-5.0_pre2-autotools.patch 44751
+SHA256 07098f718410c1ed7adfd1a66f4f9199cd5225a1adc04ea5715d1ac063e6c3fe files/metis-5.0_pre2-autotools.patch 44751
+DIST metis-5.0pre2.tar.gz 1762166 RMD160 f73bc5c9b5b2458065dd2ebdc6aa3881541016c1 SHA1 7f94fac339b7bc52eb3e874b5046f563ee3c9e07 SHA256 3a81ee72ddcaa573afbec005e777a273717cb9d6475f381f07f78f89180f58aa
+EBUILD metis-5.0_pre2.ebuild 1512 RMD160 c891f7282e6f254b10d763c94ee5ccb364e77a8d SHA1 10fae08016710bbc7a74bd03c079116148cf2e3c SHA256 fc0f73cdf1dbb39ef09327ea0f9441b76eb68bc889f8a4f278cd10e7c56058dd
+MD5 d8a432a6e995250edb2f59e9e8b8a140 metis-5.0_pre2.ebuild 1512
+RMD160 c891f7282e6f254b10d763c94ee5ccb364e77a8d metis-5.0_pre2.ebuild 1512
+SHA256 fc0f73cdf1dbb39ef09327ea0f9441b76eb68bc889f8a4f278cd10e7c56058dd metis-5.0_pre2.ebuild 1512
+MD5 215800e713e2367ce84069184d517984 files/digest-metis-5.0_pre2 244
+RMD160 9cea43a54b2ca4c8f6c67c142aac8e2605a1b724 files/digest-metis-5.0_pre2 244
+SHA256 288220197d5e15aa3446f6fdc86d71d0007e63dec329bf356aa89f0503f15018 files/digest-metis-5.0_pre2 244
diff --git a/sci-libs/metis/files/digest-metis-5.0_pre2 b/sci-libs/metis/files/digest-metis-5.0_pre2
new file mode 100644
index 000000000..d147ee0eb
--- /dev/null
+++ b/sci-libs/metis/files/digest-metis-5.0_pre2
@@ -0,0 +1,3 @@
+MD5 5b6946bdd7c8a68cd37aabbc4c31c8ae metis-5.0pre2.tar.gz 1762166
+RMD160 f73bc5c9b5b2458065dd2ebdc6aa3881541016c1 metis-5.0pre2.tar.gz 1762166
+SHA256 3a81ee72ddcaa573afbec005e777a273717cb9d6475f381f07f78f89180f58aa metis-5.0pre2.tar.gz 1762166
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 000000000..4283d2d79
--- /dev/null
+++ b/sci-libs/metis/files/metis-5.0_pre2-autotools.patch
@@ -0,0 +1,1596 @@
+--- 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: smbfactor.c,v 1.2 2002/08/10 06:02:55 karypis 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:17:00.921758821 +0100
+@@ -0,0 +1,4 @@
++AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libmetis -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
+--- 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: smbfactor.c,v 1.2 2002/08/10 06:02:55 karypis 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
+--- 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: smbfactor.c,v 1.2 2002/08/10 06:02:55 karypis 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/metis-5.0_pre2.ebuild b/sci-libs/metis/metis-5.0_pre2.ebuild
new file mode 100644
index 000000000..4caa48a77
--- /dev/null
+++ b/sci-libs/metis/metis-5.0_pre2.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2007 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+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="as-is"
+
+IUSE="pcre openmp int64 threads"
+SLOT="0"
+
+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 INSTALL.v5 || die "dodoc failed"
+}