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