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