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