1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-02-06 11:41:52 +00:00

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
This commit is contained in:
Li-Wen Hsu 2010-02-17 07:47:05 +00:00
parent 3060930fa8
commit f95c979721
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=249994
6 changed files with 151 additions and 0 deletions

View File

@ -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

54
math/lll_spect/Makefile Normal file
View File

@ -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>

9
math/lll_spect/distinfo Normal file
View File

@ -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

View File

@ -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;

View File

@ -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;

8
math/lll_spect/pkg-descr Normal file
View File

@ -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