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