gnu: rclone: Update to 1.48.0.
[jackhill/guix/guix.git] / gnu / packages / maths.scm
... / ...
CommitLineData
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013, 2014, 2015, 2016, 2019 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, 2018, 2019 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, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
9;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
10;;; Copyright © 2015, 2018 Mark H Weaver <mhw@netris.org>
11;;; Copyright © 2015, 2016, 2017, 2018, 2019 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, 2018 Kei Kebreau <kkebreau@posteo.net>
15;;; Copyright © 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
16;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
17;;; Copyright © 2016, 2017 Thomas Danckaert <post@thomasdanckaert.be>
18;;; Copyright © 2017, 2018 Paul Garlick <pgarlick@tourbillion-technology.com>
19;;; Copyright © 2017 ng0 <ng0@n0.is>
20;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
21;;; Copyright © 2017 Theodoros Foradis <theodoros@foradis.org>
22;;; Copyright © 2017, 2019 Arun Isaac <arunisaac@systemreboot.net>
23;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
24;;; Copyright © 2017 Dave Love <me@fx@gnu.org>
25;;; Copyright © 2018 Jan Nieuwenhuizen <janneke@gnu.org>
26;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com>
27;;; Copyright © 2018 Nadya Voronova <voronovank@gmail.com>
28;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
29;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
30;;; Copyright © 2018 Eric Brown <brown@fastmail.com>
31;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
32;;; Copyright © 2018 Amin Bandali <bandali@gnu.org>
33;;; Copyright © 2019 Nicolas Goaziou <mail@nicolasgoaziou.fr>
34;;;
35;;; This file is part of GNU Guix.
36;;;
37;;; GNU Guix is free software; you can redistribute it and/or modify it
38;;; under the terms of the GNU General Public License as published by
39;;; the Free Software Foundation; either version 3 of the License, or (at
40;;; your option) any later version.
41;;;
42;;; GNU Guix is distributed in the hope that it will be useful, but
43;;; WITHOUT ANY WARRANTY; without even the implied warranty of
44;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45;;; GNU General Public License for more details.
46;;;
47;;; You should have received a copy of the GNU General Public License
48;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
49
50(define-module (gnu packages maths)
51 #:use-module (ice-9 regex)
52 #:use-module (ice-9 match)
53 #:use-module (gnu packages)
54 #:use-module ((guix licenses) #:prefix license:)
55 #:use-module (guix packages)
56 #:use-module (guix download)
57 #:use-module (guix git-download)
58 #:use-module (guix utils)
59 #:use-module ((guix build utils) #:select (alist-replace))
60 #:use-module (guix build-system cmake)
61 #:use-module (guix build-system gnu)
62 #:use-module (guix build-system python)
63 #:use-module (guix build-system r)
64 #:use-module (guix build-system ruby)
65 #:use-module (gnu packages algebra)
66 #:use-module (gnu packages audio)
67 #:use-module (gnu packages autotools)
68 #:use-module (gnu packages base)
69 #:use-module (gnu packages bison)
70 #:use-module (gnu packages boost)
71 #:use-module (gnu packages check)
72 #:use-module (gnu packages cmake)
73 #:use-module (gnu packages compression)
74 #:use-module (gnu packages curl)
75 #:use-module (gnu packages cyrus-sasl)
76 #:use-module (gnu packages documentation)
77 #:use-module (gnu packages elf)
78 #:use-module (gnu packages flex)
79 #:use-module (gnu packages fltk)
80 #:use-module (gnu packages fontutils)
81 #:use-module (gnu packages gettext)
82 #:use-module (gnu packages gcc)
83 #:use-module (gnu packages gd)
84 #:use-module (gnu packages ghostscript)
85 #:use-module (gnu packages graphviz)
86 #:use-module (gnu packages gtk)
87 #:use-module (gnu packages image)
88 #:use-module (gnu packages java)
89 #:use-module (gnu packages less)
90 #:use-module (gnu packages lisp)
91 #:use-module (gnu packages linux)
92 #:use-module (gnu packages logging)
93 #:use-module (gnu packages lua)
94 #:use-module (gnu packages gnome)
95 #:use-module (gnu packages guile)
96 #:use-module (gnu packages xorg)
97 #:use-module (gnu packages gl)
98 #:use-module (gnu packages imagemagick)
99 #:use-module (gnu packages m4)
100 #:use-module (gnu packages mpi)
101 #:use-module (gnu packages multiprecision)
102 #:use-module (gnu packages netpbm)
103 #:use-module (gnu packages pcre)
104 #:use-module (gnu packages popt)
105 #:use-module (gnu packages perl)
106 #:use-module (gnu packages pkg-config)
107 #:use-module (gnu packages pulseaudio)
108 #:use-module (gnu packages python)
109 #:use-module (gnu packages python-web)
110 #:use-module (gnu packages python-xyz)
111 #:use-module (gnu packages qt)
112 #:use-module (gnu packages readline)
113 #:use-module (gnu packages ruby)
114 #:use-module (gnu packages tbb)
115 #:use-module (gnu packages scheme)
116 #:use-module (gnu packages shells)
117 #:use-module (gnu packages tcl)
118 #:use-module (gnu packages texinfo)
119 #:use-module (gnu packages tex)
120 #:use-module (gnu packages tls)
121 #:use-module (gnu packages version-control)
122 #:use-module (gnu packages wxwidgets)
123 #:use-module (gnu packages xml)
124 #:use-module (srfi srfi-1))
125
126(define-public aris
127 (package
128 (name "aris")
129 (version "2.2")
130 (source (origin
131 (method url-fetch)
132 (uri (string-append "mirror://gnu/" name "/" name "-" version ".tar.gz"))
133 (sha256 (base32
134 "1q1887ryqdr9sn0522hc7p16kqwlxxyz5dkmma8ar2nxplhgll7q"))))
135 (build-system gnu-build-system)
136 (inputs `(("gtk+" ,gtk+)
137 ("libxml2" ,libxml2)))
138 (native-inputs `(("pkg-config" ,pkg-config)))
139 (synopsis "Natural deduction first-order logic interface")
140 (description "Aris is a program for performing logical proofs. It supports
141propositional and predicate logic, as well as Boolean algebra and
142arithmetical logic. In addition to its predefined inference and equivalence
143rules, Aris also supports references to older proofs. Its use of standard
144logical symbols and its natural deduction interface make it easy to use for
145beginners.")
146 (license license:gpl3+)
147 (home-page "https://www.gnu.org/software/aris/")))
148
149(define-public c-graph
150 (package
151 (name "c-graph")
152 (version "2.0.1")
153 (source (origin
154 (method url-fetch)
155 (uri (string-append "mirror://gnu/c-graph/c-graph-" version
156 ".tar.gz"))
157 (sha256 (base32
158 "092412jzxy6wdvpk96pfj499hpmaww8xllavbvlqspfpr7ips9id"))))
159 (build-system gnu-build-system)
160 (inputs
161 `(("fortran" ,gfortran)))
162 (synopsis "Visualizing and demonstrating convolution")
163 (description
164 "GNU C-Graph is a tool for demonstrating the theory of convolution.
165Thus, it can serve as an excellent aid to students of signal and systems
166theory in visualizing the convolution process. Rather than forcing the
167student to write code, the program offers an intuitive interface with
168interactive dialogs to guide them.")
169 (license license:gpl3+)
170 (home-page "https://www.gnu.org/software/c-graph/")))
171
172(define-public coda
173 (package
174 (name "coda")
175 (version "2.19")
176 (source
177 (origin
178 (method url-fetch)
179 (uri (string-append "https://github.com/stcorp/coda/releases/download/"
180 version "/coda-" version ".tar.gz"))
181 (sha256
182 (base32 "1fbxd2afm7dshd92p10yy8dwbr9gc1h1fmnnnmr7d0c5lnw80245"))
183 (patches (search-patches "coda-use-system-libs.patch"))
184 (modules '((guix build utils)))
185 (snippet
186 ;; Make sure we don't use the bundled software.
187 '(begin
188 (for-each (lambda (d)
189 (delete-file-recursively (string-append "libcoda/" d)))
190 '("zlib" "pcre" "expat"))
191 #t))))
192 (native-inputs
193 `(("fortran" ,gfortran)
194 ("python" ,python)
195 ("python-numpy" ,python-numpy)))
196 (inputs
197 `(("zlib" ,zlib)
198 ("pcre" ,pcre)
199 ("expat" ,expat)
200 ("hdf4" ,hdf4-alt)
201 ("hdf5" ,hdf5)))
202 (build-system gnu-build-system)
203 (arguments
204 '(#:configure-flags '("--with-hdf4" "--with-hdf5" "--enable-python"
205 "LIBS= -lz -lpcre -lexpat")))
206 (synopsis "A common interface to various earth observation data formats")
207 (description
208 "The Common Data Access toolbox (CODA) provides a set of interfaces for
209reading remote sensing data from earth observation data files. It consists of
210command line applications and interfaces to the C, Fortran, Python, and Java
211programming languages.")
212 (home-page "https://stcorp.nl/coda")
213 (license license:gpl2+)))
214
215(define-public qhull
216 (package
217 (name "qhull")
218 (version "2015.2")
219 (source (origin
220 (method url-fetch)
221 (uri (string-append "http://www.qhull.org/download/qhull-"
222 (car (string-split version #\.))
223 "-src-7.2.0.tgz"))
224 (sha256
225 (base32
226 "0dm4b2xr3asy6w74khq2zg4gf26zsy3qf9sq7pf7lmrvbj911c3q"))))
227 (build-system cmake-build-system)
228 (synopsis "Calculate convex hulls and related structures")
229 (description
230 "@code{Qhull} computes the convex hull, Delaunay triangulation, Voronoi
231diagram, halfspace intersection about a point, furthest-site Delaunay
232triangulation, and furthest-site Voronoi diagram. The source code runs in 2-d,
2333-d, 4-d, and higher dimensions. @code{Qhull} implements the Quickhull
234algorithm for computing the convex hull. It handles roundoff errors from
235floating point arithmetic. It computes volumes, surface areas, and
236approximations to the convex hull.
237
238@code{Qhull} does not support triangulation of non-convex surfaces, mesh
239generation of non-convex objects, medium-sized inputs in 9-D and higher, alpha
240shapes, weighted Voronoi diagrams, Voronoi volumes, or constrained Delaunay
241triangulations.")
242 (home-page "http://qhull.org")
243 (license (license:non-copyleft "file://COPYING.txt"
244 "See COPYING in the distribution."))))
245
246(define-public python-cvxopt
247 (package
248 (name "python-cvxopt")
249 (version "1.2.1")
250 (source (origin
251 (method git-fetch)
252 (uri (git-reference
253 (url "https://github.com/cvxopt/cvxopt.git")
254 (commit version)))
255 (file-name (git-file-name name version))
256 (sha256
257 (base32
258 "05mnjil9palaa48xafdfh4f5pr4z7aqjr995rwl08qfyxs8y0crf"))))
259 (build-system python-build-system)
260 (arguments
261 `(#:phases
262 (modify-phases %standard-phases
263 (add-after 'unpack 'find-libraries
264 (lambda* (#:key inputs #:allow-other-keys)
265 (setenv "CVXOPT_BLAS_LIB" "openblas")
266 (setenv "CVXOPT_BUILD_FFTW" "1")
267 (setenv "CVXOPT_BUILD_GLPK" "1")
268 (setenv "CVXOPT_BUILD_GSL" "1")
269 #t)))))
270 (inputs
271 `(("fftw" ,fftw)
272 ("glpk" ,glpk)
273 ("gsl" ,gsl)
274 ("lapack" ,lapack)
275 ("openblas" ,openblas)
276 ("suitesparse" ,suitesparse)))
277 (home-page "https://www.cvxopt.org")
278 (synopsis "Python library for convex optimization")
279 (description
280 "CVXOPT is a package for convex optimization based on the Python
281programming language. Its main purpose is to make the development of software
282for convex optimization applications straightforward by building on Python’s
283extensive standard library and on the strengths of Python as a high-level
284programming language.")
285 (license license:gpl3+)))
286
287(define-public python2-cvxopt
288 (package-with-python2 python-cvxopt))
289
290(define-public units
291 (package
292 (name "units")
293 (version "2.19")
294 (source (origin
295 (method url-fetch)
296 (uri (string-append "mirror://gnu/units/units-" version
297 ".tar.gz"))
298 (sha256 (base32
299 "0mk562g7dnidjgfgvkxxpvlba66fh1ykmfd9ylzvcln1vxmi6qj2"))))
300 (build-system gnu-build-system)
301 (inputs
302 `(("readline" ,readline)
303 ("python" ,python-wrapper) ;for 'units_cur' script
304 ("python-requests" ,python-requests)))
305 (arguments
306 `(#:phases (modify-phases %standard-phases
307 (add-after 'install 'wrap-units_cur
308 (lambda* (#:key outputs #:allow-other-keys)
309 (let* ((out (assoc-ref outputs "out"))
310 (bin (string-append out "/bin")))
311 (wrap-program (string-append bin "/units_cur")
312 `("PYTHONPATH" ":" prefix
313 ,(search-path-as-string->list (getenv "PYTHONPATH"))))
314 #t))))))
315 (synopsis "Conversion between thousands of scales")
316 (description
317 "GNU Units converts numeric quantities between units of measure. It
318can handle scale changes through adaptive usage of standard scale
319prefixes (micro-, kilo-, etc.). It can also handle nonlinear
320conversions such as Fahrenheit to Celsius. Its interpreter is powerful
321enough to be used effectively as a scientific calculator.")
322 (license license:gpl3+)
323 (home-page "https://www.gnu.org/software/units/")))
324
325(define-public double-conversion
326 (package
327 (name "double-conversion")
328 (version "3.1.4")
329 (home-page "https://github.com/google/double-conversion")
330 (source (origin
331 (method git-fetch)
332 (uri (git-reference (url home-page)
333 (commit (string-append "v" version))))
334 (file-name (git-file-name name version))
335 (sha256
336 (base32
337 "13xwcqk2c0q8c1siw566clxcpvp0xrxvb72mra42wa3nvq9wlsv6"))))
338 (build-system cmake-build-system)
339 (arguments
340 '(#:test-target "test"
341 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
342 "-DBUILD_TESTING=ON")))
343 (synopsis "Conversion routines for IEEE doubles")
344 (description
345 "The double-conversion library provides binary-decimal and decimal-binary
346routines for IEEE doubles. The library consists of efficient conversion
347routines that have been extracted from the V8 JavaScript engine.")
348 (license license:bsd-3)))
349
350(define-public dionysus
351 (package
352 (name "dionysus")
353 (version "1.4.0")
354 (source (origin
355 (method url-fetch)
356 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
357 ".tar.xz"))
358 (sha256
359 (base32
360 "194pzs1mlsj4ww6v37qq3961h5hckm5h805cv0r14xj3g9wfx2sk"))))
361 (build-system gnu-build-system)
362 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
363 (synopsis "Local search for universal constants and scientific values")
364 (description
365 "GNU Dionysus is a convenient system for quickly retrieving the values of
366mathematical constants used in science and engineering. Values can be
367searched using a simple command-line tool, choosing from three databases:
368universal constants, atomic numbers, and constants related to
369semiconductors.")
370 (license license:gpl3+)
371 (home-page "https://www.gnu.org/software/dionysus/")))
372
373(define-public gsl
374 (package
375 (name "gsl")
376 (version "2.5")
377 (source (origin
378 (method url-fetch)
379 (uri (string-append "mirror://gnu/gsl/gsl-"
380 version ".tar.gz"))
381 (sha256
382 (base32
383 "1395y9hlhqadn5g9j8q22224fds5sd92jxi9czfavjj24myasq04"))
384 (patches (search-patches "gsl-test-i686.patch"))))
385 (build-system gnu-build-system)
386 (arguments
387 `(;; Currently there are numerous tests that fail on "exotic"
388 ;; architectures such as aarch64 and ppc64le.
389 ,@(if (string-prefix? "aarch64-linux"
390 (or (%current-target-system) (%current-system)))
391 '(#:tests? #f)
392 '())))
393 (home-page "https://www.gnu.org/software/gsl/")
394 (synopsis "Numerical library for C and C++")
395 (description
396 "The GNU Scientific Library is a library for numerical analysis in C
397and C++. It includes a wide range of mathematical routines, with over 1000
398functions in total. Subject areas covered by the library include:
399differential equations, linear algebra, Fast Fourier Transforms and random
400numbers.")
401 (license license:gpl3+)))
402
403(define-public glpk
404 (package
405 (name "glpk")
406 (version "4.65")
407 (source
408 (origin
409 (method url-fetch)
410 (uri (string-append "mirror://gnu/glpk/glpk-"
411 version ".tar.gz"))
412 (sha256
413 (base32
414 "040sfaa9jclg2nqdh83w71sv9rc1sznpnfiripjdyr48cady50a2"))))
415 (build-system gnu-build-system)
416 (inputs
417 `(("gmp" ,gmp)))
418 (arguments
419 `(#:configure-flags '("--with-gmp")))
420 (home-page "https://www.gnu.org/software/glpk/")
421 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
422 (description
423 "GLPK is a C library for solving large-scale linear programming (LP),
424mixed integer programming (MIP), and other related problems. It supports the
425GNU MathProg modeling language, a subset of the AMPL language, and features a
426translator for the language. In addition to the C library, a stand-alone
427LP/MIP solver is included in the package.")
428 (license license:gpl3+)))
429
430(define-public 4ti2
431 (package
432 (name "4ti2")
433 (version "1.6.9")
434 (source
435 (origin
436 (method url-fetch)
437 (uri (string-append "https://github.com/4ti2/4ti2/releases/download/"
438 "Release_"
439 (string-map (lambda (c) (if (char=? c #\.) #\_ c))
440 version)
441 "/4ti2-" version ".tar.gz"))
442 (sha256
443 (base32 "0rj92x6p9m3la5gasjbj7sa569im527ffmka5y2sv1amgd3fflrh"))))
444 (build-system gnu-build-system)
445 (native-inputs
446 `(("which" ,(@ (gnu packages base) which)))) ; for the tests
447 (inputs
448 `(("glpk" ,glpk)
449 ("gmp" ,gmp)))
450 (home-page "http://www.4ti2.de/")
451 (synopsis "Mathematical tool suite for problems on linear spaces")
452 (description
453 "4ti2 implements algorithms for solving algebraic, geometric and
454combinatorial problems on linear spaces. Among others, it solves systems
455of linear equations, computes extreme rays of polyhedral cones, solves
456integer programming problems and computes Markov bases for statistics.")
457 (license license:gpl2+)))
458
459(define-public cddlib
460 (package
461 (name "cddlib")
462 (version "0.94i")
463 (source
464 (origin
465 (method url-fetch)
466 (uri (string-append "ftp://ftp.math.ethz.ch/users/fukudak/cdd/cddlib-"
467 (string-delete #\. version) ".tar.gz"))
468 (sha256
469 (base32
470 "00zdgiqb91vx6gd2103h3ijij0llspsxc6zz3iw2bll39fvkl4xq"))))
471 (build-system gnu-build-system)
472 (inputs
473 `(("gmp" ,gmp)))
474 (home-page "https://www.inf.ethz.ch/personal/fukudak/cdd_home/index.html")
475 (synopsis "Library for convex hulls and extreme rays of polyhedra")
476 (description
477 "The C-library cddlib implements the Double Description Method of
478Motzkin et al. for generating all vertices (i.e. extreme points) and extreme
479rays of a general convex polyhedron given by a system of linear inequalities
480in arbitrary dimension. It can also be used for the converse operation of
481computing convex hulls.")
482 (license license:gpl2+)))
483
484(define-public arpack-ng
485 (package
486 (name "arpack-ng")
487 (version "3.6.3")
488 (home-page "https://github.com/opencollab/arpack-ng")
489 (source (origin
490 (method git-fetch)
491 (uri (git-reference (url home-page) (commit version)))
492 (file-name (git-file-name name version))
493 (sha256
494 (base32
495 "1wljl96yqxc9v8r49c37lscwkdp58kaacfb9p6s6nvpm31haax4y"))))
496 (build-system gnu-build-system)
497 (native-inputs
498 `(("autoconf" ,autoconf)
499 ("automake" ,automake)
500 ("libtool" ,libtool)))
501 (inputs
502 `(("lapack" ,lapack)
503 ("fortran" ,gfortran)))
504 (synopsis "Fortran subroutines for solving eigenvalue problems")
505 (description
506 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
507large scale eigenvalue problems.")
508 (license (license:non-copyleft "file://COPYING"
509 "See COPYING in the distribution."))))
510
511(define-public arpack-ng-3.3.0
512 (package
513 (inherit arpack-ng)
514 (version "3.3.0")
515 (name (package-name arpack-ng))
516 (home-page (package-home-page arpack-ng))
517 (source
518 (origin
519 (method url-fetch)
520 (uri (string-append home-page "/archive/" version ".tar.gz"))
521 (file-name (string-append name "-" version ".tar.gz"))
522 (sha256
523 (base32
524 "1cz53wqzcf6czmcpfb3vb61xi0rn5bwhinczl65hpmbrglg82ndd"))))))
525
526(define-public arpack-ng-openmpi
527 (package (inherit arpack-ng)
528 (name "arpack-ng-openmpi")
529 (inputs
530 `(("mpi" ,openmpi)
531 ,@(package-inputs arpack-ng)))
532 (arguments
533 (substitute-keyword-arguments (package-arguments arpack-ng)
534 ((#:configure-flags _ '())
535 ''("--enable-mpi"))
536 ((#:phases phases '%standard-phases)
537 `(modify-phases ,phases
538 (add-before 'check 'mpi-setup
539 ,%openmpi-setup)))))
540 (synopsis "Fortran subroutines for solving eigenvalue problems with MPI")))
541
542(define-public lapack
543 (package
544 (name "lapack")
545 (version "3.7.1")
546 (source
547 (origin
548 (method url-fetch)
549 (uri (string-append "http://www.netlib.org/lapack/lapack-"
550 version ".tgz"))
551 (sha256
552 (base32
553 "1j51r7n5w4k7r3lrvy7710xrpkg40wf4rqnmngfz6ck9ypckzign"))))
554 (build-system cmake-build-system)
555 (home-page "http://www.netlib.org/lapack/")
556 (inputs `(("fortran" ,gfortran)
557 ("python" ,python-2)))
558 (arguments
559 `(#:configure-flags (list
560 "-DBUILD_SHARED_LIBS:BOOL=YES"
561 "-DLAPACKE=ON"
562
563 ;; Build the 'LAPACKE_clatms' functions.
564 "-DLAPACKE_WITH_TMG=ON")
565 #:phases
566 (modify-phases %standard-phases
567 (add-before 'check 'patch-python
568 (lambda* (#:key inputs #:allow-other-keys)
569 (let ((python (assoc-ref inputs "python")))
570 (substitute* "lapack_testing.py"
571 (("/usr/bin/env python") python)))
572 #t)))))
573 (synopsis "Library for numerical linear algebra")
574 (description
575 "LAPACK is a Fortran 90 library for solving the most commonly occurring
576problems in numerical linear algebra.")
577 (license (license:non-copyleft "file://LICENSE"
578 "See LICENSE in the distribution."))))
579
580(define-public scalapack
581 (package
582 (name "scalapack")
583 (version "2.0.2")
584 (source
585 (origin
586 (method url-fetch)
587 (uri (string-append "http://www.netlib.org/scalapack/scalapack-"
588 version ".tgz"))
589 (sha256
590 (base32
591 "0p1r61ss1fq0bs8ynnx7xq4wwsdvs32ljvwjnx6yxr8gd6pawx0c"))
592 (patches (search-patches "scalapack-blacs-mpi-deprecations.patch"))))
593 (build-system cmake-build-system)
594 (inputs
595 `(("mpi" ,openmpi)
596 ("fortran" ,gfortran)
597 ("lapack" ,lapack))) ;for testing only
598 (arguments
599 `(#:configure-flags `("-DBUILD_SHARED_LIBS:BOOL=YES")
600 #:phases (modify-phases %standard-phases
601 (add-before 'check 'mpi-setup
602 ,%openmpi-setup))))
603 (home-page "http://www.netlib.org/scalapack/")
604 (synopsis "Library for scalable numerical linear algebra")
605 (description
606 "ScaLAPACK is a Fortran 90 library of high-performance linear algebra
607routines on parallel distributed memory machines. ScaLAPACK solves dense and
608banded linear systems, least squares problems, eigenvalue problems, and
609singular value problems.")
610 (license (license:non-copyleft "file://LICENSE"
611 "See LICENSE in the distribution."))))
612
613(define-public gnuplot
614 (package
615 (name "gnuplot")
616 (version "5.2.6")
617 (source (origin
618 (method url-fetch)
619 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
620 version "/gnuplot-"
621 version ".tar.gz"))
622 (sha256
623 (base32 "1vllgap08nhvdmc03idmkdnk9cfl2bp81hps50q1pqrr640qzp9m"))))
624 (build-system gnu-build-system)
625 (inputs `(("readline" ,readline)
626 ("cairo" ,cairo)
627 ("pango" ,pango)
628 ("gd" ,gd)
629 ("lua" ,lua)))
630 (native-inputs
631 `(("pkg-config" ,pkg-config)
632 ("texlive" ,texlive-tiny)))
633 (arguments `(#:configure-flags (list (string-append
634 "--with-texdir=" %output
635 "/texmf-local/tex/latex/gnuplot"))))
636 (home-page "http://www.gnuplot.info")
637 (synopsis "Command-line driven graphing utility")
638 (description "Gnuplot is a portable command-line driven graphing
639utility. It was originally created to allow scientists and students to
640visualize mathematical functions and data interactively, but has grown to
641support many non-interactive uses such as web scripting. It is also used as a
642plotting engine by third-party applications like Octave.")
643 ;; X11 Style with the additional restriction that derived works may only be
644 ;; distributed as patches to the original.
645 (license (license:fsf-free
646 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
647
648(define-public gctp
649 (package
650 (name "gctp")
651 (version "2.0.0")
652 (source
653 (origin
654 (method git-fetch)
655 (uri (git-reference
656 (url "https://github.com/OkoSanto/GCTP.git")
657 (commit (string-append "v" version))))
658 (file-name (git-file-name name version))
659 (sha256
660 (base32 "11wqmd443b4nksdbzp1msdws3av948nmwq1xz80w6hka3ss2aigd"))))
661 (native-inputs
662 `(("fortran" ,gfortran)))
663 (build-system gnu-build-system)
664 (synopsis "General Cartographic Transformation Package (GCTP)")
665 (description
666 "The General Cartographic Transformation Package (GCTP) is a system of
667software routines designed to permit the transformation of coordinate pairs
668from one map projection to another. The GCTP is the standard computer
669software used by the National Mapping Division for map projection
670computations.")
671 (home-page "https://github.com/OkoSanto/GCTP")
672 (license license:public-domain))) ;https://www2.usgs.gov/laws/info_policies.html
673
674(define-public hdf4
675 (package
676 (name "hdf4")
677 (version "4.2.13")
678 (source
679 (origin
680 (method url-fetch)
681 (uri (string-append "https://support.hdfgroup.org/ftp/HDF/releases/HDF"
682 version "/src/hdf-" version ".tar.bz2"))
683 (sha256
684 (base32 "1wz0586zh91pqb95wvr0pbh71a8rz358fdj6n2ksp85x2cis9lsm"))
685 (patches (search-patches "hdf4-architectures.patch"
686 "hdf4-reproducibility.patch"
687 "hdf4-shared-fortran.patch"))))
688 (build-system gnu-build-system)
689 (native-inputs
690 `(("gfortran" ,gfortran)
691 ("bison" ,bison)
692 ("flex" ,flex)))
693 (inputs
694 `(("zlib" ,zlib)
695 ("libjpeg" ,libjpeg)))
696 (arguments
697 `(#:parallel-tests? #f
698 #:configure-flags '("--enable-shared")
699 #:phases
700 (modify-phases %standard-phases
701 ;; This is inspired by two of Debian's patches.
702 (add-before 'configure 'add-more-aarch64-support
703 (lambda _
704 (substitute* '("mfhdf/ncgen/ncgen.l"
705 "mfhdf/ncgen/ncgenyy.c"
706 "mfhdf/libsrc/netcdf.h.in")
707 (("AIX5L64") "__aarch64__"))
708 #t))
709 (add-before 'configure 'patchbuild
710 (lambda _
711 (substitute*
712 '("mfhdf/hdfimport/testutil.sh.in" "hdf/util/testutil.sh.in")
713 (("/bin/rm") "rm")
714 (("/bin/mkdir") "mkdir"))
715 (substitute* (find-files "." "^Makefile\\.in$")
716 (("@HDF_BUILD_XDR_TRUE@XDR_ADD = \
717-R\\$\\(abs_top_builddir\\)/mfhdf/xdr/\\.libs") "")
718 (("@HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = \
719-R\\$\\(abs_top_builddir\\)/mfhdf/libsrc/\\.libs \
720-R\\$\\(abs_top_builddir\\)/hdf/src/\\.libs \\$\\(XDR_ADD\\)") ""))
721 #t))
722 (add-after 'configure 'patch-settings
723 (lambda _
724 ;; libhdf4.settings contains the full path of the
725 ;; compilers used, and its contents are included in
726 ;; .so-files. We truncate the hashes to avoid
727 ;; unnecessary store references to those compilers:
728 (substitute* "libhdf4.settings"
729 (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
730 (string-append prefix (string-take hash 10) "...")))
731 #t))
732 )))
733 (home-page "https://www.hdfgroup.org/products/hdf4/")
734 (synopsis
735 "Library and multi-object file format for storing and managing data")
736 (description "HDF4 is a library and multi-object file format for storing
737and managing data between machines. HDF4 is an older hierarchical data format,
738incompatible with HDF5.")
739 (license
740 (license:non-copyleft
741 "https://www.hdfgroup.org/ftp/HDF/HDF_Current/src/unpacked/COPYING"))))
742
743(define-public hdf4-alt
744 (package
745 (inherit hdf4)
746 (name "hdf4-alt")
747 (arguments
748 (substitute-keyword-arguments (package-arguments hdf4)
749 ((#:configure-flags flags) `(cons* "--disable-netcdf" ,flags))))
750 (synopsis
751 "HDF4 without netCDF API, can be combined with the regular netCDF library")))
752
753(define-public hdf5
754 (package
755 (name "hdf5")
756 (version "1.8.21")
757 (source
758 (origin
759 (method url-fetch)
760 (uri (list (string-append "https://support.hdfgroup.org/ftp/HDF5/releases/"
761 "hdf5-" (version-major+minor version)
762 "/hdf5-" version "/src/hdf5-"
763 version ".tar.bz2")
764 (string-append "https://support.hdfgroup.org/ftp/HDF5/"
765 "current"
766 (match (string-split version #\.)
767 ((major minor _ ...)
768 (string-append major minor)))
769 "/src/hdf5-" version ".tar.bz2")))
770 (sha256
771 (base32 "03glk4w4wyb1jyb443g53y3y1ncnf6mj2cqwm6avfr2awkgb3cg5"))
772 (patches (search-patches "hdf5-config-date.patch"
773 "hdf5-1.8-mpi-deprecations.patch"))))
774 (build-system gnu-build-system)
775 (inputs
776 `(("zlib" ,zlib)))
777 (native-inputs
778 `(("gfortran" ,gfortran)
779 ("perl" ,perl))) ;part of the test machinery needs Perl
780 (outputs '("out" ; core library
781 "fortran")) ; fortran interface
782 (arguments
783 `(;; Some of the users, notably Flann, need the C++ interface.
784 #:configure-flags '("--enable-cxx"
785 "--enable-fortran"
786 "--enable-fortran2003"
787
788 ;; Build a thread-safe library. Unfortunately,
789 ;; 'configure' invites you to either turn off C++,
790 ;; Fortran, and the high-level interface (HL), or
791 ;; to pass '--enable-unsupported'. Debian
792 ;; packagers chose to pass '--enable-unsupported'
793 ;; and we follow their lead here.
794 "--enable-threadsafe"
795 "--with-pthread"
796 "--enable-unsupported")
797 ;; Use -fPIC to allow the R bindings to link with the static libraries
798 #:make-flags (list "CFLAGS=-fPIC"
799 "CXXFLAGS=-fPIC")
800 #:phases
801 (modify-phases %standard-phases
802 (add-before 'configure 'patch-configure
803 (lambda* (#:key outputs #:allow-other-keys)
804 (substitute* "configure"
805 (("/bin/mv") "mv"))
806 (substitute* "fortran/src/Makefile.in"
807 (("libhdf5_fortran_la_LDFLAGS =")
808 (string-append "libhdf5_fortran_la_LDFLAGS = -Wl-rpath="
809 (assoc-ref outputs "fortran") "/lib")))
810 (substitute* "hl/fortran/src/Makefile.in"
811 (("libhdf5hl_fortran_la_LDFLAGS =")
812 (string-append "libhdf5hl_fortran_la_LDFLAGS = -Wl,-rpath="
813 (assoc-ref outputs "fortran") "/lib")))
814 #t))
815 (add-after 'configure 'patch-settings
816 (lambda _
817 ;; libhdf5.settings contains the full path of the
818 ;; compilers used, and its contents are included in
819 ;; libhdf5.so. We truncate the hashes to avoid
820 ;; unnecessary store references to those compilers:
821 (substitute* "src/libhdf5.settings"
822 (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
823 (string-append prefix (string-take hash 10) "..."))
824 ;; Don't record the build-time kernel version to make the
825 ;; settings file reproducible.
826 (("Uname information:.*")
827 "Uname information: Linux\n"))
828 #t))
829 (add-after 'install 'patch-references
830 (lambda* (#:key inputs outputs #:allow-other-keys)
831 (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
832 (zlib (assoc-ref inputs "zlib")))
833 (substitute* (find-files bin "h5p?cc")
834 (("-lz" lib)
835 (string-append "-L" zlib "/lib " lib)))
836 #t)))
837 (add-after 'install 'split
838 (lambda* (#:key inputs outputs #:allow-other-keys)
839 ;; Move all fortran-related files
840 (let* ((out (assoc-ref outputs "out"))
841 (bin (string-append out "/bin"))
842 (lib (string-append out "/lib"))
843 (inc (string-append out "/include"))
844 (ex (string-append out "/share/hdf5_examples/fortran"))
845 (fort (assoc-ref outputs "fortran"))
846 (fbin (string-append fort "/bin"))
847 (flib (string-append fort "/lib"))
848 (finc (string-append fort "/include"))
849 (fex (string-append fort "/share/hdf5_examples/fortran")))
850 (mkdir-p fbin)
851 (mkdir-p flib)
852 (mkdir-p finc)
853 (mkdir-p fex)
854 ;; Note: When built with --enable-parallel, the 'h5fc' file
855 ;; doesn't exist, hence this condition.
856 (when (file-exists? (string-append bin "/h5fc"))
857 (rename-file (string-append bin "/h5fc")
858 (string-append fbin "/h5fc")))
859 (for-each (lambda (file)
860 (rename-file file
861 (string-append flib "/" (basename file))))
862 (find-files lib ".*fortran.*"))
863 (for-each (lambda (file)
864 (rename-file file
865 (string-append finc "/" (basename file))))
866 (find-files inc ".*mod"))
867 (for-each (lambda (file)
868 (rename-file file
869 (string-append fex "/" (basename file))))
870 (find-files ex ".*"))
871 (delete-file-recursively ex))
872 #t)))))
873 (home-page "http://www.hdfgroup.org")
874 (synopsis "Management suite for extremely large and complex data")
875 (description "HDF5 is a suite that makes possible the management of
876extremely large and complex data collections.")
877 (license (license:x11-style
878 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
879
880(define-public hdf5-1.10
881 (package (inherit hdf5)
882 (version "1.10.4")
883 (source
884 (origin
885 (method url-fetch)
886 (uri (list (string-append "https://support.hdfgroup.org/ftp/HDF5/releases/"
887 "hdf5-" (version-major+minor version)
888 "/hdf5-" version "/src/hdf5-"
889 version ".tar.bz2")
890 (string-append "https://support.hdfgroup.org/ftp/HDF5/"
891 "current"
892 (apply string-append
893 (take (string-split version #\.) 2))
894 "/src/hdf5-" version ".tar.bz2")))
895 (sha256
896 (base32 "1pr85fa1sh2ky6ai2hs3f21lp252grl2cq3wbyi4rh7dm83gyrqj"))
897 (patches (search-patches "hdf5-config-date.patch"
898 "hdf5-mpi-deprecations.patch"))))))
899
900(define-public hdf-java
901 (package
902 (name "hdf-java")
903 (version "3.3.2")
904 (source
905 (origin
906 (method url-fetch)
907 (uri (string-append
908 "http://www.hdfgroup.org/ftp/HDF5/releases/HDF-JAVA/hdfjni-"
909 version "/src/CMake-hdfjava-" version ".tar.gz"))
910 (sha256
911 (base32 "0m1gp2aspcblqzmpqbdpfp6giskws85ds6p5gz8sx7asyp7wznpr"))
912 (modules '((guix build utils)))
913 (snippet ; Make sure we don't use the bundled sources and binaries.
914 `(begin
915 (for-each delete-file
916 (list "SZip.tar.gz" "ZLib.tar.gz" "JPEG8d.tar.gz"
917 "HDF4.tar.gz" "HDF5.tar.gz"))
918 (delete-file-recursively ,(string-append "hdfjava-" version "/lib"))
919 #t))))
920 (build-system gnu-build-system)
921 (native-inputs
922 `(("jdk" ,icedtea "jdk")
923 ("automake" ,automake) ; For up to date 'config.guess' and 'config.sub'.
924 ;; For tests:
925 ("hamcrest-core" ,java-hamcrest-core)
926 ("junit" ,java-junit)
927 ("slf4j-simple" ,java-slf4j-simple)))
928 (inputs
929 `(("hdf4" ,hdf4)
930 ("hdf5" ,hdf5)
931 ("zlib" ,zlib)
932 ("libjpeg" ,libjpeg)
933 ("slf4j-api" ,java-slf4j-api)))
934 (arguments
935 `(#:configure-flags
936 (list (string-append "--target=" ,(or (%current-target-system) (%current-system)))
937 (string-append "--with-jdk=" (assoc-ref %build-inputs "jdk") "/include,"
938 (assoc-ref %build-inputs "jdk") "/lib" )
939 (string-append "--with-hdf4=" (assoc-ref %build-inputs "hdf4") "/lib")
940 (string-append "--with-hdf5=" (assoc-ref %build-inputs "hdf5") "/lib"))
941
942 #:make-flags
943 (list (string-append "HDFLIB=" (assoc-ref %build-inputs "hdf4") "/lib")
944 (string-append "HDF5LIB=" (assoc-ref %build-inputs "hdf5") "/lib")
945 (string-append "ZLIB=" (assoc-ref %build-inputs "zlib") "/lib/libz.so")
946 (string-append "JPEGLIB="
947 (assoc-ref %build-inputs "libjpeg") "/lib/libjpeg.so")
948 "LLEXT=so")
949
950 #:phases
951 (modify-phases %standard-phases
952 (add-before 'configure 'chdir-to-source
953 (lambda _ (chdir ,(string-append "hdfjava-" version)) #t))
954 (add-before 'configure 'patch-build
955 (lambda* (#:key inputs outputs #:allow-other-keys)
956 (substitute* "configure"
957 (("COPT=\"") "COPT=\"-O2 ") ; CFLAGS is ignored in Makefiles
958 (("/bin/cat") (which "cat")))
959 ;; Set classpath for compilation
960 (substitute* '("hdf/hdf5lib/Makefile.in"
961 "hdf/hdf5lib/exceptions/Makefile.in"
962 "hdf/hdflib/Makefile.in")
963 (("\\$\\(TOP\\)/lib/slf4j-api-1\\.7\\.5\\.jar")
964 (string-append (assoc-ref inputs "slf4j-api")
965 "/share/java/slf4j-api.jar")))
966 ;; Replace outdated config.sub and config.guess:
967 (with-directory-excursion "config"
968 (for-each (lambda (file)
969 (install-file
970 (string-append (assoc-ref inputs "automake")
971 "/share/automake-"
972 ,(version-major+minor (package-version automake))
973 "/" file) "."))
974 '("config.sub" "config.guess")))
975
976 ;; Fix embedded version number
977 (let ((hdf5version (list ,@(string-split (package-version hdf5) #\.))))
978 (substitute* "hdf/hdf5lib/H5.java"
979 (("1, 8, 19")
980 (string-join hdf5version ", "))))
981
982 (mkdir-p (string-append (assoc-ref outputs "out")))
983 ;; Set classpath for tests
984 (let* ((build-dir (getcwd))
985 (lib (string-append build-dir "/lib"))
986 (jhdf (string-append lib "/jhdf.jar"))
987 (jhdf5 (string-append lib "/jhdf5.jar"))
988 (testjars
989 (map (lambda (i)
990 (string-append (assoc-ref inputs i)
991 "/share/java/" i ".jar"))
992 '("junit" "hamcrest-core" "slf4j-api" "slf4j-simple")))
993 (class-path
994 (string-join `("." ,build-dir ,jhdf ,jhdf5 ,@testjars) ":")))
995
996 (substitute* '("test/hdf5lib/Makefile.in"
997 "test/hdf5lib/junit.sh.in"
998 "examples/runExample.sh.in")
999 (("/usr/bin/test")
1000 (string-append (assoc-ref inputs "coreutils")
1001 "/bin/test"))
1002 (("/usr/bin/uname")
1003 (string-append (assoc-ref inputs "coreutils")
1004 "/bin/uname"))
1005 (("CLASSPATH=[^\n]*")
1006 (string-append "CLASSPATH=" class-path)))
1007 (setenv "CLASSPATH" class-path))
1008 #t))
1009 (add-before 'check 'build-examples
1010 (lambda _
1011 (apply invoke `("javac"
1012 ,@(find-files "examples" ".*\\.java"))))))
1013
1014 #:parallel-build? #f
1015
1016 #:parallel-tests? #f ))
1017 (home-page "https://support.hdfgroup.org/products/java")
1018 (synopsis "Java interface for the HDF4 and HDF5 libraries")
1019 (description "Java HDF Interface (JHI) and Java HDF5 Interface (JHI5) use
1020the Java Native Interface to wrap the HDF4 and HDF5 libraries, which are
1021implemented in C.")
1022
1023 ;; BSD-style license:
1024 (license (license:x11-style
1025 "https://support.hdfgroup.org/ftp/HDF5/hdf-java\
1026/current/src/unpacked/COPYING"))))
1027
1028(define-public hdf-eos2
1029 (package
1030 (name "hdf-eos2")
1031 (version "19.1.0")
1032 (source
1033 (origin
1034 (method url-fetch)
1035 (uri "ftp://edhs1.gsfc.nasa.gov\
1036/edhs/hdfeos/latest_release/HDF-EOS2.19v1.00.tar.Z")
1037 (sha256
1038 (base32 "0c9fcz25s292ldap12wxmlrvnyz99z24p63d8fwx51bf8s0s1zrz"))
1039 (patches (search-patches "hdf-eos2-remove-gctp.patch"
1040 "hdf-eos2-build-shared.patch"
1041 "hdf-eos2-fortrantests.patch"))))
1042 (build-system gnu-build-system)
1043 (native-inputs
1044 `(("gfortran" ,gfortran)))
1045 (inputs
1046 `(("hdf4" ,hdf4-alt) ; assume most HDF-EOS2 users won't use the HDF4 netCDF API
1047 ("zlib" ,zlib)
1048 ("libjpeg" ,libjpeg)
1049 ("gctp" ,gctp)))
1050 (arguments
1051 `( #:configure-flags '("--enable-install-include" "--enable-shared"
1052 "CC=h4cc -Df2cFortran" "LIBS=-lgctp")
1053 #:parallel-tests? #f))
1054 (home-page "http://hdfeos.org/software/library.php#HDF-EOS2")
1055 (synopsis "HDF4-based data format for NASA's Earth Observing System")
1056 (description "HDF-EOS2 is a software library built on HDF4 which supports
1057the construction of data structures used in NASA's Earth Observing
1058System (Grid, Point and Swath).")
1059
1060 ;; Source files carry a permissive license header.
1061 (license (license:non-copyleft home-page))))
1062
1063(define-public hdf-eos5
1064 (package
1065 (name "hdf-eos5")
1066 (version "1.15")
1067 (source (origin
1068 (method url-fetch)
1069 (uri (string-append "ftp://edhs1.gsfc.nasa.gov\
1070/edhs/hdfeos5/latest_release/HDF-EOS5." version ".tar.Z"))
1071 (sha256
1072 (base32
1073 "1p83333nzzy8rn5chxlm0hrkjjnhh2w1ji8ac0f9q4xzg838i58i"))
1074 (patches (search-patches "hdf-eos5-build-shared.patch"
1075 "hdf-eos5-remove-gctp.patch"
1076 "hdf-eos5-fix-szip.patch"
1077 "hdf-eos5-fortrantests.patch"))))
1078 (native-inputs
1079 `(("gfortran" ,gfortran)))
1080 (build-system gnu-build-system)
1081 (inputs
1082 `(("hdf5" ,hdf5)
1083 ("zlib" ,zlib)
1084 ("gctp" ,gctp)))
1085 (arguments
1086 `(#:configure-flags '("--enable-install-include" "--enable-shared"
1087 "CC=h5cc -Df2cFortran" "LIBS=-lgctp")
1088 #:parallel-tests? #f))
1089 (synopsis "HDF5-based data format for NASA's Earth Observing System")
1090 (description
1091 "HDF-EOS5 is a software library built on HDF5 to support the construction
1092of data structures used in NASA's Earth Observing System (Grid, Point and
1093Swath).")
1094 (home-page "http://www.hdfeos.org/software/library.php#HDF-EOS5")
1095
1096 ;; Source files carry a permissive license header.
1097 (license (license:non-copyleft home-page))))
1098
1099(define-public hdf5-parallel-openmpi
1100 (package (inherit hdf5)
1101 (name "hdf5-parallel-openmpi")
1102 (inputs
1103 `(("mpi" ,openmpi)
1104 ,@(package-inputs hdf5)))
1105 (arguments
1106 (substitute-keyword-arguments (package-arguments hdf5)
1107 ((#:configure-flags flags)
1108 ``("--enable-parallel"
1109 ,@(delete "--enable-cxx"
1110 (delete "--enable-threadsafe" ,flags))))
1111 ((#:phases phases)
1112 `(modify-phases ,phases
1113 (add-after 'build 'mpi-setup
1114 ,%openmpi-setup)
1115 (add-before 'check 'patch-tests
1116 (lambda _
1117 ;; OpenMPI's mpirun will exit with non-zero status if it
1118 ;; detects an "abnormal termination", i.e. any process not
1119 ;; calling MPI_Finalize(). Since the test is explicitly
1120 ;; avoiding MPI_Finalize so as not to have at_exit and thus
1121 ;; H5C_flush_cache from being called, mpirun will always
1122 ;; complain, so turn this test off.
1123 (substitute* "testpar/Makefile"
1124 (("(^TEST_PROG_PARA.*)t_pflush1(.*)" front back)
1125 (string-append front back "\n")))
1126 (substitute* "tools/h5diff/testph5diff.sh"
1127 (("/bin/sh") (which "sh")))
1128 #t))))))
1129 (synopsis "Management suite for data with parallel IO support")))
1130
1131(define-public h5check
1132 (package
1133 (name "h5check")
1134 (version "2.0.1")
1135 (source
1136 (origin
1137 (method url-fetch)
1138 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/tools/"
1139 "h5check/src/h5check-" version ".tar.gz"))
1140 (sha256
1141 (base32
1142 "1gm76jbwhz9adbxgn14zx8cj33dmjdr2g5xcy0m9c2gakp8w59kj"))))
1143 (build-system gnu-build-system)
1144 (inputs `(("hdf5" ,hdf5))) ;h5cc for tests
1145 (home-page "https://www.hdfgroup.org/products/hdf5_tools/h5check.html")
1146 (synopsis "HDF5 format checker")
1147 (description "@code{h5check} is a validation tool for verifying that an
1148HDF5 file is encoded according to the HDF File Format Specification.")
1149 (license (license:x11-style "file://COPYING"))))
1150
1151(define-public itpp
1152 (package
1153 (name "itpp")
1154 (version "4.3.1")
1155 (source (origin
1156 (method url-fetch)
1157 (uri (string-append "mirror://sourceforge/itpp/itpp/"
1158 version "/itpp-"
1159 version ".tar.gz"))
1160 (sha256
1161 (base32
1162 "14ddy2xnb6sgp4hiax9v5sv4pr4l4dd4ps76nfha3nrpr1ikhcqm"))))
1163 (build-system cmake-build-system)
1164 (arguments `(#:tests? #f)) ; Tests require googletest *sources*
1165 (inputs `(("lapack" ,lapack)
1166 ("fftw" ,fftw)))
1167 ;; FIXME: Even though the fonts are available dvips complains:
1168 ;; "Font cmmi10 not found; characters will be left blank."
1169 (native-inputs
1170 `(("texlive" ,texlive-tiny)
1171 ("ghostscript" ,ghostscript)
1172 ("doxygen" ,doxygen)))
1173 (home-page "http://itpp.sourceforge.net")
1174 (synopsis "C++ library of maths, signal processing and communication classes")
1175 (description "IT++ is a C++ library of mathematical, signal processing and
1176communication classes and functions. Its main use is in simulation of
1177communication systems and for performing research in the area of
1178communications. The kernel of the library consists of generic vector and
1179matrix classes, and a set of accompanying routines. Such a kernel makes IT++
1180similar to MATLAB, GNU Octave or SciPy.")
1181 (license license:gpl3+)))
1182
1183(define-public netcdf
1184 (package
1185 (name "netcdf")
1186 (version "4.4.1.1")
1187 (source
1188 (origin
1189 (method url-fetch)
1190 (uri (string-append "ftp://ftp.unidata.ucar.edu/pub/netcdf/"
1191 "netcdf-" version ".tar.gz"))
1192 (sha256
1193 (base32
1194 "1blc7ik5yin7i0ls2kag0a9xjk12m0dzx6v1x88az3ras3scci2d"))
1195 (patches (search-patches "netcdf-date-time.patch"
1196 "netcdf-tst_h_par.patch"))))
1197 (build-system gnu-build-system)
1198 (native-inputs
1199 `(("m4" ,m4)
1200 ("doxygen" ,doxygen)
1201 ("graphviz" ,graphviz)))
1202 (inputs
1203 `(("hdf4" ,hdf4-alt)
1204 ("hdf5" ,hdf5)
1205 ("zlib" ,zlib)
1206 ("libjpeg" ,libjpeg)))
1207 (arguments
1208 `(#:configure-flags '("--enable-doxygen" "--enable-dot" "--enable-hdf4")
1209
1210 #:phases (modify-phases %standard-phases
1211 (add-before 'configure 'fix-source-date
1212 (lambda _
1213 ;; As we ${SOURCE_DATE_EPOCH} evaluates to "1" in the build
1214 ;; environment, `date -u -d ${SOURCE_DATE_EPOCH}` will evaluate
1215 ;; to '1st hour of the current day', and therefore makes the
1216 ;; package not reproducible.
1217 (substitute* "./configure"
1218 (("date -u -d \"\\$\\{SOURCE_DATE_EPOCH\\}\"")
1219 "date --date='@0'"))
1220 #t))
1221 (add-after 'configure 'patch-settings
1222 (lambda _
1223 ;; libnetcdf.settings contains the full filename of the compilers
1224 ;; used to build the library. We truncate the hashes of those
1225 ;; filenames to avoid unnecessary references to the corresponding
1226 ;; store items.
1227 (substitute* "libnetcdf.settings"
1228 (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
1229 (string-append prefix (string-take hash 10) "...")))
1230 #t)))
1231
1232 #:parallel-tests? #f)) ;various race conditions
1233 (home-page "http://www.unidata.ucar.edu/software/netcdf/")
1234 (synopsis "Library for scientific data")
1235 (description "NetCDF is an interface for scientific data access and a
1236software library that provides an implementation of the interface. The netCDF
1237library defines a machine-independent format for representing scientific data.
1238Together, the interface, library, and format support the creation, access, and
1239sharing of scientific data.")
1240 (license (license:x11-style "file://COPYRIGHT"))))
1241
1242(define-public netcdf-parallel-openmpi
1243 (package (inherit netcdf)
1244 (name "netcdf-parallel-openmpi")
1245 (inputs
1246 `(("mpi" ,openmpi)
1247 ,@(alist-replace "hdf5" (list hdf5-parallel-openmpi)
1248 (package-inputs netcdf))))
1249 ;; TODO: Replace pkg-config references in nc-config with absolute references
1250 (arguments
1251 (substitute-keyword-arguments (package-arguments netcdf)
1252 ((#:configure-flags flags)
1253 `(cons* "CC=mpicc" "CXX=mpicxx"
1254 "--enable-parallel-tests"
1255 ;; Shared libraries not supported with parallel IO.
1256 "--disable-shared" "--with-pic"
1257 ,flags))))))
1258
1259(define-public netcdf-fortran
1260 (package
1261 (name "netcdf-fortran")
1262 (version "4.4.4")
1263 (source (origin
1264 (method url-fetch)
1265 (uri (string-append
1266 "ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-fortran-"
1267 version ".tar.gz"))
1268 (sha256
1269 (base32
1270 "0xaxdcg1p83zmypwml3swsnr3ccn38inwldyr1l3wa4dbwbrblxj"))))
1271 (build-system gnu-build-system)
1272 (arguments
1273 `(#:parallel-tests? #f))
1274 (inputs
1275 `(("netcdf" ,netcdf)))
1276 (native-inputs
1277 `(("gfortran" ,gfortran)))
1278 (synopsis "Fortran interface for the netCDF library")
1279 (description (package-description netcdf))
1280 (home-page (package-home-page netcdf))
1281 (license (package-license netcdf))))
1282
1283(define-public nlopt
1284 (package
1285 (name "nlopt")
1286 (version "2.4.2")
1287 (source (origin
1288 (method url-fetch)
1289 (uri (string-append "http://ab-initio.mit.edu/nlopt/nlopt-"
1290 version ".tar.gz"))
1291 (sha256
1292 (base32 "12cfkkhcdf4zmb6h7y6qvvdvqjs2xf9sjpa3rl3bq76px4yn76c0"))))
1293 (build-system gnu-build-system)
1294 (arguments
1295 `(;; Shared libraries are not built by default. They are required to
1296 ;; build the Guile, Octave, and Python bindings.
1297 #:configure-flags '("--enable-shared")
1298
1299 #:phases
1300 (modify-phases %standard-phases
1301 (add-before 'configure 'set-libnlopt-file-name
1302 (lambda* (#:key outputs #:allow-other-keys)
1303 ;; Make sure the Scheme module refers to the library by its
1304 ;; absolute file name (we cannot do that from a snippet
1305 ;; because the expansion of @libdir@ contains
1306 ;; ${exec_prefix}.)
1307 (let ((out (assoc-ref outputs "out")))
1308 (substitute* "swig/nlopt.scm.in"
1309 (("libnlopt")
1310 (string-append out "/lib/libnlopt")))
1311 #t))))))
1312 (inputs `(("guile" ,guile-2.0)))
1313 (native-inputs `(("pkg-config" ,pkg-config)))
1314 (home-page "http://ab-initio.mit.edu/wiki/")
1315 (synopsis "Library for nonlinear optimization")
1316 (description "NLopt is a library for nonlinear optimization, providing a
1317common interface for a number of different free optimization routines available
1318online as well as original implementations of various other algorithms.")
1319 (license license:lgpl2.1+)))
1320
1321(define-public ipopt
1322 (package
1323 (name "ipopt")
1324 (version "3.12.12")
1325 (source (origin
1326 (method url-fetch)
1327 (uri (string-append
1328 "http://www.coin-or.org/download/source/Ipopt/Ipopt-"
1329 version".tgz"))
1330 (sha256
1331 (base32
1332 "07yn9rzdswjk8n246qq6ci9ssf2bcplkifcpsfz9j6cdxw9vgbkv"))
1333 (modules '((guix build utils)))
1334 (snippet
1335 ;; Make sure we don't use the bundled software.
1336 '(begin
1337 (delete-file-recursively "ThirdParty")
1338 #t))))
1339 (build-system gnu-build-system)
1340 (arguments
1341 '(#:phases (modify-phases %standard-phases
1342 (add-after 'install 'add--L-flags-in-ipopt.pc
1343 (lambda* (#:key inputs outputs #:allow-other-keys)
1344 ;; The '.pc' file lists '-llapack -lblas' in "Libs";
1345 ;; move it to "Libs.private" where it belongs, and add a
1346 ;; '-L' flag for LAPACK.
1347 (let ((out (assoc-ref outputs "out"))
1348 (lapack (assoc-ref inputs "lapack")))
1349 (substitute* (string-append out "/lib/pkgconfig/"
1350 "ipopt.pc")
1351 (("Libs: (.*)-llapack -lblas(.*)$" _ before after)
1352 (string-append "Libs: " before " " after "\n"
1353 "Libs.private: " before
1354 "-L" lapack "/lib -llapack -lblas "
1355 after "\n")))
1356 #t))))))
1357 (native-inputs
1358 `(("gfortran" ,gfortran)))
1359 (inputs
1360 ;; TODO: Maybe add dependency on COIN-MUMPS, ASL, and HSL.
1361 `(("lapack" ,lapack))) ;for both libblas and liblapack
1362 (home-page "http://www.coin-or.org")
1363 (synopsis "Large-scale nonlinear optimizer")
1364 (description
1365 "The Interior Point Optimizer (IPOPT) is a software package for
1366large-scale nonlinear optimization. It provides C++, C, and Fortran
1367interfaces.")
1368 (license license:epl1.0)))
1369
1370(define-public clp
1371 (package
1372 (name "clp")
1373 (version "1.17.1")
1374 (source (origin
1375 (method url-fetch)
1376 (uri (string-append "https://www.coin-or.org/download/source/"
1377 "Clp/Clp-" version ".tgz"))
1378 (sha256
1379 (base32
1380 "1wdg820g3iikf9344ijwsc8sy6c0m6im42bzzizm6rlmkvnmxhk9"))
1381 (modules '((guix build utils)))
1382 (snippet
1383 ;; Make sure we don't use the bundled software.
1384 '(begin
1385 (delete-file-recursively "ThirdParty")
1386 #t))))
1387 (build-system gnu-build-system)
1388 (native-inputs
1389 `(("gfortran" ,gfortran)
1390 ("pkg-config" ,pkg-config)))
1391 (inputs
1392 `(("openblas" ,openblas)))
1393 (home-page "https://www.coin-or.org")
1394 (synopsis "Linear programming solver")
1395 (description
1396 "CLP is a high quality linear programming solver. Its main strengths are
1397its dual and primal Simplex algorithms. It also has a barrier algorithm for
1398linear and quadratic objectives. There are limited facilities for nonlinear
1399and quadratic objectives using the Simplex algorithm.")
1400 (license license:epl1.0)))
1401
1402(define-public ceres
1403 (package
1404 (name "ceres-solver")
1405 (version "1.14.0")
1406 (home-page "http://ceres-solver.org/")
1407 (source (origin
1408 (method url-fetch)
1409 (uri (string-append home-page "ceres-solver-"
1410 version ".tar.gz"))
1411 (sha256
1412 (base32
1413 "13lfxy8x58w8vprr0nkbzziaijlh0vvqshgahvcgw0mrqdgh0i27"))))
1414 (build-system cmake-build-system)
1415 (arguments
1416 ;; TODO: Build HTML user documentation and install separately.
1417 '(#:configure-flags '("-DBUILD_EXAMPLES=OFF"
1418 "-DBUILD_SHARED_LIBS=ON")
1419
1420 #:phases (modify-phases %standard-phases
1421 (add-before 'configure 'set-library-directory
1422 (lambda _
1423 ;; Install libraries to lib/, not lib64/.
1424 (substitute* "internal/ceres/CMakeLists.txt"
1425 (("set\\(LIB_SUFFIX \"64\"\\)")
1426 "set(LIB_SUFFIX \"\")"))
1427 #t)))))
1428 (native-inputs
1429 `(("pkg-config" ,pkg-config)))
1430 (propagated-inputs
1431 `(("glog" ,glog))) ;for #include <glog/glog.h>
1432 (inputs
1433 `(("eigen" ,eigen)
1434 ("blas" ,openblas)
1435 ("lapack" ,lapack)
1436 ("suitesparse" ,suitesparse)
1437 ("gflags" ,gflags)))
1438 (synopsis "C++ library for solving large optimization problems")
1439 (description
1440 "Ceres Solver is a C++ library for modeling and solving large,
1441complicated optimization problems. It is a feature rich, mature and
1442performant library which has been used in production since 2010. Ceres Solver
1443can solve two kinds of problems:
1444@enumerate
1445@item non-linear least squares problems with bounds constraints;
1446@item general unconstrained optimization problems.
1447@end enumerate\n")
1448 (license license:bsd-3)))
1449
1450;; For a fully featured Octave, users are strongly recommended also to install
1451;; the following packages: less, ghostscript, gnuplot.
1452(define-public octave-cli
1453 (package
1454 (name "octave-cli")
1455 (version "5.1.0")
1456 (source
1457 (origin
1458 (method url-fetch)
1459 (uri (string-append "mirror://gnu/octave/octave-"
1460 version ".tar.lz"))
1461 (sha256
1462 (base32
1463 "11wwxpy2q1bhxs2v41bqn05i2sb0905cj1xil6mg8l4k2kka4cq6"))))
1464 (build-system gnu-build-system)
1465 (inputs
1466 `(("lapack" ,lapack)
1467 ("qhull" ,qhull)
1468 ("readline" ,readline)
1469 ("gl2ps" ,gl2ps)
1470 ("glpk" ,glpk)
1471 ("fftw" ,fftw)
1472 ("fftwf" ,fftwf)
1473 ("arpack" ,arpack-ng)
1474 ("pcre" ,pcre)
1475 ("fltk" ,fltk)
1476 ("fontconfig" ,fontconfig)
1477 ("freetype" ,freetype)
1478 ("hdf5" ,hdf5)
1479 ("libxft" ,libxft)
1480 ("mesa" ,mesa)
1481 ("glu" ,glu)
1482 ("zlib" ,zlib)
1483 ("curl" ,curl)
1484 ("texinfo" ,texinfo)
1485 ("graphicsmagick" ,graphicsmagick)
1486 ("suitesparse" ,suitesparse)
1487 ("libsndfile" ,libsndfile)
1488 ("portaudio" ,portaudio)
1489 ("alsa-lib" ,alsa-lib)))
1490 (native-inputs
1491 `(("lzip" ,lzip)
1492 ("gfortran" ,gfortran)
1493 ("pkg-config" ,pkg-config)
1494 ("perl" ,perl)
1495 ;; The following inputs are not actually used in the build process.
1496 ;; However, the ./configure gratuitously tests for their existence and
1497 ;; assumes that programs not present at build time are also not, and
1498 ;; can never be, available at run time! If these inputs are therefore
1499 ;; not present, support for them will be built out. However, Octave
1500 ;; will still run without them, albeit without the features they
1501 ;; provide.
1502 ("less" ,less)
1503 ("ghostscript" ,ghostscript)
1504 ("gnuplot" ,gnuplot)))
1505 ;; Octave code uses this variable to detect directories holding multiple CA
1506 ;; certificates to verify peers with. This is required for the networking
1507 ;; functions that require encryption to work properly.
1508 (native-search-paths
1509 (list (search-path-specification
1510 (variable "CURLOPT_CAPATH")
1511 (files '("etc/ssl/certs")))))
1512 (arguments
1513 `(#:configure-flags
1514 (list (string-append "--with-shell="
1515 (assoc-ref %build-inputs "bash")
1516 "/bin/sh"))
1517 #:phases
1518 (modify-phases %standard-phases
1519 (add-after 'configure 'configure-makeinfo
1520 (lambda* (#:key inputs #:allow-other-keys)
1521 (substitute* "libinterp/corefcn/help.h"
1522 (("\"makeinfo\"")
1523 (string-append
1524 "\"" (assoc-ref inputs "texinfo") "/bin/makeinfo\"")))
1525 #t)))))
1526 (home-page "https://www.gnu.org/software/octave/")
1527 (synopsis "High-level language for numerical computation")
1528 (description "GNU Octave is a high-level interpreted language that is
1529specialized for numerical computations. It can be used for both linear and
1530non-linear applications and it provides great support for visualizing results.
1531Work may be performed both at the interactive command-line as well as via
1532script files.")
1533 (license license:gpl3+)))
1534
1535(define-public octave
1536 (package (inherit octave-cli)
1537 (name "octave")
1538 (source (origin
1539 (inherit (package-source octave-cli))))
1540 (inputs
1541 `(("qscintilla" ,qscintilla)
1542 ("qt" ,qtbase)
1543 ,@(package-inputs octave-cli)))
1544 (native-inputs
1545 `(("qttools" , qttools) ;for lrelease
1546 ("texlive" ,texlive) ;for texi2dvi
1547 ,@(package-native-inputs octave-cli)))
1548 (arguments
1549 (substitute-keyword-arguments (package-arguments octave-cli)
1550 ((#:phases phases)
1551 `(modify-phases ,phases
1552 (add-before 'configure 'patch-qscintilla-library-name
1553 (lambda* (#:key inputs #:allow-other-keys)
1554 ;; The QScintilla library that the Octave configure script tries
1555 ;; to link with should be named libqscintilla-qt5.so, but the
1556 ;; QScintilla input provides the shared library as
1557 ;; libqscintilla2_qt5.so.
1558 (substitute* "configure"
1559 (("qscintilla2-qt5")
1560 "qscintilla2_qt5"))
1561 #t))))))))
1562
1563(define-public qtoctave
1564 (deprecated-package "qtoctave" octave))
1565
1566(define-public opencascade-oce
1567 (package
1568 (name "opencascade-oce")
1569 (version "0.17.2")
1570 (source
1571 (origin
1572 (method git-fetch)
1573 (uri (git-reference
1574 (url "https://github.com/tpaviot/oce.git")
1575 (commit (string-append "OCE-" version))))
1576 (file-name (git-file-name name version))
1577 (patches (search-patches "opencascade-oce-glibc-2.26.patch"))
1578 (sha256
1579 (base32 "0rg5wzkvfmzfl6v2amyryb8dnjad0nn9kyr607wy2gch6rciah69"))))
1580 (build-system cmake-build-system)
1581 (arguments
1582 '(#:configure-flags
1583 (list "-DOCE_TESTING:BOOL=ON"
1584 "-DOCE_USE_TCL_TEST_FRAMEWORK:BOOL=ON"
1585 "-DOCE_DRAW:BOOL=ON"
1586 (string-append "-DOCE_INSTALL_PREFIX:PATH="
1587 (assoc-ref %outputs "out"))
1588 "-UCMAKE_INSTALL_RPATH")))
1589 (inputs
1590 `(("freetype" ,freetype)
1591 ("glu" ,glu)
1592 ("libxmu" ,libxmu)
1593 ("mesa" ,mesa)
1594 ("tcl" ,tcl)
1595 ("tk" ,tk)))
1596 (native-inputs
1597 `(("python" ,python-wrapper)))
1598 (home-page "https://github.com/tpaviot/oce")
1599 (synopsis "Libraries for 3D modeling and numerical simulation")
1600 (description
1601 "Open CASCADE is a set of libraries for the development of applications
1602dealing with 3D CAD data or requiring industrial 3D capabilities. It includes
1603C++ class libraries providing services for 3D surface and solid modeling, CAD
1604data exchange, and visualization. It is used for development of specialized
1605software dealing with 3D models in design (CAD), manufacturing (CAM),
1606numerical simulation (CAE), measurement equipment (CMM), and quality
1607control (CAQ) domains.
1608
1609This is the ``Community Edition'' (OCE) of Open CASCADE, which gathers
1610patches, improvements, and experiments contributed by users over the official
1611Open CASCADE library.")
1612 (license (list license:lgpl2.1; OCE libraries, with an exception for the
1613 ; use of header files; see
1614 ; OCCT_LGPL_EXCEPTION.txt
1615 license:public-domain; files
1616 ; src/Standard/Standard_StdAllocator.hxx and
1617 ; src/NCollection/NCollection_StdAllocator.hxx
1618 license:expat; file src/OpenGl/OpenGl_glext.h
1619 license:bsd-3)))); test framework gtest
1620
1621(define-public gmsh
1622 (package
1623 (name "gmsh")
1624 (version "2.16.0")
1625 (source
1626 (origin
1627 (method url-fetch)
1628 (uri (string-append "http://gmsh.info/src/gmsh-"
1629 version "-source.tgz"))
1630 (sha256
1631 (base32 "1slf0bfkwrcgn6296wb4qhbk4ahz6i4wfb10hnim08x05vrylag8"))
1632 (modules '((guix build utils)))
1633 (snippet
1634 ;; Remove non-free METIS code
1635 '(begin
1636 (delete-file-recursively "contrib/Metis")
1637 #t))))
1638 (build-system cmake-build-system)
1639 (propagated-inputs
1640 `(("fltk" ,fltk)
1641 ("gfortran" ,gfortran)
1642 ("gmp" ,gmp)
1643 ("hdf5" ,hdf5)
1644 ("lapack" ,lapack)
1645 ("mesa" ,mesa)
1646 ("glu" ,glu)
1647 ("opencascade-oce" ,opencascade-oce)
1648 ("libx11" ,libx11)
1649 ("libxext" ,libxext)))
1650 (inputs
1651 `(("fontconfig" ,fontconfig)
1652 ("libxft" ,libxft)))
1653 (arguments
1654 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
1655 "-DENABLE_BUILD_SHARED:BOOL=ON"
1656 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")))
1657 (home-page "http://www.geuz.org/gmsh/")
1658 (synopsis "3D finite element grid generator")
1659 (description "Gmsh is a 3D finite element grid generator with a built-in
1660CAD engine and post-processor. Its design goal is to provide a fast, light
1661and user-friendly meshing tool with parametric input and advanced
1662visualization capabilities. Gmsh is built around four modules: geometry,
1663mesh, solver and post-processing. The specification of any input to these
1664modules is done either interactively using the graphical user interface or in
1665ASCII text files using Gmsh's own scripting language.")
1666 (license license:gpl2+)))
1667
1668(define-public maxflow
1669 (package
1670 (name "maxflow")
1671 (version "3.04")
1672 (source (origin
1673 (method git-fetch)
1674 (uri (git-reference
1675 (url "https://github.com/gerddie/maxflow.git")
1676 (commit "42401fa54823d16b9da47716f04e5d9ef1605875")))
1677 (file-name (string-append name "-" version "-checkout"))
1678 (sha256
1679 (base32
1680 "0rll38whw55h0vcjrrwdnh9ascvxby0ph7n1l0d12z17cg215kkb"))))
1681 (build-system cmake-build-system)
1682 (home-page "http://pub.ist.ac.at/~vnk/software.html")
1683 (synopsis "Library implementing Maxflow algorithm")
1684 (description "An implementation of the maxflow algorithm described in
1685@cite{An Experimental Comparison of Min-Cut/Max-Flow Algorithms for
1686Energy Minimization in Computer Vision.\n
1687Yuri Boykov and Vladimir Kolmogorov.\n
1688In IEEE Transactions on Pattern Analysis and Machine Intelligence,\n
1689September 2004}")
1690 (license license:gpl3+)))
1691
1692(define-public petsc
1693 (package
1694 (name "petsc")
1695 (version "3.11.2")
1696 (source
1697 (origin
1698 (method url-fetch)
1699 ;; The *-lite-* tarball does not contain the *large* documentation
1700 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
1701 "petsc-lite-" version ".tar.gz"))
1702 (sha256
1703 (base32 "1645nwwcp9bcnfnxikk480mhbbacdvhsay2c401818hk97dqj5nx"))))
1704 (outputs '("out" ; libraries and headers
1705 "examples")) ; ~30MiB of examples
1706 (build-system gnu-build-system)
1707 (native-inputs
1708 `(("python" ,python-2)))
1709 (inputs
1710 `(("gfortran" ,gfortran)
1711 ("lapack" ,lapack)
1712 ("superlu" ,superlu)
1713 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
1714 ;; leaving out opengl, as configuration seems to only be for mac
1715 ))
1716 (arguments
1717 `(#:test-target "test"
1718 #:parallel-build? #f ; build is parallel by default
1719 #:configure-flags
1720 `("--with-mpi=0"
1721 "--with-openmp=1"
1722 "--with-superlu=1")
1723 #:make-flags
1724 ;; Honor (parallel-job-count) for build. Do not use --with-make-np,
1725 ;; whose value is dumped to $out/lib/petsc/conf/petscvariables.
1726 (list (format #f "MAKE_NP=~a" (parallel-job-count)))
1727 #:phases
1728 (modify-phases %standard-phases
1729 (replace 'configure
1730 ;; PETSc's configure script is actually a python script, so we can't
1731 ;; run it with bash.
1732 (lambda* (#:key outputs (configure-flags '())
1733 #:allow-other-keys)
1734 (let* ((prefix (assoc-ref outputs "out"))
1735 (flags `(,(string-append "--prefix=" prefix)
1736 ,@configure-flags)))
1737 (format #t "build directory: ~s~%" (getcwd))
1738 (format #t "configure flags: ~s~%" flags)
1739 (apply invoke "./configure" flags))))
1740 (add-after 'configure 'clean-local-references
1741 (lambda* (#:key outputs #:allow-other-keys)
1742 (let ((out (assoc-ref outputs "out")))
1743 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
1744 ;; Prevent build directory from leaking into compiled code
1745 (((getcwd)) out)
1746 ;; Scrub timestamp for reproducibility
1747 ((".*Libraries compiled on.*") ""))
1748 (substitute* (find-files "." "petscvariables")
1749 ;; Do not expose build machine characteristics, set to defaults.
1750 (("MAKE_NP = [:digit:]+") "MAKE_NP = 2")
1751 (("NPMAX = [:digit:]+") "NPMAX = 2"))
1752 #t)))
1753 (add-after 'install 'clean-install
1754 ;; Try to keep installed files from leaking build directory names.
1755 (lambda* (#:key inputs outputs #:allow-other-keys)
1756 (let ((out (assoc-ref outputs "out")))
1757 (substitute* (map (lambda (file)
1758 (string-append out "/lib/petsc/conf/" file))
1759 '("petscvariables"))
1760 (((getcwd)) out))
1761 ;; Make compiler references point to the store
1762 (substitute* (string-append out "/lib/petsc/conf/petscvariables")
1763 (("= (gcc|g\\+\\+|gfortran)" _ compiler)
1764 (string-append "= " (which compiler))))
1765 ;; PETSc installs some build logs, which aren't necessary.
1766 (for-each (lambda (file)
1767 (let ((f (string-append out "/lib/petsc/conf/" file)))
1768 (when (file-exists? f)
1769 (delete-file f))))
1770 '("configure.log" "make.log" "gmake.log"
1771 "test.log" "error.log" "RDict.db"
1772 "PETScBuildInternal.cmake"
1773 ;; Once installed, should uninstall with Guix
1774 "uninstall.py"))
1775 #t)))
1776 (add-after 'install 'move-examples
1777 (lambda* (#:key outputs #:allow-other-keys)
1778 (let* ((out (assoc-ref outputs "out"))
1779 (examples (assoc-ref outputs "examples"))
1780 (exdir (string-append out "/share/petsc/examples"))
1781 (exdir' (string-append examples "/share/petsc/examples")))
1782 (copy-recursively exdir exdir')
1783 (delete-file-recursively exdir)
1784 #t))))))
1785 (home-page "http://www.mcs.anl.gov/petsc")
1786 (synopsis "Library to solve PDEs")
1787 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
1788data structures and routines for the scalable (parallel) solution of
1789scientific applications modeled by partial differential equations.")
1790 (license (license:non-copyleft
1791 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
1792
1793(define-public petsc-complex
1794 (package (inherit petsc)
1795 (name "petsc-complex")
1796 (arguments
1797 (substitute-keyword-arguments (package-arguments petsc)
1798 ((#:configure-flags cf)
1799 `(cons "--with-scalar-type=complex" ,cf))))
1800 (synopsis "Library to solve PDEs (with complex scalars)")))
1801
1802(define-public petsc-openmpi
1803 (package (inherit petsc)
1804 (name "petsc-openmpi")
1805 (inputs
1806 `(("hdf5" ,hdf5-parallel-openmpi)
1807 ("hypre" ,hypre-openmpi)
1808 ("metis" ,metis)
1809 ("mumps" ,mumps-openmpi)
1810 ("openmpi" ,openmpi)
1811 ("scalapack" ,scalapack)
1812 ("scotch" ,pt-scotch32)
1813 ,@(package-inputs petsc)))
1814 (arguments
1815 (substitute-keyword-arguments (package-arguments petsc)
1816 ((#:configure-flags cf)
1817 ``("--with-hypre=1"
1818 "--with-mpiexec=mpirun"
1819 "--with-metis=1"
1820 "--with-mumps=1"
1821 "--with-scalapack=1"
1822 "--with-ptscotch=1"
1823 ,(string-append "--with-mpi-dir="
1824 (assoc-ref %build-inputs "openmpi"))
1825 ,(string-append "--with-hdf5-include="
1826 (assoc-ref %build-inputs "hdf5") "/include")
1827 ,(string-append "--with-hdf5-lib="
1828 (assoc-ref %build-inputs "hdf5") "/lib/libhdf5.a")
1829 ,@(delete "--with-mpi=0" ,cf)))
1830 ((#:phases phases)
1831 `(modify-phases ,phases
1832 (add-before 'configure 'mpi-setup
1833 ,%openmpi-setup)))))
1834 (synopsis "Library to solve PDEs (with MUMPS and MPI support)")))
1835
1836(define-public petsc-complex-openmpi
1837 (package (inherit petsc-complex)
1838 (name "petsc-complex-openmpi")
1839 (inputs
1840 `(("openmpi" ,openmpi)
1841 ,@(package-inputs petsc-complex)))
1842 (arguments
1843 (substitute-keyword-arguments (package-arguments petsc-complex)
1844 ((#:configure-flags cf)
1845 ``("--with-mpiexec=mpirun"
1846 ,(string-append "--with-mpi-dir="
1847 (assoc-ref %build-inputs "openmpi"))
1848 ,@(delete "--with-mpi=0" ,cf)))
1849 ((#:phases phases)
1850 `(modify-phases ,phases
1851 (add-before 'configure 'mpi-setup
1852 ,%openmpi-setup)))))
1853 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
1854
1855(define-public python-petsc4py
1856 (package
1857 (name "python-petsc4py")
1858 (version "3.10.1")
1859 (source
1860 (origin
1861 (method url-fetch)
1862 (uri (pypi-uri "petsc4py" version))
1863 (sha256
1864 (base32
1865 "094hcnran0r2z1wlvmjswsz3ski1m9kqrl5l0ax8jjhnk55x0flh"))))
1866 (build-system python-build-system)
1867 (arguments
1868 `(#:phases
1869 (modify-phases %standard-phases
1870 (add-before 'build 'pre-build
1871 (lambda _
1872 ;; Define path to PETSc installation.
1873 (setenv "PETSC_DIR" (assoc-ref %build-inputs "petsc"))
1874 #t))
1875 (add-before 'check 'mpi-setup
1876 ,%openmpi-setup))))
1877 (inputs
1878 `(("petsc" ,petsc-openmpi)
1879 ("python-numpy" ,python-numpy)))
1880 (home-page "https://bitbucket.org/petsc/petsc4py/")
1881 (synopsis "Python bindings for PETSc")
1882 (description "PETSc, the Portable, Extensible Toolkit for
1883Scientific Computation, is a suite of data structures and routines for
1884the scalable (parallel) solution of scientific applications modeled by
1885partial differential equations. It employs the MPI standard for all
1886message-passing communication. @code{petsc4py} provides Python
1887bindings to almost all functions of PETSc.")
1888 (license license:bsd-3)))
1889
1890(define-public python-kiwisolver
1891 (package
1892 (name "python-kiwisolver")
1893 (version "1.0.1")
1894 (source (origin
1895 (method url-fetch)
1896 (uri (pypi-uri "kiwisolver" version))
1897 (sha256
1898 (base32
1899 "0y22ci86znwwwfhbmvbgdfnbi6lv5gv2xkdlxvjw7lml43ayafyf"))))
1900 (build-system python-build-system)
1901 (home-page "https://github.com/nucleic/kiwi")
1902 (synopsis "Fast implementation of the Cassowary constraint solver")
1903 (description
1904 "Kiwi is an efficient C++ implementation of the Cassowary constraint
1905solving algorithm. Kiwi has been designed from the ground up to be
1906lightweight and fast. Kiwi ranges from 10x to 500x faster than the original
1907Cassowary solver with typical use cases gaining a 40x improvement. Memory
1908savings are consistently > 5x.")
1909 (license license:bsd-3)))
1910
1911(define-public python2-kiwisolver
1912 (package-with-python2 python-kiwisolver))
1913
1914(define-public slepc
1915 (package
1916 (name "slepc")
1917 (version "3.11.1")
1918 (source
1919 (origin
1920 (method url-fetch)
1921 (uri (string-append "http://slepc.upv.es/download/distrib/slepc-"
1922 version ".tar.gz"))
1923 (sha256
1924 (base32
1925 "1yq84q9wannc8xwapxpay4ypdd675picwi395hhsdvng9q6hf5j8"))))
1926 (build-system gnu-build-system)
1927 (native-inputs
1928 `(("python" ,python-2)
1929 ("petsc:examples" ,petsc "examples"))) ;for gmakegen.py script
1930 (inputs
1931 `(("arpack" ,arpack-ng)
1932 ("gfortran" ,gfortran)))
1933 (propagated-inputs
1934 `(("petsc" ,petsc)))
1935 (arguments
1936 `(#:parallel-build? #f ;build is parallel by default
1937 #:configure-flags
1938 `(,(string-append "--with-arpack-dir="
1939 (assoc-ref %build-inputs "arpack") "/lib"))
1940 #:make-flags ;honor (parallel-job-count)
1941 `(,(format #f "MAKE_NP=~a" (parallel-job-count))
1942 ,(string-append "PETSCCONFIGDIR="
1943 (assoc-ref %build-inputs "petsc:examples")
1944 "/share/petsc/examples/config"))
1945 #:phases
1946 (modify-phases %standard-phases
1947 (replace 'configure
1948 ;; configure is a python script, so we can't run it with bash.
1949 (lambda* (#:key inputs outputs (configure-flags '())
1950 #:allow-other-keys)
1951 (let* ((prefix (assoc-ref outputs "out"))
1952 (flags `(,(string-append "--prefix=" prefix)
1953 ,@configure-flags)))
1954 (format #t "build directory: ~s~%" (getcwd))
1955 (format #t "configure flags: ~s~%" flags)
1956 (setenv "SLEPC_DIR" (getcwd))
1957 (setenv "PETSC_DIR" (assoc-ref inputs "petsc"))
1958 (apply invoke "./configure" flags))))
1959 (add-after 'install 'delete-doc
1960 ;; TODO: SLEPc installs HTML documentation alongside headers in
1961 ;; $out/include. We'd like to move them to share/doc, but delete
1962 ;; them for now, as they are incomplete and installing the complete
1963 ;; documentation is difficult.
1964 (lambda* (#:key outputs #:allow-other-keys)
1965 (let* ((out (assoc-ref outputs "out")))
1966 (for-each delete-file (find-files out "\\.html$"))
1967 #t)))
1968 (add-after 'install 'clean-install
1969 ;; Clean up unnecessary build logs from installation.
1970 (lambda* (#:key outputs #:allow-other-keys)
1971 (let ((out (assoc-ref outputs "out")))
1972 (for-each (lambda (file)
1973 (let ((f (string-append out "/lib/slepc/conf/" file)))
1974 (when (file-exists? f)
1975 (delete-file f))))
1976 '("configure.log" "make.log" "gmake.log"
1977 "test.log" "error.log" "RDict.db"
1978 "uninstall.py"))
1979 #t))))))
1980 (home-page "http://slepc.upv.es")
1981 (synopsis "Scalable library for eigenproblems")
1982 (description "SLEPc is a software library for the solution of large sparse
1983eigenproblems on parallel computers. It can be used for the solution of
1984linear eigenvalue problems formulated in either standard or generalized form,
1985as well as other related problems such as the singular value decomposition.
1986The emphasis of the software is on methods and techniques appropriate for
1987problems in which the associated matrices are sparse, for example, those
1988arising after the discretization of partial differential equations.")
1989 (license license:bsd-2)))
1990
1991(define-public slepc-complex
1992 (package (inherit slepc)
1993 (name "slepc-complex")
1994 (propagated-inputs
1995 `(("petsc" ,petsc-complex)
1996 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
1997 (synopsis "Scalable library for eigenproblems (with complex scalars)")))
1998
1999(define-public slepc-openmpi
2000 (package (inherit slepc)
2001 (name "slepc-openmpi")
2002 (arguments
2003 (substitute-keyword-arguments (package-arguments slepc)
2004 ((#:phases phases '%standard-phases)
2005 `(modify-phases ,phases
2006 (add-before 'check 'mpi-setup
2007 ,%openmpi-setup)))))
2008 (inputs
2009 `(("mpi" ,openmpi)
2010 ("arpack" ,arpack-ng-openmpi)
2011 ,@(alist-delete "arpack" (package-inputs slepc))))
2012 (propagated-inputs
2013 `(("petsc" ,petsc-openmpi)
2014 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
2015 (synopsis "Scalable library for eigenproblems (with MPI support)")))
2016
2017(define-public slepc-complex-openmpi
2018 (package (inherit slepc-openmpi)
2019 (name "slepc-complex-openmpi")
2020 (propagated-inputs
2021 `(("petsc" ,petsc-complex-openmpi)
2022 ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
2023 (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
2024
2025(define-public python-slepc4py
2026 (package
2027 (name "python-slepc4py")
2028 (version "3.10.0")
2029 (source
2030 (origin
2031 (method url-fetch)
2032 (uri (pypi-uri "slepc4py" version))
2033 (sha256
2034 (base32
2035 "0x049dyc8frgh79fvvavf4vlbqp4mgm61nsaivzdav4316vvlv1j"))))
2036 (build-system python-build-system)
2037 (arguments
2038 `(#:phases
2039 (modify-phases %standard-phases
2040 (add-before 'build 'pre-build
2041 (lambda _
2042 ;; Define path to PETSc installation.
2043 (setenv "PETSC_DIR" (assoc-ref %build-inputs "petsc"))
2044 ;; Define path to SLEPc installation.
2045 (setenv "SLEPC_DIR" (assoc-ref %build-inputs "slepc"))
2046 #t))
2047 (add-before 'check 'mpi-setup
2048 ,%openmpi-setup))))
2049 (inputs
2050 `(("python-numpy" ,python-numpy)
2051 ("python-petsc4py" ,python-petsc4py)
2052 ("slepc" ,slepc-openmpi)))
2053 (home-page "https://bitbucket.org/slepc/slepc4py/")
2054 (synopsis "Python bindings for SLEPc")
2055 (description "SLEPc, the Scalable Library for Eigenvalue Problem
2056Computations, is based on PETSc, the Portable, Extensible Toolkit for
2057Scientific Computation. It employs the MPI standard for all
2058message-passing communication. @code{slepc4py} provides Python
2059bindings to almost all functions of SLEPc.")
2060 (license license:bsd-3)))
2061
2062(define-public mumps
2063 (package
2064 (name "mumps")
2065 (version "5.1.2")
2066 (source
2067 (origin
2068 (method url-fetch)
2069 (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
2070 version ".tar.gz"))
2071 (sha256
2072 (base32
2073 "1s9asin08zqzmh08257sdghhivvy9vjif7c53fhaxaax2kd5qd7b"))
2074 (patches (search-patches "mumps-build-parallelism.patch"))))
2075 (build-system gnu-build-system)
2076 (inputs
2077 `(("fortran" ,gfortran)
2078 ;; These are required for linking against mumps, but we let the user
2079 ;; declare the dependency.
2080 ("blas" ,openblas)
2081 ("metis" ,metis)
2082 ("scotch" ,scotch)))
2083 (arguments
2084 `(#:modules ((ice-9 match)
2085 (ice-9 popen)
2086 (srfi srfi-1)
2087 ,@%gnu-build-system-modules)
2088 #:phases
2089 (modify-phases %standard-phases
2090 (replace 'configure
2091 (lambda* (#:key inputs #:allow-other-keys)
2092 (call-with-output-file "Makefile.inc"
2093 (lambda (port)
2094 (format port "
2095PLAT =
2096LIBEXT = .a
2097OUTC = -o
2098OUTF = -o
2099RM = rm -f~:[
2100CC = gcc
2101FC = gfortran
2102FL = gfortran
2103INCSEQ = -I$(topdir)/libseq
2104LIBSEQ = -L$(topdir)/libseq -lmpiseq
2105LIBSEQNEEDED = libseqneeded~;
2106CC = mpicc
2107FC = mpifort
2108FL = mpifort~]
2109AR = ar vr # rules require trailing space, ugh...
2110RANLIB = ranlib
2111LIBBLAS = -L~a -lopenblas~@[
2112SCALAP = -L~a -lscalapack~]
2113LIBOTHERS = -pthread
2114CDEFS = -DAdd_
2115PIC = -fPIC
2116OPTF = -O2 -DALLOW_NON_INIT $(PIC)
2117OPTL = -O2 $(PIC)
2118OPTC = -O2 $(PIC)
2119INCS = $(INCSEQ)
2120LIBS = $(SCALAP) $(LIBSEQ)
2121LPORDDIR = $(topdir)/PORD/lib
2122IPORD = -I$(topdir)/PORD/include
2123LPORD = -L$(LPORDDIR) -lpord
2124ORDERINGSF = -Dpord~@[
2125METISDIR = ~a
2126IMETIS = -I$(METISDIR)/include
2127LMETIS = -L$(METISDIR)/lib -lmetis
2128ORDERINGSF += -Dmetis~]~@[~:{
2129SCOTCHDIR = ~a
2130ISCOTCH = -I$(SCOTCHDIR)/include
2131LSCOTCH = -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
2132ORDERINGSF += ~a~}~]
2133ORDERINGSC = $(ORDERINGSF)
2134LORDERINGS = $(LPORD) $(LMETIS) $(LSCOTCH)
2135IORDERINGSF = $(ISCOTCH)
2136IORDERINGSC = $(IPORD) $(IMETIS) $(ISCOTCH)"
2137 (assoc-ref inputs "mpi")
2138 (assoc-ref inputs "blas")
2139 (assoc-ref inputs "scalapack")
2140 (assoc-ref inputs "metis")
2141 (match (list (assoc-ref inputs "pt-scotch")
2142 (assoc-ref inputs "scotch"))
2143 ((#f #f)
2144 #f)
2145 ((#f scotch)
2146 `((,scotch "" "-Dscotch")))
2147 ((ptscotch _)
2148 `((,ptscotch
2149 "-lptesmumps -lptscotch -lptscotcherr "
2150 "-Dptscotch")))))))))
2151 (replace 'build
2152 ;; By default only the d-precision library is built. Make with "all"
2153 ;; target so that all precision libraries and examples are built.
2154 (lambda _
2155 (invoke "make" "all"
2156 (format #f "-j~a" (parallel-job-count)))))
2157 (replace 'check
2158 ;; Run the simple test drivers, which read test input from stdin:
2159 ;; from the "real" input for the single- and double-precision
2160 ;; testers, and from the "cmplx" input for complex-precision
2161 ;; testers. The EXEC-PREFIX key is used by the mumps-openmpi
2162 ;; package to prefix execution with "mpirun".
2163 (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
2164 (with-directory-excursion "examples"
2165 (every
2166 (lambda (prec type)
2167 (let ((tester (apply open-pipe*
2168 `(,OPEN_WRITE
2169 ,@exec-prefix
2170 ,(string-append "./" prec
2171 "simpletest"))))
2172 (input (open-input-file
2173 (string-append "input_simpletest_" type))))
2174 (begin
2175 (dump-port input tester)
2176 (close-port input)
2177 (zero? (close-pipe tester)))))
2178 '("s" "d" "c" "z")
2179 '("real" "real" "cmplx" "cmplx")))))
2180 (replace 'install
2181 (lambda* (#:key outputs #:allow-other-keys)
2182 (let* ((out (assoc-ref outputs "out"))
2183 (libdir (string-append out "/lib")))
2184 (copy-recursively "lib" libdir)
2185 (copy-recursively "include" (string-append out "/include"))
2186 (when (file-exists? "libseq/libmpiseq.a")
2187 (install-file "libseq/libmpiseq.a" libdir))
2188 #t))))))
2189 (home-page "http://mumps.enseeiht.fr")
2190 (synopsis "Multifrontal sparse direct solver")
2191 (description
2192 "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
2193sparse system of linear equations A x = b using Gaussian elimination.")
2194 (license license:cecill-c)))
2195
2196(define-public mumps-metis
2197 (package (inherit mumps)
2198 (name "mumps-metis")
2199 (inputs
2200 (alist-delete "scotch" (package-inputs mumps)))))
2201
2202(define-public mumps-openmpi
2203 (package (inherit mumps)
2204 (name "mumps-openmpi")
2205 (inputs
2206 `(("mpi" ,openmpi)
2207 ("scalapack" ,scalapack)
2208 ("pt-scotch" ,pt-scotch)
2209 ,@(alist-delete "scotch" (package-inputs mumps))))
2210 (arguments
2211 (substitute-keyword-arguments (package-arguments mumps)
2212 ((#:phases phases)
2213 `(modify-phases ,phases
2214 (add-before 'check 'mpi-setup
2215 ,%openmpi-setup)
2216 (replace 'check
2217 (lambda _
2218 ((assoc-ref ,phases 'check)
2219 #:exec-prefix '("mpirun" "-n" "2"))))))))
2220 (synopsis "Multifrontal sparse direct solver (with MPI)")))
2221
2222(define-public mumps-metis-openmpi
2223 (package (inherit mumps-openmpi)
2224 (name "mumps-metis-openmpi")
2225 (inputs
2226 (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
2227
2228(define-public r-quadprog
2229 (package
2230 (name "r-quadprog")
2231 (version "1.5-7")
2232 (source
2233 (origin
2234 (method url-fetch)
2235 (uri (cran-uri "quadprog" version))
2236 (sha256
2237 (base32
2238 "0vg7i9p241bwvfdspjbydjrsvgipl6nsb8bjigp0hbbgvxbixx0s"))))
2239 (build-system r-build-system)
2240 (native-inputs
2241 `(("gfortran" ,gfortran)))
2242 (home-page "https://cran.r-project.org/web/packages/quadprog")
2243 (synopsis "Functions to solve quadratic programming problems")
2244 (description
2245 "This package contains routines and documentation for solving quadratic
2246programming problems.")
2247 (license license:gpl3+)))
2248
2249(define-public r-pracma
2250 (package
2251 (name "r-pracma")
2252 (version "2.2.5")
2253 (source (origin
2254 (method url-fetch)
2255 (uri (cran-uri "pracma" version))
2256 (sha256
2257 (base32 "0isd3s0i4mzmva8lkh0j76hwjy1w50q7d1n9lhxsnnkgalx3xs1g"))))
2258 (build-system r-build-system)
2259 (home-page "https://cran.r-project.org/web/packages/pracma/")
2260 (synopsis "Practical numerical math functions")
2261 (description "This package provides functions for numerical analysis and
2262linear algebra, numerical optimization, differential equations, plus some
2263special functions. It uses Matlab function names where appropriate to simplify
2264porting.")
2265 (license license:gpl3+)))
2266
2267(define-public ruby-asciimath
2268 (package
2269 (name "ruby-asciimath")
2270 (version "1.0.4")
2271 (source
2272 (origin
2273 (method url-fetch)
2274 (uri (rubygems-uri "asciimath" version))
2275 (sha256
2276 (base32
2277 "1d80kiph5mc78zps7si1hv48kv4k12mzaq8jk5kb3pqpjdr72qmc"))))
2278 (build-system ruby-build-system)
2279 (arguments
2280 '(#:phases
2281 (modify-phases %standard-phases
2282 ;; Apply this patch
2283 ;; https://github.com/asciidoctor/asciimath/commit/1c06fdc8086077f4785479f78b0823a4a72d7948
2284 (add-after 'unpack 'patch-remove-spurious-backslashes
2285 (lambda _
2286 (substitute* "spec/parser_spec.rb"
2287 (("\\\\\"")
2288 "\""))
2289 #t)))))
2290 (native-inputs
2291 `(("bundler" ,bundler)
2292 ("ruby-rspec" ,ruby-rspec)))
2293 (synopsis "AsciiMath parsing and conversion library")
2294 (description
2295 "A pure Ruby AsciiMath parsing and conversion library. AsciiMath is an
2296easy-to-write markup language for mathematics.")
2297 (home-page "https://github.com/asciidoctor/asciimath")
2298 (license license:expat)))
2299
2300(define-public superlu
2301 (package
2302 (name "superlu")
2303 (version "5.2.1")
2304 (source
2305 (origin
2306 (method url-fetch)
2307 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
2308 "superlu_" version ".tar.gz"))
2309 (sha256
2310 (base32 "0qzlb7cd608q62kyppd0a8c65l03vrwqql6gsm465rky23b6dyr8"))
2311 (modules '((guix build utils)))
2312 (snippet
2313 ;; Replace the non-free implementation of MC64 with a stub adapted
2314 ;; from Debian
2315 '(begin
2316 (use-modules (ice-9 regex)
2317 (ice-9 rdelim))
2318 (call-with-output-file "SRC/mc64ad.c"
2319 (lambda (port)
2320 (display "
2321#include <stdio.h>
2322#include <stdlib.h>
2323void mc64id_(int *a) {
2324 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
2325 abort ();
2326}
2327void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
2328 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
2329 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
2330 abort ();
2331}\n" port)))
2332 ;; Remove the corresponding license verbiage. MC64 license follows
2333 ;; a "------" line separator.
2334 (with-atomic-file-replacement "License.txt"
2335 (let ((rx (make-regexp "-{8}")))
2336 (lambda (in out)
2337 (let loop ()
2338 (let ((line (read-line in 'concat)))
2339 (unless (regexp-exec rx line)
2340 (display line out)
2341 (loop))))
2342 #t)))))))
2343 (build-system cmake-build-system)
2344 (native-inputs
2345 `(("tcsh" ,tcsh)))
2346 (inputs
2347 `(("blas" ,openblas)
2348 ("gfortran" ,gfortran)))
2349 (arguments
2350 `(#:configure-flags '("-Denable_blaslib:BOOL=NO" ;do not use internal cblas
2351 "-DTPL_BLAS_LIBRARIES=openblas"
2352 "-DBUILD_SHARED_LIBS:BOOL=YES")))
2353 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
2354 (synopsis "Supernodal direct solver for sparse linear systems")
2355 (description
2356 "SuperLU is a general purpose library for the direct solution of large,
2357sparse, nonsymmetric systems of linear equations on high performance machines.
2358The library is written in C and is callable from either C or Fortran. The
2359library routines perform an LU decomposition with partial pivoting and
2360triangular system solves through forward and back substitution. The library
2361also provides threshold-based ILU factorization preconditioners.")
2362 (license (list license:bsd-3
2363 license:gpl2+ ;EXAMPLE/*fgmr.c
2364 (license:fsf-free "file://SRC/colamd.h")))))
2365
2366(define-public superlu-dist
2367 (package
2368 (name "superlu-dist")
2369 (version "6.1.0")
2370 (source
2371 (origin
2372 (method url-fetch)
2373 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
2374 "superlu_dist_" version ".tar.gz"))
2375 (sha256
2376 (base32 "0pqgcgh1yxhfzs99fas3mggajzd5wca3nbyp878rziy74gfk03dl"))
2377 (modules '((guix build utils)))
2378 (snippet
2379 ;; Replace the non-free implementation of MC64 with a stub
2380 '(begin
2381 (call-with-output-file "SRC/mc64ad_dist.c"
2382 (lambda (port)
2383 (display "
2384#include <stdio.h>
2385#include <stdlib.h>
2386void mc64id_dist(int *a) {
2387 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
2388 abort ();
2389}
2390void mc64ad_dist (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
2391 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
2392 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
2393 abort ();
2394}\n" port)))
2395 (substitute* "SRC/util.c" ;adjust default algorithm
2396 (("RowPerm[[:blank:]]*=[[:blank:]]*LargeDiag_MC64;")
2397 ;; TODO: set to "LargeDiag_AWPM" once combinatorial-blas has
2398 ;; general (i.e. non-square) processor-grid support.
2399 "RowPerm = NOROWPERM;"))
2400 #t))
2401 (patches (search-patches "superlu-dist-scotchmetis.patch"
2402 "superlu-dist-awpm-grid.patch"
2403 "superlu-dist-fix-mpi-deprecations.patch"))))
2404 (build-system cmake-build-system)
2405 (native-inputs
2406 `(("tcsh" ,tcsh)))
2407 (inputs
2408 `(("gfortran" ,gfortran)
2409 ("blas" ,openblas)
2410 ("lapack" ,lapack)
2411 ("combblas" ,combinatorial-blas)))
2412 (propagated-inputs
2413 `(("mpi" ,openmpi) ;headers include MPI heades
2414 ("parmetis" ,pt-scotch32 "metis")
2415 ("pt-scotch" ,pt-scotch32)))
2416 (arguments
2417 `(#:parallel-tests? #f ;tests use MPI and OpenMP
2418 #:configure-flags (list "-DBUILD_SHARED_LIBS:BOOL=YES"
2419 "-DTPL_ENABLE_COMBBLASLIB=YES"
2420 "-DTPL_BLAS_LIBRARIES=-lopenblas"
2421 "-DTPL_LAPACK_LIBRARIES=-llapack"
2422 (string-append "-DTPL_PARMETIS_LIBRARIES="
2423 (string-join
2424 '("ptscotchparmetis" "ptscotch" "ptscotcherr"
2425 "scotchmetis" "scotch" "scotcherr")
2426 ";"))
2427 (string-append "-DTPL_PARMETIS_INCLUDE_DIRS="
2428 (assoc-ref %build-inputs "parmetis")
2429 "/include")
2430 "-DTPL_ENABLE_COMBBLASLIB=ON"
2431 (string-append "-DTPL_COMBBLAS_INCLUDE_DIRS="
2432 (assoc-ref %build-inputs "combblas")
2433 "/include/CombBLAS;"
2434 (assoc-ref %build-inputs "combblas")
2435 "/include/BipartiteMatchings")
2436 "-DTPL_COMBBLAS_LIBRARIES=CombBLAS")
2437 #:phases
2438 (modify-phases %standard-phases
2439 (add-before 'configure 'set-c++-standard
2440 (lambda _
2441 (substitute* "CMakeLists.txt"
2442 ;; AWPM headers require C++14
2443 (("CMAKE_CXX_STANDARD 11") "CMAKE_CXX_STANDARD 14"))))
2444 (add-before 'check 'mpi-setup
2445 ,%openmpi-setup)
2446 (add-before 'check 'omp-setup
2447 (lambda _ (setenv "OMP_NUM_THREADS" "1") #t)))))
2448 (home-page (package-home-page superlu))
2449 (synopsis "Parallel supernodal direct solver")
2450 (description
2451 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
2452It is targeted for distributed memory parallel machines. SuperLU_DIST is
2453implemented in ANSI C, and MPI for communications.")
2454 (license license:bsd-3)))
2455
2456(define-public scotch
2457 (package
2458 (name "scotch")
2459 (version "6.0.6")
2460 (source
2461 (origin
2462 (method url-fetch)
2463 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
2464 "latestfile/298/scotch_" version ".tar.gz"))
2465 (sha256
2466 (base32 "1ky4k9r6jvajhqaqnnx6h8fkmds2yxgp70dpr1qzwcyhi2nhqvv8"))
2467 (patches (search-patches "scotch-build-parallelism.patch"
2468 "scotch-integer-declarations.patch"))))
2469 (build-system gnu-build-system)
2470 (inputs
2471 `(("zlib" ,zlib)
2472 ("flex" ,flex)
2473 ("bison" ,bison)))
2474 (outputs '("out" "metis"))
2475 (arguments
2476 `(#:make-flags (list (string-append "prefix=" %output))
2477 #:phases
2478 (modify-phases %standard-phases
2479 (add-after
2480 'unpack 'chdir-to-src
2481 (lambda _ (chdir "src") #t))
2482 (replace
2483 'configure
2484 (lambda _
2485 (call-with-output-file "Makefile.inc"
2486 (lambda (port)
2487 (format port "
2488EXE =
2489LIB = .a
2490OBJ = .o
2491MAKE = make
2492AR = ar
2493ARFLAGS = -ruv
2494CAT = cat
2495CCS = gcc
2496CCP = mpicc
2497CCD = gcc
2498CPPFLAGS =~{ -D~a~}
2499CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
2500LDFLAGS = -lz -lm -lrt -lpthread
2501CP = cp
2502LEX = flex -Pscotchyy -olex.yy.c
2503LN = ln
2504MKDIR = mkdir
2505MV = mv
2506RANLIB = ranlib
2507YACC = bison -pscotchyy -y -b y
2508"
2509 '("COMMON_FILE_COMPRESS_GZ"
2510 "COMMON_PTHREAD"
2511 "COMMON_RANDOM_FIXED_SEED"
2512 "INTSIZE64" ;use 'int64_t'
2513 ;; Prevents symbolc clashes with libesmumps
2514 "SCOTCH_RENAME"
2515 ;; XXX: Causes invalid frees in superlu-dist tests
2516 ;; "SCOTCH_PTHREAD"
2517 ;; "SCOTCH_PTHREAD_NUMBER=2"
2518 "restrict=__restrict"))))
2519 #t))
2520 (add-after 'build 'build-esmumps
2521 (lambda _
2522 (invoke "make"
2523 (format #f "-j~a" (parallel-job-count))
2524 "esmumps")))
2525 (add-before 'install 'make-install-dirs
2526 (lambda* (#:key outputs #:allow-other-keys)
2527 (mkdir (assoc-ref outputs "out"))))
2528 (add-after 'install 'install-metis
2529 (lambda* (#:key outputs #:allow-other-keys)
2530 (let ((out (assoc-ref outputs "metis")))
2531 (mkdir out)
2532 ;; metis files are not installed with 'make install'
2533 (for-each (lambda (f)
2534 (install-file f (string-append out "/include")))
2535 (find-files "../include/" ".*metis\\.h"))
2536 (for-each (lambda (f)
2537 (install-file f (string-append out "/lib")))
2538 (find-files "../lib/" ".*metis\\..*"))
2539 #t))))))
2540 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
2541 (synopsis "Programs and libraries for graph algorithms")
2542 (description "SCOTCH is a set of programs and libraries which implement
2543the static mapping and sparse matrix reordering algorithms developed within
2544the SCOTCH project. Its purpose is to apply graph theory, with a divide and
2545conquer approach, to scientific computing problems such as graph and mesh
2546partitioning, static mapping, and sparse matrix ordering, in application
2547domains ranging from structural mechanics to operating systems or
2548bio-chemistry.")
2549 ;; See LICENSE_en.txt
2550 (license license:cecill-c)))
2551
2552(define-public scotch32
2553 ;; This is the 'INTSIZE32' variant, which uses 32-bit integers, as needed by
2554 ;; some applications.
2555 (package (inherit scotch)
2556 (name "scotch32")
2557 (arguments
2558 (substitute-keyword-arguments (package-arguments scotch)
2559 ((#:phases scotch-phases)
2560 `(modify-phases ,scotch-phases
2561 (replace
2562 'configure
2563 (lambda _
2564 (call-with-output-file "Makefile.inc"
2565 (lambda (port)
2566 (format port "
2567EXE =
2568LIB = .a
2569OBJ = .o
2570MAKE = make
2571AR = ar
2572ARFLAGS = -ruv
2573CAT = cat
2574CCS = gcc
2575CCP = mpicc
2576CCD = gcc
2577CPPFLAGS =~{ -D~a~}
2578CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
2579LDFLAGS = -lz -lm -lrt -lpthread
2580CP = cp
2581LEX = flex -Pscotchyy -olex.yy.c
2582LN = ln
2583MKDIR = mkdir
2584MV = mv
2585RANLIB = ranlib
2586YACC = bison -pscotchyy -y -b y
2587"
2588 '("COMMON_FILE_COMPRESS_GZ"
2589 "COMMON_PTHREAD"
2590 "COMMON_RANDOM_FIXED_SEED"
2591 "INTSIZE32" ;use 32-bit integers. See INSTALL.txt
2592 ;; Prevents symbolc clashes with libesmumps
2593 "SCOTCH_RENAME"
2594 ;; XXX: Causes invalid frees in superlu-dist tests
2595 ;; "SCOTCH_PTHREAD"
2596 ;; "SCOTCH_PTHREAD_NUMBER=2"
2597 "restrict=__restrict"))))))))))
2598 (synopsis
2599 "Programs and libraries for graph algorithms (32-bit integers)")))
2600
2601(define-public pt-scotch
2602 (package (inherit scotch)
2603 (name "pt-scotch")
2604 (propagated-inputs
2605 `(("openmpi" ,openmpi))) ;Headers include MPI headers
2606 (arguments
2607 (substitute-keyword-arguments (package-arguments scotch)
2608 ((#:phases scotch-phases)
2609 `(modify-phases ,scotch-phases
2610 (replace
2611 'build
2612 (lambda _
2613 (invoke "make" (format #f "-j~a" (parallel-job-count))
2614 "ptscotch" "ptesmumps")
2615
2616 ;; Install the serial metis compatibility library
2617 (invoke "make" "-C" "libscotchmetis" "install")))
2618 (add-before 'check 'mpi-setup
2619 ,%openmpi-setup)
2620 (replace 'check
2621 (lambda _
2622 (invoke "make" "ptcheck")))))))
2623 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
2624
2625(define-public pt-scotch32
2626 (package (inherit scotch32)
2627 (name "pt-scotch32")
2628 (propagated-inputs
2629 `(("openmpi" ,openmpi))) ;headers include MPI headers
2630 (arguments
2631 (substitute-keyword-arguments (package-arguments scotch32)
2632 ((#:phases scotch32-phases)
2633 `(modify-phases ,scotch32-phases
2634 (replace 'build
2635 (lambda _
2636 (invoke "make" (format #f "-j~a" (parallel-job-count))
2637 "ptscotch" "ptesmumps")
2638 ;; Install the serial metis compatibility library
2639 (invoke "make" "-C" "libscotchmetis" "install")))
2640 (add-before 'check 'mpi-setup
2641 ,%openmpi-setup)
2642 (replace 'check
2643 (lambda _
2644 (invoke "make" "ptcheck")))))))
2645 (synopsis
2646 "Programs and libraries for graph algorithms (with MPI and 32-bit integers)")))
2647
2648(define-public metis
2649 (package
2650 (name "metis")
2651 (version "5.1.0")
2652 (source
2653 (origin
2654 (method url-fetch)
2655 (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
2656 "metis-" version ".tar.gz"))
2657 (sha256
2658 (base32
2659 "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
2660 (build-system cmake-build-system)
2661 (inputs
2662 `(("blas" ,openblas)))
2663 (arguments
2664 `(#:tests? #f ;no tests
2665 #:configure-flags `("-DSHARED=ON"
2666 ,(string-append "-DGKLIB_PATH=" (getcwd)
2667 "/metis-" ,version "/GKlib"))))
2668 (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
2669 (synopsis "Graph partitioning and fill-reducing matrix ordering library")
2670 (description
2671 "METIS is a set of serial programs for partitioning graphs, partitioning
2672finite element meshes, and producing fill-reducing orderings for sparse
2673matrices. The algorithms implemented in METIS are based on the multilevel
2674recursive-bisection, multilevel k-way, and multi-constraint partitioning
2675schemes.")
2676 (license license:asl2.0))) ;As of version 5.0.3
2677
2678(define-public p4est
2679 (package
2680 (name "p4est")
2681 (version "2.0")
2682 (source
2683 (origin
2684 (method url-fetch)
2685 (uri (string-append "http://p4est.github.io/release/p4est-"
2686 version ".tar.gz"))
2687 (sha256
2688 (base32
2689 "16h267z256kxcxfjs390qqzv19hr58vrj4x8lndb7alnk2vca8n5"))))
2690 (build-system gnu-build-system)
2691 (inputs
2692 `(("fortran" ,gfortran)
2693 ("blas" ,openblas)
2694 ("lapack" ,lapack)
2695 ("zlib" ,zlib)))
2696 (arguments
2697 `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
2698 (assoc-ref %build-inputs "blas")
2699 " -lopenblas")
2700 ,(string-append "LAPACK_LIBS=-L"
2701 (assoc-ref %build-inputs "lapack")
2702 " -llapack"))
2703 #:phases (modify-phases %standard-phases
2704 (add-before 'check 'mpi-setup
2705 ,%openmpi-setup))))
2706 (home-page "http://www.p4est.org")
2707 (synopsis "Adaptive mesh refinement on forests of octrees")
2708 (description
2709 "The p4est software library enables the dynamic management of a
2710collection of adaptive octrees, conveniently called a forest of octrees.
2711p4est is designed to work in parallel and scales to hundreds of thousands of
2712processor cores.")
2713 (license license:gpl2+)))
2714
2715(define-public p4est-openmpi
2716 (package (inherit p4est)
2717 (name "p4est-openmpi")
2718 (inputs
2719 `(("mpi" ,openmpi)
2720 ,@(package-inputs p4est)))
2721 (arguments
2722 (substitute-keyword-arguments (package-arguments p4est)
2723 ((#:configure-flags cf)
2724 ``("--enable-mpi" ,@,cf))))
2725 (synopsis "Parallel adaptive mesh refinement on forests of octrees")))
2726
2727(define-public gsegrafix
2728 (package
2729 (name "gsegrafix")
2730 (version "1.0.6")
2731 (source
2732 (origin
2733 (method url-fetch)
2734 (uri (string-append "mirror://gnu/" name "/" name "-"
2735 version ".tar.gz"))
2736 (sha256
2737 (base32
2738 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
2739 (build-system gnu-build-system)
2740 (arguments
2741 `(#:configure-flags '("LDFLAGS=-lm")))
2742 (inputs
2743 `(("libgnomecanvas" ,libgnomecanvas)
2744 ("libbonoboui" ,libbonoboui)
2745 ("libgnomeui" ,libgnomeui)
2746 ("libgnomeprintui" ,libgnomeprintui)
2747 ("popt" ,popt)))
2748 (native-inputs
2749 `(("pkg-config" ,pkg-config)))
2750 (home-page "https://www.gnu.org/software/gsegrafix/")
2751 (synopsis "GNOME application to create scientific and engineering plots")
2752 (description "GSEGrafix is an application which produces high-quality graphical
2753plots for science and engineering. Plots are specified via simple ASCII
2754parameter files and data files and are presented in an anti-aliased GNOME
2755canvas. The program supports rectangular two-dimensional plots, histograms,
2756polar-axis plots and three-dimensional plots. Plots can be printed or saved
2757to BMP, JPEG or PNG image formats.")
2758 (license license:gpl3+)))
2759
2760(define-public maxima
2761 (package
2762 (name "maxima")
2763 (version "5.43.0")
2764 (source
2765 (origin
2766 (method url-fetch)
2767 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
2768 version "-source/" name "-" version ".tar.gz"))
2769 (sha256
2770 (base32
2771 "0xyahp4c6509haxh4n1swiqm3421gplkdisa0zypclh3252sbzfw"))
2772 (patches (search-patches "maxima-defsystem-mkdir.patch"))))
2773 (build-system gnu-build-system)
2774 (inputs
2775 `(("gcl" ,gcl)
2776 ("gnuplot" ,gnuplot) ;for plots
2777 ("sed" ,sed)
2778 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
2779 (native-inputs
2780 `(("texinfo" ,texinfo)
2781 ("perl" ,perl)
2782 ("python" ,python)))
2783 (arguments
2784 `(#:configure-flags
2785 (list "--enable-gcl"
2786 (string-append "--with-posix-shell="
2787 (assoc-ref %build-inputs "bash")
2788 "/bin/sh")
2789 (string-append "--with-wish="
2790 (assoc-ref %build-inputs "tk")
2791 "/bin/wish"
2792 (let ((v ,(package-version tk)))
2793 (string-take v (string-index-right v #\.)))))
2794 ;; By default Maxima attempts to write temporary files to
2795 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
2796 ;; Work around that.
2797 #:make-flags (list "TMPDIR=/tmp")
2798 #:phases
2799 (modify-phases %standard-phases
2800 (add-after 'unpack 'patch-paths
2801 (lambda* (#:key inputs #:allow-other-keys)
2802 (let* ((sed (string-append (assoc-ref inputs "sed") "/bin/sed"))
2803 (coreutils (assoc-ref inputs "coreutils"))
2804 (dirname (string-append coreutils "/bin/dirname"))
2805 (head (string-append coreutils "/bin/head"))
2806 (perl (string-append (assoc-ref inputs "perl") "/bin/perl"))
2807 (python (string-append (assoc-ref inputs "python")
2808 "/bin/python3")))
2809 (substitute* "src/maxima.in"
2810 (("sed ") (string-append sed " "))
2811 (("dirname") dirname)
2812 (("head") head))
2813 (substitute* "doc/info/Makefile.in"
2814 (("/usr/bin/env perl") perl))
2815 (substitute* "doc/info/build_html.sh.in"
2816 (("python") python))
2817 #t)))
2818 (add-before 'check 'pre-check
2819 (lambda _
2820 (chmod "src/maxima" #o555)
2821 #t))
2822 (replace 'check
2823 (lambda _
2824 ;; This is derived from the testing code in the "debian/rules" file
2825 ;; of Debian's Maxima package.
2826 ;; If Maxima can successfully run this, the binary to be installed
2827 ;; should be fine.
2828 (invoke "sh" "-c"
2829 (string-append
2830 "./maxima-local "
2831 "--lisp=gcl "
2832 "--batch-string=\"run_testsuite();\" "
2833 "| grep -q \"No unexpected errors found\""))))
2834 ;; Make sure the doc and emacs files are found in the
2835 ;; standard location. Also configure maxima to find gnuplot
2836 ;; without having it on the PATH.
2837 (add-after 'install 'post-install
2838 (lambda* (#:key outputs inputs #:allow-other-keys)
2839 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
2840 (out (assoc-ref outputs "out"))
2841 (datadir (string-append out "/share/maxima/" ,version))
2842 (binutils (string-append (assoc-ref inputs "binutils")
2843 "/bin")))
2844 (with-directory-excursion out
2845 (mkdir-p "share/emacs")
2846 (mkdir-p "share/doc")
2847 (symlink
2848 (string-append datadir "/doc/")
2849 (string-append out "/share/doc/maxima"))
2850 (with-atomic-file-replacement
2851 (string-append datadir "/share/maxima-init.lisp")
2852 (lambda (in out)
2853 (format out "~a ~s~a~%"
2854 "(setf $gnuplot_command "
2855 (string-append gnuplot "/bin/gnuplot") ")")
2856 (dump-port in out))))
2857 ;; Ensure that Maxima will have access to the GNU binutils
2858 ;; components at runtime.
2859 (wrap-program (string-append out "/bin/maxima")
2860 `("PATH" prefix (,binutils))))
2861 #t)))))
2862 (home-page "http://maxima.sourceforge.net")
2863 (synopsis "Numeric and symbolic expression manipulation")
2864 (description "Maxima is a system for the manipulation of symbolic and
2865numerical expressions. It yields high precision numeric results by using
2866exact fractions, arbitrary precision integers, and variable precision floating
2867point numbers.")
2868 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
2869 ;; Others simply say "GNU General Public License" without stating a
2870 ;; version (which implicitly means gpl1+).
2871 ;; At least one file (src/maxima.asd) says "version 2."
2872 ;; GPLv2 only is therefore the smallest subset.
2873 (license license:gpl2)))
2874
2875(define-public wxmaxima
2876 (package
2877 (name "wxmaxima")
2878 (version "19.05.7")
2879 (source
2880 (origin
2881 (method git-fetch)
2882 (uri (git-reference
2883 (url "https://github.com/wxMaxima-developers/wxmaxima.git")
2884 (commit (string-append "Version-" version))))
2885 (file-name (git-file-name name version))
2886 (sha256
2887 (base32
2888 "0zaz71fh156b9inrxf86scnix247al5pl9v18cxhjxcm0lanqxdp"))))
2889 (build-system cmake-build-system)
2890 (native-inputs
2891 `(("gettext" ,gettext-minimal)))
2892 (inputs
2893 `(("wxwidgets" ,wxwidgets)
2894 ("maxima" ,maxima)
2895 ;; Runtime support.
2896 ("adwaita-icon-theme" ,adwaita-icon-theme)
2897 ("gtk+" ,gtk+)
2898 ("shared-mime-info" ,shared-mime-info)))
2899 (arguments
2900 `(#:tests? #f ; no check target
2901 #:phases
2902 (modify-phases %standard-phases
2903 (add-after 'install 'wrap-program
2904 (lambda* (#:key inputs outputs #:allow-other-keys)
2905 (wrap-program (string-append (assoc-ref outputs "out")
2906 "/bin/wxmaxima")
2907 `("PATH" ":" prefix
2908 (,(string-append (assoc-ref inputs "maxima")
2909 "/bin")))
2910 ;; For GtkFileChooserDialog.
2911 `("GSETTINGS_SCHEMA_DIR" =
2912 (,(string-append (assoc-ref inputs "gtk+")
2913 "/share/glib-2.0/schemas")))
2914 `("XDG_DATA_DIRS" ":" prefix
2915 (;; Needed by gdk-pixbuf to know supported icon formats.
2916 ,(string-append
2917 (assoc-ref inputs "shared-mime-info") "/share")
2918 ;; The default icon theme of GTK+.
2919 ,(string-append
2920 (assoc-ref inputs "adwaita-icon-theme") "/share"))))
2921 #t)))))
2922 (home-page "https://andrejv.github.io/wxmaxima/")
2923 (synopsis "Graphical user interface for the Maxima computer algebra system")
2924 (description
2925 "wxMaxima is a graphical user interface for the Maxima computer algebra
2926system. It eases the use of Maxima by making most of its commands available
2927through a menu system and by providing input dialogs for commands that require
2928more than one argument. It also implements its own display engine that
2929outputs mathematical symbols directly instead of depicting them with ASCII
2930characters.
2931
2932wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
2933text and mathematical calculations to create documents, exporting of input and
2934output to TeX, and a browser for Maxima's manual including command index and
2935full text searching.")
2936 (license license:gpl2+)))
2937
2938(define-public armadillo
2939 (package
2940 (name "armadillo")
2941 (version "9.100.5")
2942 (source (origin
2943 (method url-fetch)
2944 (uri (string-append "mirror://sourceforge/arma/armadillo-"
2945 version ".tar.xz"))
2946 (sha256
2947 (base32
2948 "1ka1vd9fcmvp12qkcm4888dkfqwnalvv00x04wy29f3nx3qwczby"))))
2949 (build-system cmake-build-system)
2950 (arguments `(#:tests? #f)) ; no test target
2951 (inputs
2952 `(("openblas" ,openblas)
2953 ("lapack" ,lapack)
2954 ("arpack" ,arpack-ng)))
2955 (home-page "http://arma.sourceforge.net/")
2956 (synopsis "C++ linear algebra library")
2957 (description
2958 "Armadillo is a C++ linear algebra library, aiming towards a good balance
2959between speed and ease of use. It is useful for algorithm development
2960directly in C++, or quick conversion of research code into production
2961environments. It can be used for machine learning, pattern recognition,
2962signal processing, bioinformatics, statistics, econometrics, etc. The library
2963provides efficient classes for vectors, matrices and cubes, as well as 150+
2964associated functions (eg. contiguous and non-contiguous submatrix views).")
2965 (license license:asl2.0)))
2966
2967(define-public muparser
2968 ;; When switching download sites, muparser re-issued a 2.2.5 release with a
2969 ;; different hash. In order to make `guix package --upgrade` work correctly,
2970 ;; we set a Guix packaging revision.
2971 ;; When the next version of muparser is released, we can remove
2972 ;; UPSTREAM-VERSION and REVISION and use the plain VERSION.
2973 (let ((upstream-version "2.2.5")
2974 (revision "2"))
2975 (package
2976 (name "muparser")
2977 (version (string-append upstream-version "-" revision))
2978 (source
2979 (origin
2980 (method git-fetch)
2981 (uri (git-reference
2982 (url "https://github.com/beltoforion/muparser.git")
2983 (commit (string-append "v" upstream-version))))
2984 (file-name (git-file-name name version))
2985 (sha256
2986 (base32 "0f0g4995xngf1pp3zr4p6ai2f8v6f8bxwa0k8ayjjiv1l8h44m24"))))
2987 (build-system gnu-build-system)
2988 (arguments
2989 `(#:configure-flags '("--enable-samples=no")
2990 #:tests? #f)) ;no "check" target
2991 (home-page "http://muparser.beltoforion.de/")
2992 (synopsis "Fast parser library for mathematical expressions")
2993 (description
2994 "muParser is an extensible high performance math parser library. It is
2995based on transforming an expression into a bytecode and precalculating constant
2996parts of it.")
2997 (license license:expat))))
2998
2999(define-public openblas
3000 (package
3001 (name "openblas")
3002 (version "0.3.5")
3003 (source
3004 (origin
3005 (method url-fetch)
3006 (uri (string-append "mirror://sourceforge/openblas/v" version "/OpenBLAS%20"
3007 version "%20version.tar.gz"))
3008 (file-name (string-append name "-" version ".tar.gz"))
3009 (sha256
3010 (base32
3011 "062kg4ny1ywz7k5grpb4pbf0hba0w6manbajwkmv4f477a31sxpl"))))
3012 (build-system gnu-build-system)
3013 (arguments
3014 `(#:test-target "test"
3015 ;; DYNAMIC_ARCH is only supported on x86. When it is disabled and no
3016 ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
3017 ;; we need to disable substitutions.
3018 #:substitutable?
3019 ,(let ((system (or (%current-target-system) (%current-system))))
3020 (or (string-prefix? "x86_64" system)
3021 (string-prefix? "i686" system)
3022 (string-prefix? "mips" system)
3023 (string-prefix? "aarch64" system)))
3024 #:make-flags
3025 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
3026 "SHELL=bash"
3027 "MAKE_NB_JOBS=0" ;use jobserver for submakes
3028 ;; Build the library for all supported CPUs. This allows
3029 ;; switching CPU targets at runtime with the environment variable
3030 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
3031 ;; Unfortunately, this is not supported on non-x86 architectures,
3032 ;; where it leads to failed builds.
3033 ,@(let ((system (or (%current-target-system) (%current-system))))
3034 (cond
3035 ((or (string-prefix? "x86_64" system)
3036 (string-prefix? "i686" system))
3037 '("DYNAMIC_ARCH=1"))
3038 ;; On MIPS we force the "SICORTEX" TARGET, as for the other
3039 ;; two available MIPS targets special extended instructions
3040 ;; for Loongson cores are used.
3041 ((string-prefix? "mips" system)
3042 '("TARGET=SICORTEX"))
3043 ;; On aarch64 force the generic 'armv8-a' target
3044 ((string-prefix? "aarch64" system)
3045 '("TARGET=ARMV8"))
3046 (else '()))))
3047 ;; no configure script
3048 #:phases
3049 (modify-phases %standard-phases
3050 (delete 'configure)
3051 (add-before 'build 'set-extralib
3052 (lambda* (#:key inputs #:allow-other-keys)
3053 ;; Get libgfortran found when building in utest.
3054 (setenv "FEXTRALIB"
3055 (string-append "-L" (assoc-ref inputs "fortran-lib")
3056 "/lib"))
3057 #t)))))
3058 (inputs
3059 `(("fortran-lib" ,gfortran "lib")))
3060 (native-inputs
3061 `(("cunit" ,cunit)
3062 ("fortran" ,gfortran)
3063 ("perl" ,perl)))
3064 (home-page "http://www.openblas.net/")
3065 (synopsis "Optimized BLAS library based on GotoBLAS")
3066 (description
3067 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
3068 (license license:bsd-3)))
3069
3070(define-public openblas-ilp64
3071 (package (inherit openblas)
3072 (name "openblas-ilp64")
3073 (supported-systems '("x86_64-linux" "aarch64-linux" "mips64el-linux"))
3074 (arguments
3075 (substitute-keyword-arguments (package-arguments openblas)
3076 ((#:make-flags flags '())
3077 `(append (list "INTERFACE64=1" "LIBNAMESUFFIX=ilp64")
3078 ,flags))))
3079 (synopsis "Optimized BLAS library based on GotoBLAS (ILP64 version)")
3080 (license license:bsd-3)))
3081
3082(define* (make-blis implementation #:optional substitutable?)
3083 "Return a BLIS package with the given IMPLEMENTATION (see config/ in the
3084source tree for a list of implementations.)
3085
3086SUBSTITUTABLE? determines whether the package is made available as a
3087substitute.
3088
3089Currently the specialization must be selected at configure-time, but work is
3090underway to allow BLIS to select the right optimized kernels at run time:
3091<https://github.com/flame/blis/issues/129>."
3092 (package
3093 (name (if (string=? implementation "reference")
3094 "blis"
3095 (string-append "blis-" implementation)))
3096 (version "0.2.2")
3097 (home-page "https://github.com/flame/blis")
3098 (source (origin
3099 (method git-fetch)
3100 (uri (git-reference (url home-page) (commit version)))
3101 (sha256
3102 (base32
3103 "1wr79a50nm4abhw8w3sn96nmwp5mrzifcigk7khw9qcgyyyqayfh"))
3104 (file-name (git-file-name "blis" version))))
3105 (build-system gnu-build-system)
3106 (arguments
3107 `(#:test-target "test"
3108
3109 #:substitutable? ,substitutable?
3110
3111 #:phases (modify-phases %standard-phases
3112 (replace 'configure
3113 (lambda* (#:key outputs #:allow-other-keys)
3114 ;; This is a home-made 'configure' script.
3115 (let ((out (assoc-ref outputs "out")))
3116 (invoke "./configure" "-p" out
3117 "-d" "opt"
3118 "--disable-static"
3119 "--enable-shared"
3120 "--enable-threading=openmp"
3121
3122 ,implementation))))
3123 (add-before 'check 'show-test-output
3124 (lambda _
3125 ;; By default "make check" is silent. Make it verbose.
3126 (system "tail -F output.testsuite &")
3127 #t)))))
3128 (synopsis "High-performance basic linear algebra (BLAS) routines")
3129 (description
3130 "BLIS is a portable software framework for instantiating high-performance
3131BLAS-like dense linear algebra libraries. The framework was designed to
3132isolate essential kernels of computation that, when optimized, immediately
3133enable optimized implementations of most of its commonly used and
3134computationally intensive operations. While BLIS exports a new BLAS-like API,
3135it also includes a BLAS compatibility layer which gives application developers
3136access to BLIS implementations via traditional BLAS routine calls.")
3137 (license license:bsd-3)))
3138
3139(define-public blis
3140 ;; This is the "reference" implementation, which is the non-optimized but
3141 ;; portable variant (no assembly).
3142 (make-blis "reference" #t))
3143
3144(define ignorance blis)
3145
3146(define-syntax-rule (blis/x86_64 processor)
3147 "Expand to a package specialized for PROCESSOR."
3148 (package
3149 (inherit (make-blis processor))
3150 (supported-systems '("x86_64-linux"))))
3151
3152(define-public blis-sandybridge
3153 ;; BLIS specialized for Sandy Bridge processors (launched 2011):
3154 ;; <http://ark.intel.com/products/codename/29900/Sandy-Bridge>.
3155 (blis/x86_64 "sandybridge"))
3156
3157(define-public blis-haswell
3158 ;; BLIS specialized for Haswell processors (launched 2013):
3159 ;; <http://ark.intel.com/products/codename/42174/Haswell>.
3160 (blis/x86_64 "haswell"))
3161
3162(define-public blis-knl
3163 ;; BLIS specialized for Knights Landing processor (launched 2016):
3164 ;; <http://ark.intel.com/products/series/92650/Intel-Xeon-Phi-x200-Product-Family>.
3165 (blis/x86_64 "knl"))
3166
3167
3168(define-public openlibm
3169 (package
3170 (name "openlibm")
3171 (version "0.6.0")
3172 (source
3173 (origin
3174 (method git-fetch)
3175 (uri (git-reference
3176 (url "https://github.com/JuliaLang/openlibm.git")
3177 (commit (string-append "v" version))))
3178 (file-name (git-file-name name version))
3179 (sha256
3180 (base32 "08wfchmmr5200fvmn1kwq9byc1fhsq46hn0y5k8scdl74771c7gh"))))
3181 (build-system gnu-build-system)
3182 (arguments
3183 `(#:make-flags
3184 (list (string-append "prefix=" (assoc-ref %outputs "out")))
3185 #:phases
3186 ;; no configure script
3187 (modify-phases %standard-phases (delete 'configure))
3188 #:tests? #f)) ;the tests are part of the default target
3189 (home-page "http://openlibm.org/")
3190 (synopsis "Portable C mathematical library (libm)")
3191 (description
3192 "OpenLibm is an effort to have a high quality, portable, standalone C
3193mathematical library (libm). It can be used standalone in applications and
3194programming language implementations. The project was born out of a need to
3195have a good libm for the Julia programming language that worked consistently
3196across compilers and operating systems, and in 32-bit and 64-bit
3197environments.")
3198 ;; Each architecture has its own make target, and there is none for mips.
3199 (supported-systems (delete "mips64el-linux" %supported-systems))
3200 ;; See LICENSE.md for details.
3201 (license (list license:expat
3202 license:isc
3203 license:bsd-2
3204 license:public-domain
3205 license:lgpl2.1+))))
3206
3207(define-public openspecfun
3208 (package
3209 (name "openspecfun")
3210 (version "0.5.3")
3211 (source
3212 (origin
3213 (method git-fetch)
3214 (uri (git-reference
3215 (url "https://github.com/JuliaLang/openspecfun.git")
3216 (commit (string-append "v" version))))
3217 (file-name (git-file-name name version))
3218 (sha256
3219 (base32 "0pfw6l3ch7isz403llx7inxlvavqh01jh1hb9dpidi86sjjx9kfh"))))
3220 (build-system gnu-build-system)
3221 (arguments
3222 '(#:tests? #f ; no "check" target
3223 #:make-flags
3224 (list (string-append "prefix=" (assoc-ref %outputs "out")))
3225 #:phases
3226 (modify-phases %standard-phases
3227 (delete 'configure)))) ; no configure script
3228 (inputs
3229 `(("fortran" ,gfortran)))
3230 (home-page "https://github.com/JuliaLang/openspecfun")
3231 (synopsis "Collection of special mathematical functions")
3232 (description
3233 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
3234portable package for Bessel Functions of a Complex Argument and Nonnegative
3235Order; it contains subroutines for computing Bessel functions and Airy
3236functions. Faddeeva allows computing the various error functions of arbitrary
3237complex arguments (Faddeeva function, error function, complementary error
3238function, scaled complementary error function, imaginary error function, and
3239Dawson function); given these, one can also easily compute Voigt functions,
3240Fresnel integrals, and similar related functions as well.")
3241 ;; Faddeeva is released under the Expat license; AMOS is included as
3242 ;; public domain software.
3243 (license (list license:expat license:public-domain))))
3244
3245(define-public suitesparse
3246 (package
3247 (name "suitesparse")
3248 (version "4.5.5")
3249 (source
3250 (origin
3251 (method url-fetch)
3252 (uri (string-append
3253 "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-"
3254 version ".tar.gz"))
3255 (sha256
3256 (base32
3257 "1dnr6pmjzc2qmbkmb4shigx1l74ilf6abn7svyd6brxgvph8vadr"))
3258 (modules '((guix build utils)))
3259 (snippet
3260 ;; Remove bundled metis source
3261 '(begin
3262 (delete-file-recursively "metis-5.1.0")
3263 #t))))
3264 (build-system gnu-build-system)
3265 (arguments
3266 '(#:tests? #f ;no "check" target
3267 #:make-flags
3268 (list "CC=gcc"
3269 "BLAS=-lblas"
3270 "TBB=-ltbb"
3271 "MY_METIS_LIB=-lmetis"
3272 (string-append "INSTALL_LIB="
3273 (assoc-ref %outputs "out") "/lib")
3274 (string-append "INSTALL_INCLUDE="
3275 (assoc-ref %outputs "out") "/include")
3276 "library")
3277 #:phases
3278 (modify-phases %standard-phases
3279 (delete 'configure)))) ;no configure script
3280 (inputs
3281 `(("tbb" ,tbb)
3282 ("lapack" ,lapack)
3283 ("metis" ,metis)))
3284 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
3285 (synopsis "Suite of sparse matrix software")
3286 (description
3287 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
3288multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
3289multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
3290simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
3291CXSparse, a concise sparse Cholesky factorization package; and many other
3292packages.")
3293 ;; LGPLv2.1+:
3294 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
3295 ;; GPLv2+:
3296 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
3297 (license (list license:gpl2+ license:lgpl2.1+))))
3298
3299(define-public atlas
3300 (package
3301 (name "atlas")
3302 (version "3.10.3")
3303 (source (origin
3304 (method url-fetch)
3305 (uri (string-append "mirror://sourceforge/math-atlas/Stable/"
3306 version "/atlas" version ".tar.bz2"))
3307 (sha256
3308 (base32
3309 "1dyjlq3fiparvm8ypwk6rsmjzmnwk81l88gkishphpvc79ryp216"))))
3310 (build-system gnu-build-system)
3311 (home-page "http://math-atlas.sourceforge.net/")
3312 (inputs `(("gfortran" ,gfortran)
3313 ("lapack-tar" ,(package-source lapack))))
3314 (outputs '("out" "doc"))
3315 ;; For the moment we drop support for MIPS at it fails to compile. See
3316 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
3317 (supported-systems (delete "mips64el-linux" %supported-systems))
3318 (arguments
3319 `(#:parallel-build? #f
3320 #:parallel-tests? #f
3321
3322 ;; ATLAS tunes itself for the machine it is built on, as explained at
3323 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
3324 ;; For this reason, we want users to build it locally instead of using
3325 ;; substitutes.
3326 #:substitutable? #f
3327
3328 #:modules ((srfi srfi-26)
3329 (guix build gnu-build-system)
3330 (guix build utils))
3331 #:configure-flags
3332 `(;; Generate position independent code suitable for dynamic libraries
3333 ;; and use WALL timer to get more accurate timing.
3334 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
3335 ;; Set word width.
3336 "-b"
3337 ,,(if (string-match "64" (%current-system))
3338 "64"
3339 "32")
3340 ;; Disable parallel build as it gives errors: atlas_pthread.h is
3341 ;; needed to compile C files before it is generated.
3342 "-Ss" "pmake" "make -j 1"
3343 ;; Probe is failing for MIPS. We therefore define the system
3344 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
3345 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
3346 ,,@(if (string-prefix? "mips" (%current-system))
3347 (list "-A" "49" "-V" "1")
3348 (list))
3349 ;; Generate shared libraries.
3350 "--shared"
3351 ;; Build a full LAPACK library.
3352 ,(string-append "--with-netlib-lapack-tarfile="
3353 (assoc-ref %build-inputs "lapack-tar")))
3354 #:phases
3355 (modify-phases %standard-phases
3356 (add-after 'install 'install-doc
3357 (lambda* (#:key outputs inputs #:allow-other-keys)
3358 (let ((doc (string-append (assoc-ref outputs "doc")
3359 "/share/doc/atlas")))
3360 (mkdir-p doc)
3361 (for-each (cut install-file <> doc)
3362 (find-files "../ATLAS/doc" ".*"))
3363 #t)))
3364 (add-after 'check 'check-pt
3365 (lambda _ (invoke "make" "ptcheck")))
3366 ;; Fix files required to run configure.
3367 (add-before 'configure 'fix-/bin/sh
3368 (lambda _
3369 ;; Use `sh', not `/bin/sh'.
3370 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
3371 (("/bin/sh")
3372 "sh"))))
3373 ;; Fix /bin/sh in generated make files.
3374 (add-after 'configure 'fix-/bin/sh-in-generated-files
3375 (lambda _
3376 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
3377 (("/bin/sh")
3378 "sh"))))
3379 ;; ATLAS configure program does not accepts the default flags
3380 ;; passed by the 'gnu-build-system'.
3381 (replace 'configure
3382 (lambda* (#:key native-inputs inputs outputs
3383 (configure-flags '())
3384 #:allow-other-keys #:rest args)
3385 (let* ((prefix (assoc-ref outputs "out"))
3386 (bash (or (and=> (assoc-ref
3387 (or native-inputs inputs) "bash")
3388 (cut string-append <> "/bin/bash"))
3389 "/bin/sh"))
3390 (flags `(,(string-append "--prefix=" prefix)
3391 ,@configure-flags))
3392 (abs-srcdir (getcwd))
3393 (srcdir (string-append "../" (basename abs-srcdir))))
3394 (format #t "source directory: ~s (relative from build: ~s)~%"
3395 abs-srcdir srcdir)
3396 (mkdir "../build")
3397 (chdir "../build")
3398 (format #t "build directory: ~s~%" (getcwd))
3399 (format #t "configure flags: ~s~%" flags)
3400 (apply invoke bash
3401 (string-append srcdir "/configure")
3402 flags)))))))
3403 (synopsis "Automatically Tuned Linear Algebra Software")
3404 (description
3405 "ATLAS is an automatically tuned linear algebra software library
3406providing C and Fortran77 interfaces to a portably efficient BLAS
3407implementation, as well as a few routines from LAPACK.
3408
3409Optimization occurs at build time. For this reason, the library is built on
3410the machine where it is installed, without resorting to pre-built substitutes.
3411
3412Before building the library, CPU throttling should be disabled. This can be
3413done in the BIOS, or, on GNU/Linux, with the following command:
3414
3415@example
3416# cpupower --governor performance
3417@end example
3418
3419Failure to do so will result in a library with poor performance.")
3420 (license license:bsd-3)))
3421
3422(define-public glm
3423 (package
3424 (name "glm")
3425 (version "0.9.9.5")
3426 (source
3427 (origin
3428 (method url-fetch)
3429 (uri (string-append "https://github.com/g-truc/glm/releases/download/"
3430 version "/glm-" version ".zip"))
3431 (sha256
3432 (base32
3433 "1vmg7hb4xvsa77zpbwiw6lqc7pyaj56dihx6xriny5b9rrh4iqsg"))))
3434 (build-system cmake-build-system)
3435 (native-inputs
3436 `(("unzip" ,unzip)))
3437 (home-page "https://glm.g-truc.net/")
3438 (synopsis "OpenGL Mathematics library")
3439 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
3440library for graphics software based on the OpenGL Shading Language (GLSL)
3441specifications.")
3442 (license license:expat)))
3443
3444(define-public lpsolve
3445 (package
3446 (name "lpsolve")
3447 (version "5.5.2.5")
3448 (source
3449 (origin
3450 (method url-fetch)
3451 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
3452 "/lp_solve_" version "_source.tar.gz"))
3453 (sha256
3454 (base32
3455 "12pj1idjz31r7c2mb5w03vy1cmvycvbkx9z29s40qdmkp1i7q6i0"))
3456 (modules '((guix build utils)))
3457 (snippet
3458 '(begin
3459 (substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
3460 (("^c=cc") "c=gcc")
3461 ;; Pretend to be on a 64 bit platform to obtain a common directory
3462 ;; name for the build results on all architectures; nothing else
3463 ;; seems to depend on it.
3464 (("^PLATFORM=.*$") "PLATFORM=ux64\n")
3465
3466 ;; The check for 'isnan' as it is written fails with
3467 ;; "non-floating-point argument in call to function
3468 ;; ‘__builtin_isnan’", which leads to the 'NOISNAN' cpp macro
3469 ;; definition, which in turn leads to bad things. Fix the feature
3470 ;; test.
3471 (("isnan\\(0\\)") "isnan(0.)"))
3472 #t))))
3473 (build-system gnu-build-system)
3474 (arguments
3475 `(#:tests? #f ; no check target
3476 #:phases
3477 (modify-phases %standard-phases
3478 (delete 'configure) ; no configure script
3479 (replace 'build
3480 (lambda _
3481 (with-directory-excursion "lpsolve55"
3482 (invoke "bash" "ccc"))
3483 (with-directory-excursion "lp_solve"
3484 (invoke "bash" "ccc"))
3485 #t))
3486 (replace 'install
3487 (lambda* (#:key outputs #:allow-other-keys)
3488 (let* ((out (assoc-ref outputs "out"))
3489 (bin (string-append out "/bin"))
3490 (lib (string-append out "/lib"))
3491 ;; This is where LibreOffice expects to find the header
3492 ;; files, and where they are installed by Debian.
3493 (include (string-append out "/include/lpsolve")))
3494 (install-file "lpsolve55/bin/ux64/liblpsolve55.a" lib)
3495 (install-file "lpsolve55/bin/ux64/liblpsolve55.so" lib)
3496 (install-file "lp_solve/bin/ux64/lp_solve" bin)
3497
3498 ;; Install a subset of the header files as on Debian
3499 ;; (plus lp_bit.h, which matches the regular expression).
3500 (for-each (lambda (name)
3501 (install-file name include))
3502 (find-files "." "lp_[HMSa-z].*\\.h$"))
3503 (with-directory-excursion "shared"
3504 (for-each (lambda (name)
3505 (install-file name include))
3506 (find-files "." "\\.h$")))
3507 #t))))))
3508 (home-page "http://lpsolve.sourceforge.net/")
3509 (synopsis "Mixed integer linear programming (MILP) solver")
3510 (description
3511 "lp_solve is a mixed integer linear programming solver based on the
3512revised simplex and the branch-and-bound methods.")
3513 (license license:lgpl2.1+)))
3514
3515(define-public dealii
3516 (package
3517 (name "dealii")
3518 (version "9.0.1")
3519 (source
3520 (origin
3521 (method url-fetch)
3522 (uri (string-append "https://github.com/dealii/dealii/releases/"
3523 "download/v" version "/dealii-" version ".tar.gz"))
3524 (sha256
3525 (base32
3526 "0r7f8rhl3xr94imd372plizdcbqk0a70w73lwc3vw912dxk0sbyz"))
3527 (patches (search-patches "dealii-mpi-deprecations.patch"))
3528 (modules '((guix build utils)))
3529 (snippet
3530 ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
3531 '(begin
3532 (delete-file-recursively "bundled")
3533 #t))))
3534 (build-system cmake-build-system)
3535 (inputs
3536 `(("tbb" ,tbb)
3537 ("zlib" ,zlib)
3538 ("boost" ,boost)
3539 ("p4est" ,p4est)
3540 ("blas" ,openblas)
3541 ("lapack" ,lapack)
3542 ("arpack" ,arpack-ng)
3543 ("muparser" ,muparser)
3544 ("gfortran" ,gfortran)
3545 ("suitesparse" ,suitesparse))) ;for UMFPACK
3546 (arguments
3547 `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease
3548 #:configure-flags
3549 ;; Work around a bug in libsuitesparseconfig linking
3550 ;; see https://github.com/dealii/dealii/issues/4745
3551 '("-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON")))
3552 (home-page "https://www.dealii.org")
3553 (synopsis "Finite element library")
3554 (description
3555 "Deal.II is a C++ program library targeted at the computational solution
3556of partial differential equations using adaptive finite elements. The main
3557aim of deal.II is to enable rapid development of modern finite element codes,
3558using among other aspects adaptive meshes and a wide array of tools often used
3559in finite element programs.")
3560 (license license:lgpl2.1+)))
3561
3562(define-public dealii-openmpi
3563 (package (inherit dealii)
3564 (name "dealii-openmpi")
3565 (inputs
3566 `(("mpi" ,openmpi)
3567 ;;Supported only with MPI:
3568 ("hdf5" ,hdf5-parallel-openmpi) ;TODO: have petsc-openmpi propagate?
3569 ("p4est" ,p4est-openmpi)
3570 ("petsc" ,petsc-openmpi)
3571 ("slepc" ,slepc-openmpi)
3572 ("metis" ,metis) ;for MUMPS
3573 ("scalapack" ,scalapack) ;for MUMPS
3574 ("mumps" ,mumps-metis-openmpi) ;configure supports only metis orderings
3575 ("arpack" ,arpack-ng-openmpi)
3576 ,@(fold alist-delete (package-inputs dealii)
3577 '("p4est" "arpack"))))
3578 (arguments
3579 (substitute-keyword-arguments (package-arguments dealii)
3580 ((#:configure-flags cf)
3581 `(cons "-DDEAL_II_WITH_MPI:BOOL=ON"
3582 ,cf))
3583 ((#:phases phases '%standard-phases)
3584 `(modify-phases ,phases
3585 (add-before 'check 'mpi-setup
3586 ,%openmpi-setup)))))
3587 (synopsis "Finite element library (with MPI support)")))
3588
3589(define-public flann
3590 (package
3591 (name "flann")
3592 (version "1.8.4")
3593 (source
3594 (origin
3595 (method url-fetch)
3596 (uri
3597 (string-append
3598 "http://www.cs.ubc.ca/research/flann/uploads/FLANN/flann-"
3599 version "-src.zip"))
3600 (sha256
3601 (base32
3602 "022w8hph7bli5zbpnk3z1qh1c2sl5hm8fw2ccim651ynn0hr7fyz"))
3603 (patches (search-patches "flann-cmake-3.11.patch"))))
3604 (build-system cmake-build-system)
3605 (outputs '("out"
3606 "octave")) ;46 MiB .mex file that pulls Octave
3607 (native-inputs
3608 `(("unzip" ,unzip)))
3609 (inputs
3610 `(("hdf5" ,hdf5)
3611 ("octave" ,octave-cli)
3612 ("python" ,python-2) ; print syntax
3613 ;; ("python2-numpy" ,python2-numpy) ; only required for the tests
3614 ("zlib" ,zlib)))
3615 (arguments
3616 `(;; The 'share/flann/octave' contains a .mex file, which is an ELF file
3617 ;; taken 46 MiB unstripped, and 6 MiB stripped.
3618 #:strip-directories '("lib" "lib64" "libexec"
3619 "bin" "sbin" "share/flann/octave")
3620
3621 ;; Save 12 MiB by not installing .a files. Passing
3622 ;; '-DBUILD_STATIC_LIBS=OFF' has no effect.
3623 #:phases (modify-phases %standard-phases
3624 (add-before 'configure 'set-octave-directory
3625 (lambda* (#:key outputs #:allow-other-keys)
3626 ;; Install the .mex file in the "octave" output.
3627 (let ((out (assoc-ref outputs "octave")))
3628 (substitute* "src/matlab/CMakeLists.txt"
3629 (("share/flann/octave")
3630 (string-append out "/share/flann/octave")))
3631 #t)))
3632 (add-after 'install 'remove-static-libraries
3633 (lambda* (#:key outputs #:allow-other-keys)
3634 (let* ((out (assoc-ref outputs "out"))
3635 (lib (string-append out "/lib")))
3636 (for-each delete-file
3637 (find-files lib "\\.a$"))
3638 #t))))
3639
3640 #:tests? #f)) ; The test data are downloaded from the Internet.
3641 (home-page "http://www.cs.ubc.ca/research/flann/")
3642 (synopsis "Library for approximate nearest neighbors computation")
3643 (description "FLANN is a library for performing fast approximate
3644nearest neighbor searches in high dimensional spaces. It implements a
3645collection of algorithms and a system for automatically choosing the best
3646algorithm and optimum parameters depending on the dataset.
3647
3648FLANN is written in C++ and contains bindings for C, Octave and Python.")
3649 (license (license:non-copyleft "file://COPYING"
3650 "See COPYING in the distribution."))))
3651
3652(define-public wcalc
3653 (package
3654 (name "wcalc")
3655 (version "2.5")
3656 (source
3657 (origin
3658 (method url-fetch)
3659 (uri (string-append "mirror://sourceforge/w-calc/Wcalc/" version "/"
3660 "wcalc-" version ".tar.bz2"))
3661 (sha256
3662 (base32
3663 "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
3664 (build-system gnu-build-system)
3665 (inputs
3666 `(("mpfr" ,mpfr)
3667 ("readline" ,readline)))
3668 (home-page "http://w-calc.sourceforge.net/index.php")
3669 (synopsis "Flexible command-line scientific calculator")
3670 (description "Wcalc is a very capable calculator. It has standard functions
3671(sin, asin, and sinh for example, in either radians or degrees), many
3672pre-defined constants (pi, e, c, etc.), support for using variables, \"active\"
3673variables, a command history, hex/octal/binary input and output, unit
3674conversions, embedded comments, and an expandable expression entry field. It
3675evaluates expressions using the standard order of operations.")
3676 (license license:gpl2+)))
3677
3678(define-public xaos
3679 (package
3680 (name "xaos")
3681 (version "3.6")
3682 (source (origin
3683 (method url-fetch)
3684 (uri (string-append "mirror://sourceforge/xaos/XaoS/" version
3685 "/xaos-" version ".tar.gz"))
3686 (sha256
3687 (base32
3688 "15cd1cx1dyygw6g2nhjqq3bsfdj8sj8m4va9n75i0f3ryww3x7wq"))))
3689 (build-system gnu-build-system)
3690 (native-inputs `(("gettext" ,gettext-minimal)))
3691 (inputs `(("libx11" ,libx11)
3692 ("zlib" ,zlib)
3693 ("libpng" ,libpng)
3694 ("gsl" ,gsl)))
3695 (arguments
3696 `(#:tests? #f ;no "check" target
3697 #:make-flags '("LOCALEDIR=$DATAROOTDIR/locale")))
3698 (synopsis "Real-time fractal zoomer")
3699 (description "GNU XaoS is a graphical program that generates fractal
3700patterns and allows you to zoom in and out of them infinitely in a fluid,
3701continuous manner. It also includes tutorials that help to explain how fractals
3702are built. It can generate many different fractal types such as the Mandelbrot
3703set.")
3704 (home-page "https://www.gnu.org/software/xaos/")
3705 (license license:gpl2+)))
3706
3707(define-public hypre
3708 (package
3709 (name "hypre")
3710 (version "2.15.1")
3711 (source
3712 (origin
3713 (method git-fetch)
3714 (uri (git-reference
3715 (url "https://github.com/LLNL/hypre.git")
3716 (commit (string-append "v" version))))
3717 (file-name (git-file-name name version))
3718 (sha256
3719 (base32 "1lvh4ybqkriyqfg2zmic6mrg1981qv1i9vry1fdgsabn81hb71g4"))
3720 (modules '((guix build utils)))
3721 (snippet
3722 '(begin
3723 ;; Remove use of __DATE__ and __TIME__ for reproducibility;
3724 ;; substitute the release date.
3725 (substitute* "src/utilities/HYPRE_utilities.h"
3726 (("Date Compiled: .*$")
3727 "Date Compiled: Oct 19 2018 15:23:00 +0000\"\n"))
3728 #t))))
3729 (build-system gnu-build-system)
3730 (outputs '("out" ; 6.1 MiB of headers and libraries
3731 "doc")) ; 4.8 MiB of documentation
3732 (native-inputs
3733 `(("doc++" ,doc++)
3734 ("netpbm" ,netpbm)
3735 ("perl" ,perl) ; needed to run 'ppmquant' during tests
3736 ("texlive" ,(texlive-union (list texlive-generic-xypic
3737 texlive-fonts-xypic
3738 texlive-latex-hyperref
3739 texlive-bibtex)))
3740 ("ghostscript" ,ghostscript)))
3741 (inputs
3742 `(("blas" ,openblas)
3743 ("lapack" ,lapack)))
3744 (arguments
3745 `(#:modules ((srfi srfi-1)
3746 ,@%gnu-build-system-modules)
3747 #:configure-flags '("--enable-shared"
3748 "--disable-fortran"
3749 "--without-MPI"
3750 "--with-openmp"
3751 "--with-fei"
3752 "--with-lapack"
3753 "--with-blas")
3754 #:phases
3755 (modify-phases %standard-phases
3756 (add-before 'build 'set-HOME
3757 (lambda _
3758 ;; FIXME: texlive-union does not find the built
3759 ;; metafonts, so it tries to generate them in HOME.
3760 (setenv "HOME" "/tmp")
3761 #t))
3762 (add-before 'configure 'chdir-src
3763 (lambda _ (chdir "src")))
3764 (replace 'configure
3765 (lambda* (#:key build target configure-flags
3766 #:allow-other-keys #:rest args)
3767 (let* ((configure (assoc-ref %standard-phases 'configure)))
3768 (apply configure
3769 (append args
3770 (list #:configure-flags
3771 (cons (string-append
3772 "--host=" (or target build))
3773 configure-flags)))))))
3774 (add-after 'build 'build-docs
3775 (lambda _
3776 (invoke "make" "-Cdocs" "pdf" "html")))
3777 (replace 'check
3778 (lambda _
3779 (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/hypre/lib"))
3780 (setenv "PATH" (string-append "." ":" (getenv "PATH")))
3781 (invoke "make" "check" "CHECKRUN=")
3782 (for-each (lambda (filename)
3783 (let ((size (stat:size (stat filename))))
3784 (when (positive? size)
3785 (error (format #f "~a size ~d; error indication~%"
3786 filename size)))))
3787 (find-files "test" ".*\\.err$"))
3788 #t))
3789 (add-after 'install 'install-docs
3790 (lambda* (#:key outputs #:allow-other-keys)
3791 ;; Custom install because docs/Makefile doesn't honor ${docdir}.
3792 (let* ((doc (assoc-ref outputs "doc"))
3793 (docdir (string-append doc "/share/doc/hypre-" ,version)))
3794 (with-directory-excursion "docs"
3795 (for-each (lambda (base)
3796 (install-file (string-append base ".pdf") docdir)
3797 (copy-recursively base docdir)) ; html docs
3798 '("HYPRE_usr_manual"
3799 "HYPRE_ref_manual")))
3800 #t))))))
3801 (home-page "http://www.llnl.gov/casc/hypre/")
3802 (synopsis "Library of solvers and preconditioners for linear equations")
3803 (description
3804 "HYPRE is a software library of high performance preconditioners and
3805solvers for the solution of large, sparse linear systems of equations. It
3806features multigrid solvers for both structured and unstructured grid
3807problems.")
3808 (license license:lgpl2.1)))
3809
3810(define-public hypre-openmpi
3811 (package (inherit hypre)
3812 (name "hypre-openmpi")
3813 (inputs
3814 `(("mpi" ,openmpi)
3815 ,@(package-inputs hypre)))
3816 (arguments
3817 (substitute-keyword-arguments (package-arguments hypre)
3818 ((#:configure-flags flags)
3819 ``("--with-MPI"
3820 ,@(delete "--without-MPI" ,flags)))
3821 ((#:phases phases)
3822 `(modify-phases ,phases
3823 (add-before 'check 'mpi-setup
3824 ,%openmpi-setup)))))
3825 (synopsis "Parallel solvers and preconditioners for linear equations")
3826 (description
3827 "HYPRE is a software library of high performance preconditioners and
3828solvers for the solution of large, sparse linear systems of equations on
3829parallel computers. It features parallel multigrid solvers for both
3830structured and unstructured grid problems.")))
3831
3832(define-public matio
3833 (package
3834 (name "matio")
3835 (version "1.5.6")
3836 (source
3837 (origin
3838 (method url-fetch)
3839 (uri (string-append "mirror://sourceforge/matio/matio/" version "/"
3840 "matio-" version ".tar.gz"))
3841 (sha256
3842 (base32
3843 "0y2qymgxank8wdiwc68ap8bxdzrhvyw86i29yh3xgn4z1njfd9ir"))))
3844 (build-system gnu-build-system)
3845 (inputs
3846 `(("zlib" ,zlib)
3847 ("hdf5" ,hdf5)))
3848 (home-page "http://matio.sourceforge.net/")
3849 (synopsis "Library for reading and writing MAT files")
3850 (description "Matio is a library for reading and writing MAT files. It
3851supports compressed MAT files, as well as newer (version 7.3) MAT files.")
3852 (license license:bsd-2)))
3853
3854(define-public vc
3855 (package
3856 (name "vc")
3857 (version "1.3.3")
3858 (source
3859 (origin (method url-fetch)
3860 (uri (string-append "https://github.com/VcDevel/Vc/releases/"
3861 "download/" version "/Vc-" version ".tar.gz"))
3862 (sha256
3863 (base32
3864 "1zmlpn32jzb38smp3j834llmbix3whsrbw0h397qxysbw792kih8"))))
3865 (build-system cmake-build-system)
3866 (arguments
3867 '(#:configure-flags
3868 '("-DBUILD_TESTING=ON"
3869 ;; By default, Vc will optimize for the CPU of the build machine.
3870 ;; Setting this to "none" makes it create portable binaries. See
3871 ;; "cmake/OptimizeForArchitecture.cmake".
3872 "-DTARGET_ARCHITECTURE=none")))
3873 (synopsis "SIMD vector classes for C++")
3874 (description "Vc provides portable, zero-overhead C++ types for explicitly
3875data-parallel programming. It is a library designed to ease explicit
3876vectorization of C++ code. Its types enable explicitly stating data-parallel
3877operations on multiple values. The parallelism is therefore added via the type
3878system. Vc has an intuitive API and provides portability between different
3879compilers and compiler versions as well as portability between different vector
3880instruction sets. Thus, an application written with Vc can be compiled for:
3881@enumerate
3882@item AVX and AVX2
3883@item SSE2 up to SSE4.2 or SSE4a
3884@item Scalar
3885@item MIC
3886@item NEON (in development)
3887@item NVIDIA GPUs / CUDA (in development)
3888@end enumerate\n")
3889 (home-page "https://github.com/VcDevel/Vc")
3890 ;; "No support_???.cpp file exists for this architecture."
3891 (supported-systems '("x86_64-linux" "i686-linux"))
3892 (license license:bsd-3)))
3893
3894(define-public reducelcs
3895 ;; This is the last commit which is available upstream, no
3896 ;; release happened since 2010.
3897 (let ((commit "474f88deb968061abe8cf11c959e02319b8ae5c0")
3898 (revision "1"))
3899 (package
3900 (name "reducelcs")
3901 (version (string-append "1.0-" revision "." (string-take commit 7)))
3902 (source
3903 (origin
3904 (method git-fetch)
3905 (uri (git-reference
3906 (url "https://github.com/gdv/Reduce-Expand-for-LCS")
3907 (commit commit)))
3908 (file-name (string-append name "-" version "-checkout"))
3909 (sha256
3910 (base32
3911 "1rllzcfwc042c336mhq262a8ha90x6afq30kvk60r7i4761j4yjm"))))
3912 (build-system gnu-build-system)
3913 (inputs
3914 `(("openlibm" ,openlibm)))
3915 (arguments
3916 `(#:tests? #f ; no tests
3917 #:phases
3918 (modify-phases %standard-phases
3919 (delete 'configure) ; No configure script exists.
3920 (replace 'install ; No install phase exists.
3921 (lambda* (#:key outputs #:allow-other-keys)
3922 (let* ((out (assoc-ref outputs "out"))
3923 (bin (string-append out "/bin")))
3924 (install-file "Approximation" bin)
3925 (install-file "CollectResults" bin)
3926 (install-file "GenerateInstances" bin)
3927 #t))))))
3928 (synopsis "Approximate Longest Commons Subsequence computation tool")
3929 (description
3930 "@code{reduceLCS} is an implementation of the Reduce-Expand
3931algorithm for LCS. It is a fast program to compute the approximate
3932Longest Commons Subsequence of a set of strings.")
3933 (home-page "https://github.com/gdv/Reduce-Expand-for-LCS")
3934 (license license:gpl3+))))
3935
3936(define-public jacal
3937 (package
3938 (name "jacal")
3939 (version "1c4")
3940 (source (origin
3941 (method url-fetch)
3942 (uri (string-append
3943 "http://groups.csail.mit.edu/mac/ftpdir/scm/jacal-"
3944 version ".zip"))
3945 (sha256 (base32
3946 "055zrn12a1dmy0dqkwrkq3fklbhg3yir6vn0lacp4mvbg8573a3q"))
3947 (patches (search-patches "jacal-fix-texinfo.patch"))))
3948 (build-system gnu-build-system)
3949 (arguments
3950 `(#:phases
3951 (modify-phases %standard-phases
3952 (add-before 'build 'pre-build
3953 ;; Don't use upstream's script - it really doesn't fit into
3954 ;; Guix's functional paradigm.
3955 (lambda* (#:key inputs outputs #:allow-other-keys)
3956 (substitute* "Makefile"
3957 (("^install: install-script") "install: "))))
3958 (add-after 'install 'post-install
3959 ;; Instead, we provide our own simplified script.
3960 (lambda* (#:key inputs outputs #:allow-other-keys)
3961 (let ((wrapper (string-append (assoc-ref outputs "out")
3962 "/bin/jacal")))
3963 (format (open wrapper (logior O_WRONLY O_CREAT))
3964 (string-append "#!~a\nexec ~a/bin/scm -ip1 "
3965 "-e '(slib:load \"~a/lib/jacal/math\") "
3966 "(math)' \"$@\"\n")
3967 (which "bash")
3968 (assoc-ref inputs "scm")
3969 (assoc-ref outputs "out"))
3970 (chmod wrapper #o555))))
3971 (replace 'configure
3972 (lambda* (#:key outputs #:allow-other-keys)
3973 (invoke "./configure"
3974 (string-append "--prefix="
3975 (assoc-ref outputs "out"))))))))
3976 (inputs `(("scm" ,scm)))
3977 (native-inputs `(("unzip" ,unzip)
3978 ("texinfo" ,texinfo)))
3979 (synopsis "Symbolic mathematics system")
3980 (description "GNU JACAL is an interactive symbolic mathematics program based on
3981Scheme. It manipulate and simplify a range of mathematical expressions such
3982as equations, scalars, vectors, and matrices.")
3983 (home-page "https://www.gnu.org/software/jacal/")
3984 (license license:gpl3+)))
3985
3986(define-public z3
3987 (package
3988 (name "z3")
3989 (version "4.8.4")
3990 (home-page "https://github.com/Z3Prover/z3")
3991 (source (origin
3992 (method git-fetch)
3993 (uri (git-reference (url home-page)
3994 (commit (string-append "z3-" version))))
3995 (file-name (git-file-name name version))
3996 (sha256
3997 (base32
3998 "014igqm5vwswz0yhz0cdxsj3a6dh7i79hvhgc3jmmmz3z0xm1gyn"))))
3999 (build-system gnu-build-system)
4000 (arguments
4001 `(#:phases
4002 (modify-phases %standard-phases
4003 (add-after 'unpack 'fix-compatability
4004 ;; Versions after 4.8.3 have immintrin.h IFDEFed for Windows only.
4005 (lambda _
4006 (substitute* "src/util/mpz.cpp"
4007 (("#include <immintrin.h>") ""))
4008 #t))
4009 (add-before 'configure 'bootstrap
4010 (lambda _
4011 (invoke "python" "scripts/mk_make.py")))
4012 ;; work around gnu-build-system's setting --enable-fast-install
4013 ;; (z3's `configure' is a wrapper around the above python file,
4014 ;; which fails when passed --enable-fast-install)
4015 (replace 'configure
4016 (lambda* (#:key inputs outputs #:allow-other-keys)
4017 (invoke "./configure"
4018 (string-append "--prefix=" (assoc-ref outputs "out")))))
4019 (add-after 'configure 'change-directory
4020 (lambda _
4021 (chdir "build")
4022 #t))
4023 (add-before 'check 'make-test-z3
4024 (lambda _
4025 ;; Build the test suite executable.
4026 (invoke "make" "test-z3" "-j"
4027 (number->string (parallel-job-count)))))
4028 (replace 'check
4029 (lambda _
4030 ;; Run all the tests that don't require arguments.
4031 (invoke "./test-z3" "/a"))))))
4032 (native-inputs
4033 `(("which" ,which)
4034 ("python" ,python-wrapper)))
4035 (synopsis "Theorem prover")
4036 (description "Z3 is a theorem prover and @dfn{satisfiability modulo
4037theories} (SMT) solver. It provides a C/C++ API, as well as Python bindings.")
4038 (license license:expat)))
4039
4040(define-public elpa
4041 (package
4042 (name "elpa")
4043 (version "2018.11.001")
4044 (source (origin
4045 (method url-fetch)
4046 (uri (string-append "http://elpa.mpcdf.mpg.de/html/Releases/"
4047 version "/elpa-" version ".tar.gz"))
4048 (sha256
4049 (base32
4050 "05hv3v5i6xmziaizw350ff72y1c3k662r85fm3xfdrkclj5zw9yc"))))
4051 (build-system gnu-build-system)
4052 (native-inputs
4053 `(("fortran" ,gfortran)
4054 ("perl" ,perl))) ;for configure and deps
4055 (inputs
4056 `(("blas" ,openblas)))
4057 (arguments
4058 `(#:configure-flags
4059 `("--enable-openmp"
4060 "--with-mpi=no"
4061 ;; ELPA unfortunately does not support runtime dispatch, so we can
4062 ;; only enable the "generic" kernels. See the "Cross compilation"
4063 ;; section of INSTALL.md.
4064 "--enable-generic"
4065 "--disable-sse" "--disable-sse-assembly" ;Require SSE3
4066 "--disable-avx" "--disable-avx2" "--disable-avx512"
4067 ,(string-append "CFLAGS=-O3 "
4068 "-funsafe-loop-optimizations -funsafe-math-optimizations "
4069 "-ftree-vect-loop-version -ftree-vectorize "
4070 ,(let ((system (or (%current-target-system)
4071 (%current-system))))
4072 (cond
4073 ((or (string-prefix? "x86_64" system)
4074 (string-prefix? "i686" system))
4075 "-msse2")
4076 (else "")))))
4077 #:parallel-tests? #f ;tests are multi-threaded, via BLAS
4078 #:phases
4079 (modify-phases %standard-phases
4080 (add-before 'configure 'patch-header-generation
4081 (lambda _
4082 (substitute* "configure"
4083 (("^ *make.*top_srcdir=\"\\$srcdir\"" &)
4084 (string-append & " CPP=\"$CPP\"")))
4085 #t))
4086 (add-before 'check 'setup-tests
4087 (lambda _
4088 ;; Decrease test time and RAM use by computing fewer eigenvalues.
4089 ;; The flags are (MATRIX-SIZE, EIGENVALUES, BLOCK-SIZE), where
4090 ;; the default is (500, 250, 16) for C tests and (5000, 150, 16)
4091 ;; for Fortran. This also causes several tests to pass that
4092 ;; otherwise would otherwise fail with matrix size 5000; possibly
4093 ;; due to floating point tolerances that are too tight.
4094 (setenv "TEST_FLAGS" "1500 50 16") ;from elpa.spec
4095 (setenv "OMP_NUM_THREADS" (number->string (parallel-job-count)))
4096 (substitute* "Makefile"
4097 ;; Test scripts are generated, patch the shebang
4098 (("#!/bin/bash") (string-append "#!" (which "sh"))))
4099 #t)))))
4100 (home-page "http://elpa.mpcdf.mpg.de")
4101 (synopsis "Eigenvalue solvers for symmetric matrices")
4102 (description
4103 "The ELPA library provides efficient and scalable direct eigensolvers for
4104symmetric matrices.")
4105 (license license:lgpl3)))
4106
4107(define-public elpa-openmpi
4108 (package (inherit elpa)
4109 (name "elpa-openmpi")
4110 (inputs
4111 `(("mpi" ,openmpi)
4112 ("scalapack" ,scalapack)
4113 ,@(package-inputs elpa)))
4114 (arguments
4115 (substitute-keyword-arguments (package-arguments elpa)
4116 ((#:configure-flags cf '())
4117 `(cons "--with-mpi=yes" (delete "--with-mpi=no" ,cf)))
4118 ((#:phases phases '%standard-phases)
4119 `(modify-phases ,phases
4120 (add-before 'check 'mpi-setup
4121 (lambda _
4122 ;; Tests use 2 mpi tasks by default, use our remaining build
4123 ;; cores as OpenMP threads.
4124 (setenv "OMP_NUM_THREADS" (number->string
4125 (max (quotient (parallel-job-count) 2)
4126 1)))
4127 (,%openmpi-setup)))))))
4128 (synopsis "Eigenvalue solvers for symmetric matrices (with MPI support)")))
4129
4130(define-public elemental
4131 (package
4132 (name "elemental")
4133 (version "0.87.7")
4134 (source (origin
4135 (method git-fetch)
4136 (uri (git-reference
4137 (url "https://github.com/elemental/Elemental.git")
4138 (commit (string-append "v" version))))
4139 (file-name (git-file-name name version))
4140 (sha256
4141 (base32
4142 "1687xpjjzig27y2pnqv7hv09smpijyfdpz7qjgmcxf4shfajlfkc"))))
4143 (build-system cmake-build-system)
4144 (home-page "http://libelemental.org")
4145 (native-inputs
4146 `(("gfortran" ,gfortran)))
4147 (inputs
4148 `(("blas" ,openblas)
4149 ("gfortran:lib" ,gfortran "lib")
4150 ("gmp" ,gmp)
4151 ("lapack" ,lapack)
4152 ("metis" ,metis)
4153 ("mpc" ,mpc)
4154 ("mpfr" ,mpfr)
4155 ("mpi" ,openmpi)
4156 ("qd" ,qd)))
4157 (arguments
4158 `(#:build-type "Release" ;default RelWithDebInfo not supported
4159 #:configure-flags `("-DEL_DISABLE_PARMETIS:BOOL=YES"
4160 "-DEL_AVOID_COMPLEX_MPI:BOOL=NO"
4161 "-DEL_CACHE_WARNINGS:BOOL=YES"
4162 "-DEL_TESTS:BOOL=YES"
4163 "-DCMAKE_INSTALL_LIBDIR=lib"
4164 "-DGFORTRAN_LIB=gfortran")
4165 #:phases (modify-phases %standard-phases
4166 (add-before 'check 'mpi-setup
4167 ,%openmpi-setup)
4168 (add-before 'check 'setup-tests
4169 (lambda _
4170 ;; Parallelism is done at the MPI layer.
4171 (setenv "OMP_NUM_THREADS" "1")
4172 #t))
4173 (add-after 'install 'remove-tests
4174 (lambda* (#:key outputs #:allow-other-keys)
4175 ;; Tests are installed, with no easy configuration
4176 ;; switch to prevent this, so delete them.
4177 (delete-file-recursively
4178 (string-append (assoc-ref outputs "out") "/bin"))
4179 #t)))))
4180 (synopsis "Dense and sparse-direct linear algebra and optimization")
4181 (description "Elemental is a modern C++ library for distributed-memory
4182dense and sparse-direct linear algebra, conic optimization, and lattice
4183reduction.")
4184 (license license:bsd-2)))
4185
4186(define-public mcrl2
4187 (package
4188 (name "mcrl2")
4189 (version "201707.1.15162")
4190 (source (origin
4191 (method url-fetch)
4192 (uri (string-append "http://www.mcrl2.org/download/devel/mcrl2-"
4193 version
4194 ".tar.gz"))
4195 (sha256
4196 (base32
4197 "1ziww2fchsklm25hl9p2mngssxfh9w07nc114cncqaxfibqp2p8f"))))
4198 (native-inputs
4199 `(("subversion" ,subversion)))
4200 (inputs
4201 `(("boost" ,boost)
4202 ("glu" ,glu)
4203 ("mesa" ,mesa)
4204 ("qtbase" ,qtbase)))
4205 (build-system cmake-build-system)
4206 (synopsis "Toolset for the mCRL2 formal specification language")
4207 (description
4208 "@dfn{mCRL2} (micro Common Representation Language 2) is a formal
4209specification language for describing concurrent discrete event systems. Its
4210toolset supports analysis and automatic verification, linearisation, simulation,
4211state-space exploration and generation, and tools to optimise and analyse
4212specifications. Also, state spaces can be manipulated, visualised and
4213analysed.")
4214 (home-page "https://mcrl2.org")
4215 (license license:boost1.0)))
4216
4217(define-public r-subplex
4218 (package
4219 (name "r-subplex")
4220 (version "1.5-4")
4221 (source
4222 (origin
4223 (method url-fetch)
4224 (uri (cran-uri "subplex" version))
4225 (sha256
4226 (base32
4227 "10cbgbx1bgsax5z7gz6716g360xpq4mvq19cf4qqrxv02mmwz57z"))))
4228 (build-system r-build-system)
4229 (native-inputs
4230 `(("gfortran" ,gfortran)))
4231 (home-page "https://cran.r-project.org/web/packages/subplex")
4232 (synopsis "Unconstrained optimization using the subplex algorithm")
4233 (description "This package implements the Subplex optimization algorithm.
4234It solves unconstrained optimization problems using a simplex method on
4235subspaces. The method is well suited for optimizing objective functions that
4236are noisy or are discontinuous at the solution.")
4237 (license license:gpl3+)))
4238
4239(define-public r-desolve
4240 (package
4241 (name "r-desolve")
4242 (version "1.21")
4243 (source
4244 (origin
4245 (method url-fetch)
4246 (uri (cran-uri "deSolve" version))
4247 (sha256
4248 (base32
4249 "0qqc4mknw1jblzcmph1dg3k1p6w42yal0k1xjh8pqk7yb3a75hs5"))))
4250 (properties `((upstream-name . "deSolve")))
4251 (build-system r-build-system)
4252 (native-inputs
4253 `(("gfortran" ,gfortran)))
4254 (home-page "https://desolve.r-forge.r-project.org/")
4255 (synopsis "Solvers for initial value problems of differential equations")
4256 (description "This package provides functions that solve initial
4257value problems of a system of first-order ordinary differential equations (ODE),
4258of partial differential equations (PDE), of differential algebraic equations
4259(DAE), and of delay differential equations. The functions provide an interface
4260to the FORTRAN functions lsoda, lsodar, lsode, lsodes of the ODEPACK collection,
4261to the FORTRAN functions dvode and daspk and a C-implementation of solvers of
4262the Runge-Kutta family with fixed or variable time steps. The package contains
4263routines designed for solving ODEs resulting from 1-D, 2-D and 3-D partial
4264differential equations (PDE) that have been converted to ODEs by numerical
4265differencing.")
4266 (license license:gpl2+)))
4267
4268(define-public tcalc
4269 (package
4270 (name "tcalc")
4271 (version "2.0")
4272 (source
4273 (origin
4274 (method url-fetch)
4275 (uri (string-append "https://sites.google.com/site/mohammedisam2000/tcalc/tcalc-"
4276 version ".tar.gz"))
4277 (sha256
4278 (base32
4279 "0jq806m4dqfia85nppfm75mml9w57g0cgv4cdw9bp3zymda83s0m"))))
4280 (build-system gnu-build-system)
4281 (synopsis "The terminal calculator")
4282 (description
4283 "The terminal calculator is a small program to help users of the GNU/Linux
4284terminal do calculations simply and quickly. The formula to be calculated can
4285be fed to @command{tcalc} through the command line.")
4286 (home-page "https://sites.google.com/site/mohammedisam2000/tcalc")
4287 (license license:gpl3+)))
4288
4289(define-public sundials
4290 (package
4291 (name "sundials")
4292 (version "3.1.1")
4293 (source
4294 (origin
4295 (method url-fetch)
4296 (uri (string-append "https://computation.llnl.gov/projects/sundials/download/"
4297 "sundials-" version ".tar.gz"))
4298 (sha256
4299 (base32
4300 "090s8ymhd0g1s1d44fa73r5yi32hb4biwahhbfi327zd64yn8kd2"))))
4301 (build-system cmake-build-system)
4302 (native-inputs
4303 `(("python" ,python-2))) ;for tests; syntax incompatible with python 3
4304 (inputs
4305 `(("fortran" ,gfortran) ;for fcmix
4306 ("blas" ,openblas)
4307 ("suitesparse" ,suitesparse))) ;TODO: Add hypre
4308 (arguments
4309 `(#:configure-flags `("-DEXAMPLES_ENABLE_C:BOOL=ON"
4310 "-DEXAMPLES_ENABLE_CXX:BOOL=ON"
4311 "-DEXAMPLES_ENABLE_F77:BOOL=ON"
4312 "-DEXAMPLES_ENABLE_F90:BOOL=ON"
4313 "-DEXAMPLES_INSTALL:BOOL=OFF"
4314
4315 "-DFCMIX_ENABLE:BOOL=ON"
4316
4317 "-DKLU_ENABLE:BOOL=ON"
4318 ,(string-append "-DKLU_INCLUDE_DIR="
4319 (assoc-ref %build-inputs "suitesparse")
4320 "/include")
4321 ,(string-append "-DKLU_LIBRARY_DIR="
4322 (assoc-ref %build-inputs "suitesparse")
4323 "/lib"))))
4324 (home-page "https://computation.llnl.gov/projects/sundials")
4325 (synopsis "Suite of nonlinear and differential/algebraic equation solvers")
4326 (description "SUNDIALS is a family of software packages implemented with
4327the goal of providing robust time integrators and nonlinear solvers that can
4328easily be incorporated into existing simulation codes.")
4329 (license license:bsd-3)))
4330
4331(define-public sundials-openmpi
4332 (package (inherit sundials)
4333 (name "sundials-openmpi")
4334 (inputs
4335 `(("mpi" ,openmpi)
4336 ("petsc" ,petsc-openmpi) ;support in SUNDIALS requires MPI
4337 ,@(package-inputs sundials)))
4338 (arguments
4339 (substitute-keyword-arguments (package-arguments sundials)
4340 ((#:configure-flags flags '())
4341 `(cons* "-DMPI_ENABLE:BOOL=ON"
4342 "-DPETSC_ENABLE:BOOL=ON"
4343 (string-append "-DPETSC_INCLUDE_DIR="
4344 (assoc-ref %build-inputs "petsc")
4345 "/include")
4346 (string-append "-DPETSC_LIBRARY_DIR="
4347 (assoc-ref %build-inputs "petsc")
4348 "/lib")
4349 ,flags))
4350 ((#:phases phases '%standard-phases)
4351 `(modify-phases ,phases
4352 (add-before 'check 'mpi-setup
4353 ,%openmpi-setup)))))
4354 (synopsis "SUNDIALS with OpenMPI support")))
4355
4356(define-public combinatorial-blas
4357 (package
4358 (name "combinatorial-blas")
4359 (version "1.6.2")
4360 (source
4361 (origin
4362 (method url-fetch)
4363 (uri (string-append "http://eecs.berkeley.edu/~aydin/CombBLAS_FILES/"
4364 "CombBLAS_beta_"
4365 (match (string-split version #\.)
4366 ((major minor patch)
4367 (string-append major minor "_" patch))) ;e.g. "16_2"
4368 ".tgz"))
4369 (sha256
4370 (base32
4371 "1a9wbgdqyy1whhfc0yl0yqkax3amnqa6iihhq48d063gc0jwfd9a"))
4372 (patches (search-patches "combinatorial-blas-awpm.patch"
4373 "combinatorial-blas-io-fix.patch"))))
4374 (build-system cmake-build-system)
4375 (inputs
4376 `(("mpi" ,openmpi)
4377 ("test-data" ,(origin
4378 (method url-fetch)
4379 (uri (string-append "https://people.eecs.berkeley.edu/~aydin/"
4380 "CombBLAS_FILES/testdata_combblas1.6.1.tgz"))
4381 (sha256
4382 (base32
4383 "01y2781cy3fww7znmidrp85mf8zx0c905w5vzvk1mgrmhhynim87"))))))
4384 (arguments
4385 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES"
4386 "-DCMAKE_CXX_FLAGS=-DUSE_FUNNEL")
4387 #:parallel-tests? #f ;tests use 'mpiexec -n4'
4388 #:phases
4389 (modify-phases %standard-phases
4390 (add-before 'check 'mpi-setup
4391 ,%openmpi-setup)
4392 (add-before 'check 'test-setup
4393 (lambda* (#:key inputs #:allow-other-keys)
4394 (setenv "OMP_NUM_THREADS" "2")
4395 (invoke "tar" "xf" (assoc-ref inputs "test-data")))))))
4396 (home-page "https://people.eecs.berkeley.edu/~aydin/CombBLAS/html/")
4397 (synopsis "Linear algebra primitives for graph analytics")
4398 (description "The Combinatorial BLAS (CombBLAS) is an extensible
4399distributed-memory parallel graph library offering a small but powerful set of
4400linear algebra primitives specifically targeting graph analytics.")
4401 (license (list
4402 license:gpl2+ ;include/psort/(funnel|sort)*.h
4403 license:x11 ;usort and psort
4404 license:bsd-3)))) ;CombBLAS and MersenneTwister.h
4405
4406(define-public dune-common
4407 (package
4408 (name "dune-common")
4409 (version "2.6.0")
4410 (source
4411 (origin
4412 (method url-fetch)
4413 (uri (string-append "https://dune-project.org/download/"
4414 version "/dune-common-" version ".tar.gz"))
4415 (sha256
4416 (base32
4417 "019wcr1qf7jwyxx1y5y290wdlglylskvbb2m01ljkzcza2xnlmhw"))))
4418 (build-system cmake-build-system)
4419 (arguments
4420 `(#:phases
4421 (modify-phases %standard-phases
4422 (add-after 'build 'build-tests
4423 (lambda* (#:key make-flags #:allow-other-keys)
4424 (apply invoke "make" "build_tests" make-flags)))
4425 ;; These tests fail because they require a fully functional MPI
4426 ;; environment.
4427 (add-after 'unpack 'disable-failing-tests
4428 (lambda _
4429 (setenv "ARGS"
4430 (string-append "--exclude-regex '("
4431 (string-join
4432 (list
4433 "remoteindicestest"
4434 "remoteindicestest-mpi-2"
4435 "syncertest"
4436 "syncertest-mpi-2"
4437 "variablesizecommunicatortest"
4438 "variablesizecommunicatortest-mpi-2"
4439 "arithmetictestsuitetest"
4440 "assertandreturntest"
4441 "assertandreturntest_ndebug"
4442 "concept"
4443 "debugaligntest"
4444 "mpicollectivecommunication"
4445 "mpicollectivecommunication-mpi-2"
4446 "mpiguardtest"
4447 "mpiguardtest-mpi-2"
4448 "mpihelpertest"
4449 "mpihelpertest-mpi-2"
4450 "mpihelpertest2"
4451 "mpihelpertest2-mpi-2")
4452 "|")
4453 ")'"))
4454 #t)))))
4455 (inputs
4456 `(("gmp" ,gmp)
4457 ("metis" ,metis)
4458 ("openmpi" ,openmpi)
4459 ("openblas" ,openblas)
4460 ("python" ,python)
4461 ("superlu" ,superlu)))
4462 (native-inputs
4463 `(("gfortran" ,gfortran)
4464 ("pkg-config" ,pkg-config)))
4465 (home-page "https://dune-project.org/")
4466 (synopsis "Distributed and Unified Numerics Environment")
4467 (description "DUNE, the Distributed and Unified Numerics Environment is a
4468modular toolbox for solving @dfn{partial differential equations} (PDEs) with
4469grid-based methods. It supports the easy implementation of methods like
4470@dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
4471Differences} (FD).")
4472 ;; GPL version 2 with "runtime exception" to make it behave like LGPLv2.
4473 (license license:gpl2)))
4474
4475(define-public dune-geometry
4476 (package
4477 (name "dune-geometry")
4478 (version "2.6.0")
4479 (source
4480 (origin
4481 (method url-fetch)
4482 (uri (string-append "https://dune-project.org/download/"
4483 version "/dune-geometry-" version ".tar.gz"))
4484 (sha256
4485 (base32
4486 "0hlaaxjyv9j05blasvb67sy02hd0w4g9znf68gdh3l731dd1aqbn"))))
4487 (build-system cmake-build-system)
4488 (arguments
4489 `(#:phases
4490 (modify-phases %standard-phases
4491 (add-after 'build 'build-tests
4492 (lambda* (#:key make-flags #:allow-other-keys)
4493 (apply invoke "make" "build_tests" make-flags))))))
4494 (inputs
4495 `(("dune-common" ,dune-common)
4496 ("openmpi" ,openmpi)
4497 ;; Optional
4498 ("openblas" ,openblas)
4499 ("gmp" ,gmp)
4500 ("python" ,python)))
4501 (native-inputs
4502 `(("gfortran" ,gfortran)
4503 ("pkg-config" ,pkg-config)))
4504 (home-page "https://dune-project.org/")
4505 (synopsis "Distributed and Unified Numerics Environment")
4506 (description "DUNE, the Distributed and Unified Numerics Environment is a
4507modular toolbox for solving @dfn{partial differential equations} (PDEs) with
4508grid-based methods. It supports the easy implementation of methods like
4509@dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
4510Differences} (FD).
4511
4512This package contains the basic DUNE geometry classes.")
4513 ;; GPL version 2 with "runtime exception"
4514 (license license:gpl2)))
4515
4516(define-public dune-grid
4517 (package
4518 (name "dune-grid")
4519 (version "2.6.0")
4520 (source
4521 (origin
4522 (method url-fetch)
4523 (uri (string-append "https://dune-project.org/download/"
4524 version "/dune-grid-" version ".tar.gz"))
4525 (sha256
4526 (base32
4527 "1jp4vscm9yb9xg0lh7apzccfkhvgbnk652yahigmh3cvzpl4acd0"))))
4528 (build-system cmake-build-system)
4529 (arguments
4530 `(#:phases
4531 (modify-phases %standard-phases
4532 (add-after 'build 'build-tests
4533 (lambda* (#:key make-flags #:allow-other-keys)
4534 (apply invoke "make" "build_tests" make-flags)))
4535 ;; These tests fail because they require a fully functional MPI
4536 ;; environment.
4537 (add-after 'unpack 'disable-failing-tests
4538 (lambda _
4539 (setenv "ARGS"
4540 (string-append "--exclude-regex '("
4541 (string-join
4542 (list
4543 "scsgmappertest"
4544 "conformvolumevtktest"
4545 "gnuplottest"
4546 "nonconformboundaryvtktest"
4547 "subsamplingvtktest"
4548 "vtktest"
4549 "vtktest-mpi-2"
4550 "vtksequencetest"
4551 "gmshtest-onedgrid"
4552 "test-dgf-yasp"
4553 "test-dgf-yasp-offset"
4554 "test-dgf-oned"
4555 "test-geogrid-yaspgrid"
4556 "test-gridinfo"
4557 "test-identitygrid"
4558 "testiteratorranges"
4559 "test-hierarchicsearch"
4560 "test-parallel-ug-mpi-2"
4561 "test-yaspgrid-backuprestore-equidistant"
4562 "test-yaspgrid-backuprestore-equidistant-mpi-2"
4563 "test-yaspgrid-backuprestore-equidistantoffset"
4564 "test-yaspgrid-backuprestore-equidistantoffset-mpi-2"
4565 "test-yaspgrid-backuprestore-tensor"
4566 "test-yaspgrid-backuprestore-tensor-mpi-2"
4567 "test-yaspgrid-tensorgridfactory"
4568 "test-yaspgrid-tensorgridfactory-mpi-2"
4569 "test-yaspgrid-yaspfactory-1d"
4570 "test-yaspgrid-yaspfactory-1d-mpi-2"
4571 "test-yaspgrid-yaspfactory-2d"
4572 "test-yaspgrid-yaspfactory-2d-mpi-2"
4573 "test-yaspgrid-yaspfactory-3d"
4574 "test-yaspgrid-yaspfactory-3d-mpi-2"
4575 "globalindexsettest"
4576 "persistentcontainertest"
4577 "structuredgridfactorytest"
4578 "tensorgridfactorytest"
4579 "vertexordertest")
4580 "|")
4581 ")'"))
4582 #t)))))
4583 (inputs
4584 `(("dune-common" ,dune-common)
4585 ("dune-geometry" ,dune-geometry)
4586 ("gmp" ,gmp)
4587 ("metis" ,metis)
4588 ("openblas" ,openblas)
4589 ("openmpi" ,openmpi)
4590 ("python" ,python)))
4591 (native-inputs
4592 `(("gfortran" ,gfortran)
4593 ("pkg-config" ,pkg-config)))
4594 (home-page "https://dune-project.org/")
4595 (synopsis "Distributed and Unified Numerics Environment")
4596 (description "DUNE, the Distributed and Unified Numerics Environment is a
4597modular toolbox for solving @dfn{partial differential equations} (PDEs) with
4598grid-based methods. It supports the easy implementation of methods like
4599@dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
4600Differences} (FD).
4601
4602This package contains the basic DUNE grid classes.")
4603 ;; GPL version 2 with "runtime exception"
4604 (license license:gpl2)))
4605
4606(define-public dune-istl
4607 (package
4608 (name "dune-istl")
4609 (version "2.6.0")
4610 (source
4611 (origin
4612 (method url-fetch)
4613 (uri (string-append "https://dune-project.org/download/"
4614 version "/dune-istl-" version ".tar.gz"))
4615 (sha256
4616 (base32
4617 "0l2gyrvys5w6wsmk0ckbb7295s80b7yk7qrl7x66akv2jv1nzq2w"))))
4618 (build-system cmake-build-system)
4619 (arguments
4620 `(#:phases
4621 (modify-phases %standard-phases
4622 (add-after 'build 'build-tests
4623 (lambda* (#:key make-flags #:allow-other-keys)
4624 (apply invoke "make" "build_tests" make-flags)))
4625 ;; These tests fail because they require a fully functional MPI
4626 ;; environment.
4627 (add-after 'unpack 'disable-failing-tests
4628 (lambda _
4629 (setenv "ARGS"
4630 (string-append "--exclude-regex '("
4631 (string-join
4632 (list
4633 "galerkintest"
4634 "hierarchytest"
4635 "pamgtest"
4636 "pamg_comm_repart_test"
4637 "matrixredisttest"
4638 "vectorcommtest"
4639 "matrixmarkettest")
4640 "|")
4641 ")'"))
4642 #t)))))
4643 (inputs
4644 `(("dune-common" ,dune-common)
4645 ("openmpi" ,openmpi)
4646 ;; Optional
4647 ("metis" ,metis)
4648 ("superlu" ,superlu)
4649 ("openblas" ,openblas)
4650 ("gmp" ,gmp)
4651 ("python" ,python)))
4652 (native-inputs
4653 `(("gfortran" ,gfortran)
4654 ("pkg-config" ,pkg-config)))
4655 (home-page "https://dune-project.org/")
4656 (synopsis "Distributed and Unified Numerics Environment")
4657 (description "DUNE, the Distributed and Unified Numerics Environment is a
4658modular toolbox for solving @dfn{partial differential equations} (PDEs) with
4659grid-based methods.
4660
4661This is the iterative solver template library which provides generic sparse
4662matrix/vector classes and a variety of solvers based on these classes. A
4663special feature is the use of templates to exploit the recursive block
4664structure of finite element matrices at compile time. Available solvers
4665include Krylov methods, (block-) incomplete decompositions and
4666aggregation-based algebraic multigrid.")
4667 ;; GPL version 2 with "runtime exception"
4668 (license license:gpl2)))
4669
4670(define-public dune-localfunctions
4671 (package
4672 (name "dune-localfunctions")
4673 (version "2.6.0")
4674 (source
4675 (origin
4676 (method url-fetch)
4677 (uri (string-append "https://dune-project.org/download/"
4678 version "/dune-localfunctions-" version ".tar.gz"))
4679 (sha256
4680 (base32
4681 "19c6zjinwwpy8jh4v4prhphyd438rapd4x80fj93apmwgw04nrhl"))))
4682 (build-system cmake-build-system)
4683 (arguments
4684 `(#:phases
4685 (modify-phases %standard-phases
4686 (add-after 'build 'build-tests
4687 (lambda* (#:key make-flags #:allow-other-keys)
4688 (apply invoke "make" "build_tests" make-flags))))))
4689 (inputs
4690 `(("dune-common" ,dune-common)
4691 ("dune-geometry" ,dune-geometry)
4692 ("openmpi" ,openmpi)
4693 ;; Optional
4694 ("metis" ,metis)
4695 ("superlu" ,superlu)
4696 ("gmp" ,gmp)))
4697 (native-inputs
4698 `(("gfortran" ,gfortran)
4699 ("pkg-config" ,pkg-config)))
4700 (home-page "https://dune-project.org/")
4701 (synopsis "Distributed and Unified Numerics Environment") ; TODO
4702 (description "This DUNE module provides interface and implementation for
4703shape functions defined on the DUNE reference elements. In addition to the
4704shape function, interpolation operators and special keys are provided which
4705can be used to assemble global function spaces on finite-element grids.
4706
4707This package provides an interface and implementation for shape functions
4708defined on the DUNE reference elements. In addition to the shape function,
4709interpolation operators and special keys are provided which can be used to
4710assemble global function spaces on finite-element grids.")
4711 ;; GPL version 2 with "runtime exception"
4712 (license license:gpl2)))
4713
4714(define-public dune-alugrid
4715 (package
4716 (name "dune-alugrid")
4717 (version "2.6.0")
4718 (source
4719 (origin
4720 (method url-fetch)
4721 (uri (string-append "https://dune-project.org/download/"
4722 version "/dune-alugrid-" version ".tar.gz"))
4723 (sha256
4724 (base32
4725 "1l9adgyjpra8mvwm445s0lpjshnb63jag85fb2hisbjn6bm320yj"))))
4726 (build-system cmake-build-system)
4727 (arguments
4728 `(#:tests? #f ; 7 of 8 tests fail because they need a full MPI
4729 ; environment
4730 #:phases
4731 (modify-phases %standard-phases
4732 (add-after 'unpack 'patch-include
4733 (lambda _
4734 (substitute* "dune/alugrid/test/test-alugrid.cc"
4735 (("doc/grids/gridfactory/testgrids")
4736 "doc/dune-grid/grids/gridfactory/testgrids"))
4737 #t))
4738 (add-after 'build 'build-tests
4739 (lambda* (#:key inputs make-flags #:allow-other-keys)
4740 (setenv "CPLUS_INCLUDE_PATH"
4741 (string-append (assoc-ref inputs "dune-grid") "/share:"
4742 (getenv "CPLUS_INCLUDE_PATH")))
4743 (apply invoke "make" "build_tests" make-flags))))))
4744 (inputs
4745 `(("dune-common" ,dune-common)
4746 ("dune-geometry" ,dune-geometry)
4747 ("dune-grid" ,dune-grid)
4748 ("openmpi" ,openmpi)
4749 ;; Optional
4750 ("metis" ,metis)
4751 ("openblas" ,openblas)
4752 ("python" ,python)
4753 ("superlu" ,superlu)
4754 ("gmp" ,gmp)
4755 ("zlib" ,zlib)))
4756 (native-inputs
4757 `(("gfortran" ,gfortran)
4758 ("pkg-config" ,pkg-config)))
4759 (home-page "https://dune-project.org/")
4760 (synopsis "Distributed and Unified Numerics Environment")
4761 (description "ALUGrid is an adaptive, loadbalancing, unstructured
4762implementation of the DUNE grid interface supporting either simplices or
4763cubes.")
4764 (license license:gpl2+)))
4765
4766(define-public dune-typetree
4767 (package
4768 (name "dune-typetree")
4769 (version "2.6.0")
4770 (source
4771 (origin
4772 (method git-fetch)
4773 (uri (git-reference
4774 (url "https://gitlab.dune-project.org/staging/dune-typetree.git")
4775 (commit (string-append "v" version))))
4776 (file-name (git-file-name name version))
4777 (sha256
4778 (base32
4779 "0mnv6w2f22lz3j4bdpdjq55vjm8xxfx9v4vvhg9bd36xpsbjpjp9"))))
4780 (build-system cmake-build-system)
4781 (arguments
4782 `(#:phases
4783 (modify-phases %standard-phases
4784 (add-after 'build 'build-tests
4785 (lambda* (#:key make-flags #:allow-other-keys)
4786 (apply invoke "make" "build_tests" make-flags))))))
4787 (inputs
4788 `(("dune-common" ,dune-common)
4789 ("openmpi" ,openmpi)
4790 ;; Optional
4791 ("openblas" ,openblas)
4792 ("python" ,python)
4793 ("metis" ,metis)
4794 ("superlu" ,superlu)
4795 ("gmp" ,gmp)))
4796 (native-inputs
4797 `(("gfortran" ,gfortran)
4798 ("pkg-config" ,pkg-config)))
4799 (home-page "https://dune-project.org/")
4800 (synopsis "Distributed and Unified Numerics Environment")
4801 (description "TypeTree is a template library for constructing and
4802operating on statically typed trees of objects.")
4803 ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
4804 (license (list license:lgpl3+ license:gpl2))))
4805
4806(define-public dune-functions
4807 (package
4808 (name "dune-functions")
4809 (version "2.6.0")
4810 (source
4811 (origin
4812 (method git-fetch)
4813 (uri (git-reference
4814 (url "https://gitlab.dune-project.org/staging/dune-functions.git")
4815 (commit (string-append "v" version))))
4816 (file-name (git-file-name name version))
4817 (sha256
4818 (base32
4819 "1an8gb477n8j0kzpbrv7nr1snh8pxip0gsxq6w63jc83gg3dj200"))))
4820 (build-system cmake-build-system)
4821 (arguments `(#:tests? #f)) ; FIXME: tests require dune-uugrid
4822 (inputs
4823 `(("dune-common" ,dune-common)
4824 ("dune-istl" ,dune-istl)
4825 ("dune-localfunctions" ,dune-localfunctions)
4826 ("dune-grid" ,dune-grid)
4827 ("dune-geometry" ,dune-geometry)
4828 ("dune-typetree" ,dune-typetree)
4829 ("openmpi" ,openmpi)
4830 ("openblas" ,openblas)
4831 ("metis" ,metis)
4832 ("python" ,python)
4833 ("superlu" ,superlu)
4834 ("gmp" ,gmp)))
4835 (native-inputs
4836 `(("gfortran" ,gfortran)
4837 ("pkg-config" ,pkg-config)))
4838 (home-page "https://dune-project.org/")
4839 (synopsis "Distributed and Unified Numerics Environment")
4840 (description "The dune-functions module provides an abstraction layer for
4841global finite element functions. Its two main concepts are functions
4842implemented as callable objects, and bases of finite element spaces.")
4843 ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
4844 (license (list license:lgpl3+ license:gpl2))))
4845
4846(define-public dune-pdelab
4847 (package
4848 (name "dune-pdelab")
4849 (version "2.6.0-rc1")
4850 (source
4851 (origin
4852 (method git-fetch)
4853 (uri (git-reference
4854 (url "https://gitlab.dune-project.org/pdelab/dune-pdelab")
4855 (commit (string-append "v" version))))
4856 (file-name (git-file-name name version))
4857 (sha256
4858 (base32
4859 "07g0s9448z65vjrq88g5rv3340iifil85k170n8kbqchsvi4ny5v"))))
4860 (build-system cmake-build-system)
4861 (arguments '(#:tests? #f)) ; XXX: the tests cannot be compiled
4862 (inputs
4863 `(("dune-common" ,dune-common)
4864 ("dune-istl" ,dune-istl)
4865 ("dune-localfunctions" ,dune-localfunctions)
4866 ("dune-geometry" ,dune-geometry)
4867 ("dune-grid" ,dune-grid)
4868 ("dune-typetree" ,dune-typetree)
4869 ("dune-functions" ,dune-functions)
4870 ("openmpi" ,openmpi)
4871 ;; Optional
4872 ("openblas" ,openblas)
4873 ("eigen" ,eigen)
4874 ("metis" ,metis)
4875 ("python" ,python)
4876 ("superlu" ,superlu)
4877 ("gmp" ,gmp)))
4878 (native-inputs
4879 `(("gfortran" ,gfortran)
4880 ("pkg-config" ,pkg-config)))
4881 (home-page "https://dune-project.org/")
4882 (synopsis "Differential equations solver toolbox")
4883 (description "PDELab is a partial differential equations solver toolbox
4884built on top of DUNE, the Distributed and Unified Numerics Environment.")
4885 ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
4886 (license (list license:lgpl3+ license:gpl2))))
4887
4888(define-public mlucas
4889 (package
4890 (name "mlucas")
4891 (version "18")
4892 (source
4893 (origin
4894 (method url-fetch)
4895 (uri (string-append
4896 "https://mersenneforum.org/mayer/src/C/mlucas_v" version ".txz"))
4897 (sha256
4898 (base32 "0h4xj6pyyac79ka5ibqjilfa3s9j3yxnzgpwc57b54kfh2bj3447"))))
4899 (build-system gnu-build-system)
4900 (inputs
4901 `(("python2" ,python-2)))
4902 (arguments
4903 `(#:tests? #f ; no tests
4904 #:phases
4905 (modify-phases %standard-phases
4906 (replace 'configure
4907 (lambda _
4908 (chdir "src")
4909 (call-with-output-file "Makefile"
4910 (lambda (port)
4911 (format port "CC = gcc
4912CFLAGS = -O3 ~a -DUSE_THREADS
4913LDLIBS = -lm -lpthread -lrt
4914Mlucas: $(addsuffix .o,$(basename $(wildcard *.c)))
4915"
4916 ,(let ((system (or (%current-target-system)
4917 (%current-system))))
4918 (cond
4919 ((string-prefix? "x86_64" system) "-DUSE_SSE2")
4920 (else ""))))))
4921 #t))
4922 (replace 'install
4923 (lambda* (#:key outputs #:allow-other-keys)
4924 (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
4925 (install-file "Mlucas" bin)
4926 (install-file "primenet.py" bin))
4927 #t)))))
4928 (home-page "https://www.mersenne.org")
4929 (synopsis "Great Internet Mersenne Prime Search (GIMPS) distributed computing client")
4930 (description "Mlucas performs Lucas-Lehmer primality testing of Mersenne
4931numbers in search of a world-record prime. You may use it to test any
4932suitable number as you wish, but it is preferable that you do so in a
4933coordinated fashion, as part of the Great Internet Mersenne Prime
4934Search (GIMPS). Mlucas also includes a simple Python script for assignment
4935management via the GIMPS project's Primenet server.")
4936 (license license:gpl2+)))
4937
4938(define-public nauty
4939 (package
4940 (name "nauty")
4941 (version "2.6r11")
4942 (source (origin
4943 (method url-fetch)
4944 (uri (string-append
4945 "https://pallini.di.uniroma1.it/"
4946 "nauty" (string-join (string-split version #\.) "")
4947 ".tar.gz"))
4948 (sha256
4949 (base32
4950 "05z6mk7c31j70md83396cdjmvzzip1hqb88pfszzc6k4gy8h3m2y"))))
4951 (build-system gnu-build-system)
4952 (outputs '("out" "lib"))
4953 (arguments
4954 `(#:test-target "checks"
4955 #:phases
4956 (modify-phases %standard-phases
4957 ;; Default make target does not build all available
4958 ;; executables. Create them now.
4959 (add-after 'build 'build-extra-programs
4960 (lambda _
4961 (for-each (lambda (target) (invoke "make" target))
4962 '("blisstog" "bliss2dre" "checks6" "sumlines"))
4963 #t))
4964 ;; Upstream does not provide any install target.
4965 (replace 'install
4966 (lambda* (#:key outputs #:allow-other-keys)
4967 (let* ((out (assoc-ref outputs "out"))
4968 (lib-output (assoc-ref outputs "lib"))
4969 (bin (string-append out "/bin"))
4970 (doc (string-append out "/share/doc/nauty/"))
4971 (include (string-append lib-output "/include/nauty"))
4972 (lib (string-append lib-output "/lib/nauty")))
4973 (for-each (lambda (f) (install-file f bin))
4974 '("dreadnaut" "NRswitchg" "addedgeg" "amtog" "biplabg"
4975 "blisstog" "bliss2dre" "catg" "checks6" "complg"
4976 "converseg" "copyg" "countg" "cubhamg" "deledgeg"
4977 "delptg" "directg" "dretodot" "dretog" "genbg"
4978 "genbgL" "geng" "genquarticg" "genrang" "genspecialg"
4979 "gentourng" "gentreeg" "hamheuristic" "labelg"
4980 "linegraphg" "listg" "multig" "newedgeg" "pickg"
4981 "planarg" "ranlabg" "shortg" "showg" "subdivideg"
4982 "sumlines" "twohamg" "vcolg" "watercluster2"))
4983 (for-each (lambda (f) (install-file f include))
4984 (find-files "." "\\.h$"))
4985 (for-each (lambda (f) (install-file f lib))
4986 (find-files "." "\\.a$"))
4987 (for-each (lambda (f) (install-file f doc))
4988 (append '("formats.txt" "README" "schreier.txt")
4989 (find-files "." "\\.pdf$")))))))))
4990 (inputs
4991 `(("gmp" ,gmp))) ;for sumlines
4992 (home-page "https://pallini.di.uniroma1.it/")
4993 (synopsis "Library for graph automorphisms")
4994 (description "@code{nauty} (No AUTomorphisms, Yes?) is a set of
4995procedures for computing automorphism groups of graphs and digraphs.
4996
4997@code{nauty} computes graph information in the form of a set of
4998generators, the size of the group, and the orbits of the group; it can
4999also produce a canonical label. The @code{nauty} suite is written in
5000C and comes with a command-line interface, a collection of
5001command-line tools, and an Application Programming Interface (API).
5002
5003This package provides the static libraries required to run programs
5004compiled against the nauty library.")
5005 (license license:asl2.0)))
5006
5007(define-public ppl
5008 (package
5009 (name "ppl")
5010 (version "1.2")
5011 (source
5012 (origin
5013 (method url-fetch)
5014 (uri (string-append "https://www.bugseng.com/products/ppl/download/"
5015 "ftp/releases/" version
5016 "/ppl-" version ".tar.gz"))
5017 (sha256
5018 (base32
5019 "1j5aji1g2vmdvc0gqz45n2ll2l2f6czca04wiyfl5g3sm3a6vhvb"))))
5020 (build-system gnu-build-system)
5021 (native-inputs
5022 `(("m4", m4)))
5023 (inputs
5024 `(("glpk" ,glpk)
5025 ("gmp", gmp)))
5026 (home-page "https://www.bugseng.com/parma-polyhedra-library")
5027 (synopsis
5028 "Parma Polyhedra Library for computations with polyhedra")
5029 (description
5030 "The Parma Polyhedra Library (PPL) provides numerical abstractions
5031especially targeted at applications in the field of analysis and
5032verification of complex systems. These abstractions include convex
5033polyhedra, defined as the intersection of a finite number of (open or
5034closed) halfspaces, each described by a linear inequality (strict or
5035non-strict) with rational coefficients; some special classes of polyhedra
5036shapes that offer interesting complexity/precision tradeoffs; and grids
5037which represent regularly spaced points that satisfy a set of linear
5038congruence relations. The library also supports finite powersets and
5039products of (any kind of) polyhedra and grids, a mixed integer linear
5040programming problem solver using an exact-arithmetic version of the simplex
5041algorithm, a parametric integer programming solver, and primitives for
5042termination analysis via the automatic synthesis of linear ranking
5043functions.")
5044 (license license:gpl3+)))