gnu: samba: Update to 4.3.6 [fixes CVE-2015-7560, CVE-2016-0771].
[jackhill/guix/guix.git] / gnu / packages / maths.scm
index 508c0e6..159e26f 100644 (file)
@@ -8,6 +8,8 @@
 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2015, 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2015 Fabian Harfert <fhmgufs@web.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
   #:use-module (guix download)
   #:use-module (guix svn-download)
   #:use-module (guix utils)
+  #:use-module (guix build utils)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages bison)
+  #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
@@ -50,6 +54,7 @@
   #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gtk)
+  #:use-module (gnu packages image)
   #:use-module (gnu packages less)
   #:use-module (gnu packages lisp)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages texlive)
   #:use-module (gnu packages wxwidgets)
   #:use-module (gnu packages xml)
-  #:use-module (gnu packages zip))
+  #:use-module (gnu packages zip)
+  #:use-module (srfi srfi-1))
 
 (define-public units
   (package
    (name "units")
-   (version "2.11")
+   (version "2.12")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/units/units-" version
                                 ".tar.gz"))
             (sha256 (base32
-                     "1gjs3wc212aaiq4r76hx9nl1h3fa39n0ljwl9420d6ixl3rdmdjk"))))
+                     "1jxvjknz2jhq773jrwx9gc1df3gfy73yqmkjkygqxzpi318yls3q"))))
    (build-system gnu-build-system)
    (synopsis "Conversion between thousands of scales")
    (description
     "GNU Units converts numeric quantities between units of measure.  It
-can handle scale changes through adaptive usage of standard scale prefixes
-(micro-, kilo-, etc.).  It can also handle nonlinear conversions such as
-Fahrenheit to Celsius.  Its interpreter is powerful enough to be used
-effectively as a scientific calculator.")
+can handle scale changes through adaptive usage of standard scale
+prefixes (micro-, kilo-, etc.).  It can also handle nonlinear
+conversions such as Fahrenheit to Celsius.  Its interpreter is powerful
+enough to be used effectively as a scientific calculator.")
    (license license:gpl3+)
    (home-page "http://www.gnu.org/software/units/")))
 
@@ -146,7 +152,7 @@ semiconductors.")
 (define-public gsl
   (package
     (name "gsl")
-    (version "1.16")
+    (version "2.1")
     (source
      (origin
       (method url-fetch)
@@ -154,24 +160,10 @@ semiconductors.")
                           version ".tar.gz"))
       (sha256
        (base32
-        "0lrgipi0z6559jqh82yx8n4xgnxkhzj46v96dl77hahdp58jzg3k"))
-      (patches (map search-patch '("gsl-poly-test-fix-pt1.patch"
-                                   "gsl-poly-test-fix-pt2.patch")))))
+        "0rhcia9jhr3p1f1wybwyllwqfs9bggz99i3mi5lpyqcpff1hdbar"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:parallel-tests? #f
-       #:phases
-        (alist-replace
-         'configure
-         (lambda* (#:key target system outputs #:allow-other-keys #:rest args)
-           (let ((configure (assoc-ref %standard-phases 'configure)))
-             ;; disable numerically unstable test on i686, see thread at
-             ;; http://lists.gnu.org/archive/html/bug-gsl/2011-11/msg00019.html
-             (if (string=? (or target system) "i686-linux")
-                 (substitute* "ode-initval2/Makefile.in"
-                   (("TESTS = \\$\\(check_PROGRAMS\\)") "TESTS =")))
-             (apply configure args)))
-         %standard-phases)))
+     `(#:parallel-tests? #f))
     (home-page "http://www.gnu.org/software/gsl/")
     (synopsis "Numerical library for C and C++")
     (description
@@ -185,7 +177,7 @@ numbers.")
 (define-public glpk
   (package
     (name "glpk")
-    (version "4.55")
+    (version "4.58")
     (source
      (origin
       (method url-fetch)
@@ -193,7 +185,7 @@ numbers.")
                           version ".tar.gz"))
       (sha256
        (base32
-        "1rqx5fzj1mhkifilip5mkxybpj2wkniq5qcn8h1w2vkr2rzhs29p"))))
+        "1jmrya04hgwnrxrqqs40i6m9cqka3q601cx3nh9ijyvlg90zlq24"))))
     (build-system gnu-build-system)
     (inputs
      `(("gmp" ,gmp)))
@@ -212,7 +204,7 @@ LP/MIP solver is included in the package.")
 (define-public pspp
   (package
     (name "pspp")
-    (version "0.8.4")
+    (version "0.8.5")
     (source
      (origin
       (method url-fetch)
@@ -220,7 +212,7 @@ LP/MIP solver is included in the package.")
                           version ".tar.gz"))
       (sha256
        (base32
-        "0b65q45x05ps95pph6glbg7ymdr638nfb0rk9x5x9qm5k073pk5z"))))
+        "0c8326yykidi94xi7jn27j8iqxc38vc07d4wf5zyk0l8lpzx5vz7"))))
     (build-system gnu-build-system)
     (inputs
      `(("cairo" ,cairo)
@@ -231,11 +223,12 @@ LP/MIP solver is included in the package.")
        ("pango" ,pango)
        ("readline" ,readline)
        ("gtk" ,gtk+-2)
-       ("gtksourceview" ,gtksourceview)
+       ("gtksourceview" ,gtksourceview-2)
        ("zlib" ,zlib)))
     (native-inputs
      `(("glib" ,glib "bin")             ;for glib-genmarshal
        ("perl" ,perl)
+       ("texinfo" ,texinfo)
        ("pkg-config" ,pkg-config)))
     (home-page "http://www.gnu.org/software/pspp/")
     (synopsis "Statistical analysis")
