1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
4 ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
5 ;;; Copyright © 2014, 2015 Eric Bavier <bavier@member.fsf.org>
6 ;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch>
7 ;;; Copyright © 2014 Mathieu Lirzin <mathieu.lirzin@openmailbox.org>
8 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
9 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
10 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
11 ;;; Copyright © 2015, 2016 Efraim Flashner <efraim@flashner.co.il>
12 ;;; Copyright © 2015 Fabian Harfert <fhmgufs@web.de>
14 ;;; This file is part of GNU Guix.
16 ;;; GNU Guix is free software; you can redistribute it and/or modify it
17 ;;; under the terms of the GNU General Public License as published by
18 ;;; the Free Software Foundation; either version 3 of the License, or (at
19 ;;; your option) any later version.
21 ;;; GNU Guix is distributed in the hope that it will be useful, but
22 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;;; GNU General Public License for more details.
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
29 (define-module (gnu packages maths)
30 #:use-module (ice-9 regex)
31 #:use-module (gnu packages)
32 #:use-module ((guix licenses) #:prefix license:)
33 #:use-module (guix packages)
34 #:use-module (guix download)
35 #:use-module (guix svn-download)
36 #:use-module (guix utils)
37 #:use-module (guix build utils)
38 #:use-module (guix build-system cmake)
39 #:use-module (guix build-system gnu)
40 #:use-module (gnu packages algebra)
41 #:use-module (gnu packages bison)
42 #:use-module (gnu packages boost)
43 #:use-module (gnu packages check)
44 #:use-module (gnu packages cmake)
45 #:use-module (gnu packages compression)
46 #:use-module (gnu packages curl)
47 #:use-module (gnu packages elf)
48 #:use-module (gnu packages flex)
49 #:use-module (gnu packages fltk)
50 #:use-module (gnu packages fontutils)
51 #:use-module (gnu packages gettext)
52 #:use-module (gnu packages gcc)
53 #:use-module (gnu packages gd)
54 #:use-module (gnu packages ghostscript)
55 #:use-module (gnu packages glib)
56 #:use-module (gnu packages gtk)
57 #:use-module (gnu packages image)
58 #:use-module (gnu packages less)
59 #:use-module (gnu packages lisp)
60 #:use-module (gnu packages gnome)
61 #:use-module (gnu packages xorg)
62 #:use-module (gnu packages gl)
63 #:use-module (gnu packages m4)
64 #:use-module (gnu packages mpi)
65 #:use-module (gnu packages multiprecision)
66 #:use-module (gnu packages pcre)
67 #:use-module (gnu packages popt)
68 #:use-module (gnu packages perl)
69 #:use-module (gnu packages pkg-config)
70 #:use-module (gnu packages python)
71 #:use-module (gnu packages readline)
72 #:use-module (gnu packages tbb)
73 #:use-module (gnu packages tcsh)
74 #:use-module (gnu packages tcl)
75 #:use-module (gnu packages texinfo)
76 #:use-module (gnu packages texlive)
77 #:use-module (gnu packages wxwidgets)
78 #:use-module (gnu packages xml)
79 #:use-module (gnu packages zip)
80 #:use-module (srfi srfi-1))
88 (uri (string-append "mirror://gnu/units/units-" version
91 "1jxvjknz2jhq773jrwx9gc1df3gfy73yqmkjkygqxzpi318yls3q"))))
92 (build-system gnu-build-system)
93 (synopsis "Conversion between thousands of scales")
95 "GNU Units converts numeric quantities between units of measure. It
96 can handle scale changes through adaptive usage of standard scale
97 prefixes (micro-, kilo-, etc.). It can also handle nonlinear
98 conversions such as Fahrenheit to Celsius. Its interpreter is powerful
99 enough to be used effectively as a scientific calculator.")
100 (license license:gpl3+)
101 (home-page "http://www.gnu.org/software/units/")))
103 (define-public double-conversion
105 (name "double-conversion")
110 "https://github.com/floitsch/double-conversion/archive/v"
112 (file-name (string-append name "-" version ".tar.gz"))
115 "0cnr8xhyjfxijay8ymkqcph3672wp2lj23qhdmr3m4kia5kpdf83"))))
116 (build-system cmake-build-system)
118 '(#:test-target "test"
119 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
120 "-DBUILD_TESTING=ON")))
121 (home-page "https://github.com/floitsch/double-conversion")
122 (synopsis "Conversion routines for IEEE doubles")
124 "The double-conversion library provides binary-decimal and decimal-binary
125 routines for IEEE doubles. The library consists of efficient conversion
126 routines that have been extracted from the V8 JavaScript engine.")
127 (license license:bsd-3)))
129 (define-public dionysus
135 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
139 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
140 (build-system gnu-build-system)
141 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
142 (synopsis "Local search for universal constants and scientific values")
144 "GNU Dionysus is a convenient system for quickly retrieving the values of
145 mathematical constants used in science and engineering. Values can be
146 searched using a simple command-line tool, choosing from three databases:
147 universal constants, atomic numbers, and constants related to
149 (license license:gpl3+)
150 (home-page "http://www.gnu.org/software/dionysus/")))
159 (uri (string-append "mirror://gnu/gsl/gsl-"
163 "0rhcia9jhr3p1f1wybwyllwqfs9bggz99i3mi5lpyqcpff1hdbar"))))
164 (build-system gnu-build-system)
166 `(#:parallel-tests? #f))
167 (home-page "http://www.gnu.org/software/gsl/")
168 (synopsis "Numerical library for C and C++")
170 "The GNU Scientific Library is a library for numerical analysis in C
171 and C++. It includes a wide range of mathematical routines, with over 1000
172 functions in total. Subject areas covered by the library include:
173 differential equations, linear algebra, Fast Fourier Transforms and random
175 (license license:gpl3+)))
184 (uri (string-append "mirror://gnu/glpk/glpk-"
188 "1bpbp5z0378kaj5bqmc5m2j5h9c7553p0s2j6a28badqghpbx673"))))
189 (build-system gnu-build-system)
193 `(#:configure-flags '("--with-gmp")))
194 (home-page "http://www.gnu.org/software/glpk/")
195 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
197 "GLPK is a C library for solving large-scale linear programming (LP),
198 mixed integer programming (MIP), and other related problems. It supports the
199 GNU MathProg modeling language, a subset of the AMPL language, and features a
200 translator for the language. In addition to the C library, a stand-alone
201 LP/MIP solver is included in the package.")
202 (license license:gpl3+)))
211 (uri (string-append "mirror://gnu/pspp/pspp-"
215 "0c8326yykidi94xi7jn27j8iqxc38vc07d4wf5zyk0l8lpzx5vz7"))))
216 (build-system gnu-build-system)
219 ("fontconfig" ,fontconfig)
220 ("gettext" ,gnu-gettext)
224 ("readline" ,readline)
226 ("gtksourceview" ,gtksourceview-2)
229 `(("glib" ,glib "bin") ;for glib-genmarshal
232 ("pkg-config" ,pkg-config)))
233 (home-page "http://www.gnu.org/software/pspp/")
234 (synopsis "Statistical analysis")
236 "GNU PSPP is a statistical analysis program. It can perform
237 descriptive statistics, T-tests, linear regression and non-parametric tests.
238 It features both a graphical interface as well as command-line input. PSPP
239 is designed to interoperate with Gnumeric, LibreOffice and OpenOffice. Data
240 can be imported from spreadsheets, text files and database sources and it can
241 be output in text, PostScript, PDF or HTML.")
242 (license license:gpl3+)))
244 (define-public arpack-ng
251 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
253 (file-name (string-append name "-" version ".tar.gz"))
256 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
257 (build-system gnu-build-system)
258 (home-page "https://github.com/opencollab/arpack-ng")
261 ("fortran" ,gfortran)))
262 (synopsis "Fortran subroutines for solving eigenvalue problems")
264 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
265 large scale eigenvalue problems.")
266 (license (license:non-copyleft "file://COPYING"
267 "See COPYING in the distribution."))))
269 (define-public arpack-ng-openmpi
270 (package (inherit arpack-ng)
271 (name "arpack-ng-openmpi")
274 ,@(package-inputs arpack-ng)))
275 (arguments `(#:configure-flags '("--enable-mpi")))
276 (synopsis "Fortran subroutines for solving eigenvalue problems with MPI")))
278 (define-public lapack
285 (uri (string-append "http://www.netlib.org/lapack/lapack-"
289 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
290 (build-system cmake-build-system)
291 (home-page "http://www.netlib.org/lapack/")
292 (inputs `(("fortran" ,gfortran)
293 ("python" ,python-2)))
295 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
296 #:phases (alist-cons-before
298 (lambda* (#:key inputs #:allow-other-keys)
299 (let ((python (assoc-ref inputs "python")))
300 (substitute* "lapack_testing.py"
301 (("/usr/bin/env python") python))))
303 (synopsis "Library for numerical linear algebra")
305 "LAPACK is a Fortran 90 library for solving the most commonly occurring
306 problems in numerical linear algebra.")
307 (license (license:non-copyleft "file://LICENSE"
308 "See LICENSE in the distribution."))))
310 (define-public scalapack
317 (uri (string-append "http://www.netlib.org/scalapack/scalapack-"
321 "0p1r61ss1fq0bs8ynnx7xq4wwsdvs32ljvwjnx6yxr8gd6pawx0c"))))
322 (build-system cmake-build-system)
325 ("fortran" ,gfortran)
326 ("lapack" ,lapack))) ;for testing only
328 `(#:configure-flags `("-DBUILD_SHARED_LIBS:BOOL=YES")))
329 (home-page "http://www.netlib.org/scalapack/")
330 (synopsis "Library for scalable numerical linear algebra")
332 "ScaLAPACK is a Fortran 90 library of high-performance linear algebra
333 routines on parallel distributed memory machines. ScaLAPACK solves dense and
334 banded linear systems, least squares problems, eigenvalue problems, and
335 singular value problems.")
336 (license (license:bsd-style "file://LICENSE"
337 "See LICENSE in the distribution."))))
339 (define-public gnuplot
346 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
347 version "/gnuplot-" version ".tar.gz"))
350 "146qn414z96c7cc42a1kb9a4kpjc2q2hfdwk44kjjvgmfp9k2ass"))))
351 (build-system gnu-build-system)
352 (inputs `(("readline" ,readline)
356 (native-inputs `(("pkg-config" ,pkg-config)
357 ("texlive" ,texlive-minimal)))
358 (home-page "http://www.gnuplot.info")
359 (synopsis "Command-line driven graphing utility")
360 (description "Gnuplot is a portable command-line driven graphing
361 utility. It was originally created to allow scientists and students to
362 visualize mathematical functions and data interactively, but has grown to
363 support many non-interactive uses such as web scripting. It is also used as a
364 plotting engine by third-party applications like Octave.")
365 ;; X11 Style with the additional restriction that derived works may only be
366 ;; distributed as patches to the original.
367 (license (license:fsf-free
368 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
377 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-"
381 (base32 "0f9n0v3p3lwc7564791a39c6cn1d3dbrn7d1j3ikqsi27a8hy23d"))))
382 (build-system gnu-build-system)
388 'configure 'patch-configure
390 (substitute* "configure"
393 (home-page "http://www.hdfgroup.org")
394 (synopsis "Management suite for extremely large and complex data")
395 (description "HDF5 is a suite that makes possible the management of
396 extremely large and complex data collections.")
397 (license (license:x11-style
398 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
401 ;; For a fully featured Octave, users are strongly recommended also to install
402 ;; the following packages: texinfo, less, ghostscript, gnuplot.
403 (define-public octave
410 (uri (string-append "mirror://gnu/octave/octave-"
414 "101jr9yck798586jz4vkjcgk36zksmxf1pxrzvipgn2xgyay0zjc"))))
415 (build-system gnu-build-system)
418 ("readline" ,readline)
422 ("arpack" ,arpack-ng)
426 ("fontconfig" ,fontconfig)
427 ("freetype" ,freetype)
434 `(("gfortran" ,gfortran)
435 ("pkg-config" ,pkg-config)
437 ;; The following inputs are not actually used in the build process.
438 ;; However, the ./configure gratuitously tests for their existence and
439 ;; assumes that programs not present at build time are also not, and
440 ;; can never be, available at run time! If these inputs are therefore
441 ;; not present, support for them will be built out. However, Octave
442 ;; will still run without them, albeit without the features they
446 ("ghostscript" ,ghostscript)
447 ("gnuplot" ,gnuplot)))
449 `(#:configure-flags (list (string-append "--with-shell="
450 (assoc-ref %build-inputs "bash")
452 (home-page "http://www.gnu.org/software/octave/")
453 (synopsis "High-level language for numerical computation")
454 (description "GNU Octave is a high-level interpreted language that is
455 specialized for numerical computations. It can be used for both linear and
456 non-linear applications and it provides great support for visualizing results.
457 Work may be performed both at the interactive command-line as well as via
459 (license license:gpl3+)))
468 (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
469 version "-source.tgz"))
471 (base32 "1ilplibvjgf7a905grpnclrvkmqy9fgrpl7xyp3w4yl1qc682v9b"))
472 (modules '((guix build utils)))
474 ;; Remove non-free METIS code
475 '(delete-file-recursively "contrib/Metis"))))
476 (build-system cmake-build-system)
479 ("gfortran" ,gfortran)
486 ("libxext" ,libxext)))
488 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
489 "-DENABLE_BUILD_SHARED:BOOL=ON"
490 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")
491 #:phases (modify-phases %standard-phases
495 (zero? (system* "make" "test"
496 ;; Disable this test. See
497 ;; https://geuz.org/trac/gmsh/ticket/271
498 "ARGS=-E component8_in_a_box")))))))
499 (home-page "http://www.geuz.org/gmsh/")
500 (synopsis "3D finite element grid generator")
501 (description "Gmsh is a 3D finite element grid generator with a built-in
502 CAD engine and post-processor. Its design goal is to provide a fast, light
503 and user-friendly meshing tool with parametric input and advanced
504 visualization capabilities. Gmsh is built around four modules: geometry,
505 mesh, solver and post-processing. The specification of any input to these
506 modules is done either interactively using the graphical user interface or in
507 ASCII text files using Gmsh's own scripting language.")
508 (license license:gpl2+)))
517 ;; The *-lite-* tarball does not contain the *large* documentation
518 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
519 "petsc-lite-" version ".tar.gz"))
521 (base32 "13h0m5f9xsdpps4lsp59iz2m7zkapwavq2zfkfvs3ab6sndla0l9"))))
522 (build-system gnu-build-system)
524 `(("python" ,python-2)
527 `(("gfortran" ,gfortran)
530 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
531 ;; leaving out opengl, as configuration seems to only be for mac
534 `(#:test-target "test"
535 #:parallel-build? #f ;build is parallel by default
540 ,(string-append "--with-superlu-include="
541 (assoc-ref %build-inputs "superlu") "/include")
542 ,(string-append "--with-superlu-lib="
543 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
547 ;; PETSc's configure script is actually a python script, so we can't
549 (lambda* (#:key outputs (configure-flags '())
551 (let* ((prefix (assoc-ref outputs "out"))
552 (flags `(,(string-append "--prefix=" prefix)
554 (format #t "build directory: ~s~%" (getcwd))
555 (format #t "configure flags: ~s~%" flags)
556 (zero? (apply system* "./configure" flags))))
558 'configure 'clean-local-references
559 ;; Try to keep build directory names from leaking into compiled code
560 (lambda* (#:key inputs outputs #:allow-other-keys)
561 (let ((out (assoc-ref outputs "out")))
562 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
565 'install 'clean-install
566 ;; Try to keep installed files from leaking build directory names.
567 (lambda* (#:key inputs outputs #:allow-other-keys)
568 (let ((out (assoc-ref outputs "out"))
569 (fortran (assoc-ref inputs "gfortran")))
570 (substitute* (map (lambda (file)
571 (string-append out "/lib/petsc/conf/" file))
572 '("petscvariables" "PETScConfig.cmake"))
574 ;; Make compiler references point to the store
575 (substitute* (string-append out "/lib/petsc/conf/petscvariables")
576 (("= g(cc|\\+\\+|fortran)" _ suffix)
577 (string-append "= " fortran "/bin/g" suffix)))
578 ;; PETSc installs some build logs, which aren't necessary.
579 (for-each (lambda (file)
580 (let ((f (string-append out "/lib/petsc/conf/" file)))
581 (when (file-exists? f)
583 '("configure.log" "make.log" "gmake.log"
584 "test.log" "error.log" "RDict.db"
585 ;; Once installed, should uninstall with Guix
587 %standard-phases)))))
588 (home-page "http://www.mcs.anl.gov/petsc")
589 (synopsis "Library to solve PDEs")
590 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
591 data structures and routines for the scalable (parallel) solution of
592 scientific applications modeled by partial differential equations.")
593 (license (license:non-copyleft
594 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
596 (define-public petsc-complex
597 (package (inherit petsc)
598 (name "petsc-complex")
600 (substitute-keyword-arguments (package-arguments petsc)
601 ((#:configure-flags cf)
602 `(cons "--with-scalar-type=complex" ,cf))))
603 (synopsis "Library to solve PDEs (with complex scalars)")))
605 (define-public petsc-openmpi
606 (package (inherit petsc)
607 (name "petsc-openmpi")
609 `(("openmpi" ,openmpi)
610 ,@(package-inputs petsc)))
612 (substitute-keyword-arguments (package-arguments petsc)
613 ((#:configure-flags cf)
614 ``("--with-mpiexec=mpirun"
615 ,(string-append "--with-mpi-dir="
616 (assoc-ref %build-inputs "openmpi"))
617 ,@(delete "--with-mpi=0" ,cf)))))
618 (synopsis "Library to solve PDEs (with MPI support)")))
620 (define-public petsc-complex-openmpi
621 (package (inherit petsc-complex)
622 (name "petsc-complex-openmpi")
624 `(("openmpi" ,openmpi)
625 ,@(package-inputs petsc-complex)))
627 (substitute-keyword-arguments (package-arguments petsc-complex)
628 ((#:configure-flags cf)
629 ``("--with-mpiexec=mpirun"
630 ,(string-append "--with-mpi-dir="
631 (assoc-ref %build-inputs "openmpi"))
632 ,@(delete "--with-mpi=0" ,cf)))))
633 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
642 (uri (string-append "http://slepc.upv.es/download/download.php?"
643 "filename=slepc-" version ".tar.gz"))
644 (file-name (string-append name "-" version ".tar.gz"))
647 "1pv5iqz2kc8sj49zsabyz4arnfpana8mjrhq31vzgk16xldk3d1a"))))
648 (build-system gnu-build-system)
650 `(("python" ,python-2)))
652 `(("arpack" ,arpack-ng)
653 ("gfortran" ,gfortran)))
657 `(#:parallel-build? #f ;build is parallel by default
659 `(,(string-append "--with-arpack-dir="
660 (assoc-ref %build-inputs "arpack") "/lib"))
662 (modify-phases %standard-phases
665 ;; configure is a python script, so we can't run it with bash.
666 (lambda* (#:key inputs outputs (configure-flags '())
668 (let* ((prefix (assoc-ref outputs "out"))
669 (flags `(,(string-append "--prefix=" prefix)
671 (format #t "build directory: ~s~%" (getcwd))
672 (format #t "configure flags: ~s~%" flags)
673 (setenv "SLEPC_DIR" (getcwd))
674 (setenv "PETSC_DIR" (assoc-ref inputs "petsc"))
675 (zero? (apply system* "./configure" flags)))))
678 ;; TODO: SLEPc installs HTML documentation alongside headers in
679 ;; $out/include. We'd like to move them to share/doc, but delete
680 ;; them for now, as they are incomplete and installing the complete
681 ;; documentation is difficult.
682 (lambda* (#:key outputs #:allow-other-keys)
683 (let* ((out (assoc-ref outputs "out")))
684 (for-each delete-file (find-files out "\\.html$")))))
686 'install 'clean-install
687 ;; Clean up unnecessary build logs from installation.
688 (lambda* (#:key outputs #:allow-other-keys)
689 (let ((out (assoc-ref outputs "out")))
690 (for-each (lambda (file)
691 (let ((f (string-append out "/lib/slepc/conf/" file)))
692 (when (file-exists? f)
694 '("configure.log" "make.log" "gmake.log"
695 "test.log" "error.log" "RDict.db"
696 "uninstall.py"))))))))
697 (home-page "http://slepc.upv.es")
698 (synopsis "Scalable library for eigenproblems")
699 (description "SLEPc is a software library for the solution of large sparse
700 eigenproblems on parallel computers. It can be used for the solution of
701 linear eigenvalue problems formulated in either standard or generalized form,
702 as well as other related problems such as the singular value decomposition.
703 The emphasis of the software is on methods and techniques appropriate for
704 problems in which the associated matrices are sparse, for example, those
705 arising after the discretization of partial differential equations.")
706 (license license:lgpl3)))
708 (define-public slepc-complex
709 (package (inherit slepc)
710 (name "slepc-complex")
712 `(("petsc" ,petsc-complex)
713 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
714 (synopsis "Scalable library for eigenproblems (with complex scalars)")))
716 (define-public slepc-openmpi
717 (package (inherit slepc)
718 (name "slepc-openmpi")
721 ("arpack" ,arpack-ng-openmpi)
722 ,@(alist-delete "arpack" (package-inputs slepc))))
724 `(("petsc" ,petsc-openmpi)
725 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
726 (synopsis "Scalable library for eigenproblems (with MPI support)")))
728 (define-public slepc-complex-openmpi
729 (package (inherit slepc-openmpi)
730 (name "slepc-complex-openmpi")
732 `(("petsc" ,petsc-complex-openmpi)
733 ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
734 (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
743 (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
747 "1820jfp3mbl7n85765v5mp6p0gzqpgr4d2lrnhwj4gl7cwp5ndah"))
748 (patches (list (search-patch "mumps-build-parallelism.patch")))))
749 (build-system gnu-build-system)
751 `(("fortran" ,gfortran)
752 ;; These are required for linking against mumps, but we let the user
753 ;; declare the dependency.
758 `(#:modules ((ice-9 match)
761 ,@%gnu-build-system-modules)
763 (modify-phases %standard-phases
766 (lambda* (#:key inputs #:allow-other-keys)
767 (call-with-output-file "Makefile.inc"
778 INCSEQ = -I$(topdir)/libseq
779 LIBSEQ = -L$(topdir)/libseq -lmpiseq
780 LIBSEQNEEDED = libseqneeded~;
784 AR = ar vr # rules require trailing space, ugh...
786 LIBBLAS = -L~a -lopenblas~@[
787 SCALAP = -L~a -lscalapack~]
791 OPTF = -O2 -DALLOW_NON_INIT $(PIC)
795 LIBS = $(SCALAP) $(LIBSEQ)
796 LPORDDIR = $(topdir)/PORD/lib
797 IPORD = -I$(topdir)/PORD/include
798 LPORD = -L$(LPORDDIR) -lpord
799 ORDERINGSF = -Dpord~@[
801 IMETIS = -I$(METISDIR)/include
802 LMETIS = -L$(METISDIR)/lib -lmetis
803 ORDERINGSF += -Dmetis~]~@[~:{
805 ISCOTCH = -I$(SCOTCHDIR)/include
806 LSCOTCH = -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
808 ORDERINGSC = $(ORDERINGSF)
809 LORDERINGS = $(LPORD) $(LMETIS) $(LSCOTCH)
810 IORDERINGSF = $(ISCOTCH)
811 IORDERINGSC = $(IPORD) $(IMETIS) $(ISCOTCH)"
812 (assoc-ref inputs "mpi")
813 (assoc-ref inputs "blas")
814 (assoc-ref inputs "scalapack")
815 (assoc-ref inputs "metis")
816 (match (list (assoc-ref inputs "pt-scotch")
817 (assoc-ref inputs "scotch"))
821 `((,scotch "" "-Dscotch")))
824 "-lptesmumps -lptscotch -lptscotcherr "
825 "-Dptscotch")))))))))
828 ;; By default only the d-precision library is built. Make with "all"
829 ;; target so that all precision libraries and examples are built.
831 (zero? (system* "make" "all"
832 (format #f "-j~a" (parallel-job-count))))))
835 ;; Run the simple test drivers, which read test input from stdin:
836 ;; from the "real" input for the single- and double-precision
837 ;; testers, and from the "cmplx" input for complex-precision
838 ;; testers. The EXEC-PREFIX key is used by the mumps-openmpi
839 ;; package to prefix execution with "mpirun".
840 (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
841 (with-directory-excursion "examples"
844 (let ((tester (apply open-pipe*
847 ,(string-append "./" prec
849 (input (open-input-file
850 (string-append "input_simpletest_" type))))
852 (dump-port input tester)
854 (zero? (close-pipe tester)))))
856 '("real" "real" "cmplx" "cmplx")))))
859 (lambda* (#:key outputs #:allow-other-keys)
860 (let ((out (assoc-ref outputs "out")))
861 (copy-recursively "lib" (string-append out "/lib"))
862 (copy-recursively "include" (string-append out "/include"))
863 (when (file-exists? "libseq/libmpiseq.a")
864 (copy-file "libseq/libmpiseq.a"
865 (string-append out "/lib/libmpiseq.a")))))))))
866 (home-page "http://mumps.enseeiht.fr")
867 (synopsis "Multifrontal sparse direct solver")
869 "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
870 sparse system of linear equations A x = b using Guassian elimination.")
871 (license license:cecill-c)))
873 (define-public mumps-metis
874 (package (inherit mumps)
877 (alist-delete "scotch" (package-inputs mumps)))))
879 (define-public mumps-openmpi
880 (package (inherit mumps)
881 (name "mumps-openmpi")
884 ("scalapack" ,scalapack)
885 ("pt-scotch" ,pt-scotch)
886 ,@(alist-delete "scotch" (package-inputs mumps))))
888 (substitute-keyword-arguments (package-arguments mumps)
890 `(modify-phases ,phases
894 ((assoc-ref ,phases 'check)
895 #:exec-prefix '("mpirun" "-n" "2"))))))))
896 (synopsis "Multifrontal sparse direct solver (with MPI)")))
898 (define-public mumps-metis-openmpi
899 (package (inherit mumps-openmpi)
900 (name "mumps-metis-openmpi")
902 (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
904 (define-public superlu
911 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
912 "superlu_" version ".tar.gz"))
914 (base32 "10b785s9s4x0m9q7ihap09275pq4km3k2hk76jiwdfdr5qr2168n"))))
915 (build-system gnu-build-system)
920 ("gfortran" ,gfortran)))
922 `(#:parallel-build? #f
923 #:tests? #f ;tests are run as part of `make all`
927 (lambda* (#:key inputs outputs #:allow-other-keys)
928 (call-with-output-file "make.inc"
933 SUPERLULIB = ~a/lib/libsuperlu.a
935 BLASDEF = -DUSE_VENDOR_BLAS
936 BLASLIB = -L~a/lib -lblas
937 LIBS = $(SUPERLULIB) $(BLASLIB)
943 CFLAGS = -O3 -DPRNTlevel=0 $(PIC)
950 (assoc-ref outputs "out")
951 (assoc-ref inputs "lapack")))))
953 'build 'create-install-directories
954 (lambda* (#:key outputs #:allow-other-keys)
957 (mkdir-p (string-append (assoc-ref outputs "out")
962 (lambda* (#:key outputs #:allow-other-keys)
963 ;; Library is placed in lib during the build phase. Copy over
964 ;; headers to include.
965 (let* ((out (assoc-ref outputs "out"))
966 (incdir (string-append out "/include")))
967 (for-each (lambda (file)
968 (let ((base (basename file)))
969 (format #t "installing `~a' to `~a'~%"
972 (string-append incdir "/" base))))
973 (find-files "SRC" ".*\\.h$"))))
974 %standard-phases)))))
975 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
976 (synopsis "Supernodal direct solver for sparse linear systems")
978 "SuperLU is a general purpose library for the direct solution of large,
979 sparse, nonsymmetric systems of linear equations on high performance machines.
980 The library is written in C and is callable from either C or Fortran. The
981 library routines perform an LU decomposition with partial pivoting and
982 triangular system solves through forward and back substitution. The library
983 also provides threshold-based ILU factorization preconditioners.")
984 (license license:bsd-3)))
986 (define-public superlu-dist
988 (name "superlu-dist")
993 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
994 "superlu_dist_" version ".tar.gz"))
996 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
997 (patches (list (search-patch "superlu-dist-scotchmetis.patch")))))
998 (build-system gnu-build-system)
1002 `(("gfortran" ,gfortran)))
1004 `(("openmpi" ,openmpi) ;headers include MPI heades
1005 ("lapack" ,lapack) ;required to link with output library
1006 ("pt-scotch" ,pt-scotch))) ;same
1008 `(#:parallel-build? #f ;race conditions using ar
1012 (lambda* (#:key inputs outputs #:allow-other-keys)
1013 (call-with-output-file "make.inc"
1018 DSUPERLULIB = ~a/lib/libsuperlu_dist.a
1019 BLASDEF = -DUSE_VENDOR_BLAS
1020 BLASLIB = -L~a/lib -lblas
1021 PARMETISLIB = -L~a/lib \
1022 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
1023 -lscotch -lscotcherr -lscotcherrexit
1024 METISLIB = -L~:*~a/lib \
1025 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
1026 LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
1032 CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
1033 NOOPTS = -O0 -g $(PIC)
1035 FFLAGS = -O2 -g $(PIC)
1039 (assoc-ref outputs "out")
1040 (assoc-ref inputs "lapack")
1041 (assoc-ref inputs "pt-scotch")))))
1043 'unpack 'remove-broken-symlinks
1045 (for-each delete-file
1046 (find-files "MAKE_INC" "\\.#make\\..*")))
1048 'build 'create-install-directories
1049 (lambda* (#:key outputs #:allow-other-keys)
1052 (mkdir-p (string-append (assoc-ref outputs "out")
1054 '("lib" "include")))
1058 (with-directory-excursion "EXAMPLE"
1060 (zero? (system* "mpirun" "-n" "2"
1061 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
1062 (zero? (system* "mpirun" "-n" "2"
1063 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
1066 (lambda* (#:key outputs #:allow-other-keys)
1067 ;; Library is placed in lib during the build phase. Copy over
1068 ;; headers to include.
1069 (let* ((out (assoc-ref outputs "out"))
1070 (incdir (string-append out "/include")))
1071 (for-each (lambda (file)
1072 (let ((base (basename file)))
1073 (format #t "installing `~a' to `~a'~%"
1076 (string-append incdir "/" base))))
1077 (find-files "SRC" ".*\\.h$"))))
1078 %standard-phases)))))))
1079 (home-page (package-home-page superlu))
1080 (synopsis "Parallel supernodal direct solver")
1082 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
1083 It is targeted for distributed memory parallel machines. SuperLU_DIST is
1084 implemented in ANSI C, and MPI for communications.")
1085 (license license:bsd-3)))
1087 (define-public scotch
1094 (uri (string-append "https://gforge.inria.fr/frs/download.php/34618/"
1095 "scotch_" version ".tar.gz"))
1097 (base32 "1ir088mvrqggyqdkx9qfynmiaffqbyih5qfl5mga2nrlm1qlsgzm"))
1098 (patches (list (search-patch "scotch-test-threading.patch")
1099 (search-patch "pt-scotch-build-parallelism.patch")))))
1100 (build-system gnu-build-system)
1107 (modify-phases %standard-phases
1109 'unpack 'chdir-to-src
1110 (lambda _ (chdir "src")))
1114 (call-with-output-file "Makefile.inc"
1128 CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
1129 LDFLAGS = -lz -lm -lrt -lpthread
1131 LEX = flex -Pscotchyy -olex.yy.c
1136 YACC = bison -pscotchyy -y -b y
1138 '("COMMON_FILE_COMPRESS_GZ"
1140 "COMMON_RANDOM_FIXED_SEED"
1141 ;; Prevents symbolc clashes with libesmumps
1143 ;; XXX: Causes invalid frees in superlu-dist tests
1145 ;; "SCOTCH_PTHREAD_NUMBER=2"
1146 "restrict=__restrict"))))))
1148 'build 'build-esmumps
1150 (zero? (system* "make"
1151 (format #f "-j~a" (parallel-job-count))
1155 (lambda* (#:key outputs #:allow-other-keys)
1156 (let ((out (assoc-ref outputs "out")))
1158 (zero? (system* "make"
1159 (string-append "prefix=" out)
1161 ;; esmumps files are not installed with the above
1162 (for-each (lambda (f)
1163 (copy-file f (string-append out "/include/" f)))
1164 (find-files "../include" ".*esmumps.h$"))
1165 (for-each (lambda (f)
1166 (copy-file f (string-append out "/lib/" f)))
1167 (find-files "../lib" "^lib.*esmumps.*"))))))))
1168 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
1169 (synopsis "Programs and libraries for graph algorithms")
1170 (description "SCOTCH is a set of programs and libraries which implement
1171 the static mapping and sparse matrix reordering algorithms developed within
1172 the SCOTCH project. Its purpose is to apply graph theory, with a divide and
1173 conquer approach, to scientific computing problems such as graph and mesh
1174 partitioning, static mapping, and sparse matrix ordering, in application
1175 domains ranging from structural mechanics to operating systems or
1177 ;; See LICENSE_en.txt
1178 (license license:cecill-c)))
1180 (define-public pt-scotch
1181 (package (inherit scotch)
1184 `(("openmpi" ,openmpi))) ;Headers include MPI headers
1186 (substitute-keyword-arguments (package-arguments scotch)
1187 ((#:phases scotch-phases)
1188 `(modify-phases ,scotch-phases
1193 (zero? (system* "make"
1194 (format #f "-j~a" (parallel-job-count))
1195 "ptscotch" "ptesmumps"))
1196 ;; Install the serial metis compatibility library
1197 (zero? (system* "make" "-C" "libscotchmetis" "install")))))
1200 (lambda _ (zero? (system* "make" "ptcheck"))))))))
1201 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
1203 (define-public metis
1210 (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
1211 "metis-" version ".tar.gz"))
1214 "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
1215 (build-system cmake-build-system)
1217 `(("blas" ,openblas)))
1219 `(#:tests? #f ;no tests
1220 #:configure-flags `("-DSHARED=ON"
1221 ,(string-append "-DGKLIB_PATH=" (getcwd)
1222 "/metis-" ,version "/GKlib"))))
1223 (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
1224 (synopsis "Graph partitioning and fill-reducing matrix ordering library")
1226 "METIS is a set of serial programs for partitioning graphs, partitioning
1227 finite element meshes, and producing fill-reducing orderings for sparse
1228 matrices. The algorithms implemented in METIS are based on the multilevel
1229 recursive-bisection, multilevel k-way, and multi-constraint partitioning
1231 (license license:asl2.0))) ;As of version 5.0.3
1233 (define-public p4est
1240 (uri (string-append "http://p4est.github.io/release/p4est-"
1244 "0faina2h5qsx3m2izbzaj9bbakma1krbbjmq43wrp1hcbyijflqb"))))
1245 (build-system gnu-build-system)
1247 `(("fortran" ,gfortran)
1252 `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
1253 (assoc-ref %build-inputs "blas")
1255 ,(string-append "LAPACK_LIBS=-L"
1256 (assoc-ref %build-inputs "lapack")
1258 (home-page "http://www.p4est.org")
1259 (synopsis "Adaptive mesh refinement on forests of octrees")
1261 "The p4est software library enables the dynamic management of a
1262 collection of adaptive octrees, conveniently called a forest of octrees.
1263 p4est is designed to work in parallel and scales to hundreds of thousands of
1265 (license license:gpl2+)))
1267 (define-public p4est-openmpi
1268 (package (inherit p4est)
1269 (name "p4est-openmpi")
1272 ,@(package-inputs p4est)))
1274 (substitute-keyword-arguments (package-arguments p4est)
1275 ((#:configure-flags cf)
1276 ``("--enable-mpi" ,@,cf))))
1277 (synopsis "Parallel adaptive mesh refinement on forests of octrees")))
1279 (define-public gsegrafix
1286 (uri (string-append "mirror://gnu/" name "/" name "-"
1290 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
1291 (build-system gnu-build-system)
1293 `(#:configure-flags '("LDFLAGS=-lm")))
1295 `(("libgnomecanvas" ,libgnomecanvas)
1296 ("libbonoboui" ,libbonoboui)
1297 ("libgnomeui" ,libgnomeui)
1298 ("libgnomeprintui" ,libgnomeprintui)
1301 `(("pkg-config" ,pkg-config)))
1302 (home-page "http://www.gnu.org/software/gsegrafix/")
1303 (synopsis "GNOME application to create scientific and engineering plots")
1304 (description "GSEGrafix is an application which produces high-quality graphical
1305 plots for science and engineering. Plots are specified via simple ASCII
1306 parameter files and data files and are presented in an anti-aliased GNOME
1307 canvas. The program supports rectangular two-dimensional plots, histograms,
1308 polar-axis plots and three-dimensional plots. Plots can be printed or saved
1309 to BMP, JPEG or PNG image formats.")
1310 (license license:gpl3+)))
1312 (define-public maxima
1319 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
1320 version "-source/" name "-" version ".tar.gz"))
1323 "0x1rk659sn3cq0n5c90848ilzr1gb1wf0072fl6jhkdq00qgh2s0"))
1324 (patches (list (search-patch "maxima-defsystem-mkdir.patch")))))
1325 (build-system gnu-build-system)
1328 ("gnuplot" ,gnuplot) ;for plots
1329 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
1331 `(("texinfo" ,texinfo)
1335 (list "--enable-gcl"
1336 (string-append "--with-posix-shell="
1337 (assoc-ref %build-inputs "bash")
1339 (string-append "--with-wish="
1340 (assoc-ref %build-inputs "tk")
1342 (let ((v ,(package-version tk)))
1343 (string-take v (string-index-right v #\.)))))
1344 ;; By default Maxima attempts to write temporary files to
1345 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
1346 ;; Work around that.
1347 #:make-flags (list "TMPDIR=/tmp")
1348 #:phases (alist-cons-before
1351 (chmod "src/maxima" #o555))
1352 ;; Make sure the doc and emacs files are found in the
1353 ;; standard location. Also configure maxima to find gnuplot
1354 ;; without having it on the PATH.
1356 'install 'post-install
1357 (lambda* (#:key outputs inputs #:allow-other-keys)
1358 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
1359 (out (assoc-ref outputs "out"))
1360 (datadir (string-append out "/share/maxima/" ,version)))
1361 (with-directory-excursion out
1362 (mkdir-p "share/emacs")
1363 (mkdir-p "share/doc")
1365 (string-append datadir "/emacs/")
1366 (string-append out "/share/emacs/site-lisp"))
1368 (string-append datadir "/doc/")
1369 (string-append out "/share/doc/maxima"))
1370 (with-atomic-file-replacement
1371 (string-append datadir "/share/maxima-init.lisp")
1373 (format out "~a ~s~a~%"
1374 "(setf $gnuplot_command "
1375 (string-append gnuplot "/bin/gnuplot") ")")
1376 (dump-port in out))))))
1377 %standard-phases))))
1378 (home-page "http://maxima.sourceforge.net")
1379 (synopsis "Numeric and symbolic expression manipulation")
1380 (description "Maxima is a system for the manipulation of symbolic and
1381 numerical expressions. It yields high precision numeric results by using
1382 exact fractions, arbitrary precision integers, and variable precision floating
1384 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
1385 ;; Others simply say "GNU General Public License" without stating a
1386 ;; version (which implicitly means gpl1+).
1387 ;; At least one file (src/maxima.asd) says "version 2."
1388 ;; GPLv2 only is therefore the smallest subset.
1389 (license license:gpl2)))
1391 (define-public wxmaxima
1398 (uri (string-append "mirror://sourceforge/wxmaxima/wxMaxima/"
1399 version "/" name "-" version ".tar.gz"))
1402 "1fm47ah4aw5qdjqhkz67w5fwhy8yfffa5z896crp0d3hk2bh4180"))))
1403 (build-system gnu-build-system)
1405 `(("wxwidgets" ,wxwidgets)
1406 ("maxima" ,maxima)))
1408 `(#:phases (modify-phases %standard-phases
1410 'install 'wrap-program
1411 (lambda* (#:key inputs outputs #:allow-other-keys)
1412 (wrap-program (string-append (assoc-ref outputs "out")
1415 (,(string-append (assoc-ref inputs "maxima")
1418 (home-page "https://andrejv.github.io/wxmaxima/")
1419 (synopsis "Graphical user interface for the Maxima computer algebra system")
1421 "wxMaxima is a graphical user interface for the Maxima computer algebra
1422 system. It eases the use of Maxima by making most of its commands available
1423 through a menu system and by providing input dialogs for commands that require
1424 more than one argument. It also implements its own display engine that
1425 outputs mathematical symbols directly instead of depicting them with ASCII
1428 wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
1429 text and mathematical calculations to create documents, exporting of input and
1430 output to TeX, and a browser for Maxima's manual including command index and
1431 full text searching.")
1432 (license license:gpl2+)))
1434 (define-public armadillo
1440 (uri (string-append "mirror://sourceforge/arma/armadillo-"
1444 "0bsgrmldlx77w5x26n3axj1hg6iw6csyw0dwl1flrbdwl51f9701"))))
1445 (build-system cmake-build-system)
1446 (arguments `(#:tests? #f)) ;no test target
1448 `(("openblas" ,openblas)
1450 ("arpack" ,arpack-ng)))
1451 (home-page "http://arma.sourceforge.net/")
1452 (synopsis "C++ linear algebra library")
1454 "Armadillo is a C++ linear algebra library, aiming towards a good balance
1455 between speed and ease of use. It is useful for algorithm development
1456 directly in C++, or quick conversion of research code into production
1457 environments. It can be used for machine learning, pattern recognition,
1458 signal processing, bioinformatics, statistics, econometrics, etc. The library
1459 provides efficient classes for vectors, matrices and cubes, as well as 150+
1460 associated functions (eg. contiguous and non-contiguous submatrix views).")
1461 (license license:mpl2.0)))
1463 (define-public armadillo-for-rcpparmadillo
1464 (package (inherit armadillo)
1468 (uri (string-append "mirror://sourceforge/arma/armadillo-"
1472 "1f69rlqhnf2wv8khyn2a8vi6gx1i72qgfy8b9b760ssk85dcl763"))))))
1474 (define-public muparser
1482 (url "http://muparser.googlecode.com/svn/trunk/")
1486 "1d6bdbhx9zj3srwj3m7c9hvr18gnx1fx43h6d25my7q85gicpcwn"))))
1487 (build-system gnu-build-system)
1489 `(#:configure-flags '("--enable-samples=no")
1490 #:tests? #f)) ;no "check" target
1491 (home-page "http://muparser.beltoforion.de/")
1492 (synopsis "Fast parser library for mathematical expressions")
1494 "muParser is an extensible high performance math parser library. It is
1495 based on transforming an expression into a bytecode and precalculating
1496 constant parts of it.")
1497 (license license:expat)))
1499 (define-public openblas
1506 (uri (string-append "https://github.com/xianyi/OpenBLAS/tarball/v"
1508 (file-name (string-append name "-" version ".tar.gz"))
1511 "1k5f6vjlk54qlplk5m7xkbaw6g2y7dl50lwwdv6xsbcsgsbxfcpy"))))
1512 (build-system gnu-build-system)
1514 `(#:tests? #f ;no "check" target
1515 ;; DYNAMIC_ARCH is only supported on x86. When it is disabled and no
1516 ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
1517 ;; we need to disable substitutions.
1519 ,(let ((system (or (%current-target-system) (%current-system))))
1520 (or (string-prefix? "x86_64" system)
1521 (string-prefix? "i686" system)
1522 (string-prefix? "mips" system)))
1524 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1527 ;; Build the library for all supported CPUs. This allows
1528 ;; switching CPU targets at runtime with the environment variable
1529 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
1530 ;; Unfortunately, this is not supported on non-x86 architectures,
1531 ;; where it leads to failed builds.
1532 ,@(let ((system (or (%current-target-system) (%current-system))))
1534 ((or (string-prefix? "x86_64" system)
1535 (string-prefix? "i686" system))
1536 '("DYNAMIC_ARCH=1"))
1537 ;; On MIPS we force the "SICORTEX" TARGET, as for the other
1538 ;; two available MIPS targets special extended instructions
1539 ;; for Loongson cores are used.
1540 ((string-prefix? "mips" system)
1541 '("TARGET=SICORTEX"))
1543 ;; no configure script
1544 #:phases (alist-delete 'configure %standard-phases)))
1546 `(("fortran" ,gfortran)))
1550 (home-page "http://www.openblas.net/")
1551 (synopsis "Optimized BLAS library based on GotoBLAS")
1553 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
1554 (license license:bsd-3)))
1556 (define-public openlibm
1563 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
1565 (file-name (string-append name "-" version ".tar.gz"))
1568 "0cwqqqlblj3kzp9aq1wnpfs1fl0qd1wp1xzm5shb09w06i4rh9nn"))))
1569 (build-system gnu-build-system)
1572 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1574 ;; no configure script
1575 (alist-delete 'configure %standard-phases)
1576 #:tests? #f)) ;the tests are part of the default target
1577 (home-page "http://openlibm.org/")
1578 (synopsis "Portable C mathematical library (libm)")
1580 "OpenLibm is an effort to have a high quality, portable, standalone C
1581 mathematical library (libm). It can be used standalone in applications and
1582 programming language implementations. The project was born out of a need to
1583 have a good libm for the Julia programming language that worked consistently
1584 across compilers and operating systems, and in 32-bit and 64-bit
1586 ;; See LICENSE.md for details.
1587 (license (list license:expat
1590 license:public-domain
1591 license:lgpl2.1+))))
1593 (define-public openspecfun
1595 (name "openspecfun")
1600 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
1602 (file-name (string-append name "-" version ".tar.gz"))
1605 "0nsa3jjmlhcqkw5ba5ypbn3n0c8b6lc22zzlxnmxkxi9shhdx65z"))))
1606 (build-system gnu-build-system)
1608 '(#:tests? #f ;no "check" target
1610 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1611 ;; no configure script
1612 #:phases (alist-delete 'configure %standard-phases)))
1614 `(("fortran" ,gfortran)))
1615 (home-page "https://github.com/JuliaLang/openspecfun")
1616 (synopsis "Collection of special mathematical functions")
1618 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
1619 portable package for Bessel Functions of a Complex Argument and Nonnegative
1620 Order; it contains subroutines for computing Bessel functions and Airy
1621 functions. Faddeeva allows computing the various error functions of arbitrary
1622 complex arguments (Faddeeva function, error function, complementary error
1623 function, scaled complementary error function, imaginary error function, and
1624 Dawson function); given these, one can also easily compute Voigt functions,
1625 Fresnel integrals, and similar related functions as well.")
1626 ;; Faddeeva is released under the Expat license; AMOS is included as
1627 ;; public domain software.
1628 (license (list license:expat license:public-domain))))
1630 (define-public suitesparse
1632 (name "suitesparse")
1638 "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-"
1642 "100hdzr0mf4mzlwnqpmwpfw4pymgsf9n3g0ywb1yps2nk1zbkdy5"))))
1643 (build-system gnu-build-system)
1645 '(#:parallel-build? #f ;cholmod build fails otherwise
1646 #:tests? #f ;no "check" target
1651 "CHOLMOD_CONFIG=-DNPARTITION" ;required when METIS is not used
1652 (string-append "INSTALL_LIB="
1653 (assoc-ref %outputs "out") "/lib")
1654 (string-append "INSTALL_INCLUDE="
1655 (assoc-ref %outputs "out") "/include"))
1658 'install 'prepare-out
1659 ;; README.txt states that the target directories must exist prior to
1660 ;; running "make install".
1662 (mkdir-p (string-append (assoc-ref %outputs "out") "/lib"))
1663 (mkdir-p (string-append (assoc-ref %outputs "out") "/include")))
1664 ;; no configure script
1665 (alist-delete 'configure %standard-phases))))
1668 ("lapack" ,lapack)))
1669 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
1670 (synopsis "Suite of sparse matrix software")
1672 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
1673 multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
1674 multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
1675 simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
1676 CXSparse, a concise sparse Cholesky factorization package; and many other
1679 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
1681 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
1682 (license (list license:gpl2+ license:lgpl2.1+))))
1684 (define-public atlas
1690 (uri (string-append "mirror://sourceforge/math-atlas/atlas"
1691 version ".tar.bz2"))
1694 "0bqh4bdnjdyww4mcpg6kn0x7338mfqbdgysn97dzrwwb26di7ars"))))
1695 (build-system gnu-build-system)
1696 (home-page "http://math-atlas.sourceforge.net/")
1697 (inputs `(("gfortran" ,gfortran)
1698 ("lapack-tar" ,(package-source lapack))))
1699 (outputs '("out" "doc"))
1700 ;; For the moment we drop support for MIPS at it fails to compile. See
1701 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
1702 (supported-systems (delete "mips64el-linux" %supported-systems))
1704 `(#:parallel-build? #f
1705 #:parallel-tests? #f
1707 ;; ATLAS tunes itself for the machine it is built on, as explained at
1708 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
1709 ;; For this reason, we want users to build it locally instead of using
1713 #:modules ((srfi srfi-26)
1715 (guix build gnu-build-system)
1718 `(;; Generate position independent code suitable for dynamic libraries
1719 ;; and use WALL timer to get more accurate timing.
1720 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
1723 ,,(if (string-match "64" (%current-system))
1726 ;; Disable parallel build as it gives errors: atlas_pthread.h is
1727 ;; needed to compile C files before it is generated.
1728 "-Ss" "pmake" "make -j 1"
1729 ;; Probe is failing for MIPS. We therefore define the system
1730 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
1731 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
1732 ,,@(if (string-prefix? "mips" (%current-system))
1733 (list "-A" "49" "-V" "1")
1735 ;; Generate shared libraries.
1737 ;; Build a full LAPACK library.
1738 ,(string-append "--with-netlib-lapack-tarfile="
1739 (assoc-ref %build-inputs "lapack-tar")))
1742 'install 'install-doc
1743 (lambda* (#:key outputs inputs #:allow-other-keys)
1744 (let ((doc (string-append (assoc-ref outputs "doc")
1745 "/share/doc/atlas")))
1747 (fold (lambda (file previous)
1748 (and previous (zero? (system* "cp" file doc))))
1749 #t (find-files "../ATLAS/doc" ".*"))))
1752 (lambda _ (zero? (system* "make" "ptcheck")))
1753 ;; Fix files required to run configure.
1755 'configure 'fix-/bin/sh
1757 ;; Use `sh', not `/bin/sh'.
1758 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
1761 ;; Fix /bin/sh in generated make files.
1763 'configure 'fix-/bin/sh-in-generated-files
1765 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
1768 ;; ATLAS configure program does not accepts the default flags
1769 ;; passed by the 'gnu-build-system'.
1772 (lambda* (#:key native-inputs inputs outputs
1773 (configure-flags '())
1774 #:allow-other-keys #:rest args)
1775 (let* ((prefix (assoc-ref outputs "out"))
1776 (bash (or (and=> (assoc-ref
1777 (or native-inputs inputs) "bash")
1778 (cut string-append <> "/bin/bash"))
1780 (flags `(,(string-append "--prefix=" prefix)
1782 (abs-srcdir (getcwd))
1783 (srcdir (string-append "../" (basename abs-srcdir))))
1784 (format #t "source directory: ~s (relative from build: ~s)~%"
1788 (format #t "build directory: ~s~%" (getcwd))
1789 (format #t "configure flags: ~s~%" flags)
1790 (zero? (apply system* bash
1791 (string-append srcdir "/configure")
1793 %standard-phases)))))))
1794 (synopsis "Automatically Tuned Linear Algebra Software")
1796 "ATLAS is an automatically tuned linear algebra software library
1797 providing C and Fortran77 interfaces to a portably efficient BLAS
1798 implementation, as well as a few routines from LAPACK.
1800 Optimization occurs at build time. For this reason, the library is built on
1801 the machine where it is installed, without resorting to pre-built substitutes.
1803 Before building the library, CPU throttling should be disabled. This can be
1804 done in the BIOS, or, on GNU/Linux, with the following commands:
1806 cpufreq-selector -g performance -c 0
1808 cpufreq-selector -g performance -c N-1
1810 where N is the number of cores of your CPU. Failure to do so will result in a
1811 library with poor performance.")
1812 (license license:bsd-3)))
1821 (uri (string-append "mirror://sourceforge/ogl-math/glm-"
1825 "1cnjmi033a16a95v6xfkr1bvfmkd26hzdjka8j1819hgn5b1nr8l"))))
1826 (build-system cmake-build-system)
1828 `(("unzip" ,unzip)))
1829 (home-page "http://glm.g-truc.net")
1830 (synopsis "OpenGL Mathematics library")
1831 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
1832 library for graphics software based on the OpenGL Shading Language (GLSL)
1834 (license license:expat)))
1836 (define-public lpsolve
1843 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
1844 "/lp_solve_" version "_source.tar.gz"))
1847 "176c7f023mb6b8bfmv4rfqnrlw88lsg422ca74zjh19i2h5s69sq"))
1848 (modules '((guix build utils)))
1850 '(substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
1852 ;; Pretend to be on a 64 bit platform to obtain a common directory
1853 ;; name for the build results on all architectures; nothing else
1854 ;; seems to depend on it.
1855 (("^PLATFORM=.*$") "PLATFORM=ux64\n")))))
1856 (build-system gnu-build-system)
1858 `(#:tests? #f ; no check target
1860 (modify-phases %standard-phases
1864 (with-directory-excursion "lpsolve55"
1865 (system* "bash" "ccc"))
1866 (with-directory-excursion "lp_solve"
1867 (system* "bash" "ccc"))
1870 (lambda* (#:key outputs #:allow-other-keys)
1871 (let* ((out (assoc-ref outputs "out"))
1872 (bin (string-append out "/bin"))
1873 (lib (string-append out "/lib"))
1874 ;; This is where LibreOffice expects to find the header
1875 ;; files, and where they are installed by Debian.
1876 (include (string-append out "/include/lpsolve")))
1878 (copy-file "lpsolve55/bin/ux64/liblpsolve55.a"
1879 (string-append lib "/liblpsolve55.a"))
1880 (copy-file "lpsolve55/bin/ux64/liblpsolve55.so"
1881 (string-append lib "/liblpsolve55.so"))
1882 (install-file "lp_solve/bin/ux64/lp_solve" bin)
1884 ;; Install a subset of the header files as on Debian
1885 ;; (plus lp_bit.h, which matches the regular expression).
1886 (for-each (lambda (name)
1887 (install-file name include))
1888 (find-files "." "lp_[HMSa-z].*\\.h$"))
1889 (with-directory-excursion "shared"
1890 (for-each (lambda (name)
1891 (install-file name include))
1892 (find-files "." "\\.h$")))
1894 (home-page "http://lpsolve.sourceforge.net/")
1895 (synopsis "Mixed integer linear programming (MILP) solver")
1897 "lp_solve is a mixed integer linear programming solver based on the
1898 revised simplex and the branch-and-bound methods.")
1899 (license license:lgpl2.1+)))
1901 (define-public dealii
1908 (uri (string-append "https://github.com/dealii/dealii/releases/"
1909 "download/v" version "/dealii-" version ".tar.gz"))
1912 "185jych0gdnpkjwxni7pd0dda149492zwq2457xdjg76bzj78mnp"))
1913 (patches (list (search-patch "dealii-p4est-interface.patch")))
1914 (modules '((guix build utils)))
1916 ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
1917 '(delete-file-recursively "bundled"))))
1918 (build-system cmake-build-system)
1926 ("arpack" ,arpack-ng)
1927 ("muparser" ,muparser)
1928 ("gfortran" ,gfortran)
1929 ("suitesparse" ,suitesparse))) ;for UMFPACK
1931 `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease
1932 #:configure-flags '("-DCOMPAT_FILES=OFF") ;Follow new directory structure
1933 #:phases (modify-phases %standard-phases
1935 'install 'hint-example-prefix
1936 ;; Set Cmake hints in examples so that they can find this
1937 ;; deal.II when configuring.
1938 (lambda* (#:key outputs #:allow-other-keys)
1939 (let* ((out (assoc-ref %outputs "out"))
1940 (exmpl (string-append out "/share/doc"
1941 "/dealii/examples")))
1942 (substitute* (find-files exmpl "CMakeLists.txt")
1943 (("([[:space:]]*HINTS.*)\n" _ line)
1944 (string-append line " $ENV{HOME}/.guix-profile "
1947 (home-page "https://www.dealii.org")
1948 (synopsis "Finite element library")
1950 "Deal.II is a C++ program library targeted at the computational solution
1951 of partial differential equations using adaptive finite elements. The main
1952 aim of deal.II is to enable rapid development of modern finite element codes,
1953 using among other aspects adaptive meshes and a wide array of tools often used
1954 in finite element programs.")
1955 (license license:lgpl2.1+)))
1957 (define-public dealii-openmpi
1958 (package (inherit dealii)
1959 (name "dealii-openmpi")
1962 ;;Supported only with MPI:
1963 ("p4est" ,p4est-openmpi)
1964 ("petsc" ,petsc-openmpi)
1965 ("slepc" ,slepc-openmpi)
1966 ("metis" ,metis) ;for MUMPS
1967 ("scalapack" ,scalapack) ;for MUMPS
1968 ("mumps" ,mumps-metis-openmpi) ;configure supports only metis orderings
1969 ("arpack" ,arpack-ng-openmpi)
1970 ,@(fold alist-delete (package-inputs dealii)
1971 '("p4est" "arpack"))))
1973 (substitute-keyword-arguments (package-arguments dealii)
1974 ((#:configure-flags cf)
1975 ``("-DMPI_C_COMPILER=mpicc"
1976 "-DMPI_CXX_COMPILER=mpicxx"
1977 "-DMPI_Fortran_COMPILER=mpifort"
1979 (synopsis "Finite element library (with MPI support)")))
1981 (define-public flann
1990 "http://www.cs.ubc.ca/research/flann/uploads/FLANN/flann-"
1991 version "-src.zip"))
1994 "022w8hph7bli5zbpnk3z1qh1c2sl5hm8fw2ccim651ynn0hr7fyz"))))
1995 (build-system cmake-build-system)
1997 `(("unzip" ,unzip)))
2001 ("python" ,python-2) ; print syntax
2002 ;; ("python2-numpy" ,python2-numpy) ; only required for the tests
2005 `(#:tests? #f)) ; The test data are downloaded from the Internet.
2006 (home-page "http://www.cs.ubc.ca/research/flann/")
2007 (synopsis "Library for approximate nearest neighbors computation")
2008 (description "FLANN is a library for performing fast approximate
2009 nearest neighbor searches in high dimensional spaces. It implements a
2010 collection of algorithms and a system for automatically choosing the best
2011 algorithm and optimum parameters depending on the dataset.
2013 FLANN is written in C++ and contains bindings for C, Octave and Python.")
2014 (license (license:non-copyleft "file://COPYING"
2015 "See COPYING in the distribution."))))
2017 (define-public wcalc
2026 "mirror://sourceforge/w-calc/wcalc-" version ".tar.bz2"))
2029 "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
2030 (build-system gnu-build-system)
2033 ("readline" ,readline)))
2034 (home-page "http://w-calc.sourceforge.net/index.php")
2035 (synopsis "Flexible command-line scientific calculator")
2036 (description "Wcalc is a very capable calculator. It has standard functions
2037 (sin, asin, and sinh for example, in either radians or degrees), many
2038 pre-defined constants (pi, e, c, etc.), support for using variables, \"active\"
2039 variables, a command history, hex/octal/binary input and output, unit
2040 conversions, embedded comments, and an expandable expression entry field. It
2041 evaluates expressions using the standard order of operations.")
2042 (license license:gpl2+)))
2050 (uri (string-append "mirror://sourceforge/xaos/xaos-"
2054 "15cd1cx1dyygw6g2nhjqq3bsfdj8sj8m4va9n75i0f3ryww3x7wq"))))
2055 (build-system gnu-build-system)
2056 (native-inputs `(("gettext" ,gnu-gettext)))
2057 (inputs `(("libx11" ,libx11)
2062 `(#:tests? #f ;no "check" target
2063 #:make-flags '("LOCALEDIR=$DATAROOTDIR/locale")))
2064 (synopsis "Real-time fractal zoomer")
2065 (description "GNU XaoS is a graphical program that generates fractal
2066 patterns and allows you to zoom in and out of them infinitely in a fluid,
2067 continuous manner. It also includes tutorials that help to explain how fractals
2068 are built. It can generate many different fractal types such as the Mandelbrot
2070 (home-page "http://www.gnu.org/software/xaos/")
2071 (license license:gpl2+)))