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