@@ -273,6 +266,15 @@ large scale eigenvalue problems.")
     (license (license:non-copyleft "file://COPYING"
                                 "See COPYING in the distribution."))))
 
+(define-public arpack-ng-openmpi
+  (package (inherit arpack-ng)
+    (name "arpack-ng-openmpi")
+    (inputs
+     `(("mpi" ,openmpi)
+       ,@(package-inputs arpack-ng)))
+    (arguments `(#:configure-flags '("--enable-mpi")))
+    (synopsis "Fortran subroutines for solving eigenvalue problems with MPI")))
+
 (define-public lapack
   (package
     (name "lapack")
@@ -337,22 +339,22 @@ singular value problems.")
 (define-public gnuplot
   (package
     (name "gnuplot")
-    (version "4.6.3")
+    (version "5.0.2")
     (source
      (origin
       (method url-fetch)
       (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
-                                version "/gnuplot-" version ".tar.gz"))
+                          version "/gnuplot-" version ".tar.gz"))
       (sha256
        (base32
-        "1xd7gqdhlk7k1p9yyqf9vkk811nadc7m4si0q3nb6cpv4pxglpyz"))))
+        "146qn414z96c7cc42a1kb9a4kpjc2q2hfdwk44kjjvgmfp9k2ass"))))
     (build-system gnu-build-system)
     (inputs `(("readline" ,readline)
               ("cairo" ,cairo)
               ("pango" ,pango)
               ("gd" ,gd)))
-    (native-inputs `(("texlive" ,texlive)
-                     ("pkg-config" ,pkg-config)))
+    (native-inputs `(("pkg-config" ,pkg-config)
+                     ("texlive" ,texlive-minimal)))
     (home-page "http://www.gnuplot.info")
     (synopsis "Command-line driven graphing utility")
     (description "Gnuplot is a portable command-line driven graphing
@@ -363,7 +365,7 @@ plotting engine by third-party applications like Octave.")
     ;;  X11 Style with the additional restriction that derived works may only be
     ;;  distributed as patches to the original.
     (license (license:fsf-free
-             "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
+              "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
 
 (define-public hdf5
   (package
@@ -401,15 +403,15 @@ extremely large and complex data collections.")
 (define-public octave
   (package
     (name "octave")
-    (version "3.8.2")
+    (version "4.0.0")
     (source
      (origin
       (method url-fetch)
       (uri (string-append "mirror://gnu/octave/octave-"
-                         version ".tar.gz"))
+                          version ".tar.gz"))
       (sha256
        (base32
-       "05slz8yx8k91fqlnfr1f0vni95iq9qmchz41c7nf4isn3b2fjn7j"))))
+        "101jr9yck798586jz4vkjcgk36zksmxf1pxrzvipgn2xgyay0zjc"))))
     (build-system gnu-build-system)
     (inputs
      `(("lapack" ,lapack)
@@ -459,14 +461,14 @@ script files.")
 (define-public gmsh
   (package
     (name "gmsh")
-    (version "2.8.4")
+    (version "2.11.0")
     (source
      (origin
       (method url-fetch)
       (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
                           version "-source.tgz"))
       (sha256
-       (base32 "0jv2yvk28w86rx5mvjkb0w12ff2jxih7axnpvznpd295lg5jg7hr"))
+       (base32 "1ilplibvjgf7a905grpnclrvkmqy9fgrpl7xyp3w4yl1qc682v9b"))
       (modules '((guix build utils)))
       (snippet
        ;; Remove non-free METIS code
@@ -485,7 +487,15 @@ script files.")
     (arguments
      `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
                            "-DENABLE_BUILD_SHARED:BOOL=ON"
-                           "-DENABLE_BUILD_DYNAMIC:BOOL=ON")))
+                           "-DENABLE_BUILD_DYNAMIC:BOOL=ON")
+       #:phases (modify-phases %standard-phases
+                  (replace
+                   'check
+                   (lambda _
+                     (zero? (system* "make" "test"
+                                     ;; Disable this test.  See
+                                     ;; https://geuz.org/trac/gmsh/ticket/271
+                                     "ARGS=-E component8_in_a_box")))))))
     (home-page "http://www.geuz.org/gmsh/")
     (synopsis "3D finite element grid generator")
     (description "Gmsh is a 3D finite element grid generator with a built-in
@@ -500,7 +510,7 @@ ASCII text files using Gmsh's own scripting language.")
 (define-public petsc
   (package
     (name "petsc")
-    (version "3.4.4")
+    (version "3.6.2")
     (source
      (origin
       (method url-fetch)
@@ -508,9 +518,7 @@ ASCII text files using Gmsh's own scripting language.")
       (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
                           "petsc-lite-" version ".tar.gz"))
       (sha256
-       (base32 "0v5dg6dhdjpi5ianvd4mm6hsvxzv1bsxwnh9f9myag0a0d9xk9iv"))
-      (patches
-       (list (search-patch "petsc-fix-threadcomm.patch")))))
+       (base32 "13h0m5f9xsdpps4lsp59iz2m7zkapwavq2zfkfvs3ab6sndla0l9"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("python" ,python-2)
@@ -524,7 +532,7 @@ ASCII text files using Gmsh's own scripting language.")
        ))
     (arguments
      `(#:test-target "test"
-       #:parallel-build? #f
+       #:parallel-build? #f             ;build is parallel by default
        #:configure-flags
        `("--with-mpi=0"
          "--with-openmp=1"
@@ -560,26 +568,22 @@ ASCII text files using Gmsh's own scripting language.")
             (let ((out     (assoc-ref outputs "out"))
                   (fortran (assoc-ref inputs  "gfortran")))
               (substitute* (map (lambda (file)
-                                  (string-append out "/" file))
-                                '("conf/petscvariables"
-                                  "conf/PETScConfig.cmake"))
+                                  (string-append out "/lib/petsc/conf/" file))
+                                '("petscvariables" "PETScConfig.cmake"))
                 (((getcwd)) out))
               ;; Make compiler references point to the store
-              (substitute* (string-append out "/conf/petscvariables")
+              (substitute* (string-append out "/lib/petsc/conf/petscvariables")
                 (("= g(cc|\\+\\+|fortran)" _ suffix)
                  (string-append "= " fortran "/bin/g" suffix)))
               ;; PETSc installs some build logs, which aren't necessary.
               (for-each (lambda (file)
-                          (let ((f (string-append out "/" file)))
+                          (let ((f (string-append out "/lib/petsc/conf/" file)))
                             (when (file-exists? f)
                               (delete-file f))))
-                        '("conf/configure.log"
-                          "conf/make.log"
-                          "conf/test.log"
-                          "conf/error.log"
-                          "conf/RDict.db"
+                        '("configure.log" "make.log" "gmake.log"
+                          "test.log" "error.log" "RDict.db"
                           ;; Once installed, should uninstall with Guix
-                          "conf/uninstall.py"))))
+                          "uninstall.py"))))
           %standard-phases)))))
     (home-page "http://www.mcs.anl.gov/petsc")
     (synopsis "Library to solve PDEs")
@@ -628,6 +632,274 @@ scientific applications modeled by partial differential equations.")
            ,@(delete "--with-mpi=0" ,cf)))))
     (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
 
+(define-public slepc
+  (package
+    (name "slepc")
+    (version "3.6.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "http://slepc.upv.es/download/download.php?"
+                           "filename=slepc-" version ".tar.gz"))
+       (sha256
+        (base32
+         "1pv5iqz2kc8sj49zsabyz4arnfpana8mjrhq31vzgk16xldk3d1a"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("python" ,python-2)))
+    (inputs
+     `(("arpack" ,arpack-ng)
+       ("gfortran" ,gfortran)))
+    (propagated-inputs
+     `(("petsc" ,petsc)))
+    (arguments
+     `(#:parallel-build? #f             ;build is parallel by default
+       #:configure-flags
+       `(,(string-append "--with-arpack-dir="
+                         (assoc-ref %build-inputs "arpack") "/lib"))
+       #:phases
+       (modify-phases %standard-phases
+         (replace
+          'configure
+          ;; configure is a python script, so we can't run it with bash.
+          (lambda* (#:key inputs outputs (configure-flags '())
+                    #:allow-other-keys)
+            (let* ((prefix (assoc-ref outputs "out"))
+                   (flags `(,(string-append "--prefix=" prefix)
+                            ,@configure-flags)))
+              (format #t "build directory: ~s~%" (getcwd))
+              (format #t "configure flags: ~s~%" flags)
+              (setenv "SLEPC_DIR" (getcwd))
+              (setenv "PETSC_DIR" (assoc-ref inputs "petsc"))
+              (zero? (apply system* "./configure" flags)))))
+         (add-after
+          'install 'delete-doc
+          ;; TODO: SLEPc installs HTML documentation alongside headers in
+          ;; $out/include.  We'd like to move them to share/doc, but delete
+          ;; them for now, as they are incomplete and installing the complete
+          ;; documentation is difficult.
+          (lambda* (#:key outputs #:allow-other-keys)
+            (let* ((out (assoc-ref outputs "out")))
+              (for-each delete-file (find-files out "\\.html$")))))
+         (add-after
+          'install 'clean-install
+          ;; Clean up unnecessary build logs from installation.
+          (lambda* (#:key outputs #:allow-other-keys)
+            (let ((out (assoc-ref outputs "out")))
+              (for-each (lambda (file)
+                          (let ((f (string-append out "/lib/slepc/conf/" file)))
+                            (when (file-exists? f)
+                              (delete-file f))))
+                        '("configure.log" "make.log" "gmake.log"
+                          "test.log" "error.log" "RDict.db"
+                          "uninstall.py"))))))))
+    (home-page "http://slepc.upv.es")
+    (synopsis "Scalable library for eigenproblems")
+    (description "SLEPc is a software library for the solution of large sparse
+eigenproblems on parallel computers.  It can be used for the solution of
+linear eigenvalue problems formulated in either standard or generalized form,
+as well as other related problems such as the singular value decomposition.
+The emphasis of the software is on methods and techniques appropriate for
+problems in which the associated matrices are sparse, for example, those
+arising after the discretization of partial differential equations.")
+    (license license:lgpl3)))
+
+(define-public slepc-complex
+  (package (inherit slepc)
+    (name "slepc-complex")
+    (propagated-inputs
+     `(("petsc" ,petsc-complex)
+       ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
+    (synopsis "Scalable library for eigenproblems (with complex scalars)")))
+
+(define-public slepc-openmpi
+  (package (inherit slepc)
+    (name "slepc-openmpi")
+    (inputs
+     `(("mpi" ,openmpi)
+       ("arpack" ,arpack-ng-openmpi)
+       ,@(alist-delete "arpack" (package-inputs slepc))))
+    (propagated-inputs
+     `(("petsc" ,petsc-openmpi)
+       ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
+    (synopsis "Scalable library for eigenproblems (with MPI support)")))
+
+(define-public slepc-complex-openmpi
+  (package (inherit slepc-openmpi)
+    (name "slepc-complex-openmpi")
+    (propagated-inputs
+     `(("petsc" ,petsc-complex-openmpi)
+       ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
+    (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
+
+(define-public mumps
+  (package
+    (name "mumps")
+    (version "5.0.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
+                           version ".tar.gz"))
+       (sha256
+        (base32
+         "1820jfp3mbl7n85765v5mp6p0gzqpgr4d2lrnhwj4gl7cwp5ndah"))
+       (patches (list (search-patch "mumps-build-parallelism.patch")))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("fortran" ,gfortran)
+       ;; These are required for linking against mumps, but we let the user
+       ;; declare the dependency.
+       ("blas" ,openblas)
+       ("metis" ,metis)
+       ("scotch" ,scotch)))
+    (arguments
+     `(#:modules ((ice-9 match)
+                  (ice-9 popen)
+                  (srfi srfi-1)
+                  ,@%gnu-build-system-modules)
+       #:phases
+       (modify-phases %standard-phases
+         (replace
+          'configure
+          (lambda* (#:key inputs #:allow-other-keys)
+            (call-with-output-file "Makefile.inc"
+              (lambda (port)
+                (format port "
+PLAT         =
+LIBEXT       = .a
+OUTC         = -o
+OUTF         = -o
+RM           = rm -f~:[
+CC           = gcc
+FC           = gfortran
+FL           = gfortran
+INCSEQ       = -I$(topdir)/libseq
+LIBSEQ       = -L$(topdir)/libseq -lmpiseq
+LIBSEQNEEDED = libseqneeded~;
+CC           = mpicc
+FC           = mpifort
+FL           = mpifort~]
+AR           = ar vr # rules require trailing space, ugh...
+RANLIB       = ranlib
+LIBBLAS      = -L~a -lopenblas~@[
+SCALAP       = -L~a -lscalapack~]
+LIBOTHERS    = -pthread
+CDEFS        = -DAdd_
+PIC          = -fPIC
+OPTF         = -O2 -DALLOW_NON_INIT $(PIC)
+OPTL         = -O2 $(PIC)
+OPTC         = -O2 $(PIC)
+INCS         = $(INCSEQ)
+LIBS         = $(SCALAP) $(LIBSEQ)
+LPORDDIR     = $(topdir)/PORD/lib
+IPORD        = -I$(topdir)/PORD/include
+LPORD        = -L$(LPORDDIR) -lpord
+ORDERINGSF   = -Dpord~@[
+METISDIR     = ~a
+IMETIS       = -I$(METISDIR)/include
+LMETIS       = -L$(METISDIR)/lib -lmetis
+ORDERINGSF  += -Dmetis~]~@[~:{
+SCOTCHDIR    = ~a
+ISCOTCH      = -I$(SCOTCHDIR)/include
+LSCOTCH      = -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
+ORDERINGSF  += ~a~}~]
+ORDERINGSC   = $(ORDERINGSF)
+LORDERINGS   = $(LPORD) $(LMETIS) $(LSCOTCH)
+IORDERINGSF  = $(ISCOTCH)
+IORDERINGSC  = $(IPORD) $(IMETIS) $(ISCOTCH)"
+                        (assoc-ref inputs "mpi")
+                        (assoc-ref inputs "blas")
+                        (assoc-ref inputs "scalapack")
+                        (assoc-ref inputs "metis")
+                        (match (list (assoc-ref inputs "pt-scotch")
+                                     (assoc-ref inputs "scotch"))
+                          ((#f #f)
+                           #f)
+                          ((#f scotch)
+                           `((,scotch "" "-Dscotch")))
+                          ((ptscotch _)
+                           `((,ptscotch
+                              "-lptesmumps -lptscotch -lptscotcherr "
+                              "-Dptscotch")))))))))
+         (replace
+          'build
+          ;; By default only the d-precision library is built.  Make with "all"
+          ;; target so that all precision libraries and examples are built.
+          (lambda _
+            (zero? (system* "make" "all"
+                            (format #f "-j~a" (parallel-job-count))))))
+         (replace
+          'check
+          ;; Run the simple test drivers, which read test input from stdin:
+          ;; from the "real" input for the single- and double-precision
+          ;; testers, and from the "cmplx" input for complex-precision
+          ;; testers.  The EXEC-PREFIX key is used by the mumps-openmpi
+          ;; package to prefix execution with "mpirun".
+          (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
+            (with-directory-excursion "examples"
+              (every
+               (lambda (prec type)
+                 (let ((tester (apply open-pipe*
+                                      `(,OPEN_WRITE
+                                        ,@exec-prefix
+                                        ,(string-append "./" prec
+                                                        "simpletest"))))
+                       (input  (open-input-file
+                                (string-append "input_simpletest_" type))))
+                   (begin
+                     (dump-port input tester)
+                     (close-port input)
+                     (zero? (close-pipe tester)))))
+               '("s" "d" "c" "z")
+               '("real" "real" "cmplx" "cmplx")))))
+         (replace
+          'install
+          (lambda* (#:key outputs #:allow-other-keys)
+            (let ((out (assoc-ref outputs "out")))
+              (copy-recursively "lib" (string-append out "/lib"))
+              (copy-recursively "include" (string-append out "/include"))
+              (when (file-exists? "libseq/libmpiseq.a")
+                (copy-file "libseq/libmpiseq.a"
+                           (string-append out "/lib/libmpiseq.a")))))))))
+    (home-page "http://mumps.enseeiht.fr")
+    (synopsis "Multifrontal sparse direct solver")
+    (description
+     "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
+sparse system of linear equations A x = b using Guassian elimination.")
+    (license license:cecill-c)))
+
+(define-public mumps-metis
+  (package (inherit mumps)
+    (name "mumps-metis")
+    (inputs
+     (alist-delete "scotch" (package-inputs mumps)))))
+
+(define-public mumps-openmpi
+  (package (inherit mumps)
+    (name "mumps-openmpi")
+    (inputs
+     `(("mpi" ,openmpi)
+       ("scalapack" ,scalapack)
+       ("pt-scotch" ,pt-scotch)
+       ,@(alist-delete "scotch" (package-inputs mumps))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments mumps)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (replace
+            'check
+            (lambda _
+              ((assoc-ref ,phases 'check)
+               #:exec-prefix '("mpirun" "-n" "2"))))))))
+    (synopsis "Multifrontal sparse direct solver (with MPI)")))
+
+(define-public mumps-metis-openmpi
+  (package (inherit mumps-openmpi)
+    (name "mumps-metis-openmpi")
+    (inputs
+     (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
+
 (define-public superlu
   (package
     (name "superlu")
@@ -927,6 +1199,36 @@ bio-chemistry.")
             (lambda _ (zero? (system* "make" "ptcheck"))))))))
     (synopsis "Programs and libraries for graph algorithms (with MPI)")))
 
+(define-public metis
+  (package
+    (name "metis")
+    (version "5.1.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
+                           "metis-" version ".tar.gz"))
+       (sha256
+        (base32
+         "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
+    (build-system cmake-build-system)
+    (inputs
+     `(("blas" ,openblas)))
+    (arguments
+     `(#:tests? #f                      ;no tests
+       #:configure-flags `("-DSHARED=ON"
+                           ,(string-append "-DGKLIB_PATH=" (getcwd)
+                                           "/metis-" ,version "/GKlib"))))
+    (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
+    (synopsis "Graph partitioning and fill-reducing matrix ordering library")
+    (description
+     "METIS is a set of serial programs for partitioning graphs, partitioning
+finite element meshes, and producing fill-reducing orderings for sparse
+matrices.  The algorithms implemented in METIS are based on the multilevel
+recursive-bisection, multilevel k-way, and multi-constraint partitioning
+schemes.")
+    (license license:asl2.0)))          ;As of version 5.0.3
+
 (define-public p4est
   (package
     (name "p4est")
@@ -1077,7 +1379,7 @@ to BMP, JPEG or PNG image formats.")
     (description "Maxima is a system for the manipulation of symbolic and
 numerical expressions.  It yields high precision numeric results by using
 exact fractions, arbitrary precision integers, and variable precision floating
-point numbers")
+point numbers.")
     ;; Some files are lgpl2.1+. Some are gpl2+.  Some explicitly state gpl1+.
     ;; Others simply say "GNU General Public License" without stating a
     ;; version (which implicitly means gpl1+).
@@ -1128,6 +1430,46 @@ output to TeX, and a browser for Maxima's manual including command index and
 full text searching.")
     (license license:gpl2+)))
 
+(define-public armadillo
+  (package
+    (name "armadillo")
+    (version "6.400.3")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://sourceforge/arma/armadillo-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "0bsgrmldlx77w5x26n3axj1hg6iw6csyw0dwl1flrbdwl51f9701"))))
+    (build-system cmake-build-system)
+    (arguments `(#:tests? #f)) ;no test target
+    (inputs
+     `(("openblas" ,openblas)
+       ("lapack" ,lapack)
+       ("arpack" ,arpack-ng)))
+    (home-page "http://arma.sourceforge.net/")
+    (synopsis "C++ linear algebra library")
+    (description
+     "Armadillo is a C++ linear algebra library, aiming towards a good balance
+between speed and ease of use.  It is useful for algorithm development
+directly in C++, or quick conversion of research code into production
+environments.  It can be used for machine learning, pattern recognition,
+signal processing, bioinformatics, statistics, econometrics, etc.  The library
+provides efficient classes for vectors, matrices and cubes, as well as 150+
+associated functions (eg. contiguous and non-contiguous submatrix views).")
+    (license license:mpl2.0)))
+
+(define-public armadillo-for-rcpparmadillo
+  (package (inherit armadillo)
+    (version "6.200.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://sourceforge/arma/armadillo-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "1f69rlqhnf2wv8khyn2a8vi6gx1i72qgfy8b9b760ssk85dcl763"))))))
+
 (define-public muparser
   (package
     (name "muparser")
@@ -1156,7 +1498,7 @@ constant parts of it.")
 (define-public openblas
   (package
     (name "openblas")
-    (version "0.2.14")
+    (version "0.2.15")
     (source
      (origin
        (method url-fetch)
@@ -1165,14 +1507,18 @@ constant parts of it.")
        (file-name (string-append name "-" version ".tar.gz"))
        (sha256
         (base32
-         "0av3pd96j8rx5i65f652xv9wqfkaqn0w4ma1gvbyz73i6j2hi9db"))))
+         "1k5f6vjlk54qlplk5m7xkbaw6g2y7dl50lwwdv6xsbcsgsbxfcpy"))))
     (build-system gnu-build-system)
     (arguments
      `(#:tests? #f  ;no "check" target
-       ;; DYNAMIC_ARCH is not supported on MIPS.  When it is disabled,
-       ;; OpenBLAS will tune itself to the build host, so we need to disable
-       ;; substitutions.
-       #:substitutable? ,(not (string-prefix? "mips" (%current-system)))
+       ;; DYNAMIC_ARCH is only supported on x86.  When it is disabled and no
+       ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
+       ;; we need to disable substitutions.
+       #:substitutable?
+        ,(let ((system (or (%current-target-system) (%current-system))))
+           (or (string-prefix? "x86_64" system)
+               (string-prefix? "i686" system)
+               (string-prefix? "mips" system)))
        #:make-flags
        (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
              "SHELL=bash"
@@ -1180,10 +1526,19 @@ constant parts of it.")
              ;; Build the library for all supported CPUs.  This allows
              ;; switching CPU targets at runtime with the environment variable
              ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
-             ;; Unfortunately, this is not supported on MIPS.
-             ,@(if (string-prefix? "mips" (%current-system))
-                   '()
-                   '("DYNAMIC_ARCH=1")))
+             ;; Unfortunately, this is not supported on non-x86 architectures,
+             ;; where it leads to failed builds.
+             ,@(let ((system (or (%current-target-system) (%current-system))))
+                 (cond
+                  ((or (string-prefix? "x86_64" system)
+                       (string-prefix? "i686" system))
+                   '("DYNAMIC_ARCH=1"))
+                  ;; On MIPS we force the "SICORTEX" TARGET, as for the other
+                  ;; two available MIPS targets special extended instructions
+                  ;; for Loongson cores are used.
+                  ((string-prefix? "mips" system)
+                   '("TARGET=SICORTEX"))
+                  (else '()))))
        ;; no configure script
        #:phases (alist-delete 'configure %standard-phases)))
     (inputs
@@ -1224,7 +1579,7 @@ constant parts of it.")
      "OpenLibm is an effort to have a high quality, portable, standalone C
 mathematical library (libm).  It can be used standalone in applications and
 programming language implementations.  The project was born out of a need to
-have a good libm for the Julia programming langage that worked consistently
+have a good libm for the Julia programming language that worked consistently
 across compilers and operating systems, and in 32-bit and 64-bit
 environments.")
     ;; See LICENSE.md for details.
@@ -1523,21 +1878,17 @@ specifications.")
                           (string-append lib "/liblpsolve55.a"))
                (copy-file "lpsolve55/bin/ux64/liblpsolve55.so"
                           (string-append lib "/liblpsolve55.so"))
-               (mkdir-p bin)
-               (copy-file "lp_solve/bin/ux64/lp_solve"
-                          (string-append bin "/lp_solve"))
-               (mkdir-p include)
+               (install-file "lp_solve/bin/ux64/lp_solve" bin)
+
                ;; Install a subset of the header files as on Debian
                ;; (plus lp_bit.h, which matches the regular expression).
-               (for-each
-                 (lambda (name)
-                   (copy-file name (string-append include "/" name)))
-                 (find-files "." "lp_[HMSa-z].*\\.h$"))
+               (for-each (lambda (name)
+                           (install-file name include))
+                         (find-files "." "lp_[HMSa-z].*\\.h$"))
                (with-directory-excursion "shared"
-                 (for-each
-                   (lambda (name)
-                     (copy-file name (string-append include "/" name)))
-                   (find-files "." "\\.h$")))
+                 (for-each (lambda (name)
+                             (install-file name include))
+                           (find-files "." "\\.h$")))
                #t))))))
     (home-page "http://lpsolve.sourceforge.net/")
     (synopsis "Mixed integer linear programming (MILP) solver")
@@ -1545,3 +1896,175 @@ specifications.")
      "lp_solve is a mixed integer linear programming solver based on the
 revised simplex and the branch-and-bound methods.")
     (license license:lgpl2.1+)))
+
+(define-public dealii
+  (package
+    (name "dealii")
+    (version "8.2.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/dealii/dealii/releases/"
+                           "download/v" version "/dealii-" version ".tar.gz"))
+       (sha256
+        (base32
+         "185jych0gdnpkjwxni7pd0dda149492zwq2457xdjg76bzj78mnp"))
+       (patches (list (search-patch "dealii-p4est-interface.patch")))
+       (modules '((guix build utils)))
+       (snippet
+        ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
+        '(delete-file-recursively "bundled"))))
+    (build-system cmake-build-system)
+    (inputs
+     `(("tbb" ,tbb)
+       ("zlib" ,zlib)
+       ("boost" ,boost)
+       ("p4est" ,p4est)
+       ("blas" ,openblas)
+       ("lapack" ,lapack)
+       ("arpack" ,arpack-ng)
+       ("muparser" ,muparser)
+       ("gfortran" ,gfortran)
+       ("suitesparse" ,suitesparse)))   ;for UMFPACK
+    (arguments
+     `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease
+       #:configure-flags '("-DCOMPAT_FILES=OFF") ;Follow new directory structure
+       #:phases (modify-phases %standard-phases
+                  (add-after
+                   'install 'hint-example-prefix
+                   ;; Set Cmake hints in examples so that they can find this
+                   ;; deal.II when configuring.
+                   (lambda* (#:key outputs #:allow-other-keys)
+                     (let* ((out (assoc-ref %outputs "out"))
+                            (exmpl (string-append out "/share/doc"
+                                                  "/dealii/examples")))
+                       (substitute* (find-files exmpl "CMakeLists.txt")
+                         (("([[:space:]]*HINTS.*)\n" _ line)
+                          (string-append line " $ENV{HOME}/.guix-profile "
+                                         out "\n")))
+                       #t))))))
+    (home-page "https://www.dealii.org")
+    (synopsis "Finite element library")
+    (description
+     "Deal.II is a C++ program library targeted at the computational solution
+of partial differential equations using adaptive finite elements.  The main
+aim of deal.II is to enable rapid development of modern finite element codes,
+using among other aspects adaptive meshes and a wide array of tools often used
+in finite element programs.")
+    (license license:lgpl2.1+)))
+
+(define-public dealii-openmpi
+  (package (inherit dealii)
+    (name "dealii-openmpi")
+    (inputs
+     `(("mpi" ,openmpi)
+       ;;Supported only with MPI:
+       ("p4est" ,p4est-openmpi)
+       ("petsc" ,petsc-openmpi)
+       ("slepc" ,slepc-openmpi)
+       ("metis" ,metis)               ;for MUMPS
+       ("scalapack" ,scalapack)       ;for MUMPS
+       ("mumps" ,mumps-metis-openmpi) ;configure supports only metis orderings
+       ("arpack" ,arpack-ng-openmpi)
+       ,@(fold alist-delete (package-inputs dealii)
+               '("p4est" "arpack"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments dealii)
+       ((#:configure-flags cf)
+        ``("-DMPI_C_COMPILER=mpicc"
+           "-DMPI_CXX_COMPILER=mpicxx"
+           "-DMPI_Fortran_COMPILER=mpifort"
+           ,@,cf))))
+    (synopsis "Finite element library (with MPI support)")))
+
+(define-public flann
+  (package
+    (name "flann")
+    (version "1.8.4")
+    (source
+      (origin
+        (method url-fetch)
+        (uri
+          (string-append
+            "http://www.cs.ubc.ca/research/flann/uploads/FLANN/flann-"
+            version "-src.zip"))
+        (sha256
+          (base32
+            "022w8hph7bli5zbpnk3z1qh1c2sl5hm8fw2ccim651ynn0hr7fyz"))))
+    (build-system cmake-build-system)
+    (native-inputs
+     `(("unzip" ,unzip)))
+    (inputs
+     `(("hdf5" ,hdf5)
+       ("octave" ,octave)
+       ("python" ,python-2) ; print syntax
+       ;; ("python2-numpy" ,python2-numpy) ; only required for the tests
+       ("zlib" ,zlib)))
+    (arguments
+     `(#:tests? #f)) ; The test data are downloaded from the Internet.
+    (home-page "http://www.cs.ubc.ca/research/flann/")
+    (synopsis "Library for approximate nearest neighbors computation")
+    (description "FLANN is a library for performing fast approximate
+nearest neighbor searches in high dimensional spaces.  It implements a
+collection of algorithms and a system for automatically choosing the best
+algorithm and optimum parameters depending on the dataset.
+
+FLANN is written in C++ and contains bindings for C, Octave and Python.")
+    (license (license:non-copyleft "file://COPYING"
+                                "See COPYING in the distribution."))))
+
+(define-public wcalc
+  (package
+    (name "wcalc")
+    (version "2.5")
+    (source
+      (origin
+        (method url-fetch)
+        (uri
+          (string-append
+            "mirror://sourceforge/w-calc/wcalc-" version ".tar.bz2"))
+        (sha256
+          (base32
+            "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("mpfr" ,mpfr)
+       ("readline" ,readline)))
+    (home-page "http://w-calc.sourceforge.net/index.php")
+    (synopsis "Flexible command-line scientific calculator")
+    (description "Wcalc is a very capable calculator.  It has standard functions
+(sin, asin, and sinh for example, in either radians or degrees), many
+pre-defined constants (pi, e, c, etc.), support for using variables, \"active\"
+variables, a command history, hex/octal/binary input and output, unit
+conversions, embedded comments, and an expandable expression entry field.  It
+evaluates expressions using the standard order of operations.")
+    (license license:gpl2+)))
+
+(define-public xaos
+  (package
+    (name "xaos")
+    (version "3.6")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://sourceforge/xaos/xaos-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "15cd1cx1dyygw6g2nhjqq3bsfdj8sj8m4va9n75i0f3ryww3x7wq"))))
+    (build-system gnu-build-system)
+    (native-inputs `(("gettext" ,gnu-gettext)))
+    (inputs `(("libx11" ,libx11)
+              ("zlib" ,zlib)
+              ("libpng" ,libpng)
+              ("gsl" ,gsl)))
+    (arguments
+     `(#:tests? #f ;no "check" target
+       #:make-flags '("LOCALEDIR=$DATAROOTDIR/locale")))
+    (synopsis "Real-time fractal zoomer")
+    (description "GNU XaoS is a graphical program that generates fractal
+patterns and allows you to zoom in and out of them infinitely in a fluid,
+continuous manner.  It also includes tutorials that help to explain how fractals
+are built.  It can generate many different fractal types such as the Mandelbrot
+set.")
+    (home-page "http://www.gnu.org/software/xaos/")
+    (license license:gpl2+)))