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