From b60e2d480ad5d55b94e1ad5b52fca28a85503771 Mon Sep 17 00:00:00 2001 From: Nicolò Balzarotti Date: Thu, 2 Apr 2020 08:49:46 +0200 Subject: gnu: Add dsfmt. * gnu/packages/maths.scm (dsfmt): New variable. Signed-off-by: Efraim Flashner --- gnu/packages/maths.scm | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) (limited to 'gnu') diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index 391b2a26de..cd786ac0e8 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm @@ -37,6 +37,7 @@ ;;; Copyright © 2020 Felix Gruber ;;; Copyright © 2020 R Veera Kumar ;;; Copyright © 2020 Vincent Legoll +;;; Copyright © 2020 Nicolò Balzarotti ;;; ;;; This file is part of GNU Guix. ;;; @@ -381,6 +382,81 @@ semiconductors.") (license license:gpl3+) (home-page "https://www.gnu.org/software/dionysus/"))) +(define-public dsfmt + (package + (name "dsfmt") + (version "2.2.3") + (source + (origin + (method url-fetch) + (uri + (string-append + "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/" + "dSFMT-src-" version ".tar.gz")) + (sha256 + (base32 + "03kaqbjbi6viz0n33dk5jlf6ayxqlsq4804n7kwkndiga9s4hd42")) + (modules '((guix build utils))) + ;; Don't distribute html documentation with bundled jquery. + (snippet + '(begin + (delete-file-recursively "html") #t)) + ;; Add patches borrowed from Julia. + (patches + (list + (origin + (method url-fetch) + (uri (string-append + "https://raw.githubusercontent.com/JuliaLang/julia/" + "v1.3.0/deps/patches/dSFMT.c.patch")) + (sha256 (base32 + "09mhv11bms8jsmkmdqvlcgljwhzw3b6n9nncpi2b6dla9798hw2y")) + (file-name "dSFMT.c.patch")) + (origin + (method url-fetch) + (uri (string-append + "https://raw.githubusercontent.com/JuliaLang/julia/" + "v1.3.0/deps/patches/dSFMT.h.patch")) + (sha256 (base32 + "1py5rd0yxic335lzka23f6x2dhncrpizpyrk57gi2f28c0p98y5n")) + (file-name "dSFMT.h.patch")))))) + (build-system gnu-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (delete 'configure) ; no configure script + (replace 'build + ;; Upstream Makefile does not build a shared library. Borrow from Julia + ;; https://github.com/JuliaLang/julia/blob/v1.3.0/deps/dsfmt.mk + (lambda _ + (invoke + "gcc" "-DNDEBUG" "-DDSFMT_MEXP=19937" + "-fPIC" "-DDSFMT_DO_NOT_USE_OLD_NAMES" + "-O3" "-finline-functions" "-fomit-frame-pointer" + "-fno-strict-aliasing" "--param" "max-inline-insns-single=1800" + "-Wmissing-prototypes" "-Wall" "-std=c99" "-shared" "dSFMT.c" + "-o" "libdSFMT.so"))) + (replace 'install ; no "install" target + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (lib (string-append out "/lib")) + (inc (string-append out "/include")) + (doc (string-append out "/share/doc/" ,name "-" ,version))) + (install-file "libdSFMT.so" lib) + (install-file "dSFMT.h" inc) + (install-file "LICENSE.txt" doc) + #t)))))) + (synopsis "Double precision SIMD-oriented Fast Mersenne Twister") + (description + "The dSMFT package speeds up Fast Mersenne Twister generation by avoiding +the expensive conversion of integer to double (floating point). dSFMT directly +generates double precision floating point pseudorandom numbers which have the +IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std 754-1985) +format. dSFMT is only available on the CPUs which use IEEE 754 format double +precision floating point numbers.") + (home-page "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/") + (license license:bsd-3))) + (define-public gsl (package (name "gsl") -- cgit v1.2.3