aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlwhsu <lwhsu@FreeBSD.org>2010-02-17 15:47:05 +0800
committerlwhsu <lwhsu@FreeBSD.org>2010-02-17 15:47:05 +0800
commita259819b80234d79b249c4e397cdca70cace9daa (patch)
tree1925fa668e149df4cfeef9a9125b7b2e1a8f8504
parent7cb6bfff653a3982afe8803ca291b1de435c89fa (diff)
downloadfreebsd-ports-gnome-a259819b80234d79b249c4e397cdca70cace9daa.tar.gz
freebsd-ports-gnome-a259819b80234d79b249c4e397cdca70cace9daa.tar.zst
freebsd-ports-gnome-a259819b80234d79b249c4e397cdca70cace9daa.zip
Add lll_spect , LLL-spectral test of linear congruential random number
generators. PR: ports/144023 Submitted by: bf <bf1783 at gmail.com> Feature safe: yes
-rw-r--r--math/Makefile1
-rw-r--r--math/lll_spect/Makefile54
-rw-r--r--math/lll_spect/distinfo9
-rw-r--r--math/lll_spect/files/patch-lll_search.C40
-rw-r--r--math/lll_spect/files/patch-lll_spect.C39
-rw-r--r--math/lll_spect/pkg-descr8
6 files changed, 151 insertions, 0 deletions
diff --git a/math/Makefile b/math/Makefile
index b6380e7ed042..0cd7eab53ed9 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -164,6 +164,7 @@
SUBDIR += linpack
SUBDIR += linux-SHA-1_collision_search_graz
SUBDIR += linux-relview
+ SUBDIR += lll_spect
SUBDIR += lp_solve
SUBDIR += ltl
SUBDIR += lybniz
diff --git a/math/lll_spect/Makefile b/math/lll_spect/Makefile
new file mode 100644
index 000000000000..969e2fc92556
--- /dev/null
+++ b/math/lll_spect/Makefile
@@ -0,0 +1,54 @@
+# New ports collection makefile for: lll_spect
+# Date created: 6 Feb. 2010
+# Whom: bf <bf1783@gmail.com>
+# $FreeBSD$
+
+PORTNAME= lll_spect
+DISTVERSION= 1.0
+CATEGORIES= math
+MASTER_SITES= http://random.mat.sbg.ac.at/results/karl/spectraltest/LLLSpectralTest/
+DISTFILES= lll_spect.C lll_search.C examples.txt
+DIST_SUBDIR= ${PORTNAME}
+EXTRACT_ONLY=
+
+MAINTAINER= bf1783@gmail.com
+COMMENT= LLL-spectral test of linear congruential random number generators
+
+BUILD_DEPENDS= ${LOCALBASE}/lib/libntl.a:${PORTSDIR}/math/ntl
+RUN_DEPENDS= ${LOCALBASE}/lib/libntl.a:${PORTSDIR}/math/ntl
+
+PLIST_FILES= bin/lll_spect bin/lll_search
+PORTEXAMPLES= examples.txt
+NO_WRKSUBDIR= yes
+
+CPPFLAGS+= -I${LOCALBASE}/include
+LDFLAGS+= -L${LOCALBASE}/lib
+
+post-extract:
+.for _file in lll_spect lll_search
+ @${CP} ${_DISTDIR}/${_file}.C ${WRKDIR}
+.endfor
+
+do-build:
+.for _file in lll_spect lll_search
+ ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c -o ${WRKDIR}/${_file}.o ${WRKDIR}/${_file}.C
+ ${CXX} ${CXXFLAGS} ${LDFLAGS} -o ${WRKDIR}/${_file} ${WRKDIR}/${_file}.o -lntl -lgmp -lm
+.endfor
+
+do-install:
+.for _file in lll_spect lll_search
+ ${INSTALL_PROGRAM} ${WRKDIR}/${_file} ${PREFIX}/bin
+.endfor
+.if !defined(NOPORTEXAMPLES)
+ ${MKDIR} ${EXAMPLESDIR}
+ ${INSTALL_DATA} ${_DISTDIR}/examples.txt ${EXAMPLESDIR}
+.endif
+
+test: build
+ @${WRKSRC}/lll_spect "${WRKSRC}/output_spect" 17 16907 2147483647
+ @${WRKSRC}/lll_search "${WRKSRC}/output_search" 2147483647 2 3 7 11 31 151 331
+ @${SED} -n -e '/Modul/,/Time/p' ${_DISTDIR}/examples.txt > ${WRKSRC}/output_spect_example
+ @${SED} -n -e '/may yield/,/Therefore/p' \
+ ${_DISTDIR}/examples.txt > ${WRKSRC}/output_search_example
+
+.include <bsd.port.mk>
diff --git a/math/lll_spect/distinfo b/math/lll_spect/distinfo
new file mode 100644
index 000000000000..cf73df018f27
--- /dev/null
+++ b/math/lll_spect/distinfo
@@ -0,0 +1,9 @@
+MD5 (lll_spect/lll_spect.C) = 7f8aaffde376e3699211f9d39fbee188
+SHA256 (lll_spect/lll_spect.C) = a286543035422cde3ac7dcbb9c3a0933933eaedbe609b063ec10c28615747b90
+SIZE (lll_spect/lll_spect.C) = 4410
+MD5 (lll_spect/lll_search.C) = d3d6be7ef1800fa176898875d8e8e9d7
+SHA256 (lll_spect/lll_search.C) = 4d29518d357dd2ce55c6ba2a313d2dddaba6ef6dcfaec8e2ccd78bfa4871b116
+SIZE (lll_spect/lll_search.C) = 4965
+MD5 (lll_spect/examples.txt) = a96728cd3764e22568d313d00750c408
+SHA256 (lll_spect/examples.txt) = 4ea78c5a5fa15ba07af0ac529e32767678e2c9d458cceb67e99fda4f5b094a47
+SIZE (lll_spect/examples.txt) = 2058
diff --git a/math/lll_spect/files/patch-lll_search.C b/math/lll_spect/files/patch-lll_search.C
new file mode 100644
index 000000000000..7f34b539c755
--- /dev/null
+++ b/math/lll_spect/files/patch-lll_search.C
@@ -0,0 +1,40 @@
+--- lll_search.C.orig 2010-02-16 15:59:17.000000000 -0500
++++ lll_search.C 2010-02-16 16:00:58.000000000 -0500
+@@ -12,24 +12,20 @@
+
+ /*-------------Libraries (needs Victor Shoups NTL-Lib----------------*/
+
+-#include <iostream.h>
++#include <iostream>
+
+-#include <fstream.h>
++#include <fstream>
+
+ #include <time.h>
+
+ #include <sys/resource.h>
+
+-#include <math.h>
++#include <cmath>
+
+ #include <float.h>
+
+-#include <NTL/ZZ.h>
+-
+ #include <NTL/RR.h>
+
+-#include <NTL/mat_ZZ.h>
+-
+ #include <NTL/LLL.h>
+
+
+@@ -38,7 +34,8 @@
+
+ /*------------------------ Definitions ------------------------------*/
+
+-
++using namespace NTL;
++using namespace std;
+
+ ZZ lambda, modul, *m_primes;
+
diff --git a/math/lll_spect/files/patch-lll_spect.C b/math/lll_spect/files/patch-lll_spect.C
new file mode 100644
index 000000000000..165e6cb693fb
--- /dev/null
+++ b/math/lll_spect/files/patch-lll_spect.C
@@ -0,0 +1,39 @@
+--- lll_spect.C.orig 2010-02-16 15:51:33.000000000 -0500
++++ lll_spect.C 2010-02-16 15:55:48.000000000 -0500
+@@ -14,30 +14,29 @@
+
+ /*-------------Libraries (needs Victor Shoups NTL-Lib----------------*/
+
+-#include <iostream.h>
++#include <iostream>
+
+-#include <fstream.h>
++#include <fstream>
+
+ #include <time.h>
+
+ #include <sys/resource.h>
+
+-#include <math.h>
++#include <cmath>
+
+ #include <float.h>
+
+-#include <NTL/ZZ.h>
+-
+ #include <NTL/RR.h>
+
+-#include <NTL/mat_ZZ.h>
+-
+ #include <NTL/LLL.h>
+
+
+
+ /*------------------------ Definitions ------------------------------*/
+
++using namespace NTL;
++using namespace std;
++
+ ZZ mult, modul;
+
+ const int dim_max = 24;
diff --git a/math/lll_spect/pkg-descr b/math/lll_spect/pkg-descr
new file mode 100644
index 000000000000..0ce46ba5007f
--- /dev/null
+++ b/math/lll_spect/pkg-descr
@@ -0,0 +1,8 @@
+This software calculates a normalized version of the classical spectral test for
+linear congruential pseudorandom number generators (LCGs), where the shortest
+vector is replaced by an approximation obtained with the Lenstra-Lenstra-Lovasz
+basis reduction algorithm, which can be calculated in polynomial time. The code
+is able to test in up to 24 dimensions, and includes an example of how to use
+the test to search for good LCG parameters.
+
+WWW: http://random.mat.sbg.ac.at/results/karl/spectraltest/lll.html