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