gnu: packages: Use 'search-patches' everywhere.
[jackhill/guix/guix.git] / gnu / packages / algebra.scm
index 2d0804a..5b00493 100644 (file)
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2013, 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016 Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
 ;;;
 ;;; This file is part of GNU Guix.
 
 (define-module (gnu packages algebra)
   #:use-module (gnu packages)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages doxygen)
+  #:use-module (gnu packages fltk)
+  #:use-module (gnu packages gl)
+  #:use-module (gnu packages graphviz)
+  #:use-module (gnu packages image)
   #:use-module (gnu packages multiprecision)
+  #:use-module (gnu packages maths)
   #:use-module (gnu packages mpi)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages flex)
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages tcsh)
+  #:use-module (gnu packages texlive)
+  #:use-module (gnu packages xiph)
+  #:use-module (gnu packages xorg)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
@@ -65,7 +78,7 @@ multiplication routines such as Toom–Cook and the FFT.")
 (define-public cm
   (package
    (name "cm")
-   (version "0.2.1")
+   (version "0.3")
    (source (origin
             (method url-fetch)
             (uri (string-append
@@ -73,7 +86,7 @@ multiplication routines such as Toom–Cook and the FFT.")
                   version ".tar.gz"))
             (sha256
              (base32
-              "1r5dx5qy0ka2sq26n9jll9iy4sjqg0jp5r3jnbjhpgxvmj8jbhq8"))))
+              "1nf5kr0nqmhbzrsrinky18z0ighjpsmb5cr8zyg8jf04bfbyrfmc"))))
    (build-system gnu-build-system)
    (propagated-inputs
      `(("mpfrcx" ,mpfrcx)
@@ -87,7 +100,7 @@ imaginary quadratic number fields and of elliptic curves with complex
 multiplication via floating point approximations.  It consists of libraries
 that can be called from within a C program and of executable command
 line applications.")
-   (license license:gpl2+)
+   (license license:gpl3+)
    (home-page "http://cm.multiprecision.org/")))
 
 (define-public fplll
@@ -114,7 +127,7 @@ solve the shortest vector problem.")
 (define-public pari-gp
   (package
    (name "pari-gp")
-   (version "2.7.4")
+   (version "2.7.5")
    (source (origin
             (method url-fetch)
             (uri (string-append
@@ -122,24 +135,23 @@ solve the shortest vector problem.")
                   version ".tar.gz"))
             (sha256
               (base32
-                "0k1qqagfl6zn7gvwmsqffj6g9yrzqvszwh2mblhmxpjlw1pigfh8"))))
+                "0c8l83a0gjq73r9hndsrzkypwxvnnm4pxkkzbg6jm95m80nzwh11"))))
    (build-system gnu-build-system)
+   (native-inputs `(("texlive" ,texlive-minimal)))
    (inputs `(("gmp" ,gmp)
+             ("libx11" ,libx11)
              ("perl" ,perl)
              ("readline" ,readline)))
    (arguments
-    '(#:make-flags '("gp")
-      ;; FIXME: building the documentation requires tex; once this is
-      ;; available, replace "gp" by "all"
+    '(#:make-flags '("all")
       #:test-target "dobench"
-      #:phases
-      (alist-replace
-       'configure
-       (lambda* (#:key outputs #:allow-other-keys)
-         (let ((out (assoc-ref outputs "out")))
-           (zero?
-            (system* "./Configure" (string-append "--prefix=" out)))))
-       %standard-phases)))
+      #:phases (modify-phases %standard-phases
+                 (replace 'configure
+                          (lambda* (#:key outputs #:allow-other-keys)
+                           (let ((out (assoc-ref outputs "out")))
+                            (zero?
+                             (system* "./Configure"
+                                      (string-append "--prefix=" out)))))))))
    (synopsis "PARI/GP, a computer algebra system for number theory")
    (description
     "PARI/GP is a widely used computer algebra system designed for fast
@@ -155,7 +167,7 @@ PARI is also available as a C library to allow for faster computations.")
 (define-public gp2c
   (package
    (name "gp2c")
-   (version "0.0.9pl3")
+   (version "0.0.9pl5")
    (source (origin
             (method url-fetch)
             (uri (string-append
@@ -163,7 +175,7 @@ PARI is also available as a C library to allow for faster computations.")
                   version ".tar.gz"))
             (sha256
               (base32
-                "0wbghihwlcx3w4j1la3bjf5gcrkk6lp9syw6iimqndq1f73ijlq3"))))
+                "1q003mkagc5ib6lqb2xfay7j4ffkwv7xlnznp6wdrq2sbqq4vyak"))))
    (build-system gnu-build-system)
    (native-inputs `(("perl" ,perl)))
    (inputs `(("pari-gp" ,pari-gp)))
@@ -186,34 +198,92 @@ GP2C, the GP to C compiler, translates GP scripts to PARI programs.")
    (license license:gpl2)
    (home-page "http://pari.math.u-bordeaux.fr/")))
 
+(define-public giac-xcas
+  (package
+    (name "giac-xcas")
+    (version "1.2.2-37")
+    (source (origin
+              (method url-fetch)
+              ;; "~parisse/giac" is not used because the maintainer regularly
+              ;; overwrites the release tarball there, introducing a checksum
+              ;; mismatch every time.  See
+              ;; <https://www-fourier.ujf-grenoble.fr/~parisse/debian/dists/stable/main/source/README>
+              (uri (string-append "https://www-fourier.ujf-grenoble.fr/"
+                                  "~parisse/debian/dists/stable/main/"
+                                  "source/giac_" version ".tar.gz"))
+              (sha256
+               (base32
+                "0cagh9nnaz7ks299b2bs3lrdclv4xbyis24zc8vf3i25p470bxsf"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-bin-cp
+           (lambda _
+             ;; Some Makefiles contain hard-coded "/bin/cp".
+             (substitute* (find-files "doc" "^Makefile")
+               (("/bin/cp") (which "cp")))
+             #t))
+         (add-after 'unpack 'disable-broken-test
+           (lambda _
+             ;; Disable failing test.  Actually, the results are correct but
+             ;; a sorting discrepancy prevents the test from being validated.
+             (substitute* "check/Makefile.in"
+               (("chk_fhan16") ""))
+             #t)))))
+    (inputs
+     `(("fltk" ,fltk)
+       ("gmp" ,gmp)
+       ("gsl" ,gsl)
+       ("lapack" ,lapack)
+       ("libao" ,ao)
+       ("libjpeg" ,libjpeg)
+       ("libpng" ,libpng)
+       ("libx11" ,libx11)
+       ("libxft" ,libxft)
+       ("libxt" ,libxt)
+       ("mesa" ,mesa)
+       ("mpfi" ,mpfi)
+       ("mpfr" ,mpfr)
+       ("ntl" ,ntl)
+       ("perl" ,perl)
+       ("pari-gp" ,pari-gp)
+       ("tcsh" ,tcsh)
+       ("texlive" ,texlive-minimal)))
+    (native-inputs `(("readline" ,readline)))
+    (home-page "https://www-fourier.ujf-grenoble.fr/~parisse/giac.html")
+    (synopsis "Computer algebra system")
+    (description
+     "Giac/Xcas is a computer algebra system.  It has a compatibility mode for
+maple, mupad and the TI89.  It is available as a standalone program (graphic
+or text interfaces) or as a C++ library.")
+    (license license:gpl3+)))
+
 (define-public flint
   (package
    (name "flint")
-   (version "2.4.5")
+   (version "2.5.2")
    (source (origin
             (method url-fetch)
             (uri (string-append
                   "http://flintlib.org/flint-"
                   version ".tar.gz"))
             (sha256 (base32
-                     "1qq11sxliy499a9g656dgk47ffb951q4gl6ddjbq838gy16kb2g4"))))
+                     "11syazv1a8rrnac3wj3hnyhhflpqcmq02q8pqk2m6g2k6h0gxwfb"))
+            (patches (search-patches "flint-ldconfig.patch"))))
    (build-system gnu-build-system)
    (propagated-inputs
     `(("gmp" ,gmp)
       ("mpfr" ,mpfr))) ; header files from both are included by flint/arith.h
    (arguments
-    `(#:phases
+    `(#:parallel-tests? #f ; seems to be necessary on arm
+      #:phases
        (modify-phases %standard-phases
          (replace 'configure
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out"))
                    (gmp (assoc-ref inputs "gmp"))
                    (mpfr (assoc-ref inputs "mpfr")))
-               ;; Drop test failing with gmp-6 due to changed invertibility
-               ;; of 0 in Z/1 Z, which according to the flint authors has no
-               ;; impact on flint.
-               ;; FIXME: Drop with later version.
-               (delete-file "fmpz/test/t-invmod.c")
                ;; do not pass "--enable-fast-install", which makes the
                ;; homebrew configure process fail
                (zero? (system*
@@ -239,7 +309,7 @@ fast arithmetic.")
 (define-public arb
   (package
    (name "arb")
-   (version "2.7.0")
+   (version "2.8.1")
    (source (origin
             (method url-fetch)
             (uri (string-append
@@ -248,7 +318,8 @@ fast arithmetic.")
             (file-name (string-append name "-" version ".tar.gz"))
             (sha256
               (base32
-                "1rwkffs57v8mry63rq8l2dyw69zfs9rg5fpbfllqp3nkjnkp1fly"))))
+                "04hhcpshfkcq9fr4hixbhpps50yf9drk62xgkvlcaj5kb4nyrx7l"))
+            (patches (search-patches "arb-ldconfig.patch"))))
    (build-system gnu-build-system)
    (propagated-inputs
     `(("flint" ,flint))) ; flint.h is included by arf.h
@@ -282,6 +353,116 @@ real and complex numbers, with automatic, rigorous error control.")
    (license license:gpl2+)
    (home-page "http://fredrikj.net/arb/")))
 
+(define-public ntl
+  (package
+   (name "ntl")
+   (version "9.7.0")
+   (source (origin
+            (method url-fetch)
+            (uri (string-append "http://shoup.net/ntl/ntl-"
+                                version ".tar.gz"))
+            (sha256 (base32
+                     "115frp5flyvw9wghz4zph1b3llmr5nbxk1skgsggckr81fh3gmxq"))))
+   (build-system gnu-build-system)
+   (native-inputs
+    `(("libtool" ,libtool)
+      ("perl" ,perl))) ; for configuration
+   ;; FIXME: Add optional input gf2x once available; then also add
+   ;; configure flag "NTL_GF2X_LIB=on".
+   (inputs
+    `(("gmp" ,gmp)))
+   (arguments
+    `(#:phases
+      (modify-phases %standard-phases
+        (replace 'configure
+         (lambda* (#:key outputs #:allow-other-keys)
+           (chdir "src")
+           (system* "./configure"
+                    (string-append "PREFIX=" (assoc-ref outputs "out"))
+                    ;; Do not build especially for the build machine.
+                    "NATIVE=off"
+                    ;; Also do not tune to the build machine.
+                    "WIZARD=off"
+                    "SHARED=on")
+           #t)))))
+   (synopsis "C++ library for number theory")
+   (description
+    "NTL is a C++ library providing data structures and algorithms
+for manipulating signed, arbitrary length integers, and for vectors,
+matrices, and polynomials over the integers and over finite fields.")
+   (license license:gpl2+)
+   (home-page "http://shoup.net/ntl/")))
+
+(define-public singular
+  (package
+   (name "singular")
+   (version "4.0.3")
+   (source (origin
+            (method url-fetch)
+            (uri (string-append "http://www.mathematik.uni-kl.de/ftp/pub/"
+                                "Math/Singular/SOURCES/"
+                                (string-join (string-split version #\.) "-")
+                                "/singular-" version ".tar.gz"))
+            (sha256 (base32
+                     "0viidy2fz62rln9p0s9qfs7fnm55c6fw1agydd1py26gxylp1ksc"))))
+   (build-system gnu-build-system)
+   (native-inputs
+    `(("doxygen" ,doxygen)
+      ("graphviz" ,graphviz)
+      ("perl" ,perl)))
+   (inputs
+    `(("cddlib" ,cddlib)
+      ("gmp" ,gmp)
+      ("flint" ,flint)
+      ("mpfr" ,mpfr)
+      ("ntl" ,ntl)
+      ("python" ,python-2)
+      ("readline" ,readline)))
+   (arguments
+    `(#:configure-flags
+      (list (string-append "--with-ntl="
+                           (assoc-ref %build-inputs "ntl")))))
+   (synopsis "Computer algebra system for polynomial computations")
+   (description
+    "Singular is a computer algebra system for polynomial computations,
+with special emphasis on commutative and non-commutative algebra, algebraic
+geometry and singularity theory.")
+   ;; Singular itself is dual licensed gpl2 or gpl3, but some of the
+   ;; libraries with which it links are licensed under lgpl3+, so the
+   ;; combined work becomes gpl3. See COPYING in the source code.
+   (license license:gpl3)
+   (home-page "http://www.singular.uni-kl.de/index.php")))
+
+(define-public gmp-ecm
+  (package
+   (name "gmp-ecm")
+   (version "7.0")
+   (source (origin
+            (method url-fetch)
+            (uri (string-append "https://gforge.inria.fr/frs/download.php/"
+                                "file/35642/ecm-"
+                                version ".tar.gz"))
+            (sha256 (base32
+                     "00jzzwqp49m01vwsr9z1w7bvm8lb69l3f62x7qr8sfz0xiczxnpm"))))
+   (build-system gnu-build-system)
+   (inputs
+    `(("gmp" ,gmp)))
+   (arguments
+    `(#:configure-flags '("--enable-shared"
+                          ;; Disable specific assembly routines, which depend
+                          ;; on the subarchitecture of the build machine,
+                          ;; and use gmp instead.
+                          "--disable-asm-redc")))
+   (synopsis "Integer factorization library using the elliptic curve method")
+   (description
+    "GMP-ECM factors integers using the elliptic curve method (ECM) as well
+as the P-1 and P+1 algorithms.  It provides a library and a stand-alone
+binary.")
+   ;; Most files are under lgpl3+, but some are under gpl3+ or gpl2+,
+   ;; so the combined work is under gpl3+.
+   (license license:gpl3+)
+   (home-page "http://ecm.gforge.inria.fr/")))
+
 (define-public bc
   (package
     (name "bc")
@@ -384,14 +565,15 @@ cosine/ sine transforms or DCT/DST).")
 (define-public eigen
   (package
     (name "eigen")
-    (version "3.2.5")
+    (version "3.2.7")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://bitbucket.org/eigen/eigen/get/"
                                   version ".tar.bz2"))
               (sha256
                (base32
-                "1yf27mfq1x38wlsghkvpjgs8xd5rvbbikf1wyj2l3qw8h6w6qvjz"))
+                "0gigbjjdlw2q0gvcnyiwc6in314a647rkidk6977bwiwn88im3p5"))
+              (file-name (string-append name "-" version ".tar.bz2"))
               (modules '((guix build utils)))
               (snippet
                ;; There are 3 test failures in the "unsupported" directory,
@@ -399,29 +581,28 @@ cosine/ sine transforms or DCT/DST).")
                ;; anyway, so just skip them.
                '(substitute* "CMakeLists.txt"
                   (("add_subdirectory\\(unsupported\\)")
-                   "# Do not build the tests for unsupported features.\n")))))
+                   "# Do not build the tests for unsupported features.\n")
+                  ;; Work around
+                  ;; <http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1114>.
+                  (("\"include/eigen3\"")
+                   "\"${CMAKE_INSTALL_PREFIX}/include/eigen3\"")))))
     (build-system cmake-build-system)
     (arguments
      '(;; Turn off debugging symbols to save space.
        #:build-type "Release"
 
-       ;; Use 'make check', as per
-       ;; <http://eigen.tuxfamily.org/index.php?title=Tests>.
-       #:test-target "check"
-
-       #:phases (alist-cons-before
-                 'check 'build-tests
-                 (lambda _
-                   ;; First build the tests, in parallel.
-                   ;; See <http://eigen.tuxfamily.org/index.php?title=Tests>.
-                   (let* ((cores  (parallel-job-count))
-                          (dash-j (format #f "-j~a" cores)))
-                     ;; These variables are supposed to be honored.
-                     (setenv "EIGEN_MAKE_ARGS" dash-j)
-                     (setenv "EIGEN_CTEST_ARGS" dash-j)
+       #:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda _
+                      (let* ((cores  (parallel-job-count))
+                             (dash-j (format #f "-j~a" cores)))
+                        ;; First build the tests, in parallel.  See
+                        ;; <http://eigen.tuxfamily.org/index.php?title=Tests>.
+                        (and (zero? (system* "make" "buildtests" dash-j))
 
-                     (zero? (system* "make" "buildtests" dash-j))))
-                 %standard-phases)))
+                             ;; Then run 'CTest' with -V so we get more
+                             ;; details upon failure.
+                             (zero? (system* "ctest" "-V" dash-j)))))))))
     (home-page "http://eigen.tuxfamily.org")
     (synopsis "C++ template library for linear algebra")
     (description