aboutsummaryrefslogtreecommitdiff
path: root/math/kktdirect
diff options
context:
space:
mode:
authorBrendan Fabeny <bf@FreeBSD.org>2012-01-02 09:58:01 +0000
committerBrendan Fabeny <bf@FreeBSD.org>2012-01-02 09:58:01 +0000
commiteb6cb039fc9994ed64dbf0f1c574c48cb7244a74 (patch)
tree862dbe970654cff8d9af21cd974a7576109170ef /math/kktdirect
parentd3680e41d3f3aad6dd2cc259dd2e9ebd5b121a8b (diff)
downloadports-eb6cb039fc9994ed64dbf0f1c574c48cb7244a74.tar.gz
ports-eb6cb039fc9994ed64dbf0f1c574c48cb7244a74.zip
Add kktdirect 0.5, a direct solver package for saddle-point (KKT)
matrices.
Notes
Notes: svn path=/head/; revision=288407
Diffstat (limited to 'math/kktdirect')
-rw-r--r--math/kktdirect/Makefile110
-rw-r--r--math/kktdirect/distinfo4
-rw-r--r--math/kktdirect/pkg-descr19
3 files changed, 133 insertions, 0 deletions
diff --git a/math/kktdirect/Makefile b/math/kktdirect/Makefile
new file mode 100644
index 000000000000..a8b9bea2651f
--- /dev/null
+++ b/math/kktdirect/Makefile
@@ -0,0 +1,110 @@
+# ex:ts=8
+# Ports collection makefile for: kktdirect
+# Date created: 1 Jan 2012
+# Whom: bf@FreeBSD.org
+#
+# $FreeBSD$
+#
+
+PORTNAME= kktdirect
+PORTVERSION= 0.5
+CATEGORIES= math
+MASTER_SITES= http://www.cs.ubc.ca/~rbridson/download/ LOCAL/bf
+DISTNAME= KKTDirect${PORTVERSION}
+
+MAINTAINER= bf@FreeBSD.org
+COMMENT= A direct solver package for saddle-point (KKT) matrices
+
+USE_FORTRAN= yes
+USE_LDCONFIG= yes
+
+CFLAGS+= -DUSE_FORTRAN_BLAS -DUSE_FORTRAN_LAPACK
+LDFLAGS+= -L${LOCALBASE}/lib ${LAPACK} ${BLAS} -lm
+PLIST_FILES= include/kktdirect.h lib/libkktdirect.a lib/libkktdirect_pic.a \
+ lib/libkktdirect.so lib/libkktdirect.so.0
+
+.include <bsd.port.pre.mk>
+
+.if ${ARCH} == "sparc64"
+PICFLAG?= -fPIC
+.else
+PICFLAG?= -fpic
+.endif
+
+.if exists(${LOCALBASE}/lib/libgoto2.so)
+WITH_BLAS?= gotoblas
+.elif exists(${LOCALBASE}/lib/libatlas.so)
+WITH_BLAS?= atlas
+.else
+WITH_BLAS?= reference
+.endif
+
+.if ${WITH_BLAS} == reference
+LIB_DEPENDS+= blas.2:${PORTSDIR}/math/blas
+LIB_DEPENDS+= lapack.4:${PORTSDIR}/math/lapack
+BLAS= -lblas
+LAPACK = -llapack
+.elif ${WITH_BLAS} == gotoblas
+LIB_DEPENDS+= goto2:${PORTSDIR}/math/gotoblas
+BLAS = -lgoto2p
+LAPACK = -lgoto2p
+.elif ${WITH_BLAS} == atlas
+LIB_DEPENDS+= atlas:${PORTSDIR}/math/atlas
+BLAS= -lptf77blas
+LAPACK = -lalapack -lptcblas
+.endif
+
+.ifndef(NOPORTDOCS)
+PORTDOCS= kktdirect.pdf
+.endif
+
+.ifndef(NOPORTEXAMPLES)
+PORTEXAMPLES= kktsolve.cpp
+.endif
+
+post-patch:
+ @${REINPLACE_CMD} -E \
+ -e 's@CPP@CXX@g' \
+ -e '\@^(CC|CXX) =@s@^@#@' \
+ -e 's@^(C|CXX|LD)(FLAGS )(=)(.*)@\1\2+\3 $${PICFLAG}@' \
+ -e 's@ar r@${AR} r@' \
+ -e 's@ranlib@${RANLIB}@' \
+ ${WRKSRC}/Makefile
+
+do-build: build-dynamic build-static
+
+.ORDER: build-dynamic build-static
+
+build-dynamic: patch
+ @cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${_MAKE_JOBS} \
+ ${MAKE_ARGS} PICFLAG="${PICFLAG}" clean libkktdirect.a ; \
+ ${CXX} ${CXXFLAGS} -shared -Wl,-x -Wl,-soname,libkktdirect.so.0 \
+ -o ${WRKDIR}/libkktdirect.so.0 -Wl,--whole-archive libkktdirect.a \
+ -Wl,--no-whole-archive -Wl,--as-needed ${LDFLAGS} ; \
+ ${CP} -af libkktdirect.a ${WRKDIR}/libkktdirect_pic.a
+
+build-static: patch
+ @cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${_MAKE_JOBS} \
+ ${MAKE_ARGS} PICFLAG="" clean libkktdirect.a ; \
+ ${CP} -af libkktdirect.a ${WRKDIR}
+
+check regression-test test: build
+ @cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${_MAKE_JOBS} \
+ ${MAKE_ARGS} PICFLAG="" stokes ; \
+ ./stokes 3
+
+do-install:
+ @${INSTALL_DATA} ${WRKSRC}/kktdirect.h ${PREFIX}/include
+ @cd ${WRKDIR}; ${INSTALL_DATA} libkktdirect.a libkktdirect_pic.a \
+ libkktdirect.so.0 ${PREFIX}/lib
+ @${LN} -sf libkktdirect.so.0 ${PREFIX}/lib/libkktdirect.so
+.ifndef(NOPORTDOCS)
+ @${INSTALL_DATA} -d ${DOCSDIR}
+ @cd ${WRKSRC}; ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR}
+.endif
+.ifndef(NOPORTEXAMPLES)
+ @${INSTALL_DATA} -d ${EXAMPLESDIR}
+ @cd ${WRKSRC}; ${INSTALL_DATA} ${PORTEXAMPLES} ${EXAMPLESDIR}
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/math/kktdirect/distinfo b/math/kktdirect/distinfo
new file mode 100644
index 000000000000..d761d6dee8f8
--- /dev/null
+++ b/math/kktdirect/distinfo
@@ -0,0 +1,4 @@
+SHA256 (KKTDirect0.5.tar.gz) = 14ff71b76a65f4a07e75f1042e70c5850217539e718931e2a91e805499442934
+SIZE (KKTDirect0.5.tar.gz) = 166677
+SHA256 (kktdirect.pdf) = f29d48ad9a43d690a2688824c443d3afd240af4ddf7a63457e083775eab58650
+SIZE (kktdirect.pdf) = 149612
diff --git a/math/kktdirect/pkg-descr b/math/kktdirect/pkg-descr
new file mode 100644
index 000000000000..c9ed536a9afd
--- /dev/null
+++ b/math/kktdirect/pkg-descr
@@ -0,0 +1,19 @@
+KKTDirect implements an ordering method and accompanying factorization for
+the direct solution of saddle-point matrices (also known as KKT or equilibrium
+matrices). A simple constraint on ordering together with an assumption on
+the rank of parts of the matrix are sufficient to guarantee the existence of
+the LDL^T factorization, stability concerns aside. In fact, D may be taken
+to be a diagonal matrix with +/-1 along the diagonal, and be fully determined
+prior to factorization, giving rise to a "signed Cholesky" factorization. A
+modified minimum-degree-like algorithm which incorporates this constraint is
+used, along with a simple algorithm to modify an existing fill-reducing
+ordering to respect the constraint. While a stability analysis is lacking,
+numerical experiments indicate that this is generally sufficient to avoid the
+need for numerical pivoting during factorization, with clear possible benefits
+for performance.
+
+Note this is only alpha-quality proof-of-concept code: for example,
+out-of-memory errors are not handled gracefully, and the provided Minimum
+Degree routine is not yet competitive with other packages.
+
+WWW: http://www.cs.ubc.ca/~rbridson/kktdirect/