Port of the TestU01 test suite
Library for statistical testing of uniform random number generators. http://simul.iro.umontreal.ca/testu01/tu01.html Fix #48
This commit is contained in:
committed by
Norman Feske
parent
e18a1c1e96
commit
8b8491aaf1
99
include/testu01/config.h
Normal file
99
include/testu01/config.h
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
/* include/config.h. Generated from config.h.in by configure. */
|
||||||
|
/* include/config.h.in. Generated from configure.ac by autoheader. */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||||
|
#define HAVE_DLFCN_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `erf' function. */
|
||||||
|
#define HAVE_ERF 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <gmp.h> header file. */
|
||||||
|
#define HAVE_GMP_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
|
#define HAVE_INTTYPES_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `lgamma' function. */
|
||||||
|
#define HAVE_LGAMMA 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `log1p' function. */
|
||||||
|
#define HAVE_LOG1P 1
|
||||||
|
|
||||||
|
/* Define to 1 if the system has the type `long long'. */
|
||||||
|
#define HAVE_LONG_LONG 1
|
||||||
|
|
||||||
|
/* Define when Mathematica is installed */
|
||||||
|
#undef HAVE_MATHEMATICA
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <memory.h> header file. */
|
||||||
|
#define HAVE_MEMORY_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `random' function. */
|
||||||
|
#define HAVE_RANDOM 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdint.h> header file. */
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||||
|
#define HAVE_STDLIB_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <strings.h> header file. */
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <string.h> header file. */
|
||||||
|
#define HAVE_STRING_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/utsname.h> header file. */
|
||||||
|
#define HAVE_SYS_UTSNAME_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if the system has the type `uint32_t'. */
|
||||||
|
#define HAVE_UINT32_T 1
|
||||||
|
|
||||||
|
/* Define to 1 if the system has the type `uint8_t'. */
|
||||||
|
#define HAVE_UINT8_T 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <windows.h> header file. */
|
||||||
|
/* #undef HAVE_WINDOWS_H */
|
||||||
|
|
||||||
|
/* Name of package */
|
||||||
|
#define PACKAGE "testu01"
|
||||||
|
|
||||||
|
/* Define to the address where bug reports for this package should be sent. */
|
||||||
|
#define PACKAGE_BUGREPORT "lecuyer@iro.umontreal.ca"
|
||||||
|
|
||||||
|
/* Define to the full name of this package. */
|
||||||
|
#define PACKAGE_NAME "TestU01"
|
||||||
|
|
||||||
|
/* Define to the full name and version of this package. */
|
||||||
|
#define PACKAGE_STRING "TestU01 1.2.3"
|
||||||
|
|
||||||
|
/* Define to the one symbol short name of this package. */
|
||||||
|
#define PACKAGE_TARNAME "testu01"
|
||||||
|
|
||||||
|
/* Define to the version of this package. */
|
||||||
|
#define PACKAGE_VERSION "1.2.3"
|
||||||
|
|
||||||
|
/* Define to 1 if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* Version number of package */
|
||||||
|
#define VERSION "1.2.3"
|
||||||
|
|
||||||
|
/* Define to 1 if your processor stores words with the most significant byte
|
||||||
|
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||||
|
/* #undef WORDS_BIGENDIAN */
|
||||||
|
|
||||||
|
/* Define to empty if `const' does not conform to ANSI C. */
|
||||||
|
/* #undef const */
|
||||||
|
|
||||||
|
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||||
|
/* #undef size_t */
|
||||||
30
include/testu01/gdefconf.h
Normal file
30
include/testu01/gdefconf.h
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/* include/gdefconf.h. Generated from gdefconf.h.in by configure. */
|
||||||
|
/* gdef.h for ANSI C */
|
||||||
|
#ifndef GDEFCONF_H
|
||||||
|
#define GDEFCONF_H
|
||||||
|
|
||||||
|
/* #undef HAVE_LEBOOL */
|
||||||
|
|
||||||
|
#define HAVE_LONG_LONG 1
|
||||||
|
|
||||||
|
#define HAVE_ERF 1
|
||||||
|
|
||||||
|
#define HAVE_RANDOM 1
|
||||||
|
|
||||||
|
#define HAVE_LGAMMA 1
|
||||||
|
|
||||||
|
#define HAVE_GMP_H 1
|
||||||
|
|
||||||
|
#undef HAVE_MATHEMATICA
|
||||||
|
|
||||||
|
#define HAVE_SYS_UTSNAME_H 1
|
||||||
|
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
|
||||||
|
#define HAVE_UINT32_T 1
|
||||||
|
|
||||||
|
#define HAVE_UINT8_T 1
|
||||||
|
|
||||||
|
#endif
|
||||||
3
lib/import/import-testu01.mk
Normal file
3
lib/import/import-testu01.mk
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
INC_DIR += \
|
||||||
|
$(call select_from_ports,testu01)/include/testu01 \
|
||||||
|
$(call select_from_repositories,include/testu01)
|
||||||
24
lib/mk/testu01.mk
Normal file
24
lib/mk/testu01.mk
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
include $(call select_from_repositories,lib/import/import-testu01.mk)
|
||||||
|
|
||||||
|
TESTU01_DIR = $(call select_from_ports,testu01)
|
||||||
|
TESTU01_SRC_DIR = $(TESTU01_DIR)/src/lib/testu01/TestU01-1.2.3
|
||||||
|
|
||||||
|
LIBS += libc
|
||||||
|
|
||||||
|
CC_WARN += -Wno-unused-variable -Wno-maybe-uninitialized -Wno-return-type
|
||||||
|
|
||||||
|
TESTU01_SRC_C = unif01.c ulcg.c umrg.c ucarry.c utaus.c ugfsr.c uinv.c uquad.c ucubic.c ulec.c utezuka.c umarsa.c uweyl.c uknuth.c uwu.c unumrec.c uvaria.c usoft.c ugranger.c ucrypto.c ufile.c udeng.c utouzin.c uautomata.c uxorshift.c ubrent.c rijndael-alg-fst.c tu01_sha1.c scatter.c swrite.c sres.c smultin.c sknuth.c smarsa.c sstring.c svaria.c snpair.c swalk.c sentrop.c sspectral.c scomp.c sspacings.c vectorsF2.c bbattery.c ffam.c fcong.c ffsr.c ftab.c fres.c fcho.c fmultin.c fmarsa.c fknuth.c fwalk.c fstring.c fspectral.c fvaria.c fnpair.c
|
||||||
|
PROBDIST_SRC_C = fmass.c fdist.c fbar.c finv.c gofs.c gofw.c statcoll.c wdist.c
|
||||||
|
MYLIB_SRC_C = addstr.c bitset.c mystr.c num.c num2.c tables.c util.c
|
||||||
|
|
||||||
|
EXAMPLES_SRC_C = mrg32k3a.c xorshift.c
|
||||||
|
|
||||||
|
SRC_C = $(TESTU01_SRC_C) $(PROBDIST_SRC_C) $(MYLIB_SRC_C) $(EXAMPLES_SRC_C)
|
||||||
|
|
||||||
|
SRC_CC = genode_chrono.cc genode_gdef.cc
|
||||||
|
|
||||||
|
vpath %.cc $(REP_DIR)/src/lib/testu01
|
||||||
|
vpath %.c $(TESTU01_SRC_DIR)/testu01
|
||||||
|
vpath %.c $(TESTU01_SRC_DIR)/probdist
|
||||||
|
vpath %.c $(TESTU01_SRC_DIR)/mylib
|
||||||
|
vpath %.c $(TESTU01_SRC_DIR)/examples
|
||||||
1
ports/testu01.hash
Normal file
1
ports/testu01.hash
Normal file
@@ -0,0 +1 @@
|
|||||||
|
ad8cc8e8b947a26e747f3089535e67c952926256
|
||||||
40
ports/testu01.port
Normal file
40
ports/testu01.port
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
LICENSE := other
|
||||||
|
VERSION := 1.2.3
|
||||||
|
DOWNLOADS := testu01.archive
|
||||||
|
|
||||||
|
URL(testu01) := http://www.iro.umontreal.ca/~simardr/testu01/TestU01.zip
|
||||||
|
SHA(testu01) := f41af4bc71841e16dacc195930e6c3a191c9ab99
|
||||||
|
DIR(testu01) := src/lib/testu01
|
||||||
|
|
||||||
|
TESTU01_DIR := src/lib/testu01/TestU01-1.2.3
|
||||||
|
|
||||||
|
testu01_includes = $(addprefix $(TESTU01_DIR)/testu01/,\
|
||||||
|
unif01.h ulcg.h umrg.h ucarry.h utaus.h ugfsr.h uinv.h uquad.h ucubic.h ulec.h utezuka.h umarsa.h uweyl.h uknuth.h uwu.h unumrec.h uvaria.h usoft.h ugranger.h ucrypto.h ufile.h udeng.h utouzin.h uautomata.h uxorshift.h ubrent.h rijndael-alg-fst.h tu01_sha1.h scatter.h swrite.h sres.h smultin.h sknuth.h smarsa.h sstring.h svaria.h snpair.h swalk.h sentrop.h sspectral.h scomp.h sspacings.h vectorsF2.h bbattery.h ffam.h fcong.h ffsr.h ftab.h fres.h fcho.h fmultin.h fmarsa.h fknuth.h fwalk.h fstring.h fspectral.h fvaria.h fnpair.h)
|
||||||
|
|
||||||
|
probdist_includes = $(addprefix $(TESTU01_DIR)/probdist/,\
|
||||||
|
fmass.h fdist.h fbar.h finv.h gofs.h gofw.h statcoll.h wdist.h)
|
||||||
|
|
||||||
|
mylib_includes = $(addprefix $(TESTU01_DIR)/mylib/,\
|
||||||
|
gdef.h addstr.h bitset.h chrono.h mystr.h num.h num2.h tables.h util.h)
|
||||||
|
|
||||||
|
DIRS := include/testu01
|
||||||
|
DIR_CONTENT(include/testu01) = $(generated_headers)
|
||||||
|
|
||||||
|
generated_headers = $(testu01_includes) $(probdist_includes) $(mylib_includes)
|
||||||
|
|
||||||
|
_dirs: $(generated_headers)
|
||||||
|
|
||||||
|
$(generated_headers): $(DOWNLOADS)
|
||||||
|
|
||||||
|
%.h: %.tex tcode
|
||||||
|
@$(MSG_GENERATE)$(notdir $@)
|
||||||
|
$(VERBOSE)mkdir -p include/testu01
|
||||||
|
$(VERBOSE)./tcode $< $@
|
||||||
|
|
||||||
|
%.tex: $(DOWNLOADS)
|
||||||
|
|
||||||
|
tcode: $(TESTU01_DIR)/mylib/tcode.c
|
||||||
|
@$(MSG_GENERATE)$(notdir $@)
|
||||||
|
$(VERBOSE)$(CC) -o $@ $<
|
||||||
|
|
||||||
|
tcode.c: $(DOWNLOADS)
|
||||||
106
src/lib/testu01/genode_chrono.cc
Normal file
106
src/lib/testu01/genode_chrono.cc
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
#include <timer_session/connection.h>
|
||||||
|
#include <base/printf.h>
|
||||||
|
|
||||||
|
/* XXX: should be the CPU session time, but the timer works for now */
|
||||||
|
static void Heure (unsigned long *tsec, unsigned long *tusec)
|
||||||
|
{
|
||||||
|
static Timer::Connection timer;
|
||||||
|
|
||||||
|
unsigned long ms = timer.elapsed_ms();
|
||||||
|
|
||||||
|
*tsec = ms / 1000;
|
||||||
|
*tusec = ms * 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
|
#include "chrono.h"
|
||||||
|
#include <num.h>
|
||||||
|
#include <util.h>
|
||||||
|
|
||||||
|
void chrono_Init (chrono_Chrono *C) {
|
||||||
|
Heure(&C->second, &C->microsec); }
|
||||||
|
|
||||||
|
|
||||||
|
chrono_Chrono * chrono_Create (void)
|
||||||
|
{
|
||||||
|
chrono_Chrono *C = new (Genode::env()->heap()) chrono_Chrono;
|
||||||
|
Heure(&C->second, &C->microsec);
|
||||||
|
return C;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void chrono_Delete (chrono_Chrono *C) { destroy(Genode::env()->heap(), C); }
|
||||||
|
|
||||||
|
|
||||||
|
double chrono_Val (chrono_Chrono *C, chrono_TimeFormat Unit)
|
||||||
|
{
|
||||||
|
double temps; /* Time elapsed, in seconds */
|
||||||
|
chrono_Chrono now;
|
||||||
|
Heure (&now.second, &now.microsec);
|
||||||
|
temps = (((double) now.microsec - (double) C->microsec) / 1.E+6 +
|
||||||
|
(double) now.second) - (double) C->second;
|
||||||
|
|
||||||
|
switch (Unit) {
|
||||||
|
case chrono_sec:
|
||||||
|
return temps;
|
||||||
|
case chrono_min:
|
||||||
|
return temps * 1.666666667E-2;
|
||||||
|
case chrono_hours:
|
||||||
|
return temps * 2.777777778E-4;
|
||||||
|
case chrono_days:
|
||||||
|
return temps * 1.157407407E-5;
|
||||||
|
case chrono_hms:
|
||||||
|
util_Error ("chrono_Val : hms is a wrong arg for chrono_TimeUnit");
|
||||||
|
}
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void chrono_Write (chrono_Chrono * C, chrono_TimeFormat Form)
|
||||||
|
{
|
||||||
|
long centieme;
|
||||||
|
long minute;
|
||||||
|
long heure;
|
||||||
|
long seconde;
|
||||||
|
double temps;
|
||||||
|
if (Form != chrono_hms)
|
||||||
|
temps = chrono_Val (C, Form);
|
||||||
|
else
|
||||||
|
temps = 0.0;
|
||||||
|
switch (Form) {
|
||||||
|
case chrono_sec:
|
||||||
|
num_WriteD (temps, 10, 2, 1);
|
||||||
|
printf (" seconds");
|
||||||
|
break;
|
||||||
|
case chrono_min:
|
||||||
|
num_WriteD (temps, 10, 2, 1);
|
||||||
|
printf (" minutes");
|
||||||
|
break;
|
||||||
|
case chrono_hours:
|
||||||
|
num_WriteD (temps, 10, 2, 1);
|
||||||
|
printf (" hours");
|
||||||
|
break;
|
||||||
|
case chrono_days:
|
||||||
|
num_WriteD (temps, 10, 2, 1);
|
||||||
|
printf (" days");
|
||||||
|
break;
|
||||||
|
case chrono_hms:
|
||||||
|
temps = chrono_Val (C, chrono_sec);
|
||||||
|
heure = (long) (temps * 2.777777778E-4);
|
||||||
|
if (heure > 0)
|
||||||
|
temps -= (double) (heure) * 3600.0;
|
||||||
|
minute = (long) (temps * 1.666666667E-2);
|
||||||
|
if (minute > 0)
|
||||||
|
temps -= (double) (minute) * 60.0;
|
||||||
|
seconde = (long) (temps);
|
||||||
|
centieme = (long) (100.0 * (temps - (double) (seconde)));
|
||||||
|
printf ("%02ld:", heure);
|
||||||
|
printf ("%02ld:", minute);
|
||||||
|
printf ("%02ld.", seconde);
|
||||||
|
printf ("%02ld", centieme);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
22
src/lib/testu01/genode_gdef.cc
Normal file
22
src/lib/testu01/genode_gdef.cc
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#include <os/config.h>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void gdef_GetHostName (char machine[], int n)
|
||||||
|
{
|
||||||
|
try { Genode::config()->xml_node().attribute("hostname").value(machine, n); }
|
||||||
|
catch (...) { Genode::strncpy(machine, "genode", n); }
|
||||||
|
}
|
||||||
|
|
||||||
|
void gdef_WriteHostName (void)
|
||||||
|
{
|
||||||
|
enum { MAXBYTES = 255 };
|
||||||
|
|
||||||
|
char machine[1 + MAXBYTES] = {'\0'};
|
||||||
|
gdef_GetHostName(machine, MAXBYTES);
|
||||||
|
printf("%s\n", machine);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user