1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
4 ;;; Copyright © 2014, 2016, 2017 John Darrington <jmd@gnu.org>
5 ;;; Copyright © 2014, 2015, 2016, 2017 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, 2016, 2017 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, 2017 Efraim Flashner <efraim@flashner.co.il>
12 ;;; Copyright © 2015 Fabian Harfert <fhmgufs@web.de>
13 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
14 ;;; Copyright © 2016 Kei Kebreau <kkebreau@posteo.net>
15 ;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
16 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
17 ;;; Copyright © 2016 Thomas Danckaert <post@thomasdanckaert.be>
18 ;;; Copyright © 2017 Paul Garlick <pgarlick@tourbillion-technology.com>
19 ;;; Copyright © 2017 ng0 <contact.ng0@cryptolab.net>
20 ;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
21 ;;; Copyright © 2017 Theodoros Foradis <theodoros.for@openmailbox.org>
23 ;;; This file is part of GNU Guix.
25 ;;; GNU Guix is free software; you can redistribute it and/or modify it
26 ;;; under the terms of the GNU General Public License as published by
27 ;;; the Free Software Foundation; either version 3 of the License, or (at
28 ;;; your option) any later version.
30 ;;; GNU Guix is distributed in the hope that it will be useful, but
31 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
32 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 ;;; GNU General Public License for more details.
35 ;;; You should have received a copy of the GNU General Public License
36 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
38 (define-module (gnu packages maths)
39 #:use-module (ice-9 regex)
40 #:use-module (gnu packages)
41 #:use-module ((guix licenses) #:prefix license:)
42 #:use-module (guix packages)
43 #:use-module (guix download)
44 #:use-module (guix git-download)
45 #:use-module (guix utils)
46 #:use-module (guix build utils)
47 #:use-module (guix build-system cmake)
48 #:use-module (guix build-system gnu)
49 #:use-module (guix build-system ocaml)
50 #:use-module (guix build-system r)
51 #:use-module (gnu packages algebra)
52 #:use-module (gnu packages autotools)
53 #:use-module (gnu packages bison)
54 #:use-module (gnu packages boost)
55 #:use-module (gnu packages check)
56 #:use-module (gnu packages cmake)
57 #:use-module (gnu packages compression)
58 #:use-module (gnu packages curl)
59 #:use-module (gnu packages cyrus-sasl)
60 #:use-module (gnu packages documentation)
61 #:use-module (gnu packages elf)
62 #:use-module (gnu packages flex)
63 #:use-module (gnu packages fltk)
64 #:use-module (gnu packages fontutils)
65 #:use-module (gnu packages gettext)
66 #:use-module (gnu packages gcc)
67 #:use-module (gnu packages gd)
68 #:use-module (gnu packages ghostscript)
69 #:use-module (gnu packages graphviz)
70 #:use-module (gnu packages gtk)
71 #:use-module (gnu packages image)
72 #:use-module (gnu packages less)
73 #:use-module (gnu packages lisp)
74 #:use-module (gnu packages logging)
75 #:use-module (gnu packages lua)
76 #:use-module (gnu packages gnome)
77 #:use-module (gnu packages guile)
78 #:use-module (gnu packages xorg)
79 #:use-module (gnu packages gl)
80 #:use-module (gnu packages imagemagick)
81 #:use-module (gnu packages m4)
82 #:use-module (gnu packages mpi)
83 #:use-module (gnu packages multiprecision)
84 #:use-module (gnu packages netpbm)
85 #:use-module (gnu packages ocaml)
86 #:use-module (gnu packages pcre)
87 #:use-module (gnu packages popt)
88 #:use-module (gnu packages perl)
89 #:use-module (gnu packages pkg-config)
90 #:use-module (gnu packages python)
91 #:use-module (gnu packages readline)
92 #:use-module (gnu packages tbb)
93 #:use-module (gnu packages scheme)
94 #:use-module (gnu packages shells)
95 #:use-module (gnu packages tcl)
96 #:use-module (gnu packages texinfo)
97 #:use-module (gnu packages tex)
98 #:use-module (gnu packages tls)
99 #:use-module (gnu packages wxwidgets)
100 #:use-module (gnu packages xml)
101 #:use-module (srfi srfi-1))
109 (uri (string-append "mirror://gnu/" name "/" name "-" version ".tar.gz"))
111 "1q1887ryqdr9sn0522hc7p16kqwlxxyz5dkmma8ar2nxplhgll7q"))))
112 (build-system gnu-build-system)
113 (inputs `(("gtk+" ,gtk+)
114 ("libxml2" ,libxml2)))
115 (native-inputs `(("pkg-config" ,pkg-config)))
116 (synopsis "Natural deduction first-order logic interface")
117 (description "Aris is a program for performing logical proofs. It supports
118 propositional and predicate logic, as well as Boolean algebra and
119 arithmetical logic. In addition to its predefined inference and equivalence
120 rules, Aris also supports references to older proofs. Its use of standard
121 logical symbols and its natural deduction interface make it easy to use for
123 (license license:gpl3+)
124 (home-page "https://www.gnu.org/software/aris/")))
126 (define-public c-graph
132 (uri (string-append "mirror://gnu/c-graph/c-graph-" version
135 "1hlvpzrh7hzzf533diyfiabzskddi8zx92av9hwkjw3l46z7qv01"))))
136 (build-system gnu-build-system)
138 `(("fortran" ,gfortran)))
139 (synopsis "Visualizing and demonstrating convolution")
141 "GNU C-Graph is a tool for demonstrating the theory of convolution.
142 Thus, it can serve as an excellent aid to students of signal and systems
143 theory in visualizing the convolution process. Rather than forcing the
144 student to write code, the program offers an intuitive interface with
145 interactive dialogs to guide them.")
146 (license license:gpl3+)
147 (home-page "https://www.gnu.org/software/c-graph/")))
156 (uri (string-append "https://github.com/stcorp/coda/releases/download/"
157 version "/coda-" version ".tar.gz"))
159 (base32 "01fnqcby9jijvf3jxr1fk4bny059lvvq5wbqm7ns60ilykfdnm6a"))
160 (patches (search-patches "coda-use-system-libs.patch"))
161 (modules '((guix build utils)))
163 ;; Make sure we don't use the bundled software.
164 '(for-each (lambda (d)
165 (delete-file-recursively (string-append "libcoda/" d)))
166 '("zlib" "pcre" "expat")))))
168 `(("fortran" ,gfortran)
170 ("python-numpy" ,python-numpy)))
177 (build-system gnu-build-system)
179 '(#:configure-flags '("--with-hdf4" "--with-hdf5" "--enable-python"
180 "LIBS= -lz -lpcre -lexpat")))
181 (synopsis "A common interface to various earth observation data formats")
183 "The Common Data Access toolbox (CODA) provides a set of interfaces for
184 reading remote sensing data from earth observation data files. It consists of
185 command line applications and interfaces to the C, Fortran, Python, and Java
186 programming languages.")
187 (home-page "https://stcorp.nl/coda")
188 (license license:gpl2+)))
196 (uri (string-append "mirror://gnu/units/units-" version
199 "1s421bxm36akjsy3qzg6da1d1g20gh094ac2slqxipgkh8yqjcwx"))))
200 (build-system gnu-build-system)
201 (synopsis "Conversion between thousands of scales")
203 "GNU Units converts numeric quantities between units of measure. It
204 can handle scale changes through adaptive usage of standard scale
205 prefixes (micro-, kilo-, etc.). It can also handle nonlinear
206 conversions such as Fahrenheit to Celsius. Its interpreter is powerful
207 enough to be used effectively as a scientific calculator.")
208 (license license:gpl3+)
209 (home-page "https://www.gnu.org/software/units/")))
211 (define-public double-conversion
213 (name "double-conversion")
218 "https://github.com/floitsch/double-conversion/archive/v"
220 (file-name (string-append name "-" version ".tar.gz"))
223 "0cnr8xhyjfxijay8ymkqcph3672wp2lj23qhdmr3m4kia5kpdf83"))))
224 (build-system cmake-build-system)
226 '(#:test-target "test"
227 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
228 "-DBUILD_TESTING=ON")))
229 (home-page "https://github.com/floitsch/double-conversion")
230 (synopsis "Conversion routines for IEEE doubles")
232 "The double-conversion library provides binary-decimal and decimal-binary
233 routines for IEEE doubles. The library consists of efficient conversion
234 routines that have been extracted from the V8 JavaScript engine.")
235 (license license:bsd-3)))
237 (define-public dionysus
243 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
247 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
248 (build-system gnu-build-system)
249 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
250 (synopsis "Local search for universal constants and scientific values")
252 "GNU Dionysus is a convenient system for quickly retrieving the values of
253 mathematical constants used in science and engineering. Values can be
254 searched using a simple command-line tool, choosing from three databases:
255 universal constants, atomic numbers, and constants related to
257 (license license:gpl3+)
258 (home-page "https://www.gnu.org/software/dionysus/")))
266 (uri (string-append "mirror://gnu/gsl/gsl-"
270 "16yfs5n444s03np1naj6yp1fsysd42kdscxzkg0k2yvfjixx0ijd"))
271 (patches (search-patches "gsl-test-i686.patch"))))
272 (build-system gnu-build-system)
274 `(;; Currently there are numerous tests that fail on "exotic"
275 ;; architectures such as aarch64 and ppc64le.
276 ,@(if (string-prefix? "aarch64-linux"
277 (or (%current-target-system) (%current-system)))
280 (home-page "https://www.gnu.org/software/gsl/")
281 (synopsis "Numerical library for C and C++")
283 "The GNU Scientific Library is a library for numerical analysis in C
284 and C++. It includes a wide range of mathematical routines, with over 1000
285 functions in total. Subject areas covered by the library include:
286 differential equations, linear algebra, Fast Fourier Transforms and random
288 (license license:gpl3+)))
290 (define-public ocaml-gsl
299 "https://github.com/mmottl/gsl-ocaml/releases/download/v"
300 version"/gsl-ocaml-" version ".tar.gz"))
303 "0nzp43hp8pbjqkrxnwp5lgjrabxayf61h18fjaydi0s5faq6f3xh"))))
304 (build-system ocaml-build-system)
307 (home-page "https://mmottl.github.io/gsl-ocaml")
308 (synopsis "Bindings to the GNU Scientific Library")
310 "GSL-OCaml is an interface to the @dfn{GNU scientific library} (GSL) for
311 the OCaml language.")
312 (license license:gpl3+)))
314 (define-public ocaml4.01-gsl
315 (package-with-ocaml4.01 ocaml-gsl))
324 (uri (string-append "mirror://gnu/glpk/glpk-"
328 "1xp7nclmp8inp20968bvvfcwmz3mz03sbm0v3yjz8aqwlpqjfkci"))))
329 (build-system gnu-build-system)
333 `(#:configure-flags '("--with-gmp")))
334 (home-page "https://www.gnu.org/software/glpk/")
335 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
337 "GLPK is a C library for solving large-scale linear programming (LP),
338 mixed integer programming (MIP), and other related problems. It supports the
339 GNU MathProg modeling language, a subset of the AMPL language, and features a
340 translator for the language. In addition to the C library, a stand-alone
341 LP/MIP solver is included in the package.")
342 (license license:gpl3+)))
351 (uri (string-append "http://www.4ti2.de/version_" version
352 "/4ti2-" version ".tar.gz"))
355 "1frix3rnm9ffr93alqzw4cavxbfpf524l8rfbmcpyhwd3n1km0yl"))))
356 (build-system gnu-build-system)
358 `(("which" ,(@ (gnu packages base) which)))) ; for the tests
362 (home-page "http://www.4ti2.de/")
363 (synopsis "Mathematical tool suite for problems on linear spaces")
365 "4ti2 implements algorithms for solving algebraic, geometric and
366 combinatorial problems on linear spaces. Among others, it solves systems
367 of linear equations, computes extreme rays of polyhedral cones, solves
368 integer programming problems and computes Markov bases for statistics.")
369 (license license:gpl2+)))
371 (define-public cddlib
378 (uri (string-append "ftp://ftp.math.ethz.ch/users/fukudak/cdd/cddlib-"
379 (string-delete #\. version) ".tar.gz"))
382 "1dasasscwfg793q8fwzgwf64xwj7w62yfvszpr8x8g38jka08vgy"))))
383 (build-system gnu-build-system)
386 (home-page "https://www.inf.ethz.ch/personal/fukudak/cdd_home/index.html")
387 (synopsis "Library for convex hulls and extreme rays of polyhedra")
389 "The C-library cddlib implements the Double Description Method of
390 Motzkin et al. for generating all vertices (i.e. extreme points) and extreme
391 rays of a general convex polyhedron given by a system of linear inequalities
392 in arbitrary dimension. It can also be used for the converse operation of
393 computing convex hulls.")
394 (license license:gpl2+)))
396 (define-public arpack-ng
403 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
405 (file-name (string-append name "-" version ".tar.gz"))
408 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
409 (build-system gnu-build-system)
410 (home-page "https://github.com/opencollab/arpack-ng")
413 ("fortran" ,gfortran)))
414 (synopsis "Fortran subroutines for solving eigenvalue problems")
416 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
417 large scale eigenvalue problems.")
418 (license (license:non-copyleft "file://COPYING"
419 "See COPYING in the distribution."))))
421 (define-public arpack-ng-openmpi
422 (package (inherit arpack-ng)
423 (name "arpack-ng-openmpi")
426 ,@(package-inputs arpack-ng)))
427 (arguments `(#:configure-flags '("--enable-mpi")))
428 (synopsis "Fortran subroutines for solving eigenvalue problems with MPI")))
430 (define-public lapack
437 (uri (string-append "http://www.netlib.org/lapack/lapack-"
441 "1j51r7n5w4k7r3lrvy7710xrpkg40wf4rqnmngfz6ck9ypckzign"))))
442 (build-system cmake-build-system)
443 (home-page "http://www.netlib.org/lapack/")
444 (inputs `(("fortran" ,gfortran)
445 ("python" ,python-2)))
447 `(#:configure-flags (list
448 ;; Install to PREFIX/lib (the default is
450 (string-append "-DCMAKE_INSTALL_LIBDIR="
451 (assoc-ref %outputs "out")
454 "-DBUILD_SHARED_LIBS:BOOL=YES"
457 ;; Build the 'LAPACKE_clatms' functions.
458 "-DLAPACKE_WITH_TMG=ON")
459 #:phases (alist-cons-before
461 (lambda* (#:key inputs #:allow-other-keys)
462 (let ((python (assoc-ref inputs "python")))
463 (substitute* "lapack_testing.py"
464 (("/usr/bin/env python") python))))
466 (synopsis "Library for numerical linear algebra")
468 "LAPACK is a Fortran 90 library for solving the most commonly occurring
469 problems in numerical linear algebra.")
470 (license (license:non-copyleft "file://LICENSE"
471 "See LICENSE in the distribution."))))
473 (define-public scalapack
480 (uri (string-append "http://www.netlib.org/scalapack/scalapack-"
484 "0p1r61ss1fq0bs8ynnx7xq4wwsdvs32ljvwjnx6yxr8gd6pawx0c"))))
485 (build-system cmake-build-system)
488 ("fortran" ,gfortran)
489 ("lapack" ,lapack))) ;for testing only
491 `(#:configure-flags `("-DBUILD_SHARED_LIBS:BOOL=YES")))
492 (home-page "http://www.netlib.org/scalapack/")
493 (synopsis "Library for scalable numerical linear algebra")
495 "ScaLAPACK is a Fortran 90 library of high-performance linear algebra
496 routines on parallel distributed memory machines. ScaLAPACK solves dense and
497 banded linear systems, least squares problems, eigenvalue problems, and
498 singular value problems.")
499 (license (license:bsd-style "file://LICENSE"
500 "See LICENSE in the distribution."))))
502 (define-public gnuplot
508 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
513 "0q5lr6nala3ln6f3yp6g17ziymb9r9gx9zylnw1y3hjmwl9lggjv"))))
514 (build-system gnu-build-system)
515 (inputs `(("readline" ,readline)
521 `(("pkg-config" ,pkg-config)
522 ("texlive" ,texlive-tiny)))
523 (home-page "http://www.gnuplot.info")
524 (synopsis "Command-line driven graphing utility")
525 (description "Gnuplot is a portable command-line driven graphing
526 utility. It was originally created to allow scientists and students to
527 visualize mathematical functions and data interactively, but has grown to
528 support many non-interactive uses such as web scripting. It is also used as a
529 plotting engine by third-party applications like Octave.")
530 ;; X11 Style with the additional restriction that derived works may only be
531 ;; distributed as patches to the original.
532 (license (license:fsf-free
533 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
542 (uri (string-append "https://github.com/OkoSanto/GCTP/archive/v"
544 (file-name (string-append name "-" version ".tar.gz"))
547 "0l9aqnqynh9laicn5dxf3rsb1n14xiks79wbyqccirzmjqd1c1x4"))))
549 `(("fortran" ,gfortran)))
550 (build-system gnu-build-system)
551 (synopsis "General Cartographic Transformation Package (GCTP)")
553 "The General Cartographic Transformation Package (GCTP) is a system of
554 software routines designed to permit the transformation of coordinate pairs
555 from one map projection to another. The GCTP is the standard computer
556 software used by the National Mapping Division for map projection
558 (home-page "https://github.com/OkoSanto/GCTP")
559 (license license:public-domain))) ;https://www2.usgs.gov/laws/info_policies.html
568 (uri (string-append "https://support.hdfgroup.org/ftp/HDF/releases/HDF"
569 version "/src/hdf-" version ".tar.bz2"))
571 (base32 "1wz0586zh91pqb95wvr0pbh71a8rz358fdj6n2ksp85x2cis9lsm"))
572 (patches (search-patches "hdf4-architectures.patch"
573 "hdf4-reproducibility.patch"
574 "hdf4-shared-fortran.patch"))))
575 (build-system gnu-build-system)
577 `(("gfortran" ,gfortran)
582 ("libjpeg" ,libjpeg)))
584 `(#:parallel-tests? #f
585 #:configure-flags '("--enable-shared")
587 (modify-phases %standard-phases
588 ;; This is inspired by two of Debian's patches.
589 (add-before 'configure 'add-more-aarch64-support
591 (substitute* '("mfhdf/ncgen/ncgen.l"
592 "mfhdf/ncgen/ncgenyy.c"
593 "mfhdf/libsrc/netcdf.h.in")
594 (("AIX5L64") "__aarch64__"))
596 (add-before 'configure 'patchbuild
599 '("mfhdf/hdfimport/testutil.sh.in" "hdf/util/testutil.sh.in")
601 (("/bin/mkdir") "mkdir"))
602 (substitute* (find-files "." "^Makefile\\.in$")
603 (("@HDF_BUILD_XDR_TRUE@XDR_ADD = \
604 -R\\$\\(abs_top_builddir\\)/mfhdf/xdr/\\.libs") "")
605 (("@HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = \
606 -R\\$\\(abs_top_builddir\\)/mfhdf/libsrc/\\.libs \
607 -R\\$\\(abs_top_builddir\\)/hdf/src/\\.libs \\$\\(XDR_ADD\\)") ""))
609 (add-after 'configure 'patch-settings
611 ;; libhdf4.settings contains the full path of the
612 ;; compilers used, and its contents are included in
613 ;; .so-files. We truncate the hashes to avoid
614 ;; unnecessary store references to those compilers:
615 (substitute* "libhdf4.settings"
616 (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
617 (string-append prefix (string-take hash 10) "...")))
620 (home-page "https://www.hdfgroup.org/products/hdf4/")
622 "Library and multi-object file format for storing and managing data")
623 (description "HDF4 is a library and multi-object file format for storing
624 and managing data between machines. HDF4 is an older hierarchical data format,
625 incompatible with HDF5.")
627 (license:non-copyleft
628 "https://www.hdfgroup.org/ftp/HDF/HDF_Current/src/unpacked/COPYING"))))
630 (define-public hdf4-alt
635 (substitute-keyword-arguments (package-arguments hdf4)
636 ((#:configure-flags flags) `(cons* "--disable-netcdf" ,flags))))
638 "HDF4 without netCDF API, can be combined with the regular netCDF library")))
647 (uri (list (string-append "https://support.hdfgroup.org/ftp/HDF5/releases/"
648 "hdf5-" (version-major+minor version)
649 "/hdf5-" version "/src/hdf5-"
651 (string-append "https://support.hdfgroup.org/ftp/HDF5/"
654 (take (string-split version #\.) 2))
655 "/src/hdf5-" version ".tar.bz2")))
657 (base32 "0f3jfbqpaaq21ighi40qzs52nb52kc2d2yjk541rjmsx20b3ih2r"))
658 (patches (list (search-patch "hdf5-config-date.patch")))))
659 (build-system gnu-build-system)
663 `(("gfortran" ,gfortran)))
664 (outputs '("out" ; core library
665 "fortran")) ; fortran interface
667 `(;; Some of the users, notably Flann, need the C++ interface.
668 #:configure-flags '("--enable-cxx"
670 "--enable-fortran2003")
673 (modify-phases %standard-phases
674 (add-before 'configure 'patch-configure
675 (lambda* (#:key outputs #:allow-other-keys)
676 (substitute* "configure"
678 (substitute* "fortran/src/Makefile.in"
679 (("libhdf5_fortran_la_LDFLAGS =")
680 (string-append "libhdf5_fortran_la_LDFLAGS = -Wl-rpath="
681 (assoc-ref outputs "fortran") "/lib")))
682 (substitute* "hl/fortran/src/Makefile.in"
683 (("libhdf5hl_fortran_la_LDFLAGS =")
684 (string-append "libhdf5hl_fortran_la_LDFLAGS = -Wl,-rpath="
685 (assoc-ref outputs "fortran") "/lib")))
687 (add-after 'configure 'patch-settings
689 ;; libhdf5.settings contains the full path of the
690 ;; compilers used, and its contents are included in
691 ;; libhdf5.so. We truncate the hashes to avoid
692 ;; unnecessary store references to those compilers:
693 (substitute* "src/libhdf5.settings"
694 (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
695 (string-append prefix (string-take hash 10) "...")))
697 (add-after 'install 'patch-references
698 (lambda* (#:key inputs outputs #:allow-other-keys)
699 (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
700 (zlib (assoc-ref inputs "zlib")))
701 (substitute* (find-files bin "h5p?cc")
703 (string-append "-L" zlib "/lib " lib)))
705 (add-after 'install 'split
706 (lambda* (#:key inputs outputs #:allow-other-keys)
707 ;; Move all fortran-related files
708 (let* ((out (assoc-ref outputs "out"))
709 (bin (string-append out "/bin"))
710 (lib (string-append out "/lib"))
711 (inc (string-append out "/include"))
712 (ex (string-append out "/share/hdf5_examples/fortran"))
713 (fort (assoc-ref outputs "fortran"))
714 (fbin (string-append fort "/bin"))
715 (flib (string-append fort "/lib"))
716 (finc (string-append fort "/include"))
717 (fex (string-append fort "/share/hdf5_examples/fortran")))
722 (rename-file (string-append bin "/h5fc")
723 (string-append fbin "/h5fc"))
724 (for-each (lambda (file)
726 (string-append flib "/" (basename file))))
727 (find-files lib ".*fortran.*"))
728 (for-each (lambda (file)
730 (string-append finc "/" (basename file))))
731 (find-files inc ".*mod"))
732 (for-each (lambda (file)
734 (string-append fex "/" (basename file))))
735 (find-files ex ".*"))
736 (delete-file-recursively ex))
738 (home-page "http://www.hdfgroup.org")
739 (synopsis "Management suite for extremely large and complex data")
740 (description "HDF5 is a suite that makes possible the management of
741 extremely large and complex data collections.")
742 (license (license:x11-style
743 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
745 (define-public hdf-eos2
752 (uri "ftp://edhs1.gsfc.nasa.gov\
753 /edhs/hdfeos/latest_release/HDF-EOS2.19v1.00.tar.Z")
755 (base32 "0c9fcz25s292ldap12wxmlrvnyz99z24p63d8fwx51bf8s0s1zrz"))
756 (patches (search-patches "hdf-eos2-remove-gctp.patch"
757 "hdf-eos2-build-shared.patch"
758 "hdf-eos2-fortrantests.patch"))))
759 (build-system gnu-build-system)
761 `(("gfortran" ,gfortran)))
763 `(("hdf4" ,hdf4-alt) ; assume most HDF-EOS2 users won't use the HDF4 netCDF API
768 `( #:configure-flags '("--enable-install-include" "--enable-shared"
769 "CC=h4cc -Df2cFortran" "LIBS=-lgctp")
770 #:parallel-tests? #f))
771 (home-page "http://hdfeos.org/software/library.php#HDF-EOS2")
772 (synopsis "HDF4-based data format for NASA's Earth Observing System")
773 (description "HDF-EOS2 is a software library built on HDF4 which supports
774 the construction of data structures used in NASA's Earth Observing
775 System (Grid, Point and Swath).")
777 ;; Source files carry a permissive license header.
778 (license (license:non-copyleft home-page))))
780 (define-public hdf-eos5
786 (uri (string-append "ftp://edhs1.gsfc.nasa.gov\
787 /edhs/hdfeos5/latest_release/HDF-EOS5." version ".tar.Z"))
790 "1p83333nzzy8rn5chxlm0hrkjjnhh2w1ji8ac0f9q4xzg838i58i"))
791 (patches (search-patches "hdf-eos5-build-shared.patch"
792 "hdf-eos5-remove-gctp.patch"
793 "hdf-eos5-fix-szip.patch"
794 "hdf-eos5-fortrantests.patch"))))
796 `(("gfortran" ,gfortran)))
797 (build-system gnu-build-system)
803 `(#:configure-flags '("--enable-install-include" "--enable-shared"
804 "CC=h5cc -Df2cFortran" "LIBS=-lgctp")
805 #:parallel-tests? #f))
806 (synopsis "HDF5-based data format for NASA's Earth Observing System")
808 "HDF-EOS5 is a software library built on HDF5 to support the construction
809 of data structures used in NASA's Earth Observing System (Grid, Point and
811 (home-page "http://www.hdfeos.org/software/library.php#HDF-EOS5")
813 ;; Source files carry a permissive license header.
814 (license (license:non-copyleft home-page))))
816 (define-public hdf5-parallel-openmpi
817 (package (inherit hdf5)
818 (name "hdf5-parallel-openmpi")
821 ,@(package-inputs hdf5)))
823 (substitute-keyword-arguments `(#:configure-flags '("--enable-parallel")
824 ,@(package-arguments hdf5))
826 `(modify-phases ,phases
827 (add-before 'check 'patch-tests
829 ;; OpenMPI's mpirun will exit with non-zero status if it
830 ;; detects an "abnormal termination", i.e. any process not
831 ;; calling MPI_Finalize(). Since the test is explicitely
832 ;; avoiding MPI_Finalize so as not to have at_exit and thus
833 ;; H5C_flush_cache from being called, mpirun will always
834 ;; complain, so turn this test off.
835 (substitute* "testpar/Makefile"
836 (("(^TEST_PROG_PARA.*)t_pflush1(.*)" front back)
837 (string-append front back "\n")))
838 (substitute* "tools/h5diff/testph5diff.sh"
839 (("/bin/sh") (which "sh")))
841 (synopsis "Management suite for data with parallel IO support")))
843 (define-public h5check
850 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/tools/"
851 "h5check/src/h5check-" version ".tar.gz"))
854 "1gm76jbwhz9adbxgn14zx8cj33dmjdr2g5xcy0m9c2gakp8w59kj"))))
855 (build-system gnu-build-system)
856 (inputs `(("hdf5" ,hdf5))) ;h5cc for tests
857 (home-page "https://www.hdfgroup.org/products/hdf5_tools/h5check.html")
858 (synopsis "HDF5 format checker")
859 (description "@code{h5check} is a validation tool for verifying that an
860 HDF5 file is encoded according to the HDF File Format Specification.")
861 (license (license:x11-style "file://COPYING"))))
869 (uri (string-append "mirror://sourceforge/itpp/itpp/"
874 "14ddy2xnb6sgp4hiax9v5sv4pr4l4dd4ps76nfha3nrpr1ikhcqm"))))
875 (build-system cmake-build-system)
876 (arguments `(#:tests? #f)) ; Tests require googletest *sources*
877 (inputs `(("lapack" ,lapack)
879 ;; FIXME: Even though the fonts are available dvips complains:
880 ;; "Font cmmi10 not found; characters will be left blank."
882 `(("texlive" ,texlive-tiny)
883 ("ghostscript" ,ghostscript)
884 ("doxygen" ,doxygen)))
885 (home-page "http://itpp.sourceforge.net")
886 (synopsis "C++ library of maths, signal processing and communication classes")
887 (description "IT++ is a C++ library of mathematical, signal processing and
888 communication classes and functions. Its main use is in simulation of
889 communication systems and for performing research in the area of
890 communications. The kernel of the library consists of generic vector and
891 matrix classes, and a set of accompanying routines. Such a kernel makes IT++
892 similar to MATLAB, GNU Octave or SciPy.")
893 (license license:gpl3+)))
895 (define-public netcdf
902 (uri (string-append "ftp://ftp.unidata.ucar.edu/pub/netcdf/"
903 "netcdf-" version ".tar.gz"))
906 "1blc7ik5yin7i0ls2kag0a9xjk12m0dzx6v1x88az3ras3scci2d"))
907 (patches (search-patches "netcdf-date-time.patch"
908 "netcdf-tst_h_par.patch"))))
909 (build-system gnu-build-system)
913 ("graphviz" ,graphviz)))
918 ("libjpeg" ,libjpeg)))
920 `(#:configure-flags '("--enable-doxygen" "--enable-dot" "--enable-hdf4")
922 #:phases (modify-phases %standard-phases
923 (add-before 'configure 'fix-source-date
925 ;; As we ${SOURCE_DATE_EPOCH} evaluates to "1" in the build
926 ;; environment, `date -u -d ${SOURCE_DATE_EPOCH}` will evaluate
927 ;; to '1st hour of the current day', and therefore makes the
928 ;; package not reproducible.
929 (substitute* "./configure"
930 (("date -u -d \"\\$\\{SOURCE_DATE_EPOCH\\}\"")
933 (add-after 'configure 'patch-settings
935 ;; libnetcdf.settings contains the full filename of the compilers
936 ;; used to build the library. We truncate the hashes of those
937 ;; filenames to avoid unnecessary references to the corresponding
939 (substitute* "libnetcdf.settings"
940 (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
941 (string-append prefix (string-take hash 10) "...")))
944 #:parallel-tests? #f)) ;various race conditions
945 (home-page "http://www.unidata.ucar.edu/software/netcdf/")
946 (synopsis "Library for scientific data")
947 (description "NetCDF is an interface for scientific data access and a
948 software library that provides an implementation of the interface. The netCDF
949 library defines a machine-independent format for representing scientific data.
950 Together, the interface, library, and format support the creation, access, and
951 sharing of scientific data.")
952 (license (license:x11-style "file://COPYRIGHT"))))
954 (define-public netcdf-parallel-openmpi
955 (package (inherit netcdf)
956 (name "netcdf-parallel-openmpi")
959 ,@(alist-replace "hdf5" (list hdf5-parallel-openmpi)
960 (package-inputs netcdf))))
961 ;; TODO: Replace pkg-config references in nc-config with absolute references
963 (substitute-keyword-arguments (package-arguments netcdf)
964 ((#:configure-flags flags)
965 `(cons* "CC=mpicc" "CXX=mpicxx"
966 "--enable-parallel-tests"
967 ;; Shared libraries not supported with parallel IO.
968 "--disable-shared" "--with-pic"
971 (define-public netcdf-fortran
973 (name "netcdf-fortran")
978 "ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-fortran-"
982 "0xaxdcg1p83zmypwml3swsnr3ccn38inwldyr1l3wa4dbwbrblxj"))))
983 (build-system gnu-build-system)
985 `(#:parallel-tests? #f))
987 `(("netcdf" ,netcdf)))
989 `(("gfortran" ,gfortran)))
990 (synopsis "Fortran interface for the netCDF library")
991 (description (package-description netcdf))
992 (home-page (package-home-page netcdf))
993 (license (package-license netcdf))))
1001 (uri (string-append "http://ab-initio.mit.edu/nlopt/nlopt-"
1004 (base32 "12cfkkhcdf4zmb6h7y6qvvdvqjs2xf9sjpa3rl3bq76px4yn76c0"))))
1005 (build-system gnu-build-system)
1007 `(;; Shared libraries are not built by default. They are required to
1008 ;; build the Guile, Octave, and Python bindings.
1009 #:configure-flags '("--enable-shared")
1012 (modify-phases %standard-phases
1013 (add-before 'configure 'set-libnlopt-file-name
1014 (lambda* (#:key outputs #:allow-other-keys)
1015 ;; Make sure the Scheme module refers to the library by its
1016 ;; absolute file name (we cannot do that from a snippet
1017 ;; because the expansion of @libdir@ contains
1019 (let ((out (assoc-ref outputs "out")))
1020 (substitute* "swig/nlopt.scm.in"
1022 (string-append out "/lib/libnlopt")))
1024 (inputs `(("guile" ,guile-2.0)))
1025 (native-inputs `(("pkg-config" ,pkg-config)))
1026 (home-page "http://ab-initio.mit.edu/wiki/")
1027 (synopsis "Library for nonlinear optimization")
1028 (description "NLopt is a library for nonlinear optimization, providing a
1029 common interface for a number of different free optimization routines available
1030 online as well as original implementations of various other algorithms.")
1031 (license license:lgpl2.1+)))
1033 (define-public ipopt
1040 "http://www.coin-or.org/download/source/Ipopt/Ipopt-"
1044 "09bk2hqy2vgi4yi76xng9zxakddwqy3wij9nx7wf2vfbxxpazrsk"))
1045 (modules '((guix build utils)))
1047 ;; Make sure we don't use the bundled software.
1048 '(delete-file-recursively "ThirdParty"))))
1049 (build-system gnu-build-system)
1051 '(#:phases (modify-phases %standard-phases
1052 (add-after 'install 'add--L-flags-in-ipopt.pc
1053 (lambda* (#:key inputs outputs #:allow-other-keys)
1054 ;; The '.pc' file lists '-llapack -lblas' in "Libs";
1055 ;; move it to "Libs.private" where it belongs, and add a
1056 ;; '-L' flag for LAPACK.
1057 (let ((out (assoc-ref outputs "out"))
1058 (lapack (assoc-ref inputs "lapack")))
1059 (substitute* (string-append out "/lib/pkgconfig/"
1061 (("Libs: (.*)-llapack -lblas(.*)$" _ before after)
1062 (string-append "Libs: " before " " after "\n"
1063 "Libs.private: " before
1064 "-L" lapack "/lib -llapack -lblas "
1068 `(("gfortran" ,gfortran)))
1070 ;; TODO: Maybe add dependency on COIN-MUMPS, ASL, and HSL.
1071 `(("lapack" ,lapack))) ;for both libblas and liblapack
1072 (home-page "http://www.coin-or.org")
1073 (synopsis "Large-scale nonlinear optimizer")
1075 "The Interior Point Optimizer (IPOPT) is a software package for
1076 large-scale nonlinear optimization. It provides C++, C, and Fortran
1078 (license license:epl1.0)))
1080 (define-public ceres
1082 (name "ceres-solver")
1084 (home-page "http://ceres-solver.org/")
1087 (uri (string-append home-page "ceres-solver-"
1091 "0i7qkbf8g6pd8arxzldppga26ckv93y8zldsfz6wbd4n6b1nqrjd"))))
1092 (build-system cmake-build-system)
1094 ;; TODO: Build HTML user documentation and install separately.
1095 '(#:configure-flags '("-DBUILD_EXAMPLES=OFF"
1096 "-DBUILD_SHARED_LIBS=ON")
1098 #:phases (modify-phases %standard-phases
1099 (add-before 'configure 'set-library-directory
1101 ;; Install libraries to lib/, not lib64/.
1102 (substitute* "internal/ceres/CMakeLists.txt"
1103 (("set\\(LIB_SUFFIX \"64\"\\)")
1104 "set(LIB_SUFFIX \"\")"))
1107 `(("pkg-config" ,pkg-config)))
1109 `(("glog" ,glog))) ;for #include <glog/glog.h>
1114 ("suitesparse" ,suitesparse)
1115 ("gflags" ,gflags)))
1116 (synopsis "C++ library for solving large optimization problems")
1118 "Ceres Solver is a C++ library for modeling and solving large,
1119 complicated optimization problems. It is a feature rich, mature and
1120 performant library which has been used in production since 2010. Ceres Solver
1121 can solve two kinds of problems:
1123 @item non-linear least squares problems with bounds constraints;
1124 @item general unconstrained optimization problems.
1126 (license license:bsd-3)))
1128 ;; For a fully featured Octave, users are strongly recommended also to install
1129 ;; the following packages: texinfo, less, ghostscript, gnuplot.
1130 (define-public octave
1137 (uri (string-append "mirror://gnu/octave/octave-"
1141 "09zhhch79jw3ynw39vizx0i2cbd2bjz3sp38pjdzraqrbivpwp92"))))
1142 (build-system gnu-build-system)
1144 `(("lapack" ,lapack)
1145 ("readline" ,readline)
1150 ("arpack" ,arpack-ng)
1153 ("fontconfig" ,fontconfig)
1154 ("freetype" ,freetype)
1161 ("graphicsmagick" ,graphicsmagick)))
1164 ("gfortran" ,gfortran)
1165 ("pkg-config" ,pkg-config)
1167 ;; The following inputs are not actually used in the build process.
1168 ;; However, the ./configure gratuitously tests for their existence and
1169 ;; assumes that programs not present at build time are also not, and
1170 ;; can never be, available at run time! If these inputs are therefore
1171 ;; not present, support for them will be built out. However, Octave
1172 ;; will still run without them, albeit without the features they
1175 ("texinfo" ,texinfo)
1176 ("ghostscript" ,ghostscript)
1177 ("gnuplot" ,gnuplot)))
1180 (list (string-append "--with-shell="
1181 (assoc-ref %build-inputs "bash")
1183 (home-page "https://www.gnu.org/software/octave/")
1184 (synopsis "High-level language for numerical computation")
1185 (description "GNU Octave is a high-level interpreted language that is
1186 specialized for numerical computations. It can be used for both linear and
1187 non-linear applications and it provides great support for visualizing results.
1188 Work may be performed both at the interactive command-line as well as via
1190 (license license:gpl3+)))
1192 (define-public opencascade-oce
1194 (name "opencascade-oce")
1200 "https://github.com/tpaviot/oce/archive/OCE-"
1205 "0vpmnb0k5y2f7lpmwx9pg9yfq24zjvnsak5alzacncfm1hv9b6cd"))))
1206 (build-system cmake-build-system)
1209 (list "-DOCE_TESTING:BOOL=ON"
1210 "-DOCE_USE_TCL_TEST_FRAMEWORK:BOOL=ON"
1211 "-DOCE_DRAW:BOOL=ON"
1212 (string-append "-DOCE_INSTALL_PREFIX:PATH="
1213 (assoc-ref %outputs "out"))
1214 "-UCMAKE_INSTALL_RPATH")))
1216 `(("freetype" ,freetype)
1223 `(("python" ,python-wrapper)))
1224 (home-page "https://github.com/tpaviot/oce")
1225 (synopsis "Libraries for 3D modeling and numerical simulation")
1227 "Open CASCADE is a set of libraries for the development of applications
1228 dealing with 3D CAD data or requiring industrial 3D capabilities. It includes
1229 C++ class libraries providing services for 3D surface and solid modeling, CAD
1230 data exchange, and visualization. It is used for development of specialized
1231 software dealing with 3D models in design (CAD), manufacturing (CAM),
1232 numerical simulation (CAE), measurement equipment (CMM), and quality
1233 control (CAQ) domains.
1235 This is the ``Community Edition'' (OCE) of Open CASCADE, which gathers
1236 patches, improvements, and experiments contributed by users over the official
1237 Open CASCADE library.")
1238 (license (list license:lgpl2.1; OCE libraries, with an exception for the
1239 ; use of header files; see
1240 ; OCCT_LGPL_EXCEPTION.txt
1241 license:public-domain; files
1242 ; src/Standard/Standard_StdAllocator.hxx and
1243 ; src/NCollection/NCollection_StdAllocator.hxx
1244 license:expat; file src/OpenGl/OpenGl_glext.h
1245 license:bsd-3)))); test framework gtest
1254 (uri (string-append "http://gmsh.info/src/gmsh-"
1255 version "-source.tgz"))
1257 (base32 "1slf0bfkwrcgn6296wb4qhbk4ahz6i4wfb10hnim08x05vrylag8"))
1258 (modules '((guix build utils)))
1260 ;; Remove non-free METIS code
1261 '(delete-file-recursively "contrib/Metis"))))
1262 (build-system cmake-build-system)
1265 ("gfortran" ,gfortran)
1271 ("opencascade-oce" ,opencascade-oce)
1273 ("libxext" ,libxext)))
1275 `(("fontconfig" ,fontconfig)
1276 ("libxft" ,libxft)))
1278 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
1279 "-DENABLE_BUILD_SHARED:BOOL=ON"
1280 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")))
1281 (home-page "http://www.geuz.org/gmsh/")
1282 (synopsis "3D finite element grid generator")
1283 (description "Gmsh is a 3D finite element grid generator with a built-in
1284 CAD engine and post-processor. Its design goal is to provide a fast, light
1285 and user-friendly meshing tool with parametric input and advanced
1286 visualization capabilities. Gmsh is built around four modules: geometry,
1287 mesh, solver and post-processing. The specification of any input to these
1288 modules is done either interactively using the graphical user interface or in
1289 ASCII text files using Gmsh's own scripting language.")
1290 (license license:gpl2+)))
1292 (define-public maxflow
1299 (url "https://github.com/gerddie/maxflow.git")
1300 (commit "42401fa54823d16b9da47716f04e5d9ef1605875")))
1301 (file-name (string-append name "-" version "-checkout"))
1304 "0rll38whw55h0vcjrrwdnh9ascvxby0ph7n1l0d12z17cg215kkb"))))
1305 (build-system cmake-build-system)
1306 (home-page "http://pub.ist.ac.at/~vnk/software.html")
1307 (synopsis "Library implementing Maxflow algorithm")
1308 (description "An implementation of the maxflow algorithm described in
1309 @cite{An Experimental Comparison of Min-Cut/Max-Flow Algorithms for
1310 Energy Minimization in Computer Vision.\n
1311 Yuri Boykov and Vladimir Kolmogorov.\n
1312 In IEEE Transactions on Pattern Analysis and Machine Intelligence,\n
1314 (license license:gpl3+)))
1316 (define-public petsc
1323 ;; The *-lite-* tarball does not contain the *large* documentation
1324 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
1325 "petsc-lite-" version ".tar.gz"))
1327 (base32 "1y3f5jjq0v5b62i3sabp4kp5mgfyp3vnk0dxhwkrhpypax77nzxh"))))
1328 (build-system gnu-build-system)
1330 `(("python" ,python-2)
1333 `(("gfortran" ,gfortran)
1335 ("superlu" ,superlu)
1336 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
1337 ;; leaving out opengl, as configuration seems to only be for mac
1340 `(#:test-target "test"
1341 #:parallel-build? #f ;build is parallel by default
1346 ,(string-append "--with-superlu-include="
1347 (assoc-ref %build-inputs "superlu") "/include")
1348 ,(string-append "--with-superlu-lib="
1349 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
1351 ;; Honor (parallel-job-count) for build. Do not use --with-make-np,
1352 ;; whose value is dumped to $out/lib/petsc/conf/petscvariables.
1353 (list (format #f "MAKE_NP=~a" (parallel-job-count)))
1355 (modify-phases %standard-phases
1357 ;; PETSc's configure script is actually a python script, so we can't
1358 ;; run it with bash.
1359 (lambda* (#:key outputs (configure-flags '())
1361 (let* ((prefix (assoc-ref outputs "out"))
1362 (flags `(,(string-append "--prefix=" prefix)
1363 ,@configure-flags)))
1364 (format #t "build directory: ~s~%" (getcwd))
1365 (format #t "configure flags: ~s~%" flags)
1366 (zero? (apply system* "./configure" flags)))))
1367 (add-after 'configure 'clean-local-references
1368 (lambda* (#:key outputs #:allow-other-keys)
1369 (let ((out (assoc-ref outputs "out")))
1370 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
1371 ;; Prevent build directory from leaking into compiled code
1373 ;; Scrub timestamp for reproducibility
1374 ((".*Libraries compiled on.*") ""))
1375 (substitute* (find-files "." "petscvariables")
1376 ;; Do not expose build machine characteristics, set to defaults.
1377 (("MAKE_NP = [:digit:]+") "MAKE_NP = 2")
1378 (("NPMAX = [:digit:]+") "NPMAX = 2"))
1380 (add-after 'install 'clean-install
1381 ;; Try to keep installed files from leaking build directory names.
1382 (lambda* (#:key inputs outputs #:allow-other-keys)
1383 (let ((out (assoc-ref outputs "out")))
1384 (substitute* (map (lambda (file)
1385 (string-append out "/lib/petsc/conf/" file))
1386 '("petscvariables"))
1388 ;; Make compiler references point to the store
1389 (substitute* (string-append out "/lib/petsc/conf/petscvariables")
1390 (("= (gcc|g\\+\\+|gfortran)" _ compiler)
1391 (string-append "= " (which compiler))))
1392 ;; PETSc installs some build logs, which aren't necessary.
1393 (for-each (lambda (file)
1394 (let ((f (string-append out "/lib/petsc/conf/" file)))
1395 (when (file-exists? f)
1397 '("configure.log" "make.log" "gmake.log"
1398 "test.log" "error.log" "RDict.db"
1399 "PETScBuildInternal.cmake"
1400 ;; Once installed, should uninstall with Guix
1403 (home-page "http://www.mcs.anl.gov/petsc")
1404 (synopsis "Library to solve PDEs")
1405 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
1406 data structures and routines for the scalable (parallel) solution of
1407 scientific applications modeled by partial differential equations.")
1408 (license (license:non-copyleft
1409 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
1411 (define-public petsc-complex
1412 (package (inherit petsc)
1413 (name "petsc-complex")
1415 (substitute-keyword-arguments (package-arguments petsc)
1416 ((#:configure-flags cf)
1417 `(cons "--with-scalar-type=complex" ,cf))))
1418 (synopsis "Library to solve PDEs (with complex scalars)")))
1420 (define-public petsc-openmpi
1421 (package (inherit petsc)
1422 (name "petsc-openmpi")
1424 `(("openmpi" ,openmpi)
1425 ,@(package-inputs petsc)))
1427 (substitute-keyword-arguments (package-arguments petsc)
1428 ((#:configure-flags cf)
1429 ``("--with-mpiexec=mpirun"
1430 ,(string-append "--with-mpi-dir="
1431 (assoc-ref %build-inputs "openmpi"))
1432 ,@(delete "--with-mpi=0" ,cf)))))
1433 (synopsis "Library to solve PDEs (with MPI support)")))
1435 (define-public petsc-complex-openmpi
1436 (package (inherit petsc-complex)
1437 (name "petsc-complex-openmpi")
1439 `(("openmpi" ,openmpi)
1440 ,@(package-inputs petsc-complex)))
1442 (substitute-keyword-arguments (package-arguments petsc-complex)
1443 ((#:configure-flags cf)
1444 ``("--with-mpiexec=mpirun"
1445 ,(string-append "--with-mpi-dir="
1446 (assoc-ref %build-inputs "openmpi"))
1447 ,@(delete "--with-mpi=0" ,cf)))))
1448 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
1450 (define-public slepc
1457 (uri (string-append "http://slepc.upv.es/download/distrib/slepc-"
1461 "12pbl8yd6r8k9xjlr1qw25rs0k1acgic7hw1s6l6bhiv9s285drg"))))
1462 (build-system gnu-build-system)
1464 `(("python" ,python-2)))
1466 `(("arpack" ,arpack-ng)
1467 ("gfortran" ,gfortran)))
1469 `(("petsc" ,petsc)))
1471 `(#:parallel-build? #f ;build is parallel by default
1473 `(,(string-append "--with-arpack-dir="
1474 (assoc-ref %build-inputs "arpack") "/lib"))
1475 #:make-flags ;honor (parallel-job-count)
1476 `(,(format #f "MAKE_NP=~a" (parallel-job-count)))
1478 (modify-phases %standard-phases
1480 ;; configure is a python script, so we can't run it with bash.
1481 (lambda* (#:key inputs outputs (configure-flags '())
1483 (let* ((prefix (assoc-ref outputs "out"))
1484 (flags `(,(string-append "--prefix=" prefix)
1485 ,@configure-flags)))
1486 (format #t "build directory: ~s~%" (getcwd))
1487 (format #t "configure flags: ~s~%" flags)
1488 (setenv "SLEPC_DIR" (getcwd))
1489 (setenv "PETSC_DIR" (assoc-ref inputs "petsc"))
1490 (zero? (apply system* "./configure" flags)))))
1491 (add-after 'install 'delete-doc
1492 ;; TODO: SLEPc installs HTML documentation alongside headers in
1493 ;; $out/include. We'd like to move them to share/doc, but delete
1494 ;; them for now, as they are incomplete and installing the complete
1495 ;; documentation is difficult.
1496 (lambda* (#:key outputs #:allow-other-keys)
1497 (let* ((out (assoc-ref outputs "out")))
1498 (for-each delete-file (find-files out "\\.html$")))))
1499 (add-after 'install 'clean-install
1500 ;; Clean up unnecessary build logs from installation.
1501 (lambda* (#:key outputs #:allow-other-keys)
1502 (let ((out (assoc-ref outputs "out")))
1503 (for-each (lambda (file)
1504 (let ((f (string-append out "/lib/slepc/conf/" file)))
1505 (when (file-exists? f)
1507 '("configure.log" "make.log" "gmake.log"
1508 "test.log" "error.log" "RDict.db"
1509 "uninstall.py"))))))))
1510 (home-page "http://slepc.upv.es")
1511 (synopsis "Scalable library for eigenproblems")
1512 (description "SLEPc is a software library for the solution of large sparse
1513 eigenproblems on parallel computers. It can be used for the solution of
1514 linear eigenvalue problems formulated in either standard or generalized form,
1515 as well as other related problems such as the singular value decomposition.
1516 The emphasis of the software is on methods and techniques appropriate for
1517 problems in which the associated matrices are sparse, for example, those
1518 arising after the discretization of partial differential equations.")
1519 (license license:lgpl3)))
1521 (define-public slepc-complex
1522 (package (inherit slepc)
1523 (name "slepc-complex")
1525 `(("petsc" ,petsc-complex)
1526 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
1527 (synopsis "Scalable library for eigenproblems (with complex scalars)")))
1529 (define-public slepc-openmpi
1530 (package (inherit slepc)
1531 (name "slepc-openmpi")
1534 ("arpack" ,arpack-ng-openmpi)
1535 ,@(alist-delete "arpack" (package-inputs slepc))))
1537 `(("petsc" ,petsc-openmpi)
1538 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
1539 (synopsis "Scalable library for eigenproblems (with MPI support)")))
1541 (define-public slepc-complex-openmpi
1542 (package (inherit slepc-openmpi)
1543 (name "slepc-complex-openmpi")
1545 `(("petsc" ,petsc-complex-openmpi)
1546 ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
1547 (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
1549 (define-public mumps
1556 (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
1560 "0igyc1pfzxdhpbad3v3lb86ixkdbqa1a8gbs15b04r2294h2nabp"))
1561 (patches (search-patches "mumps-build-parallelism.patch"))))
1562 (build-system gnu-build-system)
1564 `(("fortran" ,gfortran)
1565 ;; These are required for linking against mumps, but we let the user
1566 ;; declare the dependency.
1569 ("scotch" ,scotch)))
1571 `(#:modules ((ice-9 match)
1574 ,@%gnu-build-system-modules)
1576 (modify-phases %standard-phases
1578 (lambda* (#:key inputs #:allow-other-keys)
1579 (call-with-output-file "Makefile.inc"
1590 INCSEQ = -I$(topdir)/libseq
1591 LIBSEQ = -L$(topdir)/libseq -lmpiseq
1592 LIBSEQNEEDED = libseqneeded~;
1596 AR = ar vr # rules require trailing space, ugh...
1598 LIBBLAS = -L~a -lopenblas~@[
1599 SCALAP = -L~a -lscalapack~]
1600 LIBOTHERS = -pthread
1603 OPTF = -O2 -DALLOW_NON_INIT $(PIC)
1607 LIBS = $(SCALAP) $(LIBSEQ)
1608 LPORDDIR = $(topdir)/PORD/lib
1609 IPORD = -I$(topdir)/PORD/include
1610 LPORD = -L$(LPORDDIR) -lpord
1611 ORDERINGSF = -Dpord~@[
1613 IMETIS = -I$(METISDIR)/include
1614 LMETIS = -L$(METISDIR)/lib -lmetis
1615 ORDERINGSF += -Dmetis~]~@[~:{
1617 ISCOTCH = -I$(SCOTCHDIR)/include
1618 LSCOTCH = -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
1619 ORDERINGSF += ~a~}~]
1620 ORDERINGSC = $(ORDERINGSF)
1621 LORDERINGS = $(LPORD) $(LMETIS) $(LSCOTCH)
1622 IORDERINGSF = $(ISCOTCH)
1623 IORDERINGSC = $(IPORD) $(IMETIS) $(ISCOTCH)"
1624 (assoc-ref inputs "mpi")
1625 (assoc-ref inputs "blas")
1626 (assoc-ref inputs "scalapack")
1627 (assoc-ref inputs "metis")
1628 (match (list (assoc-ref inputs "pt-scotch")
1629 (assoc-ref inputs "scotch"))
1633 `((,scotch "" "-Dscotch")))
1636 "-lptesmumps -lptscotch -lptscotcherr "
1637 "-Dptscotch")))))))))
1639 ;; By default only the d-precision library is built. Make with "all"
1640 ;; target so that all precision libraries and examples are built.
1642 (zero? (system* "make" "all"
1643 (format #f "-j~a" (parallel-job-count))))))
1645 ;; Run the simple test drivers, which read test input from stdin:
1646 ;; from the "real" input for the single- and double-precision
1647 ;; testers, and from the "cmplx" input for complex-precision
1648 ;; testers. The EXEC-PREFIX key is used by the mumps-openmpi
1649 ;; package to prefix execution with "mpirun".
1650 (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
1651 (with-directory-excursion "examples"
1654 (let ((tester (apply open-pipe*
1657 ,(string-append "./" prec
1659 (input (open-input-file
1660 (string-append "input_simpletest_" type))))
1662 (dump-port input tester)
1664 (zero? (close-pipe tester)))))
1666 '("real" "real" "cmplx" "cmplx")))))
1668 (lambda* (#:key outputs #:allow-other-keys)
1669 (let* ((out (assoc-ref outputs "out"))
1670 (libdir (string-append out "/lib")))
1671 (copy-recursively "lib" libdir)
1672 (copy-recursively "include" (string-append out "/include"))
1673 (when (file-exists? "libseq/libmpiseq.a")
1674 (install-file "libseq/libmpiseq.a" libdir))
1676 (home-page "http://mumps.enseeiht.fr")
1677 (synopsis "Multifrontal sparse direct solver")
1679 "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
1680 sparse system of linear equations A x = b using Guassian elimination.")
1681 (license license:cecill-c)))
1683 (define-public mumps-metis
1684 (package (inherit mumps)
1685 (name "mumps-metis")
1687 (alist-delete "scotch" (package-inputs mumps)))))
1689 (define-public mumps-openmpi
1690 (package (inherit mumps)
1691 (name "mumps-openmpi")
1694 ("scalapack" ,scalapack)
1695 ("pt-scotch" ,pt-scotch)
1696 ,@(alist-delete "scotch" (package-inputs mumps))))
1698 (substitute-keyword-arguments (package-arguments mumps)
1700 `(modify-phases ,phases
1704 ((assoc-ref ,phases 'check)
1705 #:exec-prefix '("mpirun" "-n" "2"))))))))
1706 (synopsis "Multifrontal sparse direct solver (with MPI)")))
1708 (define-public mumps-metis-openmpi
1709 (package (inherit mumps-openmpi)
1710 (name "mumps-metis-openmpi")
1712 (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
1714 (define-public r-quadprog
1721 (uri (cran-uri "quadprog" version))
1724 "0jg3r6abmhp8r9vkbhpx9ldjfw6vyl1m4c5vwlyjhk1mi03656fr"))))
1725 (build-system r-build-system)
1727 `(("gfortran" ,gfortran)))
1728 (home-page "http://cran.r-project.org/web/packages/quadprog")
1729 (synopsis "Functions to solve quadratic programming problems")
1731 "This package contains routines and documentation for solving quadratic
1732 programming problems.")
1733 (license license:gpl3+)))
1735 (define-public r-pracma
1741 (uri (cran-uri "pracma" version))
1743 (base32 "0hxa0rbbp54j0c05qj7vfwhqfdmiz5ax8vhqxd09g33x7c0hqbc5"))))
1744 (build-system r-build-system)
1746 `(("r-quadprog" ,r-quadprog)))
1747 (home-page "http://cran.r-project.org/web/packages/pracma")
1748 (synopsis "Practical numerical math functions")
1749 (description "This package provides functions for numerical analysis and
1750 linear algebra, numerical optimization, differential equations, plus some
1751 special functions. It uses Matlab function names where appropriate to simplify
1753 (license license:gpl3+)))
1755 (define-public superlu
1762 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
1763 "superlu_" version ".tar.gz"))
1765 (base32 "0qzlb7cd608q62kyppd0a8c65l03vrwqql6gsm465rky23b6dyr8"))
1766 (modules '((guix build utils)))
1768 ;; Replace the non-free implementation of MC64 with a stub adapted
1771 (use-modules (ice-9 regex)
1773 (call-with-output-file "SRC/mc64ad.c"
1778 void mc64id_(int *a) {
1779 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
1782 void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
1783 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
1784 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
1787 ;; Remove the corresponding license verbiage. MC64 license follows
1788 ;; a "------" line separator.
1789 (with-atomic-file-replacement "License.txt"
1790 (let ((rx (make-regexp "-{8}")))
1793 (let ((line (read-line in 'concat)))
1794 (unless (regexp-exec rx line)
1797 (build-system cmake-build-system)
1801 `(("blas" ,openblas)
1802 ("gfortran" ,gfortran)))
1804 `(#:configure-flags '("-Denable_blaslib:BOOL=NO" ;do not use internal cblas
1805 "-DTPL_BLAS_LIBRARIES=openblas"
1806 "-DBUILD_SHARED_LIBS:BOOL=YES"
1807 "-DCMAKE_INSTALL_LIBDIR=lib")))
1808 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
1809 (synopsis "Supernodal direct solver for sparse linear systems")
1811 "SuperLU is a general purpose library for the direct solution of large,
1812 sparse, nonsymmetric systems of linear equations on high performance machines.
1813 The library is written in C and is callable from either C or Fortran. The
1814 library routines perform an LU decomposition with partial pivoting and
1815 triangular system solves through forward and back substitution. The library
1816 also provides threshold-based ILU factorization preconditioners.")
1817 (license (list license:bsd-3
1818 license:gpl2+ ;EXAMPLE/*fgmr.c
1819 (license:fsf-free "file://SRC/colamd.h")))))
1821 (define-public superlu-dist
1823 (name "superlu-dist")
1828 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
1829 "superlu_dist_" version ".tar.gz"))
1831 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
1832 (modules '((guix build utils)))
1834 ;; Replace the non-free implementation of MC64 with a stub
1836 (use-modules (ice-9 regex)
1838 (call-with-output-file "SRC/mc64ad.c"
1843 void mc64id_(int *a) {
1844 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
1847 void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
1848 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
1849 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
1852 (delete-file "SRC/mc64ad.f.bak")
1853 (substitute* "SRC/util.c" ;adjust default algorithm
1854 (("RowPerm[[:blank:]]*=[[:blank:]]*LargeDiag")
1855 "RowPerm = NOROWPERM"))))
1856 (patches (search-patches "superlu-dist-scotchmetis.patch"))))
1857 (build-system gnu-build-system)
1861 `(("gfortran" ,gfortran)))
1863 `(("openmpi" ,openmpi) ;headers include MPI heades
1864 ("lapack" ,lapack) ;required to link with output library
1865 ("pt-scotch" ,pt-scotch))) ;same
1867 `(#:parallel-build? #f ;race conditions using ar
1871 (lambda* (#:key inputs outputs #:allow-other-keys)
1872 (call-with-output-file "make.inc"
1877 DSUPERLULIB = ~a/lib/libsuperlu_dist.a
1878 BLASDEF = -DUSE_VENDOR_BLAS
1879 BLASLIB = -L~a/lib -lblas
1880 PARMETISLIB = -L~a/lib \
1881 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
1882 -lscotch -lscotcherr -lscotcherrexit
1883 METISLIB = -L~:*~a/lib \
1884 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
1885 LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
1891 CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
1892 NOOPTS = -O0 -g $(PIC)
1894 FFLAGS = -O2 -g $(PIC)
1898 (assoc-ref outputs "out")
1899 (assoc-ref inputs "lapack")
1900 (assoc-ref inputs "pt-scotch")))))
1902 'unpack 'remove-broken-symlinks
1904 (for-each delete-file
1905 (find-files "MAKE_INC" "\\.#make\\..*")))
1907 'build 'create-install-directories
1908 (lambda* (#:key outputs #:allow-other-keys)
1911 (mkdir-p (string-append (assoc-ref outputs "out")
1913 '("lib" "include")))
1917 (with-directory-excursion "EXAMPLE"
1919 (zero? (system* "mpirun" "-n" "2"
1920 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
1921 (zero? (system* "mpirun" "-n" "2"
1922 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
1925 (lambda* (#:key outputs #:allow-other-keys)
1926 ;; Library is placed in lib during the build phase. Copy over
1927 ;; headers to include.
1928 (let* ((out (assoc-ref outputs "out"))
1929 (incdir (string-append out "/include")))
1930 (for-each (lambda (file)
1931 (let ((base (basename file)))
1932 (format #t "installing `~a' to `~a'~%"
1935 (string-append incdir "/" base))))
1936 (find-files "SRC" ".*\\.h$"))))
1937 %standard-phases)))))))
1938 (home-page (package-home-page superlu))
1939 (synopsis "Parallel supernodal direct solver")
1941 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
1942 It is targeted for distributed memory parallel machines. SuperLU_DIST is
1943 implemented in ANSI C, and MPI for communications.")
1944 (license license:bsd-3)))
1946 (define-public scotch
1953 (uri (string-append "https://gforge.inria.fr/frs/download.php/34618/"
1954 "scotch_" version ".tar.gz"))
1956 (base32 "1ir088mvrqggyqdkx9qfynmiaffqbyih5qfl5mga2nrlm1qlsgzm"))
1957 (patches (search-patches "scotch-test-threading.patch"
1958 "pt-scotch-build-parallelism.patch"))))
1959 (build-system gnu-build-system)
1966 (modify-phases %standard-phases
1968 'unpack 'chdir-to-src
1969 (lambda _ (chdir "src")))
1973 (call-with-output-file "Makefile.inc"
1987 CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
1988 LDFLAGS = -lz -lm -lrt -lpthread
1990 LEX = flex -Pscotchyy -olex.yy.c
1995 YACC = bison -pscotchyy -y -b y
1997 '("COMMON_FILE_COMPRESS_GZ"
1999 "COMMON_RANDOM_FIXED_SEED"
2000 "INTSIZE64" ;use 'long' instead of 'int'
2001 ;; Prevents symbolc clashes with libesmumps
2003 ;; XXX: Causes invalid frees in superlu-dist tests
2005 ;; "SCOTCH_PTHREAD_NUMBER=2"
2006 "restrict=__restrict"))))))
2008 'build 'build-esmumps
2010 (zero? (system* "make"
2011 (format #f "-j~a" (parallel-job-count))
2015 (lambda* (#:key outputs #:allow-other-keys)
2016 (let ((out (assoc-ref outputs "out")))
2018 (zero? (system* "make"
2019 (string-append "prefix=" out)
2021 ;; esmumps files are not installed with the above
2022 (for-each (lambda (f)
2023 (copy-file f (string-append out "/include/" f)))
2024 (find-files "../include" ".*esmumps.h$"))
2025 (for-each (lambda (f)
2026 (copy-file f (string-append out "/lib/" f)))
2027 (find-files "../lib" "^lib.*esmumps.*"))))))))
2028 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
2029 (synopsis "Programs and libraries for graph algorithms")
2030 (description "SCOTCH is a set of programs and libraries which implement
2031 the static mapping and sparse matrix reordering algorithms developed within
2032 the SCOTCH project. Its purpose is to apply graph theory, with a divide and
2033 conquer approach, to scientific computing problems such as graph and mesh
2034 partitioning, static mapping, and sparse matrix ordering, in application
2035 domains ranging from structural mechanics to operating systems or
2037 ;; See LICENSE_en.txt
2038 (license license:cecill-c)))
2040 (define-public scotch32
2041 ;; This is the 'INTSIZE32' variant, which uses 32-bit integers, as needed by
2042 ;; some applications.
2043 (package (inherit scotch)
2046 (substitute-keyword-arguments (package-arguments scotch)
2047 ((#:phases scotch-phases)
2048 `(modify-phases ,scotch-phases
2052 (call-with-output-file "Makefile.inc"
2066 CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
2067 LDFLAGS = -lz -lm -lrt -lpthread
2069 LEX = flex -Pscotchyy -olex.yy.c
2074 YACC = bison -pscotchyy -y -b y
2076 '("COMMON_FILE_COMPRESS_GZ"
2078 "COMMON_RANDOM_FIXED_SEED"
2079 "INTSIZE32" ;use 32-bit integers. See INSTALL.txt
2080 ;; Prevents symbolc clashes with libesmumps
2082 ;; XXX: Causes invalid frees in superlu-dist tests
2084 ;; "SCOTCH_PTHREAD_NUMBER=2"
2085 "restrict=__restrict"))))))))))
2087 "Programs and libraries for graph algorithms (32-bit integers)")))
2089 (define-public pt-scotch
2090 (package (inherit scotch)
2093 `(("openmpi" ,openmpi))) ;Headers include MPI headers
2095 (substitute-keyword-arguments (package-arguments scotch)
2096 ((#:phases scotch-phases)
2097 `(modify-phases ,scotch-phases
2102 (zero? (system* "make"
2103 (format #f "-j~a" (parallel-job-count))
2104 "ptscotch" "ptesmumps"))
2105 ;; Install the serial metis compatibility library
2106 (zero? (system* "make" "-C" "libscotchmetis" "install")))))
2109 (lambda _ (zero? (system* "make" "ptcheck"))))))))
2110 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
2112 (define-public pt-scotch32
2113 (package (inherit scotch32)
2114 (name "pt-scotch32")
2116 `(("openmpi" ,openmpi))) ;headers include MPI headers
2118 (substitute-keyword-arguments (package-arguments scotch32)
2119 ((#:phases scotch32-phases)
2120 `(modify-phases ,scotch32-phases
2124 (zero? (system* "make"
2125 (format #f "-j~a" (parallel-job-count))
2126 "ptscotch" "ptesmumps"))
2127 ;; Install the serial metis compatibility library
2128 (zero? (system* "make" "-C" "libscotchmetis" "install")))))
2131 (zero? (system* "make" "ptcheck"))))))))
2133 "Programs and libraries for graph algorithms (with MPI and 32-bit integers)")))
2135 (define-public metis
2142 (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
2143 "metis-" version ".tar.gz"))
2146 "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
2147 (build-system cmake-build-system)
2149 `(("blas" ,openblas)))
2151 `(#:tests? #f ;no tests
2152 #:configure-flags `("-DSHARED=ON"
2153 ,(string-append "-DGKLIB_PATH=" (getcwd)
2154 "/metis-" ,version "/GKlib"))))
2155 (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
2156 (synopsis "Graph partitioning and fill-reducing matrix ordering library")
2158 "METIS is a set of serial programs for partitioning graphs, partitioning
2159 finite element meshes, and producing fill-reducing orderings for sparse
2160 matrices. The algorithms implemented in METIS are based on the multilevel
2161 recursive-bisection, multilevel k-way, and multi-constraint partitioning
2163 (license license:asl2.0))) ;As of version 5.0.3
2165 (define-public p4est
2172 (uri (string-append "http://p4est.github.io/release/p4est-"
2176 "0faina2h5qsx3m2izbzaj9bbakma1krbbjmq43wrp1hcbyijflqb"))))
2177 (build-system gnu-build-system)
2179 `(("fortran" ,gfortran)
2184 `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
2185 (assoc-ref %build-inputs "blas")
2187 ,(string-append "LAPACK_LIBS=-L"
2188 (assoc-ref %build-inputs "lapack")
2190 (home-page "http://www.p4est.org")
2191 (synopsis "Adaptive mesh refinement on forests of octrees")
2193 "The p4est software library enables the dynamic management of a
2194 collection of adaptive octrees, conveniently called a forest of octrees.
2195 p4est is designed to work in parallel and scales to hundreds of thousands of
2197 (license license:gpl2+)))
2199 (define-public p4est-openmpi
2200 (package (inherit p4est)
2201 (name "p4est-openmpi")
2204 ,@(package-inputs p4est)))
2206 (substitute-keyword-arguments (package-arguments p4est)
2207 ((#:configure-flags cf)
2208 ``("--enable-mpi" ,@,cf))))
2209 (synopsis "Parallel adaptive mesh refinement on forests of octrees")))
2211 (define-public gsegrafix
2218 (uri (string-append "mirror://gnu/" name "/" name "-"
2222 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
2223 (build-system gnu-build-system)
2225 `(#:configure-flags '("LDFLAGS=-lm")))
2227 `(("libgnomecanvas" ,libgnomecanvas)
2228 ("libbonoboui" ,libbonoboui)
2229 ("libgnomeui" ,libgnomeui)
2230 ("libgnomeprintui" ,libgnomeprintui)
2233 `(("pkg-config" ,pkg-config)))
2234 (home-page "https://www.gnu.org/software/gsegrafix/")
2235 (synopsis "GNOME application to create scientific and engineering plots")
2236 (description "GSEGrafix is an application which produces high-quality graphical
2237 plots for science and engineering. Plots are specified via simple ASCII
2238 parameter files and data files and are presented in an anti-aliased GNOME
2239 canvas. The program supports rectangular two-dimensional plots, histograms,
2240 polar-axis plots and three-dimensional plots. Plots can be printed or saved
2241 to BMP, JPEG or PNG image formats.")
2242 (license license:gpl3+)))
2244 (define-public maxima
2251 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
2252 version "-source/" name "-" version ".tar.gz"))
2255 "15pp35ayglv723bjbqc60gcdv2bm54s6pywsm4i4cwbjsf64dzkl"))
2256 (patches (search-patches "maxima-defsystem-mkdir.patch"))))
2257 (build-system gnu-build-system)
2260 ("gnuplot" ,gnuplot) ;for plots
2261 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
2263 `(("texinfo" ,texinfo)
2265 ("python" ,python)))
2268 (list "--enable-gcl"
2269 (string-append "--with-posix-shell="
2270 (assoc-ref %build-inputs "bash")
2272 (string-append "--with-wish="
2273 (assoc-ref %build-inputs "tk")
2275 (let ((v ,(package-version tk)))
2276 (string-take v (string-index-right v #\.)))))
2277 ;; By default Maxima attempts to write temporary files to
2278 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
2279 ;; Work around that.
2280 #:make-flags (list "TMPDIR=/tmp")
2282 (modify-phases %standard-phases
2283 (add-before 'check 'pre-check
2285 (chmod "src/maxima" #o555)
2287 ;; Make sure the doc and emacs files are found in the
2288 ;; standard location. Also configure maxima to find gnuplot
2289 ;; without having it on the PATH.
2290 (add-after 'install 'post-install
2291 (lambda* (#:key outputs inputs #:allow-other-keys)
2292 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
2293 (out (assoc-ref outputs "out"))
2294 (datadir (string-append out "/share/maxima/" ,version))
2295 (binutils (string-append (assoc-ref inputs "binutils")
2297 (with-directory-excursion out
2298 (mkdir-p "share/emacs")
2299 (mkdir-p "share/doc")
2301 (string-append datadir "/emacs/")
2302 (string-append out "/share/emacs/site-lisp"))
2304 (string-append datadir "/doc/")
2305 (string-append out "/share/doc/maxima"))
2306 (with-atomic-file-replacement
2307 (string-append datadir "/share/maxima-init.lisp")
2309 (format out "~a ~s~a~%"
2310 "(setf $gnuplot_command "
2311 (string-append gnuplot "/bin/gnuplot") ")")
2312 (dump-port in out))))
2313 ;; Ensure that Maxima will have access to the GNU binutils
2314 ;; components at runtime.
2315 (wrap-program (string-append out "/bin/maxima")
2316 `("PATH" prefix (,binutils))))
2318 (home-page "http://maxima.sourceforge.net")
2319 (synopsis "Numeric and symbolic expression manipulation")
2320 (description "Maxima is a system for the manipulation of symbolic and
2321 numerical expressions. It yields high precision numeric results by using
2322 exact fractions, arbitrary precision integers, and variable precision floating
2324 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
2325 ;; Others simply say "GNU General Public License" without stating a
2326 ;; version (which implicitly means gpl1+).
2327 ;; At least one file (src/maxima.asd) says "version 2."
2328 ;; GPLv2 only is therefore the smallest subset.
2329 (license license:gpl2)))
2331 (define-public wxmaxima
2338 (uri (string-append "https://github.com/andrejv/" name "/archive"
2339 "/Version-" version ".tar.gz"))
2340 (file-name (string-append name "-" version ".tar.gz"))
2343 "0dv0cy0cf46v0cbw32izscpkdmpxg1qhwq1f4cz46kkqd8k4yfbj"))))
2344 (build-system gnu-build-system)
2346 `(("autoconf" ,autoconf)
2347 ("automake" ,automake)
2348 ("gettext" ,gettext-minimal)))
2350 `(("wxwidgets" ,wxwidgets)
2353 ("adwaita-icon-theme" ,adwaita-icon-theme)
2355 ("shared-mime-info" ,shared-mime-info)))
2358 (modify-phases %standard-phases
2359 (add-after 'unpack 'autoconf
2361 (zero? (system* "sh" "bootstrap"))))
2362 (add-after 'install 'wrap-program
2363 (lambda* (#:key inputs outputs #:allow-other-keys)
2364 (wrap-program (string-append (assoc-ref outputs "out")
2367 (,(string-append (assoc-ref inputs "maxima")
2369 ;; For GtkFileChooserDialog.
2370 `("GSETTINGS_SCHEMA_DIR" =
2371 (,(string-append (assoc-ref inputs "gtk+")
2372 "/share/glib-2.0/schemas")))
2373 `("XDG_DATA_DIRS" ":" prefix
2374 (;; Needed by gdk-pixbuf to know supported icon formats.
2376 (assoc-ref inputs "shared-mime-info") "/share")
2377 ;; The default icon theme of GTK+.
2379 (assoc-ref inputs "adwaita-icon-theme") "/share"))))
2381 (home-page "https://andrejv.github.io/wxmaxima/")
2382 (synopsis "Graphical user interface for the Maxima computer algebra system")
2384 "wxMaxima is a graphical user interface for the Maxima computer algebra
2385 system. It eases the use of Maxima by making most of its commands available
2386 through a menu system and by providing input dialogs for commands that require
2387 more than one argument. It also implements its own display engine that
2388 outputs mathematical symbols directly instead of depicting them with ASCII
2391 wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
2392 text and mathematical calculations to create documents, exporting of input and
2393 output to TeX, and a browser for Maxima's manual including command index and
2394 full text searching.")
2395 (license license:gpl2+)))
2397 (define-public armadillo
2403 (uri (string-append "mirror://sourceforge/arma/armadillo-"
2407 "1qqzy7dp891j9v7062mv1599hdwr97vqzrd3j2fl8c3gmc00dmzg"))))
2408 (build-system cmake-build-system)
2409 (arguments `(#:tests? #f)) ;no test target
2411 `(("openblas" ,openblas)
2413 ("arpack" ,arpack-ng)))
2414 (home-page "http://arma.sourceforge.net/")
2415 (synopsis "C++ linear algebra library")
2417 "Armadillo is a C++ linear algebra library, aiming towards a good balance
2418 between speed and ease of use. It is useful for algorithm development
2419 directly in C++, or quick conversion of research code into production
2420 environments. It can be used for machine learning, pattern recognition,
2421 signal processing, bioinformatics, statistics, econometrics, etc. The library
2422 provides efficient classes for vectors, matrices and cubes, as well as 150+
2423 associated functions (eg. contiguous and non-contiguous submatrix views).")
2424 (license license:asl2.0)))
2426 (define-public muparser
2427 ;; When switching download sites, muparser re-issued a 2.2.5 release with a
2428 ;; different hash. In order to make `guix package --upgrade` work correctly,
2429 ;; we set a Guix packaging revision.
2430 ;; When the next version of muparser is released, we can remove
2431 ;; UPSTREAM-VERSION and REVISION and use the plain VERSION.
2432 (let ((upstream-version "2.2.5")
2436 (version (string-append upstream-version "-" revision))
2440 (uri (string-append "https://github.com/beltoforion/muparser/archive/v"
2441 upstream-version ".tar.gz"))
2442 (file-name (string-append name "-" version ".tar.gz"))
2445 "0277qsi5l23jsck1vhn383bmvc2n9l4a1dl5r9bf7hvjv9ayyrh6"))))
2446 (build-system gnu-build-system)
2448 `(#:configure-flags '("--enable-samples=no")
2449 #:tests? #f)) ;no "check" target
2450 (home-page "http://muparser.beltoforion.de/")
2451 (synopsis "Fast parser library for mathematical expressions")
2453 "muParser is an extensible high performance math parser library. It is
2454 based on transforming an expression into a bytecode and precalculating constant
2456 (license license:expat))))
2458 (define-public openblas
2465 (uri (string-append "https://github.com/xianyi/OpenBLAS/tarball/v"
2467 (file-name (string-append name "-" version ".tar.gz"))
2470 "071zqnmnxhh0c9phzyn3f198yxa0hjxda7016azdbq2056sm70w7"))))
2471 (build-system gnu-build-system)
2473 `(#:tests? #f ;no "check" target
2474 ;; DYNAMIC_ARCH is only supported on x86. When it is disabled and no
2475 ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
2476 ;; we need to disable substitutions.
2478 ,(let ((system (or (%current-target-system) (%current-system))))
2479 (or (string-prefix? "x86_64" system)
2480 (string-prefix? "i686" system)
2481 (string-prefix? "mips" system)
2482 (string-prefix? "aarch64" system)))
2484 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
2487 ;; Build the library for all supported CPUs. This allows
2488 ;; switching CPU targets at runtime with the environment variable
2489 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
2490 ;; Unfortunately, this is not supported on non-x86 architectures,
2491 ;; where it leads to failed builds.
2492 ,@(let ((system (or (%current-target-system) (%current-system))))
2494 ((or (string-prefix? "x86_64" system)
2495 (string-prefix? "i686" system))
2496 '("DYNAMIC_ARCH=1"))
2497 ;; On MIPS we force the "SICORTEX" TARGET, as for the other
2498 ;; two available MIPS targets special extended instructions
2499 ;; for Loongson cores are used.
2500 ((string-prefix? "mips" system)
2501 '("TARGET=SICORTEX"))
2502 ;; On aarch64 force the generic 'armv8-a' target
2503 ((string-prefix? "aarch64" system)
2506 ;; no configure script
2507 #:phases (alist-delete 'configure %standard-phases)))
2509 `(("fortran" ,gfortran)))
2513 (home-page "http://www.openblas.net/")
2514 (synopsis "Optimized BLAS library based on GotoBLAS")
2516 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
2517 (license license:bsd-3)))
2519 (define* (make-blis implementation #:optional substitutable?)
2520 "Return a BLIS package with the given IMPLEMENTATION (see config/ in the
2521 source tree for a list of implementations.)
2523 SUBSTITUTABLE? determines whether the package is made available as a
2526 Currently the specialization must be selected at configure-time, but work is
2527 underway to allow BLIS to select the right optimized kernels at run time:
2528 <https://github.com/flame/blis/issues/129>."
2530 (name (if (string=? implementation "reference")
2532 (string-append "blis-" implementation)))
2534 (home-page "https://github.com/flame/blis")
2537 (uri (git-reference (url home-page) (commit version)))
2540 "1wr79a50nm4abhw8w3sn96nmwp5mrzifcigk7khw9qcgyyyqayfh"))
2541 (file-name (git-file-name "blis" version))))
2542 (build-system gnu-build-system)
2544 `(#:test-target "test"
2546 #:substitutable? ,substitutable?
2548 #:phases (modify-phases %standard-phases
2550 (lambda* (#:key outputs #:allow-other-keys)
2551 ;; This is a home-made 'configure' script.
2552 (let ((out (assoc-ref outputs "out")))
2553 (zero? (system* "./configure" "-p" out
2557 "--enable-threading=openmp"
2559 ,implementation)))))
2560 (add-before 'check 'show-test-output
2562 ;; By default "make check" is silent. Make it verbose.
2563 (system "tail -F output.testsuite &")
2565 (synopsis "High-performance basic linear algebra (BLAS) routines")
2567 "BLIS is a portable software framework for instantiating high-performance
2568 BLAS-like dense linear algebra libraries. The framework was designed to
2569 isolate essential kernels of computation that, when optimized, immediately
2570 enable optimized implementations of most of its commonly used and
2571 computationally intensive operations. While BLIS exports a new BLAS-like API,
2572 it also includes a BLAS compatibility layer which gives application developers
2573 access to BLIS implementations via traditional BLAS routine calls.")
2574 (license license:bsd-3)))
2577 ;; This is the "reference" implementation, which is the non-optimized but
2578 ;; portable variant (no assembly).
2579 (make-blis "reference" #t))
2581 (define ignorance blis)
2583 (define-syntax-rule (blis/x86_64 processor)
2584 "Expand to a package specialized for PROCESSOR."
2586 (inherit (make-blis processor))
2587 (supported-systems '("x86_64-linux"))))
2589 (define-public blis-sandybridge
2590 ;; BLIS specialized for Sandy Bridge processors (launched 2011):
2591 ;; <http://ark.intel.com/products/codename/29900/Sandy-Bridge>.
2592 (blis/x86_64 "sandybridge"))
2594 (define-public blis-haswell
2595 ;; BLIS specialized for Haswell processors (launched 2013):
2596 ;; <http://ark.intel.com/products/codename/42174/Haswell>.
2597 (blis/x86_64 "haswell"))
2599 (define-public blis-knl
2600 ;; BLIS specialized for Knights Landing processor (launched 2016):
2601 ;; <http://ark.intel.com/products/series/92650/Intel-Xeon-Phi-x200-Product-Family>.
2602 (blis/x86_64 "knl"))
2605 (define-public openlibm
2612 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
2614 (file-name (string-append name "-" version ".tar.gz"))
2617 "11czx2z7nh6dfpz45s3xl7v38hw36jxzxfvny454bk3if14pfakq"))))
2618 (build-system gnu-build-system)
2621 (list (string-append "prefix=" (assoc-ref %outputs "out")))
2623 ;; no configure script
2624 (alist-delete 'configure %standard-phases)
2625 #:tests? #f)) ;the tests are part of the default target
2626 (home-page "http://openlibm.org/")
2627 (synopsis "Portable C mathematical library (libm)")
2629 "OpenLibm is an effort to have a high quality, portable, standalone C
2630 mathematical library (libm). It can be used standalone in applications and
2631 programming language implementations. The project was born out of a need to
2632 have a good libm for the Julia programming language that worked consistently
2633 across compilers and operating systems, and in 32-bit and 64-bit
2635 ;; Each architecture has its own make target, and there is none for mips.
2636 (supported-systems (delete "mips64el-linux" %supported-systems))
2637 ;; See LICENSE.md for details.
2638 (license (list license:expat
2641 license:public-domain
2642 license:lgpl2.1+))))
2644 (define-public openspecfun
2646 (name "openspecfun")
2651 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
2653 (file-name (string-append name "-" version ".tar.gz"))
2656 "1y5b2h6f2k72536kym3vzy3li3bhpd23x463g7hdmjdi3cncavz1"))))
2657 (build-system gnu-build-system)
2659 '(#:tests? #f ;no "check" target
2661 (list (string-append "prefix=" (assoc-ref %outputs "out")))
2662 ;; no configure script
2663 #:phases (alist-delete 'configure %standard-phases)))
2665 `(("fortran" ,gfortran)))
2666 (home-page "https://github.com/JuliaLang/openspecfun")
2667 (synopsis "Collection of special mathematical functions")
2669 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
2670 portable package for Bessel Functions of a Complex Argument and Nonnegative
2671 Order; it contains subroutines for computing Bessel functions and Airy
2672 functions. Faddeeva allows computing the various error functions of arbitrary
2673 complex arguments (Faddeeva function, error function, complementary error
2674 function, scaled complementary error function, imaginary error function, and
2675 Dawson function); given these, one can also easily compute Voigt functions,
2676 Fresnel integrals, and similar related functions as well.")
2677 ;; Faddeeva is released under the Expat license; AMOS is included as
2678 ;; public domain software.
2679 (license (list license:expat license:public-domain))))
2681 (define-public suitesparse
2683 (name "suitesparse")
2689 "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-"
2693 "1dnr6pmjzc2qmbkmb4shigx1l74ilf6abn7svyd6brxgvph8vadr"))
2694 (modules '((guix build utils)))
2696 ;; Remove bundled metis source
2697 '(delete-file-recursively "metis-5.1.0"))))
2698 (build-system gnu-build-system)
2700 '(#:tests? #f ;no "check" target
2705 "MY_METIS_LIB=-lmetis"
2706 (string-append "INSTALL_LIB="
2707 (assoc-ref %outputs "out") "/lib")
2708 (string-append "INSTALL_INCLUDE="
2709 (assoc-ref %outputs "out") "/include")
2712 (modify-phases %standard-phases
2713 (delete 'configure)))) ;no configure script
2718 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
2719 (synopsis "Suite of sparse matrix software")
2721 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
2722 multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
2723 multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
2724 simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
2725 CXSparse, a concise sparse Cholesky factorization package; and many other
2728 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
2730 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
2731 (license (list license:gpl2+ license:lgpl2.1+))))
2733 (define-public atlas
2739 (uri (string-append "mirror://sourceforge/math-atlas/Stable/"
2740 version "/atlas" version ".tar.bz2"))
2743 "1dyjlq3fiparvm8ypwk6rsmjzmnwk81l88gkishphpvc79ryp216"))))
2744 (build-system gnu-build-system)
2745 (home-page "http://math-atlas.sourceforge.net/")
2746 (inputs `(("gfortran" ,gfortran)
2747 ("lapack-tar" ,(package-source lapack))))
2748 (outputs '("out" "doc"))
2749 ;; For the moment we drop support for MIPS at it fails to compile. See
2750 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
2751 (supported-systems (delete "mips64el-linux" %supported-systems))
2753 `(#:parallel-build? #f
2754 #:parallel-tests? #f
2756 ;; ATLAS tunes itself for the machine it is built on, as explained at
2757 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
2758 ;; For this reason, we want users to build it locally instead of using
2762 #:modules ((srfi srfi-26)
2764 (guix build gnu-build-system)
2767 `(;; Generate position independent code suitable for dynamic libraries
2768 ;; and use WALL timer to get more accurate timing.
2769 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
2772 ,,(if (string-match "64" (%current-system))
2775 ;; Disable parallel build as it gives errors: atlas_pthread.h is
2776 ;; needed to compile C files before it is generated.
2777 "-Ss" "pmake" "make -j 1"
2778 ;; Probe is failing for MIPS. We therefore define the system
2779 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
2780 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
2781 ,,@(if (string-prefix? "mips" (%current-system))
2782 (list "-A" "49" "-V" "1")
2784 ;; Generate shared libraries.
2786 ;; Build a full LAPACK library.
2787 ,(string-append "--with-netlib-lapack-tarfile="
2788 (assoc-ref %build-inputs "lapack-tar")))
2790 (modify-phases %standard-phases
2791 (add-after 'install 'install-doc
2792 (lambda* (#:key outputs inputs #:allow-other-keys)
2793 (let ((doc (string-append (assoc-ref outputs "doc")
2794 "/share/doc/atlas")))
2796 (fold (lambda (file previous)
2797 (and previous (zero? (system* "cp" file doc))))
2798 #t (find-files "../ATLAS/doc" ".*")))))
2799 (add-after 'check 'check-pt
2800 (lambda _ (zero? (system* "make" "ptcheck"))))
2801 ;; Fix files required to run configure.
2802 (add-before 'configure 'fix-/bin/sh
2804 ;; Use `sh', not `/bin/sh'.
2805 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
2808 ;; Fix /bin/sh in generated make files.
2809 (add-after 'configure 'fix-/bin/sh-in-generated-files
2811 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
2814 ;; ATLAS configure program does not accepts the default flags
2815 ;; passed by the 'gnu-build-system'.
2817 (lambda* (#:key native-inputs inputs outputs
2818 (configure-flags '())
2819 #:allow-other-keys #:rest args)
2820 (let* ((prefix (assoc-ref outputs "out"))
2821 (bash (or (and=> (assoc-ref
2822 (or native-inputs inputs) "bash")
2823 (cut string-append <> "/bin/bash"))
2825 (flags `(,(string-append "--prefix=" prefix)
2827 (abs-srcdir (getcwd))
2828 (srcdir (string-append "../" (basename abs-srcdir))))
2829 (format #t "source directory: ~s (relative from build: ~s)~%"
2833 (format #t "build directory: ~s~%" (getcwd))
2834 (format #t "configure flags: ~s~%" flags)
2835 (zero? (apply system* bash
2836 (string-append srcdir "/configure")
2838 (synopsis "Automatically Tuned Linear Algebra Software")
2840 "ATLAS is an automatically tuned linear algebra software library
2841 providing C and Fortran77 interfaces to a portably efficient BLAS
2842 implementation, as well as a few routines from LAPACK.
2844 Optimization occurs at build time. For this reason, the library is built on
2845 the machine where it is installed, without resorting to pre-built substitutes.
2847 Before building the library, CPU throttling should be disabled. This can be
2848 done in the BIOS, or, on GNU/Linux, with the following command:
2851 # cpupower --governor performance
2854 Failure to do so will result in a library with poor performance.")
2855 (license license:bsd-3)))
2864 (uri (string-append "mirror://sourceforge/ogl-math/glm-" version
2865 "/glm-" version ".zip"))
2868 "1cnjmi033a16a95v6xfkr1bvfmkd26hzdjka8j1819hgn5b1nr8l"))))
2869 (build-system cmake-build-system)
2871 `(("unzip" ,unzip)))
2872 (home-page "http://glm.g-truc.net")
2873 (synopsis "OpenGL Mathematics library")
2874 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
2875 library for graphics software based on the OpenGL Shading Language (GLSL)
2877 (license license:expat)))
2879 (define-public lpsolve
2886 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
2887 "/lp_solve_" version "_source.tar.gz"))
2890 "176c7f023mb6b8bfmv4rfqnrlw88lsg422ca74zjh19i2h5s69sq"))
2891 (modules '((guix build utils)))
2893 '(substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
2895 ;; Pretend to be on a 64 bit platform to obtain a common directory
2896 ;; name for the build results on all architectures; nothing else
2897 ;; seems to depend on it.
2898 (("^PLATFORM=.*$") "PLATFORM=ux64\n")
2900 ;; The check for 'isnan' as it is written fails with
2901 ;; "non-floating-point argument in call to function
2902 ;; ‘__builtin_isnan’", which leads to the 'NOISNAN' cpp macro
2903 ;; definition, which in turn leads to bad things. Fix the feature
2905 (("isnan\\(0\\)") "isnan(0.)")))))
2906 (build-system gnu-build-system)
2908 `(#:tests? #f ; no check target
2910 (modify-phases %standard-phases
2914 (and (with-directory-excursion "lpsolve55"
2915 (zero? (system* "bash" "ccc")))
2916 (with-directory-excursion "lp_solve"
2917 (zero? (system* "bash" "ccc"))))))
2919 (lambda* (#:key outputs #:allow-other-keys)
2920 (let* ((out (assoc-ref outputs "out"))
2921 (bin (string-append out "/bin"))
2922 (lib (string-append out "/lib"))
2923 ;; This is where LibreOffice expects to find the header
2924 ;; files, and where they are installed by Debian.
2925 (include (string-append out "/include/lpsolve")))
2927 (copy-file "lpsolve55/bin/ux64/liblpsolve55.a"
2928 (string-append lib "/liblpsolve55.a"))
2929 (copy-file "lpsolve55/bin/ux64/liblpsolve55.so"
2930 (string-append lib "/liblpsolve55.so"))
2931 (install-file "lp_solve/bin/ux64/lp_solve" bin)
2933 ;; Install a subset of the header files as on Debian
2934 ;; (plus lp_bit.h, which matches the regular expression).
2935 (for-each (lambda (name)
2936 (install-file name include))
2937 (find-files "." "lp_[HMSa-z].*\\.h$"))
2938 (with-directory-excursion "shared"
2939 (for-each (lambda (name)
2940 (install-file name include))
2941 (find-files "." "\\.h$")))
2943 (home-page "http://lpsolve.sourceforge.net/")
2944 (synopsis "Mixed integer linear programming (MILP) solver")
2946 "lp_solve is a mixed integer linear programming solver based on the
2947 revised simplex and the branch-and-bound methods.")
2948 (license license:lgpl2.1+)))
2950 (define-public dealii
2957 (uri (string-append "https://github.com/dealii/dealii/releases/"
2958 "download/v" version "/dealii-" version ".tar.gz"))
2961 "0yfpy4zh8j7hmqakw17zdlmvfdcmhwgs66wcb716plc4y7v3z4g6"))
2962 (modules '((guix build utils)))
2964 ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
2965 '(delete-file-recursively "bundled"))))
2966 (build-system cmake-build-system)
2974 ("arpack" ,arpack-ng)
2975 ("muparser" ,muparser)
2976 ("gfortran" ,gfortran)
2977 ("suitesparse" ,suitesparse))) ;for UMFPACK
2979 `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease
2981 ;; Work around a bug in libsuitesparseconfig linking
2982 ;; see https://github.com/dealii/dealii/issues/4745
2983 '("-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON")))
2984 (home-page "https://www.dealii.org")
2985 (synopsis "Finite element library")
2987 "Deal.II is a C++ program library targeted at the computational solution
2988 of partial differential equations using adaptive finite elements. The main
2989 aim of deal.II is to enable rapid development of modern finite element codes,
2990 using among other aspects adaptive meshes and a wide array of tools often used
2991 in finite element programs.")
2992 (license license:lgpl2.1+)))
2994 (define-public dealii-openmpi
2995 (package (inherit dealii)
2996 (name "dealii-openmpi")
2999 ;;Supported only with MPI:
3000 ("p4est" ,p4est-openmpi)
3001 ("petsc" ,petsc-openmpi)
3002 ("slepc" ,slepc-openmpi)
3003 ("metis" ,metis) ;for MUMPS
3004 ("scalapack" ,scalapack) ;for MUMPS
3005 ("mumps" ,mumps-metis-openmpi) ;configure supports only metis orderings
3006 ("arpack" ,arpack-ng-openmpi)
3007 ,@(fold alist-delete (package-inputs dealii)
3008 '("p4est" "arpack"))))
3010 (substitute-keyword-arguments (package-arguments dealii)
3011 ((#:configure-flags cf)
3012 ``("-DMPI_C_COMPILER=mpicc"
3013 "-DMPI_CXX_COMPILER=mpicxx"
3014 "-DMPI_Fortran_COMPILER=mpifort"
3016 (synopsis "Finite element library (with MPI support)")))
3018 (define-public flann
3027 "http://www.cs.ubc.ca/research/flann/uploads/FLANN/flann-"
3028 version "-src.zip"))
3031 "022w8hph7bli5zbpnk3z1qh1c2sl5hm8fw2ccim651ynn0hr7fyz"))))
3032 (build-system cmake-build-system)
3034 "octave")) ;46 MiB .mex file that pulls Octave
3036 `(("unzip" ,unzip)))
3040 ("python" ,python-2) ; print syntax
3041 ;; ("python2-numpy" ,python2-numpy) ; only required for the tests
3044 `(;; The 'share/flann/octave' contains a .mex file, which is an ELF file
3045 ;; taken 46 MiB unstripped, and 6 MiB stripped.
3046 #:strip-directories '("lib" "lib64" "libexec"
3047 "bin" "sbin" "share/flann/octave")
3049 ;; Save 12 MiB by not installing .a files. Passing
3050 ;; '-DBUILD_STATIC_LIBS=OFF' has no effect.
3051 #:phases (modify-phases %standard-phases
3052 (add-before 'configure 'set-octave-directory
3053 (lambda* (#:key outputs #:allow-other-keys)
3054 ;; Install the .mex file in the "octave" output.
3055 (let ((out (assoc-ref outputs "octave")))
3056 (substitute* "src/matlab/CMakeLists.txt"
3057 (("share/flann/octave")
3058 (string-append out "/share/flann/octave")))
3060 (add-after 'install 'remove-static-libraries
3061 (lambda* (#:key outputs #:allow-other-keys)
3062 (let* ((out (assoc-ref outputs "out"))
3063 (lib (string-append out "/lib")))
3064 (for-each delete-file
3065 (find-files lib "\\.a$"))
3068 #:tests? #f)) ; The test data are downloaded from the Internet.
3069 (home-page "http://www.cs.ubc.ca/research/flann/")
3070 (synopsis "Library for approximate nearest neighbors computation")
3071 (description "FLANN is a library for performing fast approximate
3072 nearest neighbor searches in high dimensional spaces. It implements a
3073 collection of algorithms and a system for automatically choosing the best
3074 algorithm and optimum parameters depending on the dataset.
3076 FLANN is written in C++ and contains bindings for C, Octave and Python.")
3077 (license (license:non-copyleft "file://COPYING"
3078 "See COPYING in the distribution."))))
3080 (define-public wcalc
3087 (uri (string-append "mirror://sourceforge/w-calc/Wcalc/" version "/"
3088 "wcalc-" version ".tar.bz2"))
3091 "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
3092 (build-system gnu-build-system)
3095 ("readline" ,readline)))
3096 (home-page "http://w-calc.sourceforge.net/index.php")
3097 (synopsis "Flexible command-line scientific calculator")
3098 (description "Wcalc is a very capable calculator. It has standard functions
3099 (sin, asin, and sinh for example, in either radians or degrees), many
3100 pre-defined constants (pi, e, c, etc.), support for using variables, \"active\"
3101 variables, a command history, hex/octal/binary input and output, unit
3102 conversions, embedded comments, and an expandable expression entry field. It
3103 evaluates expressions using the standard order of operations.")
3104 (license license:gpl2+)))
3112 (uri (string-append "mirror://sourceforge/xaos/XaoS/" version
3113 "/xaos-" version ".tar.gz"))
3116 "15cd1cx1dyygw6g2nhjqq3bsfdj8sj8m4va9n75i0f3ryww3x7wq"))))
3117 (build-system gnu-build-system)
3118 (native-inputs `(("gettext" ,gettext-minimal)))
3119 (inputs `(("libx11" ,libx11)
3124 `(#:tests? #f ;no "check" target
3125 #:make-flags '("LOCALEDIR=$DATAROOTDIR/locale")))
3126 (synopsis "Real-time fractal zoomer")
3127 (description "GNU XaoS is a graphical program that generates fractal
3128 patterns and allows you to zoom in and out of them infinitely in a fluid,
3129 continuous manner. It also includes tutorials that help to explain how fractals
3130 are built. It can generate many different fractal types such as the Mandelbrot
3132 (home-page "https://www.gnu.org/software/xaos/")
3133 (license license:gpl2+)))
3135 (define-public hypre
3141 (uri (string-append "https://github.com/LLNL/hypre/archive/"
3142 "v" version ".tar.gz"))
3143 (file-name (string-append name "-" version ".tar.gz"))
3146 "0q69ia0jivzcr8p049dn3mg8yjpn6nwq4sw9iqac8vr63vi54l6m"))
3147 (modules '((guix build utils)))
3150 ;; Remove use of __DATE__ and __TIME__ for reproducibility;
3151 ;; substitute the tarball creation time.
3152 (substitute* "src/utilities/HYPRE_utilities.h"
3153 (("Date Compiled: .*$")
3154 "Date Compiled: Mar 28 2016 20:19:59 +0000\"\n"))
3156 (build-system gnu-build-system)
3157 (outputs '("out" ;6.1 MiB of headers and libraries
3158 "doc")) ;4.8 MiB of documentation
3162 ("texlive" ,texlive) ;full package required for fonts
3163 ("ghostscript" ,ghostscript)))
3165 `(("blas" ,openblas)
3166 ("lapack" ,lapack)))
3168 `(#:modules ((srfi srfi-1)
3169 ,@%gnu-build-system-modules)
3170 #:configure-flags '("--enable-shared"
3178 (modify-phases %standard-phases
3179 (add-before 'configure 'chdir-src
3180 (lambda _ (chdir "src")))
3182 (lambda* (#:key build target configure-flags
3183 #:allow-other-keys #:rest args)
3184 (let* ((configure (assoc-ref %standard-phases 'configure)))
3187 (list #:configure-flags
3188 (cons (string-append
3189 "--host=" (or target build))
3190 configure-flags)))))))
3191 (add-after 'build 'build-docs
3193 (zero? (system* "make" "-Cdocs" "pdf" "html"))))
3196 (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/hypre/lib"))
3197 (setenv "PATH" (string-append "." ":" (getenv "PATH")))
3198 (and (system* "make" "check" "CHECKRUN=")
3199 (fold (lambda (filename result)
3201 (let ((size (stat:size (stat filename))))
3202 (when (not (zero? size))
3203 (format #t "~a size ~d; error indication~%"
3207 (find-files "test" ".*\\.err$")))))
3208 (add-after 'install 'install-docs
3209 (lambda* (#:key outputs #:allow-other-keys)
3210 ;; Custom install because docs/Makefile doesn't honor ${docdir}.
3211 (let* ((doc (assoc-ref outputs "doc"))
3212 (docdir (string-append doc "/share/doc/hypre-" ,version)))
3213 (with-directory-excursion "docs"
3214 (for-each (lambda (base)
3215 (install-file (string-append base ".pdf") docdir)
3216 (copy-recursively base docdir)) ;html docs
3217 '("HYPRE_usr_manual"
3218 "HYPRE_ref_manual")))
3220 (home-page "http://www.llnl.gov/casc/hypre/")
3221 (synopsis "Library of solvers and preconditioners for linear equations")
3223 "HYPRE is a software library of high performance preconditioners and
3224 solvers for the solution of large, sparse linear systems of equations. It
3225 features multigrid solvers for both structured and unstructured grid
3227 (license license:lgpl2.1)))
3229 (define-public hypre-openmpi
3230 (package (inherit hypre)
3231 (name "hypre-openmpi")
3234 ,@(package-inputs hypre)))
3236 (substitute-keyword-arguments (package-arguments hypre)
3237 ((#:configure-flags flags)
3239 ,@(delete "--without-MPI" ,flags)))))
3240 (synopsis "Parallel solvers and preconditioners for linear equations")
3242 "HYPRE is a software library of high performance preconditioners and
3243 solvers for the solution of large, sparse linear systems of equations on
3244 parallel computers. It features parallel multigrid solvers for both
3245 structured and unstructured grid problems.")))
3247 (define-public matio
3254 (uri (string-append "mirror://sourceforge/matio/matio/" version "/"
3255 "matio-" version ".tar.gz"))
3258 "0y2qymgxank8wdiwc68ap8bxdzrhvyw86i29yh3xgn4z1njfd9ir"))))
3259 (build-system gnu-build-system)
3263 (home-page "http://matio.sourceforge.net/")
3264 (synopsis "Library for reading and writing MAT files")
3265 (description "Matio is a library for reading and writing MAT files. It
3266 supports compressed MAT files, as well as newer (version 7.3) MAT files.")
3267 (license license:bsd-2)))
3269 (define-public libhilbert
3276 (uri (string-append "http://web.cs.dal.ca/~chamilto/hilbert/"
3277 "libhilbert-" version ".tar.gz"))
3280 "0v48x8405dj95gjn2saja4bzhw86d6zl6d3dg8h7dzac2qr97s34"))))
3281 (build-system gnu-build-system)
3282 (home-page "http://web.cs.dal.ca/~chamilto/hilbert")
3283 (synopsis "Hilbert indices for multidimensional data")
3284 (description "The libhilbert library can efficiently calculate Hilbert
3285 curves and order-preserving representations of Hilbert curve indices that use
3286 the same amount of space as the original point representation. This is useful
3287 when using the Gilbert curve as a space filling curve through a
3288 high-dimensional space where not all demensions have the same cardinality.")
3289 (license license:lgpl2.1+)))
3296 (origin (method url-fetch)
3297 (uri (string-append "https://github.com/VcDevel/Vc/releases/"
3298 "download/" version "/Vc-" version ".tar.gz"))
3301 "1rh6dhqar3y07n4xqyml0sa0v48qv3ch9dc3yc2in855hlh4vnqi"))))
3302 (build-system cmake-build-system)
3305 '("-DBUILD_TESTING=ON")))
3306 (synopsis "SIMD vector classes for C++")
3307 (description "Vc provides portable, zero-overhead C++ types for explicitly
3308 data-parallel programming. It is a library designed to ease explicit
3309 vectorization of C++ code. Its types enable explicitly stating data-parallel
3310 operations on multiple values. The parallelism is therefore added via the type
3311 system. Vc has an intuitive API and provides portability between different
3312 compilers and compiler versions as well as portability between different vector
3313 instruction sets. Thus, an application written with Vc can be compiled for:
3316 @item SSE2 up to SSE4.2 or SSE4a
3319 @item NEON (in development)
3320 @item NVIDIA GPUs / CUDA (in development)
3322 (home-page "https://github.com/VcDevel/Vc")
3323 ;; "No support_???.cpp file exists for this architecture."
3324 (supported-systems '("x86_64-linux" "i686-linux"))
3325 (license license:bsd-3)))
3327 (define-public reducelcs
3328 ;; This is the last commit which is available upstream, no
3329 ;; release happened since 2010.
3330 (let ((commit "474f88deb968061abe8cf11c959e02319b8ae5c0")
3334 (version (string-append "1.0-" revision "." (string-take commit 7)))
3339 (url "https://github.com/gdv/Reduce-Expand-for-LCS")
3341 (file-name (string-append name "-" version "-checkout"))
3344 "1rllzcfwc042c336mhq262a8ha90x6afq30kvk60r7i4761j4yjm"))))
3345 (build-system gnu-build-system)
3347 `(("openlibm" ,openlibm)))
3349 `(#:tests? #f ; no tests
3351 (modify-phases %standard-phases
3352 (delete 'configure) ; No configure script exists.
3353 (replace 'install ; No install phase exists.
3354 (lambda* (#:key outputs #:allow-other-keys)
3355 (let* ((out (assoc-ref outputs "out"))
3356 (bin (string-append out "/bin")))
3357 (install-file "Approximation" bin)
3358 (install-file "CollectResults" bin)
3359 (install-file "GenerateInstances" bin)
3361 (synopsis "Approximate Longest Commons Subsequence computation tool")
3363 "@code{reduceLCS} is an implementation of the Reduce-Expand
3364 algorithm for LCS. It is a fast program to compute the approximate
3365 Longest Commons Subsequence of a set of strings.")
3366 (home-page "https://github.com/gdv/Reduce-Expand-for-LCS")
3367 (license license:gpl3+))))
3369 (define-public jacal
3376 "http://groups.csail.mit.edu/mac/ftpdir/scm/jacal-"
3379 "055zrn12a1dmy0dqkwrkq3fklbhg3yir6vn0lacp4mvbg8573a3q"))
3380 (patches (search-patches "jacal-fix-texinfo.patch"))))
3381 (build-system gnu-build-system)
3384 (modify-phases %standard-phases
3385 (add-before 'build 'pre-build
3386 ;; Don't use upstream's script - it really doesn't fit into
3387 ;; Guix's functional paradigm.
3388 (lambda* (#:key inputs outputs #:allow-other-keys)
3389 (substitute* "Makefile"
3390 (("^install: install-script") "install: "))))
3391 (add-after 'install 'post-install
3392 ;; Instead, we provide our own simplified script.
3393 (lambda* (#:key inputs outputs #:allow-other-keys)
3394 (let ((wrapper (string-append (assoc-ref outputs "out")
3396 (format (open wrapper (logior O_WRONLY O_CREAT))
3397 (string-append "#!~a\nexec ~a/bin/scm -ip1 "
3398 "-e '(slib:load \"~a/lib/jacal/math\") "
3401 (assoc-ref inputs "scm")
3402 (assoc-ref outputs "out"))
3403 (chmod wrapper #o555))))
3405 (lambda* (#:key inputs outputs #:allow-other-keys)
3406 (zero? (system* "./configure"
3407 (string-append "--prefix="
3408 (assoc-ref outputs "out")))))))))
3409 (inputs `(("scm" ,scm)))
3410 (native-inputs `(("unzip" ,unzip)
3411 ("texinfo" ,texinfo)))
3412 (synopsis "Symbolic mathematics system")
3413 (description "GNU JACAL is an interactive symbolic mathematics program based on
3414 Scheme. It manipulate and simplify a range of mathematical expressions such
3415 as equations, scalars, vectors, and matrices.")
3416 (home-page "https://www.gnu.org/software/jacal/")
3417 (license license:gpl3+)))
3426 "https://github.com/Z3Prover/z3/archive/z3-"
3430 "032a5lvji2liwmc25jv52bdrhimqflvqbpg77ccaq1jykhiivbmf"))))
3431 (build-system cmake-build-system)
3434 (list "-DBUILD_PYTHON_BINDINGS=true"
3435 "-DINSTALL_PYTHON_BINDINGS=true"
3436 (string-append "-DCMAKE_INSTALL_PYTHON_PKG_DIR="
3438 "/lib/python2.7/site-packages")
3439 (string-append "-DCMAKE_INSTALL_LIBDIR="
3444 (modify-phases %standard-phases
3445 (add-before 'configure 'bootstrap
3448 (system* "python" "contrib/cmake/bootstrap.py" "create"))))
3449 (add-before 'check 'make-test-z3
3451 ;; Build the test suite executable.
3452 (zero? (system* "make" "test-z3" "-j"
3453 (number->string (parallel-job-count))))))
3456 ;; Run all the tests that don't require arguments.
3457 (zero? (system* "./test-z3" "/a")))))))
3459 `(("python" ,python-2)))
3460 (synopsis "Theorem prover")
3461 (description "Z3 is a theorem prover and @dfn{satisfiability modulo
3462 theories} (SMT) solver. It provides a C/C++ API, as well as Python bindings.")
3463 (home-page "https://github.com/Z3Prover/z3")
3464 (license license:expat)))
3466 (define-public cubicle
3472 (uri (string-append "http://cubicle.lri.fr/cubicle-"
3476 "1sny9c4fm14k014pk62ibpwbrjjirkx8xmhs9jg7q1hk7y7x3q2h"))))
3477 (build-system gnu-build-system)
3480 ("which" ,(@@ (gnu packages base) which))))
3484 `(#:configure-flags (list "--with-z3")
3487 (modify-phases %standard-phases
3488 (add-before 'configure 'configure-for-release
3490 (substitute* "Makefile.in"
3491 (("SVNREV=") "#SVNREV="))))
3492 (add-before 'configure 'fix-/bin/sh
3494 (substitute* "configure"
3495 (("/bin/sh") (which "sh")))))
3496 (add-before 'configure 'fix-smt-z3wrapper.ml
3498 (substitute* "Makefile.in"
3499 (("\\\\n") "")))))))
3500 (home-page "http://cubicle.lri.fr/")
3501 (synopsis "Model checker for array-based systems")
3502 (description "Cubicle is an open source model checker for verifying safety
3503 properties of array-based systems. This is a syntactically restricted class of
3504 parametrized transition systems with states represented as arrays indexed by an
3505 arbitrary number of processes. Cache coherence protocols and mutual exclusion
3506 algorithms are typical examples of such systems.")
3507 (license license:asl2.0)))