aboutsummaryrefslogtreecommitdiff
path: root/math/scalapack
diff options
context:
space:
mode:
authorMaho Nakata <maho@FreeBSD.org>2003-05-05 03:33:39 +0000
committerMaho Nakata <maho@FreeBSD.org>2003-05-05 03:33:39 +0000
commitd767d0f025471f94714d8638e81d140d76c08980 (patch)
tree1b52c4b3cd12cfa3889972c7601218aa9e2b2b70 /math/scalapack
parent5897c92e94ce8f432086af9f5f04e2f610174456 (diff)
downloadports-d767d0f025471f94714d8638e81d140d76c08980.tar.gz
ports-d767d0f025471f94714d8638e81d140d76c08980.zip
Notes
Diffstat (limited to 'math/scalapack')
-rw-r--r--math/scalapack/Makefile76
-rw-r--r--math/scalapack/distinfo10
-rw-r--r--math/scalapack/files/Makefile11
-rw-r--r--math/scalapack/files/PBtools.h.patch19
-rw-r--r--math/scalapack/files/example1.cc434
-rw-r--r--math/scalapack/files/example1.f324
-rw-r--r--math/scalapack/files/manpages617
-rw-r--r--math/scalapack/files/patch-SLmake.inc62
-rw-r--r--math/scalapack/pkg-descr7
-rw-r--r--math/scalapack/pkg-message21
-rw-r--r--math/scalapack/pkg-plist164
11 files changed, 1745 insertions, 0 deletions
diff --git a/math/scalapack/Makefile b/math/scalapack/Makefile
new file mode 100644
index 000000000000..9808f3acce33
--- /dev/null
+++ b/math/scalapack/Makefile
@@ -0,0 +1,76 @@
+# New ports collection makefile for: scalapack
+# Date created: 5 Feb 2003
+# Whom: NAKATA, Maho <maho@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= scalapack
+PORTVERSION= 1.7
+CATEGORIES= math
+MASTER_SITES= ftp://ftp.netlib.org/scalapack/
+DISTNAME= SCALAPACK
+DISTFILES= scalapack.tgz manpages.tgz
+.if !defined(NOPORTDOCS)
+DISTFILES+= scalapack_install.ps scalapackqref.ps \
+ lawn100.ps pblasqref.ps manual.ps design.ps \
+ pumma_refmanual.ps trans.ps
+.endif
+DIST_SUBDIR= scalapack
+EXTRACT_ONLY= scalapack.tgz manpages.tgz
+
+MAINTAINER= maho@FreeBSD.org
+COMMENT= The ScaLAPACK Scalable LAPACK library
+
+BUILD_DEPENDS= ${LOCALBASE}/mpich/lib/libmpich.a:${PORTSDIR}/net/mpich \
+ ${LOCALBASE}/lib/libblacs.a:${PORTSDIR}/math/blacs \
+ ${LOCALBASE}/bin/f2c:${PORTSDIR}/lang/f2c
+LIB_DEPENDS= lapack:${PORTSDIR}/math/lapack \
+ atlas:${PORTSDIR}/math/atlas
+
+F77?= f77
+USE_REINPLACE= yes
+
+.include "files/manpages"
+
+post-patch:
+ ${REINPLACE_CMD} -e 's,@WRKSRC@,${WRKSRC},g ; s,@PREFIX@,${PREFIX},g ; s,@CC@,${CC},g ; s,@CFLAGS@,${CFLAGS},g ; s,@F77@,${F77},g ; s,@FFLAGS@,${FFLAGS},g ; s,@F77EXTRAFLAGS@,${F77EXTRAFLAGS},g' ${WRKSRC}/SLmake.inc
+
+do-build:
+ (cd ${WRKSRC}; make ; make exe)
+ (cd ${WRKSRC}; ${PATCH} < ${FILESDIR}/PBtools.h.patch )
+ (${MKDIR} ${WRKSRC}/include ;\
+ cd ${WRKSRC}/include ;\
+ f2c -C++ -P ${WRKSRC}/SRC/*.f ;\
+ f2c -C++ -P ${WRKSRC}/TOOLS/*.f ;\
+ ${CAT} *.P | ${GREP} -v :ref: > scalapack.h)
+
+do-install:
+ ${INSTALL_DATA} ${WRKSRC}/libscalapack.a ${PREFIX}/lib/libscalapack.a
+ ${INSTALL_MAN} ${WRKDIR}/MANPAGES/man/manl/*.l ${PREFIX}/man/manl
+ ${MKDIR} ${PREFIX}/share/SCALAPACK/TESTING
+ (cd ${WRKSRC}/TESTING/ ;\
+ ${INSTALL_PROGRAM} x* ${PREFIX}/share/SCALAPACK/TESTING ;\
+ ${INSTALL_DATA} *.dat ${PREFIX}/share/SCALAPACK/TESTING)
+ ${INSTALL_DATA} ${WRKSRC}/include/scalapack.h ${PREFIX}/include
+ ${INSTALL_DATA} ${WRKSRC}/PBLAS/SRC/*.h ${PREFIX}/include
+ ${MKDIR} ${PREFIX}/share/examples/SCALAPACK
+ ${INSTALL_DATA} ${FILESDIR}/Makefile ${PREFIX}/share/examples/SCALAPACK
+ ${INSTALL_DATA} ${FILESDIR}/example1.cc ${PREFIX}/share/examples/SCALAPACK
+ ${INSTALL_DATA} ${FILESDIR}/example1.f ${PREFIX}/share/examples/SCALAPACK
+.if !defined(NOPORTDOCS)
+ @${MKDIR} ${DOCSDIR}
+ ${CAT} ${DISTDIR}/${DIST_SUBDIR}/design.ps | ${GZIP_CMD} > ${DOCSDIR}/design.ps.gz
+ ${CAT} ${DISTDIR}/${DIST_SUBDIR}/lawn100.ps | ${GZIP_CMD} > ${DOCSDIR}/lawn100.ps.gz
+ ${CAT} ${DISTDIR}/${DIST_SUBDIR}/manual.ps | ${GZIP_CMD} > ${DOCSDIR}/manual.ps.gz
+ ${CAT} ${DISTDIR}/${DIST_SUBDIR}/pblasqref.ps | ${GZIP_CMD} > ${DOCSDIR}/pblasqref.ps.gz
+ ${CAT} ${DISTDIR}/${DIST_SUBDIR}/pumma_refmanual.ps | ${GZIP_CMD} > ${DOCSDIR}/pumma_refmanual.ps.gz
+ ${CAT} ${DISTDIR}/${DIST_SUBDIR}/scalapack_install.ps | ${GZIP_CMD} > ${DOCSDIR}/scalapack_install.ps.gz
+ ${CAT} ${DISTDIR}/${DIST_SUBDIR}/scalapackqref.ps | ${GZIP_CMD} > ${DOCSDIR}/scalapackqref.ps.gz
+ ${CAT} ${DISTDIR}/${DIST_SUBDIR}/trans.ps | ${GZIP_CMD} > ${DOCSDIR}/trans.ps.gz
+.endif
+
+post-install:
+ @${SED} -e 's,/usr/local,${PREFIX},g' ${PKGMESSAGE}
+
+.include <bsd.port.mk>
diff --git a/math/scalapack/distinfo b/math/scalapack/distinfo
new file mode 100644
index 000000000000..f9038e2ccad6
--- /dev/null
+++ b/math/scalapack/distinfo
@@ -0,0 +1,10 @@
+MD5 (scalapack/scalapack.tgz) = 6d214940fab71d56117184d55cbb29f1
+MD5 (scalapack/manpages.tgz) = a536ab4837ec68addff0a3ec99427a10
+MD5 (scalapack/scalapack_install.ps) = 72e99a64a7fd917793bca0425bd35c7d
+MD5 (scalapack/scalapackqref.ps) = 3e4c1d66839d8dcaef80f0ebf39318d4
+MD5 (scalapack/lawn100.ps) = d52ec306a6814afe5cd6e190c9816c06
+MD5 (scalapack/pblasqref.ps) = c93be9b58ea44560b423fce88d8dbf66
+MD5 (scalapack/manual.ps) = 95562c3c6ebd0f32ccc6f0aaf10df3e5
+MD5 (scalapack/design.ps) = 753b0896099470821cde54c34055ad26
+MD5 (scalapack/pumma_refmanual.ps) = ec890d5fa5e4c6dd49466670b04e23b6
+MD5 (scalapack/trans.ps) = 6a8d050b208ac27d6538718e27bc16f2
diff --git a/math/scalapack/files/Makefile b/math/scalapack/files/Makefile
new file mode 100644
index 000000000000..b8acf5217911
--- /dev/null
+++ b/math/scalapack/files/Makefile
@@ -0,0 +1,11 @@
+# Makefile of Sample program
+# Written by NAKATA, Maho <maho@FreeBSD.org>
+# $FreeBSD$
+
+all: densg densg2
+
+densg: example1.f # f77 version
+ mpif77 -o densg example1.f -L/usr/local/lib -lscalapack -lblacs -lblacsf77 -lblacs -lf77blas -latlas
+
+densg2: example1.cc # C++ version
+ mpiCC -o densg2 example1.cc -I/usr/local/mpich/include -I/usr/local/include -L/usr/local/lib -lscalapack -lblacs -lblacsf77 -lblacs -lf77blas -latlas -lg2c -lm
diff --git a/math/scalapack/files/PBtools.h.patch b/math/scalapack/files/PBtools.h.patch
new file mode 100644
index 000000000000..59445d1196c9
--- /dev/null
+++ b/math/scalapack/files/PBtools.h.patch
@@ -0,0 +1,19 @@
+--- PBLAS/SRC/PBtools.h.orig Wed Feb 16 03:04:17 2000
++++ PBLAS/SRC/PBtools.h Sat Jul 13 12:38:19 2002
+@@ -1148,7 +1148,7 @@
+ int *, char *, char *,
+ int *, char *, int *,
+ char *, char *, int * );
+-
++/* comment out to avoid conflict with lapack.h
+ F_VOID_FCT csymv_ ( F_CHAR_T, int *, char *,
+ char *, int *, char *,
+ int *, char *, char *,
+@@ -1164,6 +1164,7 @@
+ F_VOID_FCT zsyr_ ( F_CHAR_T, int *, char *,
+ char *, int *, char *,
+ int * );
++*/
+
+ F_VOID_FCT csyr2_ ( F_CHAR_T, int *, char *,
+ char *, int *, char *,
diff --git a/math/scalapack/files/example1.cc b/math/scalapack/files/example1.cc
new file mode 100644
index 000000000000..255740de09dd
--- /dev/null
+++ b/math/scalapack/files/example1.cc
@@ -0,0 +1,434 @@
+/* example1.f -- translated by f2c (version 20000817).
+ You must link the resulting object file with the libraries:
+ -lf2c -lm (in that order)
+*/
+
+#include <mpi.h>
+
+#ifdef __cplusplus
+extern "C" {
+#include <blas.h>
+#include <lapack.h>
+#include <pblas.h>
+#include <PBpblas.h>
+#include <PBtools.h>
+#include <PBblacs.h>
+#include <scalapack.h>
+#endif
+#include "g2c.h"
+
+/* Table of constant values */
+
+static integer c__9 = 9;
+static integer c__2 = 2;
+static integer c__0 = 0;
+static integer c__5 = 5;
+static integer c__1 = 1;
+static doublereal c_b70 = 1.;
+static doublereal c_b75 = -1.;
+static integer c_n1 = -1;
+
+/* Main program */ int MAIN__()
+{
+ /* Initialized data */
+
+ static integer nprow = 2;
+ static integer npcol = 3;
+
+ /* Format strings */
+ static char fmt_9999[] = "(/\002ScaLAPACK Example Program #1 -- May 1, 1\
+997\002)";
+ static char fmt_9998[] = "(/\002Solving Ax=b where A is a \002,i3,\002 b\
+y \002,i3,\002 matrix with a block size of \002,i3)";
+ static char fmt_9997[] = "(\002Running on \002,i3,\002 processes, where \
+the process grid\002,\002 is \002,i3,\002 by \002,i3)";
+ static char fmt_9996[] = "(/\002INFO code returned by PDGESV = \002,i3)";
+ static char fmt_9995[] = "(/\002According to the normalized residual the\
+ solution is correct.\002)";
+ static char fmt_9993[] = "(/\002||A*x - b|| / ( ||x||*||A||*eps*N ) =\
+ \002,1p,e16.8)";
+ static char fmt_9994[] = "(/\002According to the normalized residual the\
+ solution is incorrect.\002)";
+
+ /* System generated locals */
+ integer i__1;
+
+ /* Builtin functions */
+ integer s_wsfe(cilist *), e_wsfe(), do_fio(integer *, char *, ftnlen);
+ /* Subroutine */ int s_stop(char *, ftnlen);
+
+ /* Local variables */
+ static integer info, ipiv[7];
+ extern /* Subroutine */ int descinit_(integer *, integer *, integer *,
+ integer *, integer *, integer *, integer *, integer *, integer *,
+ integer *);
+ static doublereal work[5], a[20] /* was [5][4] */, b[5] /* was [5][1]
+ */;
+ static integer desca[9], descb[9];
+ static doublereal resid, anorm, bnorm, a0[20] /* was [5][4] */, b0[
+ 5] /* was [5][1] */;
+ static integer mycol, ictxt;
+ static doublereal xnorm;
+ static integer myrow;
+ extern /* Subroutine */ int pdgemm_(char *, char *, integer *, integer *,
+ integer *, doublereal *, doublereal *, integer *, integer *,
+ integer *, doublereal *, integer *, integer *, integer *,
+ doublereal *, doublereal *, integer *, integer *, integer *,
+ ftnlen, ftnlen), pdgesv_(integer *, integer *, doublereal *,
+ integer *, integer *, integer *, integer *, doublereal *, integer
+ *, integer *, integer *, integer *), blacs_exit__(integer *),
+ blacs_gridinfo__(integer *, integer *, integer *, integer *,
+ integer *), blacs_gridexit__(integer *);
+ static doublereal eps;
+ extern doublereal pdlamch_(integer *, char *, ftnlen), pdlange_(char *,
+ integer *, integer *, doublereal *, integer *, integer *, integer
+ *, doublereal *, ftnlen);
+ extern /* Subroutine */ int pdlacpy_(char *, integer *, integer *,
+ doublereal *, integer *, integer *, integer *, doublereal *,
+ integer *, integer *, integer *, ftnlen), sl_init__(integer *,
+ integer *, integer *), matinit_(doublereal *, integer *,
+ doublereal *, integer *);
+
+ /* Fortran I/O blocks */
+ static cilist io___14 = { 0, 6, 0, fmt_9999, 0 };
+ static cilist io___15 = { 0, 6, 0, fmt_9998, 0 };
+ static cilist io___16 = { 0, 6, 0, fmt_9997, 0 };
+ static cilist io___17 = { 0, 6, 0, fmt_9996, 0 };
+ static cilist io___24 = { 0, 6, 0, fmt_9995, 0 };
+ static cilist io___25 = { 0, 6, 0, fmt_9993, 0 };
+ static cilist io___26 = { 0, 6, 0, fmt_9994, 0 };
+ static cilist io___27 = { 0, 6, 0, fmt_9993, 0 };
+
+
+
+/* Example Program solving Ax=b via ScaLAPACK routine PDGESV */
+
+/* .. Parameters .. */
+/* .. */
+/* .. Local Scalars .. */
+/* .. */
+/* .. Local Arrays .. */
+/* .. */
+/* .. External Functions .. */
+/* .. */
+/* .. External Subroutines .. */
+/* .. */
+/* .. Intrinsic Functions .. */
+/* .. */
+/* .. Data statements .. */
+/* .. */
+/* .. Executable Statements .. */
+
+/* INITIALIZE THE PROCESS GRID */
+
+ sl_init__(&ictxt, &nprow, &npcol);
+ blacs_gridinfo__(&ictxt, &nprow, &npcol, &myrow, &mycol);
+
+/* If I'm not in the process grid, go to the end of the program */
+
+ if (myrow == -1) {
+ goto L10;
+ }
+
+/* DISTRIBUTE THE MATRIX ON THE PROCESS GRID */
+/* Initialize the array descriptors for the matrices A and B */
+
+ descinit_(desca, &c__9, &c__9, &c__2, &c__2, &c__0, &c__0, &ictxt, &c__5,
+ &info);
+ descinit_(descb, &c__9, &c__1, &c__2, &c__1, &c__0, &c__0, &ictxt, &c__5,
+ &info);
+
+/* Generate matrices A and B and distribute to the process grid */
+
+ matinit_(a, desca, b, descb);
+
+/* Make a copy of A and B for checking purposes */
+
+ pdlacpy_("All", &c__9, &c__9, a, &c__1, &c__1, desca, a0, &c__1, &c__1,
+ desca, (ftnlen)3);
+ pdlacpy_("All", &c__9, &c__1, b, &c__1, &c__1, descb, b0, &c__1, &c__1,
+ descb, (ftnlen)3);
+
+/* CALL THE SCALAPACK ROUTINE */
+/* Solve the linear system A * X = B */
+
+ pdgesv_(&c__9, &c__1, a, &c__1, &c__1, desca, ipiv, b, &c__1, &c__1,
+ descb, &info);
+
+ if (myrow == 0 && mycol == 0) {
+ s_wsfe(&io___14);
+ e_wsfe();
+ s_wsfe(&io___15);
+ do_fio(&c__1, (char *)&c__9, (ftnlen)sizeof(integer));
+ do_fio(&c__1, (char *)&c__9, (ftnlen)sizeof(integer));
+ do_fio(&c__1, (char *)&c__2, (ftnlen)sizeof(integer));
+ e_wsfe();
+ s_wsfe(&io___16);
+ i__1 = nprow * npcol;
+ do_fio(&c__1, (char *)&i__1, (ftnlen)sizeof(integer));
+ do_fio(&c__1, (char *)&nprow, (ftnlen)sizeof(integer));
+ do_fio(&c__1, (char *)&npcol, (ftnlen)sizeof(integer));
+ e_wsfe();
+ s_wsfe(&io___17);
+ do_fio(&c__1, (char *)&info, (ftnlen)sizeof(integer));
+ e_wsfe();
+ }
+
+/* Compute residual ||A * X - B|| / ( ||X|| * ||A|| * eps * N ) */
+
+ eps = pdlamch_(&ictxt, "Epsilon", (ftnlen)7);
+ anorm = pdlange_("I", &c__9, &c__9, a, &c__1, &c__1, desca, work, (ftnlen)
+ 1);
+ bnorm = pdlange_("I", &c__9, &c__1, b, &c__1, &c__1, descb, work, (ftnlen)
+ 1);
+ pdgemm_("N", "N", &c__9, &c__1, &c__9, &c_b70, a0, &c__1, &c__1, desca, b,
+ &c__1, &c__1, descb, &c_b75, b0, &c__1, &c__1, descb, (ftnlen)1,
+ (ftnlen)1);
+ xnorm = pdlange_("I", &c__9, &c__1, b0, &c__1, &c__1, descb, work, (
+ ftnlen)1);
+ resid = xnorm / (anorm * bnorm * eps * 9.);
+
+ if (myrow == 0 && mycol == 0) {
+ if (resid < 10.) {
+ s_wsfe(&io___24);
+ e_wsfe();
+ s_wsfe(&io___25);
+ do_fio(&c__1, (char *)&resid, (ftnlen)sizeof(doublereal));
+ e_wsfe();
+ } else {
+ s_wsfe(&io___26);
+ e_wsfe();
+ s_wsfe(&io___27);
+ do_fio(&c__1, (char *)&resid, (ftnlen)sizeof(doublereal));
+ e_wsfe();
+ }
+ }
+
+/* RELEASE THE PROCESS GRID */
+/* Free the BLACS context */
+
+ blacs_gridexit__(&ictxt);
+L10:
+
+/* Exit the BLACS */
+
+ blacs_exit__(&c__0);
+
+ s_stop("", (ftnlen)0);
+ return 0;
+} /* MAIN__ */
+
+/* Subroutine */ int matinit_(doublereal *aa, integer *desca, doublereal *b,
+ integer *descb)
+{
+ static doublereal a, c__, k, l, p, s;
+ static integer npcol, mycol, ictxt, nprow, myrow, mxllda;
+ extern /* Subroutine */ int blacs_gridinfo__(integer *, integer *,
+ integer *, integer *, integer *);
+
+
+/* MATINIT generates and distributes matrices A and B (depicted in */
+/* Figures 2.5 and 2.6) to a 2 x 3 process grid */
+
+/* .. Array Arguments .. */
+/* .. */
+/* .. Parameters .. */
+/* .. */
+/* .. Local Scalars .. */
+/* .. */
+/* .. External Subroutines .. */
+/* .. */
+/* .. Executable Statements .. */
+
+ /* Parameter adjustments */
+ --descb;
+ --b;
+ --desca;
+ --aa;
+
+ /* Function Body */
+ ictxt = desca[2];
+ blacs_gridinfo__(&ictxt, &nprow, &npcol, &myrow, &mycol);
+
+ s = 19.;
+ c__ = 3.;
+ a = 1.;
+ l = 12.;
+ p = 16.;
+ k = 11.;
+
+ mxllda = desca[9];
+
+ if (myrow == 0 && mycol == 0) {
+ aa[1] = s;
+ aa[2] = -s;
+ aa[3] = -s;
+ aa[4] = -s;
+ aa[5] = -s;
+ aa[mxllda + 1] = c__;
+ aa[mxllda + 2] = c__;
+ aa[mxllda + 3] = -c__;
+ aa[mxllda + 4] = -c__;
+ aa[mxllda + 5] = -c__;
+ aa[(mxllda << 1) + 1] = a;
+ aa[(mxllda << 1) + 2] = a;
+ aa[(mxllda << 1) + 3] = a;
+ aa[(mxllda << 1) + 4] = a;
+ aa[(mxllda << 1) + 5] = -a;
+ aa[mxllda * 3 + 1] = c__;
+ aa[mxllda * 3 + 2] = c__;
+ aa[mxllda * 3 + 3] = c__;
+ aa[mxllda * 3 + 4] = c__;
+ aa[mxllda * 3 + 5] = -c__;
+ b[1] = 0.;
+ b[2] = 0.;
+ b[3] = 0.;
+ b[4] = 0.;
+ b[5] = 0.;
+ } else if (myrow == 0 && mycol == 1) {
+ aa[1] = a;
+ aa[2] = a;
+ aa[3] = -a;
+ aa[4] = -a;
+ aa[5] = -a;
+ aa[mxllda + 1] = l;
+ aa[mxllda + 2] = l;
+ aa[mxllda + 3] = -l;
+ aa[mxllda + 4] = -l;
+ aa[mxllda + 5] = -l;
+ aa[(mxllda << 1) + 1] = k;
+ aa[(mxllda << 1) + 2] = k;
+ aa[(mxllda << 1) + 3] = k;
+ aa[(mxllda << 1) + 4] = k;
+ aa[(mxllda << 1) + 5] = k;
+ } else if (myrow == 0 && mycol == 2) {
+ aa[1] = a;
+ aa[2] = a;
+ aa[3] = a;
+ aa[4] = -a;
+ aa[5] = -a;
+ aa[mxllda + 1] = p;
+ aa[mxllda + 2] = p;
+ aa[mxllda + 3] = p;
+ aa[mxllda + 4] = p;
+ aa[mxllda + 5] = -p;
+ } else if (myrow == 1 && mycol == 0) {
+ aa[1] = -s;
+ aa[2] = -s;
+ aa[3] = -s;
+ aa[4] = -s;
+ aa[mxllda + 1] = -c__;
+ aa[mxllda + 2] = -c__;
+ aa[mxllda + 3] = -c__;
+ aa[mxllda + 4] = c__;
+ aa[(mxllda << 1) + 1] = a;
+ aa[(mxllda << 1) + 2] = a;
+ aa[(mxllda << 1) + 3] = a;
+ aa[(mxllda << 1) + 4] = -a;
+ aa[mxllda * 3 + 1] = c__;
+ aa[mxllda * 3 + 2] = c__;
+ aa[mxllda * 3 + 3] = c__;
+ aa[mxllda * 3 + 4] = c__;
+ b[1] = 1.;
+ b[2] = 0.;
+ b[3] = 0.;
+ b[4] = 0.;
+ } else if (myrow == 1 && mycol == 1) {
+ aa[1] = a;
+ aa[2] = -a;
+ aa[3] = -a;
+ aa[4] = -a;
+ aa[mxllda + 1] = l;
+ aa[mxllda + 2] = l;
+ aa[mxllda + 3] = -l;
+ aa[mxllda + 4] = -l;
+ aa[(mxllda << 1) + 1] = k;
+ aa[(mxllda << 1) + 2] = k;
+ aa[(mxllda << 1) + 3] = k;
+ aa[(mxllda << 1) + 4] = k;
+ } else if (myrow == 1 && mycol == 2) {
+ aa[1] = a;
+ aa[2] = a;
+ aa[3] = -a;
+ aa[4] = -a;
+ aa[mxllda + 1] = p;
+ aa[mxllda + 2] = p;
+ aa[mxllda + 3] = -p;
+ aa[mxllda + 4] = -p;
+ }
+ return 0;
+} /* matinit_ */
+
+/* Subroutine */ int sl_init__(integer *ictxt, integer *nprow, integer *npcol)
+{
+ extern /* Subroutine */ int blacs_get__(integer *, integer *, integer *);
+ static integer nprocs;
+ extern /* Subroutine */ int blacs_gridinit__(integer *, char *, integer *,
+ integer *, ftnlen);
+ static integer iam;
+ extern /* Subroutine */ int blacs_pinfo__(integer *, integer *),
+ blacs_setup__(integer *, integer *);
+
+
+/* .. Scalar Arguments .. */
+/* .. */
+
+/* Purpose */
+/* ======= */
+
+/* SL_INIT initializes an NPROW x NPCOL process grid using a row-major */
+/* ordering of the processes. This routine retrieves a default system */
+/* context which will include all available processes. In addition it */
+/* spawns the processes if needed. */
+
+/* Arguments */
+/* ========= */
+
+/* ICTXT (global output) INTEGER */
+/* ICTXT specifies the BLACS context handle identifying the */
+/* created process grid. The context itself is global. */
+
+/* NPROW (global input) INTEGER */
+/* NPROW specifies the number of process rows in the grid */
+/* to be created. */
+
+/* NPCOL (global input) INTEGER */
+/* NPCOL specifies the number of process columns in the grid */
+/* to be created. */
+
+/* ===================================================================== */
+
+/* .. Local Scalars .. */
+/* .. */
+/* .. External Subroutines .. */
+/* .. */
+/* .. Executable Statements .. */
+
+/* Get starting information */
+
+ blacs_pinfo__(&iam, &nprocs);
+
+/* If machine needs additional set up, do it now */
+
+ if (nprocs < 1) {
+ if (iam == 0) {
+ nprocs = *nprow * *npcol;
+ }
+ blacs_setup__(&iam, &nprocs);
+ }
+
+/* Define process grid */
+
+ blacs_get__(&c_n1, &c__0, ictxt);
+ blacs_gridinit__(ictxt, "Row-major", nprow, npcol, (ftnlen)9);
+
+ return 0;
+
+/* End of SL_INIT */
+
+} /* sl_init__ */
+
+/* Main program alias */ int example1_ () { MAIN__ (); return 0; }
+#ifdef __cplusplus
+ }
+#endif
diff --git a/math/scalapack/files/example1.f b/math/scalapack/files/example1.f
new file mode 100644
index 000000000000..ce1b1a6fa6eb
--- /dev/null
+++ b/math/scalapack/files/example1.f
@@ -0,0 +1,324 @@
+ PROGRAM EXAMPLE1
+*
+* Example Program solving Ax=b via ScaLAPACK routine PDGESV
+*
+* .. Parameters ..
+ INTEGER DLEN_, IA, JA, IB, JB, M, N, MB, NB, RSRC,
+ $ CSRC, MXLLDA, MXLLDB, NRHS, NBRHS, NOUT,
+ $ MXLOCR, MXLOCC, MXRHSC
+ PARAMETER ( DLEN_ = 9, IA = 1, JA = 1, IB = 1, JB = 1,
+ $ M = 9, N = 9, MB = 2, NB = 2, RSRC = 0,
+ $ CSRC = 0, MXLLDA = 5, MXLLDB = 5, NRHS = 1,
+ $ NBRHS = 1, NOUT = 6, MXLOCR = 5, MXLOCC = 4,
+ $ MXRHSC = 1 )
+ DOUBLE PRECISION ONE
+ PARAMETER ( ONE = 1.0D+0 )
+* ..
+* .. Local Scalars ..
+ INTEGER ICTXT, INFO, MYCOL, MYROW, NPCOL, NPROW
+ DOUBLE PRECISION ANORM, BNORM, EPS, RESID, XNORM
+* ..
+* .. Local Arrays ..
+ INTEGER DESCA( DLEN_ ), DESCB( DLEN_ ),
+ $ IPIV( MXLOCR+NB )
+ DOUBLE PRECISION A( MXLLDA, MXLOCC ), A0( MXLLDA, MXLOCC ),
+ $ B( MXLLDB, MXRHSC ), B0( MXLLDB, MXRHSC ),
+ $ WORK( MXLOCR )
+* ..
+* .. External Functions ..
+ DOUBLE PRECISION PDLAMCH, PDLANGE
+ EXTERNAL PDLAMCH, PDLANGE
+* ..
+* .. External Subroutines ..
+ EXTERNAL BLACS_EXIT, BLACS_GRIDEXIT, BLACS_GRIDINFO,
+ $ DESCINIT, MATINIT, PDGEMM, PDGESV, PDLACPY,
+ $ SL_INIT
+* ..
+* .. Intrinsic Functions ..
+ INTRINSIC DBLE
+* ..
+* .. Data statements ..
+ DATA NPROW / 2 / , NPCOL / 3 /
+* ..
+* .. Executable Statements ..
+*
+* INITIALIZE THE PROCESS GRID
+*
+ CALL SL_INIT( ICTXT, NPROW, NPCOL )
+ CALL BLACS_GRIDINFO( ICTXT, NPROW, NPCOL, MYROW, MYCOL )
+*
+* If I'm not in the process grid, go to the end of the program
+*
+ IF( MYROW.EQ.-1 )
+ $ GO TO 10
+*
+* DISTRIBUTE THE MATRIX ON THE PROCESS GRID
+* Initialize the array descriptors for the matrices A and B
+*
+ CALL DESCINIT( DESCA, M, N, MB, NB, RSRC, CSRC, ICTXT, MXLLDA,
+ $ INFO )
+ CALL DESCINIT( DESCB, N, NRHS, NB, NBRHS, RSRC, CSRC, ICTXT,
+ $ MXLLDB, INFO )
+*
+* Generate matrices A and B and distribute to the process grid
+*
+ CALL MATINIT( A, DESCA, B, DESCB )
+*
+* Make a copy of A and B for checking purposes
+*
+ CALL PDLACPY( 'All', N, N, A, 1, 1, DESCA, A0, 1, 1, DESCA )
+ CALL PDLACPY( 'All', N, NRHS, B, 1, 1, DESCB, B0, 1, 1, DESCB )
+*
+* CALL THE SCALAPACK ROUTINE
+* Solve the linear system A * X = B
+*
+ CALL PDGESV( N, NRHS, A, IA, JA, DESCA, IPIV, B, IB, JB, DESCB,
+ $ INFO )
+*
+ IF( MYROW.EQ.0 .AND. MYCOL.EQ.0 ) THEN
+ WRITE( NOUT, FMT = 9999 )
+ WRITE( NOUT, FMT = 9998 )M, N, NB
+ WRITE( NOUT, FMT = 9997 )NPROW*NPCOL, NPROW, NPCOL
+ WRITE( NOUT, FMT = 9996 )INFO
+ END IF
+*
+* Compute residual ||A * X - B|| / ( ||X|| * ||A|| * eps * N )
+*
+ EPS = PDLAMCH( ICTXT, 'Epsilon' )
+ ANORM = PDLANGE( 'I', N, N, A, 1, 1, DESCA, WORK )
+ BNORM = PDLANGE( 'I', N, NRHS, B, 1, 1, DESCB, WORK )
+ CALL PDGEMM( 'N', 'N', N, NRHS, N, ONE, A0, 1, 1, DESCA, B, 1, 1,
+ $ DESCB, -ONE, B0, 1, 1, DESCB )
+ XNORM = PDLANGE( 'I', N, NRHS, B0, 1, 1, DESCB, WORK )
+ RESID = XNORM / ( ANORM*BNORM*EPS*DBLE( N ) )
+*
+ IF( MYROW.EQ.0 .AND. MYCOL.EQ.0 ) THEN
+ IF( RESID.LT.10.0D+0 ) THEN
+ WRITE( NOUT, FMT = 9995 )
+ WRITE( NOUT, FMT = 9993 )RESID
+ ELSE
+ WRITE( NOUT, FMT = 9994 )
+ WRITE( NOUT, FMT = 9993 )RESID
+ END IF
+ END IF
+*
+* RELEASE THE PROCESS GRID
+* Free the BLACS context
+*
+ CALL BLACS_GRIDEXIT( ICTXT )
+ 10 CONTINUE
+*
+* Exit the BLACS
+*
+ CALL BLACS_EXIT( 0 )
+*
+ 9999 FORMAT( / 'ScaLAPACK Example Program #1 -- May 1, 1997' )
+ 9998 FORMAT( / 'Solving Ax=b where A is a ', I3, ' by ', I3,
+ $ ' matrix with a block size of ', I3 )
+ 9997 FORMAT( 'Running on ', I3, ' processes, where the process grid',
+ $ ' is ', I3, ' by ', I3 )
+ 9996 FORMAT( / 'INFO code returned by PDGESV = ', I3 )
+ 9995 FORMAT( /
+ $ 'According to the normalized residual the solution is correct.'
+ $ )
+ 9994 FORMAT( /
+ $ 'According to the normalized residual the solution is incorrect.'
+ $ )
+ 9993 FORMAT( / '||A*x - b|| / ( ||x||*||A||*eps*N ) = ', 1P, E16.8 )
+ STOP
+ END
+ SUBROUTINE MATINIT( AA, DESCA, B, DESCB )
+*
+* MATINIT generates and distributes matrices A and B (depicted in
+* Figures 2.5 and 2.6) to a 2 x 3 process grid
+*
+* .. Array Arguments ..
+ INTEGER DESCA( * ), DESCB( * )
+ DOUBLE PRECISION AA( * ), B( * )
+* ..
+* .. Parameters ..
+ INTEGER CTXT_, LLD_
+ PARAMETER ( CTXT_ = 2, LLD_ = 9 )
+* ..
+* .. Local Scalars ..
+ INTEGER ICTXT, MXLLDA, MYCOL, MYROW, NPCOL, NPROW
+ DOUBLE PRECISION A, C, K, L, P, S
+* ..
+* .. External Subroutines ..
+ EXTERNAL BLACS_GRIDINFO
+* ..
+* .. Executable Statements ..
+*
+ ICTXT = DESCA( CTXT_ )
+ CALL BLACS_GRIDINFO( ICTXT, NPROW, NPCOL, MYROW, MYCOL )
+*
+ S = 19.0D0
+ C = 3.0D0
+ A = 1.0D0
+ L = 12.0D0
+ P = 16.0D0
+ K = 11.0D0
+*
+ MXLLDA = DESCA( LLD_ )
+*
+ IF( MYROW.EQ.0 .AND. MYCOL.EQ.0 ) THEN
+ AA( 1 ) = S
+ AA( 2 ) = -S
+ AA( 3 ) = -S
+ AA( 4 ) = -S
+ AA( 5 ) = -S
+ AA( 1+MXLLDA ) = C
+ AA( 2+MXLLDA ) = C
+ AA( 3+MXLLDA ) = -C
+ AA( 4+MXLLDA ) = -C
+ AA( 5+MXLLDA ) = -C
+ AA( 1+2*MXLLDA ) = A
+ AA( 2+2*MXLLDA ) = A
+ AA( 3+2*MXLLDA ) = A
+ AA( 4+2*MXLLDA ) = A
+ AA( 5+2*MXLLDA ) = -A
+ AA( 1+3*MXLLDA ) = C
+ AA( 2+3*MXLLDA ) = C
+ AA( 3+3*MXLLDA ) = C
+ AA( 4+3*MXLLDA ) = C
+ AA( 5+3*MXLLDA ) = -C
+ B( 1 ) = 0.0D0
+ B( 2 ) = 0.0D0
+ B( 3 ) = 0.0D0
+ B( 4 ) = 0.0D0
+ B( 5 ) = 0.0D0
+ ELSE IF( MYROW.EQ.0 .AND. MYCOL.EQ.1 ) THEN
+ AA( 1 ) = A
+ AA( 2 ) = A
+ AA( 3 ) = -A
+ AA( 4 ) = -A
+ AA( 5 ) = -A
+ AA( 1+MXLLDA ) = L
+ AA( 2+MXLLDA ) = L
+ AA( 3+MXLLDA ) = -L
+ AA( 4+MXLLDA ) = -L
+ AA( 5+MXLLDA ) = -L
+ AA( 1+2*MXLLDA ) = K
+ AA( 2+2*MXLLDA ) = K
+ AA( 3+2*MXLLDA ) = K
+ AA( 4+2*MXLLDA ) = K
+ AA( 5+2*MXLLDA ) = K
+ ELSE IF( MYROW.EQ.0 .AND. MYCOL.EQ.2 ) THEN
+ AA( 1 ) = A
+ AA( 2 ) = A
+ AA( 3 ) = A
+ AA( 4 ) = -A
+ AA( 5 ) = -A
+ AA( 1+MXLLDA ) = P
+ AA( 2+MXLLDA ) = P
+ AA( 3+MXLLDA ) = P
+ AA( 4+MXLLDA ) = P
+ AA( 5+MXLLDA ) = -P
+ ELSE IF( MYROW.EQ.1 .AND. MYCOL.EQ.0 ) THEN
+ AA( 1 ) = -S
+ AA( 2 ) = -S
+ AA( 3 ) = -S
+ AA( 4 ) = -S
+ AA( 1+MXLLDA ) = -C
+ AA( 2+MXLLDA ) = -C
+ AA( 3+MXLLDA ) = -C
+ AA( 4+MXLLDA ) = C
+ AA( 1+2*MXLLDA ) = A
+ AA( 2+2*MXLLDA ) = A
+ AA( 3+2*MXLLDA ) = A
+ AA( 4+2*MXLLDA ) = -A
+ AA( 1+3*MXLLDA ) = C
+ AA( 2+3*MXLLDA ) = C
+ AA( 3+3*MXLLDA ) = C
+ AA( 4+3*MXLLDA ) = C
+ B( 1 ) = 1.0D0
+ B( 2 ) = 0.0D0
+ B( 3 ) = 0.0D0
+ B( 4 ) = 0.0D0
+ ELSE IF( MYROW.EQ.1 .AND. MYCOL.EQ.1 ) THEN
+ AA( 1 ) = A
+ AA( 2 ) = -A
+ AA( 3 ) = -A
+ AA( 4 ) = -A
+ AA( 1+MXLLDA ) = L
+ AA( 2+MXLLDA ) = L
+ AA( 3+MXLLDA ) = -L
+ AA( 4+MXLLDA ) = -L
+ AA( 1+2*MXLLDA ) = K
+ AA( 2+2*MXLLDA ) = K
+ AA( 3+2*MXLLDA ) = K
+ AA( 4+2*MXLLDA ) = K
+ ELSE IF( MYROW.EQ.1 .AND. MYCOL.EQ.2 ) THEN
+ AA( 1 ) = A
+ AA( 2 ) = A
+ AA( 3 ) = -A
+ AA( 4 ) = -A
+ AA( 1+MXLLDA ) = P
+ AA( 2+MXLLDA ) = P
+ AA( 3+MXLLDA ) = -P
+ AA( 4+MXLLDA ) = -P
+ END IF
+ RETURN
+ END
+ SUBROUTINE SL_INIT( ICTXT, NPROW, NPCOL )
+*
+* .. Scalar Arguments ..
+ INTEGER ICTXT, NPCOL, NPROW
+* ..
+*
+* Purpose
+* =======
+*
+* SL_INIT initializes an NPROW x NPCOL process grid using a row-major
+* ordering of the processes. This routine retrieves a default system
+* context which will include all available processes. In addition it
+* spawns the processes if needed.
+*
+* Arguments
+* =========
+*
+* ICTXT (global output) INTEGER
+* ICTXT specifies the BLACS context handle identifying the
+* created process grid. The context itself is global.
+*
+* NPROW (global input) INTEGER
+* NPROW specifies the number of process rows in the grid
+* to be created.
+*
+* NPCOL (global input) INTEGER
+* NPCOL specifies the number of process columns in the grid
+* to be created.
+*
+* =====================================================================
+*
+* .. Local Scalars ..
+ INTEGER IAM, NPROCS
+* ..
+* .. External Subroutines ..
+ EXTERNAL BLACS_GET, BLACS_GRIDINIT, BLACS_PINFO,
+ $ BLACS_SETUP
+* ..
+* .. Executable Statements ..
+*
+* Get starting information
+*
+ CALL BLACS_PINFO( IAM, NPROCS )
+*
+* If machine needs additional set up, do it now
+*
+ IF( NPROCS.LT.1 ) THEN
+ IF( IAM.EQ.0 )
+ $ NPROCS = NPROW*NPCOL
+ CALL BLACS_SETUP( IAM, NPROCS )
+ END IF
+*
+* Define process grid
+*
+ CALL BLACS_GET( -1, 0, ICTXT )
+ CALL BLACS_GRIDINIT( ICTXT, 'Row-major', NPROW, NPCOL )
+*
+ RETURN
+*
+* End of SL_INIT
+*
+ END
diff --git a/math/scalapack/files/manpages b/math/scalapack/files/manpages
new file mode 100644
index 000000000000..08d385feefee
--- /dev/null
+++ b/math/scalapack/files/manpages
@@ -0,0 +1,617 @@
+MANL= \
+cdbtf2.l \
+cdbtrf.l \
+cdttrf.l \
+cdttrsv.l \
+clahqr2.l \
+clamsh.l \
+clanv2.l \
+claref.l \
+cpttrsv.l \
+csteqr2.l \
+ctrmvt.l \
+ddbtf2.l \
+ddbtrf.l \
+ddttrf.l \
+ddttrsv.l \
+dlamsh.l \
+dlapst.l \
+dlaref.l \
+dlasorte.l \
+dlasrt2.l \
+dpttrsv.l \
+dstein2.l \
+dsteqr2.l \
+dtrmvt.l \
+pcdbsv.l \
+pcdbtrf.l \
+pcdbtrs.l \
+pcdbtrsv.l \
+pcdtsv.l \
+pcdttrf.l \
+pcdttrs.l \
+pcdttrsv.l \
+pcgbsv.l \
+pcgbtrf.l \
+pcgbtrs.l \
+pcgebd2.l \
+pcgebrd.l \
+pcgecon.l \
+pcgeequ.l \
+pcgehd2.l \
+pcgehrd.l \
+pcgelq2.l \
+pcgelqf.l \
+pcgels.l \
+pcgeql2.l \
+pcgeqlf.l \
+pcgeqpf.l \
+pcgeqr2.l \
+pcgeqrf.l \
+pcgerfs.l \
+pcgerq2.l \
+pcgerqf.l \
+pcgesv.l \
+pcgesvx.l \
+pcgetf2.l \
+pcgetrf.l \
+pcgetri.l \
+pcgetrs.l \
+pcggqrf.l \
+pcggrqf.l \
+pcheev.l \
+pcheevd.l \
+pcheevx.l \
+pchegs2.l \
+pchegst.l \
+pchegvx.l \
+pchengst.l \
+pchentrd.l \
+pchetd2.l \
+pchetrd.l \
+pchettrd.l \
+pclabrd.l \
+pclacgv.l \
+pclacon.l \
+pclaconsb.l \
+pclacp2.l \
+pclacp3.l \
+pclacpy.l \
+pclaevswp.l \
+pclahqr.l \
+pclahrd.l \
+pclamr1d.l \
+pclange.l \
+pclanhe.l \
+pclanhs.l \
+pclansy.l \
+pclantr.l \
+pclapiv.l \
+pclapv2.l \
+pclaqge.l \
+pclaqsy.l \
+pclarf.l \
+pclarfb.l \
+pclarfc.l \
+pclarfg.l \
+pclarft.l \
+pclarz.l \
+pclarzb.l \
+pclarzc.l \
+pclarzt.l \
+pclascl.l \
+pclase2.l \
+pclaset.l \
+pclasmsub.l \
+pclassq.l \
+pclaswp.l \
+pclatra.l \
+pclatrd.l \
+pclatrs.l \
+pclatrz.l \
+pclattrs.l \
+pclauu2.l \
+pclauum.l \
+pclawil.l \
+pcmax1.l \
+pcpbsv.l \
+pcpbtrf.l \
+pcpbtrs.l \
+pcpbtrsv.l \
+pcpocon.l \
+pcpoequ.l \
+pcporfs.l \
+pcposv.l \
+pcposvx.l \
+pcpotf2.l \
+pcpotrf.l \
+pcpotri.l \
+pcpotrs.l \
+pcptsv.l \
+pcpttrf.l \
+pcpttrs.l \
+pcpttrsv.l \
+pcsrscl.l \
+pcstein.l \
+pctrcon.l \
+pctrevc.l \
+pctrrfs.l \
+pctrti2.l \
+pctrtri.l \
+pctrtrs.l \
+pctzrzf.l \
+pcung2l.l \
+pcung2r.l \
+pcungl2.l \
+pcunglq.l \
+pcungql.l \
+pcungqr.l \
+pcungr2.l \
+pcungrq.l \
+pcunm2l.l \
+pcunm2r.l \
+pcunmbr.l \
+pcunmhr.l \
+pcunml2.l \
+pcunmlq.l \
+pcunmql.l \
+pcunmqr.l \
+pcunmr2.l \
+pcunmr3.l \
+pcunmrq.l \
+pcunmrz.l \
+pcunmtr.l \
+pddbsv.l \
+pddbtrf.l \
+pddbtrs.l \
+pddbtrsv.l \
+pddtsv.l \
+pddttrf.l \
+pddttrs.l \
+pddttrsv.l \
+pdgbsv.l \
+pdgbtrf.l \
+pdgbtrs.l \
+pdgebd2.l \
+pdgebrd.l \
+pdgecon.l \
+pdgeequ.l \
+pdgehd2.l \
+pdgehrd.l \
+pdgelq2.l \
+pdgelqf.l \
+pdgels.l \
+pdgeql2.l \
+pdgeqlf.l \
+pdgeqpf.l \
+pdgeqr2.l \
+pdgeqrf.l \
+pdgerfs.l \
+pdgerq2.l \
+pdgerqf.l \
+pdgesv.l \
+pdgesvd.l \
+pdgesvx.l \
+pdgetf2.l \
+pdgetrf.l \
+pdgetri.l \
+pdgetrs.l \
+pdggqrf.l \
+pdggrqf.l \
+pdlabad.l \
+pdlabrd.l \
+pdlacon.l \
+pdlaconsb.l \
+pdlacp2.l \
+pdlacp3.l \
+pdlacpy.l \
+pdlaed0.l \
+pdlaed1.l \
+pdlaed2.l \
+pdlaed3.l \
+pdlaedz.l \
+pdlaevswp.l \
+pdlahqr.l \
+pdlahrd.l \
+pdlamch.l \
+pdlamr1d.l \
+pdlange.l \
+pdlanhs.l \
+pdlansy.l \
+pdlantr.l \
+pdlapiv.l \
+pdlapv2.l \
+pdlaqge.l \
+pdlaqsy.l \
+pdlared1d.l \
+pdlared2d.l \
+pdlarf.l \
+pdlarfb.l \
+pdlarfg.l \
+pdlarft.l \
+pdlarz.l \
+pdlarzb.l \
+pdlarzt.l \
+pdlascl.l \
+pdlase2.l \
+pdlaset.l \
+pdlasmsub.l \
+pdlasrt.l \
+pdlassq.l \
+pdlaswp.l \
+pdlatra.l \
+pdlatrd.l \
+pdlatrs.l \
+pdlatrz.l \
+pdlauu2.l \
+pdlauum.l \
+pdlawil.l \
+pdorg2l.l \
+pdorg2r.l \
+pdorgl2.l \
+pdorglq.l \
+pdorgql.l \
+pdorgqr.l \
+pdorgr2.l \
+pdorgrq.l \
+pdorm2l.l \
+pdorm2r.l \
+pdormbr.l \
+pdormhr.l \
+pdorml2.l \
+pdormlq.l \
+pdormql.l \
+pdormqr.l \
+pdormr2.l \
+pdormr3.l \
+pdormrq.l \
+pdormrz.l \
+pdormtr.l \
+pdpbsv.l \
+pdpbtrf.l \
+pdpbtrs.l \
+pdpbtrsv.l \
+pdpocon.l \
+pdpoequ.l \
+pdporfs.l \
+pdposv.l \
+pdposvx.l \
+pdpotf2.l \
+pdpotrf.l \
+pdpotri.l \
+pdpotrs.l \
+pdptsv.l \
+pdpttrf.l \
+pdpttrs.l \
+pdpttrsv.l \
+pdrscl.l \
+pdstebz.l \
+pdstedc.l \
+pdstein.l \
+pdsyev.l \
+pdsyevd.l \
+pdsyevx.l \
+pdsygs2.l \
+pdsygst.l \
+pdsygvx.l \
+pdsyngst.l \
+pdsyntrd.l \
+pdsytd2.l \
+pdsytrd.l \
+pdsyttrd.l \
+pdtrcon.l \
+pdtrrfs.l \
+pdtrti2.l \
+pdtrtri.l \
+pdtrtrs.l \
+pdtzrzf.l \
+pdzsum1.l \
+pjlaenv.l \
+pscsum1.l \
+psdbsv.l \
+psdbtrf.l \
+psdbtrs.l \
+psdbtrsv.l \
+psdtsv.l \
+psdttrf.l \
+psdttrs.l \
+psdttrsv.l \
+psgbsv.l \
+psgbtrf.l \
+psgbtrs.l \
+psgebd2.l \
+psgebrd.l \
+psgecon.l \
+psgeequ.l \
+psgehd2.l \
+psgehrd.l \
+psgelq2.l \
+psgelqf.l \
+psgels.l \
+psgeql2.l \
+psgeqlf.l \
+psgeqpf.l \
+psgeqr2.l \
+psgeqrf.l \
+psgerfs.l \
+psgerq2.l \
+psgerqf.l \
+psgesv.l \
+psgesvd.l \
+psgesvx.l \
+psgetf2.l \
+psgetrf.l \
+psgetri.l \
+psgetrs.l \
+psggqrf.l \
+psggrqf.l \
+pslabad.l \
+pslabrd.l \
+pslacon.l \
+pslaconsb.l \
+pslacp2.l \
+pslacp3.l \
+pslacpy.l \
+pslaed0.l \
+pslaed1.l \
+pslaed2.l \
+pslaed3.l \
+pslaedz.l \
+pslaevswp.l \
+pslahqr.l \
+pslahrd.l \
+pslamch.l \
+pslamr1d.l \
+pslange.l \
+pslanhs.l \
+pslansy.l \
+pslantr.l \
+pslapiv.l \
+pslapv2.l \
+pslaqge.l \
+pslaqsy.l \
+pslared1d.l \
+pslared2d.l \
+pslarf.l \
+pslarfb.l \
+pslarfg.l \
+pslarft.l \
+pslarz.l \
+pslarzb.l \
+pslarzt.l \
+pslascl.l \
+pslase2.l \
+pslaset.l \
+pslasmsub.l \
+pslasrt.l \
+pslassq.l \
+pslaswp.l \
+pslatra.l \
+pslatrd.l \
+pslatrs.l \
+pslatrz.l \
+pslauu2.l \
+pslauum.l \
+pslawil.l \
+psorg2l.l \
+psorg2r.l \
+psorgl2.l \
+psorglq.l \
+psorgql.l \
+psorgqr.l \
+psorgr2.l \
+psorgrq.l \
+psorm2l.l \
+psorm2r.l \
+psormbr.l \
+psormhr.l \
+psorml2.l \
+psormlq.l \
+psormql.l \
+psormqr.l \
+psormr2.l \
+psormr3.l \
+psormrq.l \
+psormrz.l \
+psormtr.l \
+pspbsv.l \
+pspbtrf.l \
+pspbtrs.l \
+pspbtrsv.l \
+pspocon.l \
+pspoequ.l \
+psporfs.l \
+psposv.l \
+psposvx.l \
+pspotf2.l \
+pspotrf.l \
+pspotri.l \
+pspotrs.l \
+psptsv.l \
+pspttrf.l \
+pspttrs.l \
+pspttrsv.l \
+psrscl.l \
+psstebz.l \
+psstedc.l \
+psstein.l \
+pssyev.l \
+pssyevd.l \
+pssyevx.l \
+pssygs2.l \
+pssygst.l \
+pssygvx.l \
+pssyngst.l \
+pssyntrd.l \
+pssytd2.l \
+pssytrd.l \
+pssyttrd.l \
+pstrcon.l \
+pstrrfs.l \
+pstrti2.l \
+pstrtri.l \
+pstrtrs.l \
+pstzrzf.l \
+pzdbsv.l \
+pzdbtrf.l \
+pzdbtrs.l \
+pzdbtrsv.l \
+pzdrscl.l \
+pzdtsv.l \
+pzdttrf.l \
+pzdttrs.l \
+pzdttrsv.l \
+pzgbsv.l \
+pzgbtrf.l \
+pzgbtrs.l \
+pzgebd2.l \
+pzgebrd.l \
+pzgecon.l \
+pzgeequ.l \
+pzgehd2.l \
+pzgehrd.l \
+pzgelq2.l \
+pzgelqf.l \
+pzgels.l \
+pzgeql2.l \
+pzgeqlf.l \
+pzgeqpf.l \
+pzgeqr2.l \
+pzgeqrf.l \
+pzgerfs.l \
+pzgerq2.l \
+pzgerqf.l \
+pzgesv.l \
+pzgesvx.l \
+pzgetf2.l \
+pzgetrf.l \
+pzgetri.l \
+pzgetrs.l \
+pzggqrf.l \
+pzggrqf.l \
+pzheev.l \
+pzheevd.l \
+pzheevx.l \
+pzhegs2.l \
+pzhegst.l \
+pzhegvx.l \
+pzhengst.l \
+pzhentrd.l \
+pzhetd2.l \
+pzhetrd.l \
+pzhettrd.l \
+pzlabrd.l \
+pzlacgv.l \
+pzlacon.l \
+pzlaconsb.l \
+pzlacp2.l \
+pzlacp3.l \
+pzlacpy.l \
+pzlaevswp.l \
+pzlahqr.l \
+pzlahrd.l \
+pzlamr1d.l \
+pzlange.l \
+pzlanhe.l \
+pzlanhs.l \
+pzlansy.l \
+pzlantr.l \
+pzlapiv.l \
+pzlapv2.l \
+pzlaqge.l \
+pzlaqsy.l \
+pzlarf.l \
+pzlarfb.l \
+pzlarfc.l \
+pzlarfg.l \
+pzlarft.l \
+pzlarz.l \
+pzlarzb.l \
+pzlarzc.l \
+pzlarzt.l \
+pzlascl.l \
+pzlase2.l \
+pzlaset.l \
+pzlasmsub.l \
+pzlassq.l \
+pzlaswp.l \
+pzlatra.l \
+pzlatrd.l \
+pzlatrs.l \
+pzlatrz.l \
+pzlattrs.l \
+pzlauu2.l \
+pzlauum.l \
+pzlawil.l \
+pzmax1.l \
+pzpbsv.l \
+pzpbtrf.l \
+pzpbtrs.l \
+pzpbtrsv.l \
+pzpocon.l \
+pzpoequ.l \
+pzporfs.l \
+pzposv.l \
+pzposvx.l \
+pzpotf2.l \
+pzpotrf.l \
+pzpotri.l \
+pzpotrs.l \
+pzptsv.l \
+pzpttrf.l \
+pzpttrs.l \
+pzpttrsv.l \
+pzstein.l \
+pztrcon.l \
+pztrevc.l \
+pztrrfs.l \
+pztrti2.l \
+pztrtri.l \
+pztrtrs.l \
+pztzrzf.l \
+pzung2l.l \
+pzung2r.l \
+pzungl2.l \
+pzunglq.l \
+pzungql.l \
+pzungqr.l \
+pzungr2.l \
+pzungrq.l \
+pzunm2l.l \
+pzunm2r.l \
+pzunmbr.l \
+pzunmhr.l \
+pzunml2.l \
+pzunmlq.l \
+pzunmql.l \
+pzunmqr.l \
+pzunmr2.l \
+pzunmr3.l \
+pzunmrq.l \
+pzunmrz.l \
+pzunmtr.l \
+sdbtf2.l \
+sdbtrf.l \
+sdttrf.l \
+sdttrsv.l \
+slamsh.l \
+slapst.l \
+slaref.l \
+slasorte.l \
+slasrt2.l \
+spttrsv.l \
+sstein2.l \
+ssteqr2.l \
+strmvt.l \
+zdbtf2.l \
+zdbtrf.l \
+zdttrf.l \
+zdttrsv.l \
+zlahqr2.l \
+zlamsh.l \
+zlanv2.l \
+zlaref.l \
+zpttrsv.l \
+zsteqr2.l \
+ztrmvt.l
+
diff --git a/math/scalapack/files/patch-SLmake.inc b/math/scalapack/files/patch-SLmake.inc
new file mode 100644
index 000000000000..b1f8032d0ba4
--- /dev/null
+++ b/math/scalapack/files/patch-SLmake.inc
@@ -0,0 +1,62 @@
+--- SLmake.inc.orig Thu Aug 9 11:59:50 2001
++++ SLmake.inc Mon May 5 11:51:11 2003
+@@ -19,26 +19,26 @@
+ # The complete path to the top level of ScaLAPACK directory, usually
+ # $(HOME)/SCALAPACK
+ #
+-home = $(HOME)/SCALAPACK
++home = @WRKSRC@
+ #
+ # The platform identifier to suffix to the end of library names
+ #
+-PLAT = LINUX
++PLAT = FreeBSD
+ #
+ # BLACS setup. All version need the debug level (0 or 1),
+ # and the directory where the BLACS libraries are
+ #
+ BLACSDBGLVL = 0
+-BLACSdir = /usr/local/lib
++BLACSdir = @PREFIX@/lib
+ #
+ # MPI setup; tailor to your system if using MPIBLACS
+ # Will need to comment out these 6 lines if using PVM
+ #
+ USEMPI = -DUsingMpiBlacs
+-SMPLIB = /usr/local/mpich-1.2.1/lib/libmpich.a
+-BLACSFINIT = $(BLACSdir)/libmpiblacsF77init-p4.a
+-BLACSCINIT = $(BLACSdir)/libmpiblacsCinit-p4.a
+-BLACSLIB = $(BLACSdir)/libmpiblacs-p4.a
++SMPLIB = @PREFIX@/mpich/lib/libmpich.a @PREFIX@/mpich/lib/libpmpich.a
++BLACSFINIT = $(BLACSdir)/libblacsf77.a
++BLACSCINIT = $(BLACSdir)/libblacsc.a
++BLACSLIB = $(BLACSdir)/libblacs.a
+ TESTINGdir = $(home)/TESTING
+
+ #
+@@ -67,12 +67,12 @@
+ #
+ # The fortran and C compilers, loaders, and their flags
+ #
+-F77 = g77
++F77 = @F77@
+ #F77 = /usr/local/pgi/linux86/bin/pgf77
+-CC = gcc
++CC = @CC@
+ NOOPT =
+-F77FLAGS = -O3 $(NOOPT)
+-CCFLAGS = -O4
++F77FLAGS = @FFLAGS@
++CCFLAGS = @CFLAGS@
+ SRCFLAG =
+ F77LOADER = $(F77)
+ CCLOADER = $(CC)
+@@ -94,7 +94,7 @@
+ # The name of the libraries to be created/linked to
+ #
+ SCALAPACKLIB = $(home)/libscalapack.a
+-BLASLIB = /usr/local/lib/libf77blas.a /usr/local/lib/libatlas.a
++BLASLIB = @PREFIX@/lib/libf77blas.a @PREFIX@/lib/libatlas.a
+ #
+ PBLIBS = $(SCALAPACKLIB) $(FBLACSLIB) $(BLASLIB) $(SMPLIB)
+ PRLIBS = $(SCALAPACKLIB) $(CBLACSLIB) $(SMPLIB)
diff --git a/math/scalapack/pkg-descr b/math/scalapack/pkg-descr
new file mode 100644
index 000000000000..645ffa78ac3c
--- /dev/null
+++ b/math/scalapack/pkg-descr
@@ -0,0 +1,7 @@
+The ScaLAPACK (or Scalable LAPACK) library includes a subset of LAPACK routines
+redesigned for distributed memory MIMD parallel computers. It is currently
+written in a Single-Program-Multiple-Data style using explicit message
+passing for interprocessor communication. It assumes matrices are laid out
+in a two-dimensional block cyclic decomposition.
+
+WWW: http://www.netlib.org/scalapack
diff --git a/math/scalapack/pkg-message b/math/scalapack/pkg-message
new file mode 100644
index 000000000000..c06a730d934c
--- /dev/null
+++ b/math/scalapack/pkg-message
@@ -0,0 +1,21 @@
+***********************************************************************
+ Please test your blacs installation
+ Example programs are located at /usr/local/share/SCALAPACK/examples
+
+ Test programs are located at /usr/local/share/SCALAPACK/TESTING
+
+ Example:
+ % cd /usr/local/share/SCLAPACK/TESTING
+ % mpirun -np 4 xcbrd
+ % mpirun -np 4 xcdblu
+ etc., etc. ...
+
+ to perform all the tests,
+ % cd /usr/local/share/SCLAPACK/TESTING
+ % csh
+ % foreach i (x*)
+ ? mpirun -np 4 $i >& ~/$i.log
+ ? end
+You can change -np 4 to any number to meet your environment.
+See files at /usr/local/share/doc/scalapack for detail.
+**********************************************************************
diff --git a/math/scalapack/pkg-plist b/math/scalapack/pkg-plist
new file mode 100644
index 000000000000..54ea868ee9c3
--- /dev/null
+++ b/math/scalapack/pkg-plist
@@ -0,0 +1,164 @@
+include/PBblacs.h
+include/PBblas.h
+include/PBpblas.h
+include/PBtools.h
+include/pblas.h
+include/scalapack.h
+lib/libscalapack.a
+share/SCALAPACK/TESTING/BLLT.dat
+share/SCALAPACK/TESTING/BLU.dat
+share/SCALAPACK/TESTING/BRD.dat
+share/SCALAPACK/TESTING/EVC.dat
+share/SCALAPACK/TESTING/GEMR2D.dat
+share/SCALAPACK/TESTING/HRD.dat
+share/SCALAPACK/TESTING/INV.dat
+share/SCALAPACK/TESTING/LLT.dat
+share/SCALAPACK/TESTING/LS.dat
+share/SCALAPACK/TESTING/LU.dat
+share/SCALAPACK/TESTING/NEP.dat
+share/SCALAPACK/TESTING/PCBLAS1TIM.dat
+share/SCALAPACK/TESTING/PCBLAS1TST.dat
+share/SCALAPACK/TESTING/PCBLAS2TIM.dat
+share/SCALAPACK/TESTING/PCBLAS2TST.dat
+share/SCALAPACK/TESTING/PCBLAS3TIM.dat
+share/SCALAPACK/TESTING/PCBLAS3TST.dat
+share/SCALAPACK/TESTING/PDBLAS1TIM.dat
+share/SCALAPACK/TESTING/PDBLAS1TST.dat
+share/SCALAPACK/TESTING/PDBLAS2TIM.dat
+share/SCALAPACK/TESTING/PDBLAS2TST.dat
+share/SCALAPACK/TESTING/PDBLAS3TIM.dat
+share/SCALAPACK/TESTING/PDBLAS3TST.dat
+share/SCALAPACK/TESTING/PSBLAS1TIM.dat
+share/SCALAPACK/TESTING/PSBLAS1TST.dat
+share/SCALAPACK/TESTING/PSBLAS2TIM.dat
+share/SCALAPACK/TESTING/PSBLAS2TST.dat
+share/SCALAPACK/TESTING/PSBLAS3TIM.dat
+share/SCALAPACK/TESTING/PSBLAS3TST.dat
+share/SCALAPACK/TESTING/PZBLAS1TIM.dat
+share/SCALAPACK/TESTING/PZBLAS1TST.dat
+share/SCALAPACK/TESTING/PZBLAS2TIM.dat
+share/SCALAPACK/TESTING/PZBLAS2TST.dat
+share/SCALAPACK/TESTING/PZBLAS3TIM.dat
+share/SCALAPACK/TESTING/PZBLAS3TST.dat
+share/SCALAPACK/TESTING/QR.dat
+share/SCALAPACK/TESTING/SEP.dat
+share/SCALAPACK/TESTING/SVD.dat
+share/SCALAPACK/TESTING/TRD.dat
+share/SCALAPACK/TESTING/TRMR2D.dat
+share/SCALAPACK/TESTING/xcbrd
+share/SCALAPACK/TESTING/xcdblu
+share/SCALAPACK/TESTING/xcdtlu
+share/SCALAPACK/TESTING/xcevc
+share/SCALAPACK/TESTING/xcgblu
+share/SCALAPACK/TESTING/xcgemr
+share/SCALAPACK/TESTING/xcgsep
+share/SCALAPACK/TESTING/xchrd
+share/SCALAPACK/TESTING/xcinv
+share/SCALAPACK/TESTING/xcllt
+share/SCALAPACK/TESTING/xcls
+share/SCALAPACK/TESTING/xclu
+share/SCALAPACK/TESTING/xcnep
+share/SCALAPACK/TESTING/xcpblas1tim
+share/SCALAPACK/TESTING/xcpblas1tst
+share/SCALAPACK/TESTING/xcpblas2tim
+share/SCALAPACK/TESTING/xcpblas2tst
+share/SCALAPACK/TESTING/xcpblas3tim
+share/SCALAPACK/TESTING/xcpblas3tst
+share/SCALAPACK/TESTING/xcpbllt
+share/SCALAPACK/TESTING/xcptllt
+share/SCALAPACK/TESTING/xcqr
+share/SCALAPACK/TESTING/xcsep
+share/SCALAPACK/TESTING/xctrd
+share/SCALAPACK/TESTING/xctrmr
+share/SCALAPACK/TESTING/xdbrd
+share/SCALAPACK/TESTING/xddblu
+share/SCALAPACK/TESTING/xddtlu
+share/SCALAPACK/TESTING/xdgblu
+share/SCALAPACK/TESTING/xdgemr
+share/SCALAPACK/TESTING/xdgsep
+share/SCALAPACK/TESTING/xdhrd
+share/SCALAPACK/TESTING/xdinv
+share/SCALAPACK/TESTING/xdllt
+share/SCALAPACK/TESTING/xdls
+share/SCALAPACK/TESTING/xdlu
+share/SCALAPACK/TESTING/xdnep
+share/SCALAPACK/TESTING/xdpblas1tim
+share/SCALAPACK/TESTING/xdpblas1tst
+share/SCALAPACK/TESTING/xdpblas2tim
+share/SCALAPACK/TESTING/xdpblas2tst
+share/SCALAPACK/TESTING/xdpblas3tim
+share/SCALAPACK/TESTING/xdpblas3tst
+share/SCALAPACK/TESTING/xdpbllt
+share/SCALAPACK/TESTING/xdptllt
+share/SCALAPACK/TESTING/xdqr
+share/SCALAPACK/TESTING/xdsep
+share/SCALAPACK/TESTING/xdsvd
+share/SCALAPACK/TESTING/xdtrd
+share/SCALAPACK/TESTING/xdtrmr
+share/SCALAPACK/TESTING/xigemr
+share/SCALAPACK/TESTING/xitrmr
+share/SCALAPACK/TESTING/xsbrd
+share/SCALAPACK/TESTING/xsdblu
+share/SCALAPACK/TESTING/xsdtlu
+share/SCALAPACK/TESTING/xsgblu
+share/SCALAPACK/TESTING/xsgemr
+share/SCALAPACK/TESTING/xsgsep
+share/SCALAPACK/TESTING/xshrd
+share/SCALAPACK/TESTING/xsinv
+share/SCALAPACK/TESTING/xsllt
+share/SCALAPACK/TESTING/xsls
+share/SCALAPACK/TESTING/xslu
+share/SCALAPACK/TESTING/xsnep
+share/SCALAPACK/TESTING/xspblas1tim
+share/SCALAPACK/TESTING/xspblas1tst
+share/SCALAPACK/TESTING/xspblas2tim
+share/SCALAPACK/TESTING/xspblas2tst
+share/SCALAPACK/TESTING/xspblas3tim
+share/SCALAPACK/TESTING/xspblas3tst
+share/SCALAPACK/TESTING/xspbllt
+share/SCALAPACK/TESTING/xsptllt
+share/SCALAPACK/TESTING/xsqr
+share/SCALAPACK/TESTING/xssep
+share/SCALAPACK/TESTING/xssvd
+share/SCALAPACK/TESTING/xstrd
+share/SCALAPACK/TESTING/xstrmr
+share/SCALAPACK/TESTING/xzbrd
+share/SCALAPACK/TESTING/xzdblu
+share/SCALAPACK/TESTING/xzdtlu
+share/SCALAPACK/TESTING/xzevc
+share/SCALAPACK/TESTING/xzgblu
+share/SCALAPACK/TESTING/xzgemr
+share/SCALAPACK/TESTING/xzgsep
+share/SCALAPACK/TESTING/xzhrd
+share/SCALAPACK/TESTING/xzinv
+share/SCALAPACK/TESTING/xzllt
+share/SCALAPACK/TESTING/xzls
+share/SCALAPACK/TESTING/xzlu
+share/SCALAPACK/TESTING/xznep
+share/SCALAPACK/TESTING/xzpblas1tim
+share/SCALAPACK/TESTING/xzpblas1tst
+share/SCALAPACK/TESTING/xzpblas2tim
+share/SCALAPACK/TESTING/xzpblas2tst
+share/SCALAPACK/TESTING/xzpblas3tim
+share/SCALAPACK/TESTING/xzpblas3tst
+share/SCALAPACK/TESTING/xzpbllt
+share/SCALAPACK/TESTING/xzptllt
+share/SCALAPACK/TESTING/xzqr
+share/SCALAPACK/TESTING/xzsep
+share/SCALAPACK/TESTING/xztrd
+share/SCALAPACK/TESTING/xztrmr
+share/examples/SCALAPACK/Makefile
+share/examples/SCALAPACK/example1.cc
+share/examples/SCALAPACK/example1.f
+@dirrm share/SCALAPACK/TESTING
+@dirrm share/SCALAPACK
+@dirrm share/examples/SCALAPACK
+%%PORTDOCS%%share/doc/scalapack/design.ps.gz
+%%PORTDOCS%%share/doc/scalapack/lawn100.ps.gz
+%%PORTDOCS%%share/doc/scalapack/manual.ps.gz
+%%PORTDOCS%%share/doc/scalapack/pblasqref.ps.gz
+%%PORTDOCS%%share/doc/scalapack/pumma_refmanual.ps.gz
+%%PORTDOCS%%share/doc/scalapack/scalapack_install.ps.gz
+%%PORTDOCS%%share/doc/scalapack/scalapackqref.ps.gz
+%%PORTDOCS%%share/doc/scalapack/trans.ps.gz
+%%PORTDOCS%%@dirrm share/doc/scalapack