gnu: emacs-extempore-mode: Update to 0.0.0-1.09518ae.
[jackhill/guix/guix.git] / gnu / packages / maths.scm
CommitLineData
8f8b2451 1;;; GNU Guix --- Functional package management for GNU
b457f3cc 2;;; Copyright © 2013, 2014, 2015, 2016, 2019, 2020 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>
aa2e83cc 5;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Eric Bavier <bavier@posteo.net>
df354a77 6;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch>
182d6311 7;;; Copyright © 2014 Mathieu Lirzin <mathieu.lirzin@openmailbox.org>
0b2c8838 8;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
32158110 9;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
df129041 10;;; Copyright © 2015, 2018 Mark H Weaver <mhw@netris.org>
0ef54303 11;;; Copyright © 2015, 2016, 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
45147b0c 12;;; Copyright © 2015 Fabian Harfert <fhmgufs@web.de>
ec8c7e47 13;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
1d3c6a31 14;;; Copyright © 2016, 2018, 2020 Kei Kebreau <kkebreau@posteo.net>
59a07504 15;;; Copyright © 2016, 2017, 2018, 2019 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>
f1cc312e 18;;; Copyright © 2017, 2018, 2019, 2020 Paul Garlick <pgarlick@tourbillion-technology.com>
47956fa0 19;;; Copyright © 2017 ng0 <ng0@n0.is>
ba1be533 20;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
d109b1e8 21;;; Copyright © 2017 Theodoros Foradis <theodoros@foradis.org>
b18b9d20 22;;; Copyright © 2017, 2019 Arun Isaac <arunisaac@systemreboot.net>
98a5cd51 23;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
dc7d6d4e 24;;; Copyright © 2017 Dave Love <me@fx@gnu.org>
3bc74090 25;;; Copyright © 2018, 2019 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>
564cf93f 31;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
c2cf286c 32;;; Copyright © 2018 Amin Bandali <bandali@gnu.org>
6f8c4195 33;;; Copyright © 2019 Nicolas Goaziou <mail@nicolasgoaziou.fr>
4cb5d251 34;;; Copyright © 2019 Steve Sprang <scs@stevesprang.com>
3b7828cc 35;;; Copyright © 2019 Robert Smith <robertsmith@posteo.net>
f6b4d395 36;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
aac148a8 37;;; Copyright © 2020 Felix Gruber <felgru@posteo.net>
70c98efa 38;;; Copyright © 2020 R Veera Kumar <vkor@vkten.in>
525e83ec 39;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
b60e2d48 40;;; Copyright © 2020 Nicolò Balzarotti <nicolo@nixo.xyz>
8f8b2451
AE
41;;;
42;;; This file is part of GNU Guix.
43;;;
44;;; GNU Guix is free software; you can redistribute it and/or modify it
45;;; under the terms of the GNU General Public License as published by
46;;; the Free Software Foundation; either version 3 of the License, or (at
47;;; your option) any later version.
48;;;
49;;; GNU Guix is distributed in the hope that it will be useful, but
50;;; WITHOUT ANY WARRANTY; without even the implied warranty of
51;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
52;;; GNU General Public License for more details.
53;;;
54;;; You should have received a copy of the GNU General Public License
55;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
56
57(define-module (gnu packages maths)
ec322be2 58 #:use-module (ice-9 regex)
a6b9ebc2 59 #:use-module (ice-9 match)
8f8b2451 60 #:use-module (gnu packages)
b5b73a82 61 #:use-module ((guix licenses) #:prefix license:)
8f8b2451
AE
62 #:use-module (guix packages)
63 #:use-module (guix download)
54052a54 64 #:use-module (guix git-download)
0e2672ae 65 #:use-module (guix utils)
fa574a6d 66 #:use-module ((guix build utils) #:select (alist-replace))
da95c817 67 #:use-module (guix build-system cmake)
72c71d24 68 #:use-module (guix build-system glib-or-gtk)
c9dfa3c7 69 #:use-module (guix build-system gnu)
560acf25 70 #:use-module (guix build-system python)
63e07468 71 #:use-module (guix build-system ruby)
3de01d3f 72 #:use-module (gnu packages algebra)
ab5f3f21 73 #:use-module (gnu packages audio)
5143517c 74 #:use-module (gnu packages autotools)
fa574a6d 75 #:use-module (gnu packages base)
3de01d3f 76 #:use-module (gnu packages bison)
a17d4564 77 #:use-module (gnu packages boost)
e73b49fb 78 #:use-module (gnu packages check)
3de01d3f 79 #:use-module (gnu packages cmake)
c9dfa3c7 80 #:use-module (gnu packages compression)
668c06ac 81 #:use-module (gnu packages curl)
b7b27a8f 82 #:use-module (gnu packages cyrus-sasl)
8a0dd289 83 #:use-module (gnu packages dbm)
528bb464 84 #:use-module (gnu packages documentation)
57e544e8 85 #:use-module (gnu packages elf)
70c98efa 86 #:use-module (gnu packages file)
3de01d3f 87 #:use-module (gnu packages flex)
668c06ac 88 #:use-module (gnu packages fltk)
f3929800 89 #:use-module (gnu packages fontutils)
1dba6407 90 #:use-module (gnu packages gettext)
da95c817 91 #:use-module (gnu packages gcc)
73fed4f8 92 #:use-module (gnu packages gd)
668c06ac 93 #:use-module (gnu packages ghostscript)
70c98efa 94 #:use-module (gnu packages glib)
889187a4 95 #:use-module (gnu packages graphviz)
f3929800 96 #:use-module (gnu packages gtk)
70c98efa 97 #:use-module (gnu packages icu4c)
45147b0c 98 #:use-module (gnu packages image)
2fd26d05 99 #:use-module (gnu packages java)
668c06ac 100 #:use-module (gnu packages less)
8731e527 101 #:use-module (gnu packages lisp)
ab5f3f21 102 #:use-module (gnu packages linux)
bc3a2e35 103 #:use-module (gnu packages logging)
6e64766a 104 #:use-module (gnu packages lua)
5698b8b8 105 #:use-module (gnu packages gnome)
1b39a196 106 #:use-module (gnu packages guile)
668c06ac
JD
107 #:use-module (gnu packages xorg)
108 #:use-module (gnu packages gl)
9f913401 109 #:use-module (gnu packages imagemagick)
8731e527 110 #:use-module (gnu packages m4)
d8c7eeb9 111 #:use-module (gnu packages mpi)
b92eee75 112 #:use-module (gnu packages multiprecision)
528bb464 113 #:use-module (gnu packages netpbm)
bd3d71cb 114 #:use-module (gnu packages onc-rpc)
668c06ac 115 #:use-module (gnu packages pcre)
5698b8b8 116 #:use-module (gnu packages popt)
c9dfa3c7
AE
117 #:use-module (gnu packages perl)
118 #:use-module (gnu packages pkg-config)
ab5f3f21 119 #:use-module (gnu packages pulseaudio)
da95c817 120 #:use-module (gnu packages python)
589e3f4e 121 #:use-module (gnu packages python-web)
44d10b1f 122 #:use-module (gnu packages python-xyz)
5b05dce7 123 #:use-module (gnu packages qt)
c9dfa3c7 124 #:use-module (gnu packages readline)
63e07468 125 #:use-module (gnu packages ruby)
2742f87e 126 #:use-module (gnu packages tbb)
479c4273 127 #:use-module (gnu packages scheme)
b7194849 128 #:use-module (gnu packages shells)
df354a77 129 #:use-module (gnu packages tcl)
668c06ac 130 #:use-module (gnu packages texinfo)
8f9ac901 131 #:use-module (gnu packages tex)
b7b27a8f 132 #:use-module (gnu packages tls)
5b05dce7 133 #:use-module (gnu packages version-control)
9aafbc0c 134 #:use-module (gnu packages wxwidgets)
c12efc72 135 #:use-module (gnu packages xml)
a17d4564 136 #:use-module (srfi srfi-1))
8f8b2451 137
193abc82
JD
138(define-public aris
139 (package
1f45f18a
JD
140 (name "aris")
141 (version "2.2")
142 (source (origin
143 (method url-fetch)
144 (uri (string-append "mirror://gnu/" name "/" name "-" version ".tar.gz"))
145 (sha256 (base32
146 "1q1887ryqdr9sn0522hc7p16kqwlxxyz5dkmma8ar2nxplhgll7q"))))
147 (build-system gnu-build-system)
148 (inputs `(("gtk+" ,gtk+)
149 ("libxml2" ,libxml2)))
150 (native-inputs `(("pkg-config" ,pkg-config)))
151 (synopsis "Natural deduction first-order logic interface")
152 (description "Aris is a program for performing logical proofs. It supports
153propositional and predicate logic, as well as Boolean algebra and
154arithmetical logic. In addition to its predefined inference and equivalence
155rules, Aris also supports references to older proofs. Its use of standard
156logical symbols and its natural deduction interface make it easy to use for
157beginners.")
158 (license license:gpl3+)
6fd52309 159 (home-page "https://www.gnu.org/software/aris/")))
193abc82 160
9c45c519
JD
161(define-public c-graph
162 (package
163 (name "c-graph")
0ef54303 164 (version "2.0.1")
9c45c519
JD
165 (source (origin
166 (method url-fetch)
167 (uri (string-append "mirror://gnu/c-graph/c-graph-" version
168 ".tar.gz"))
169 (sha256 (base32
0ef54303 170 "092412jzxy6wdvpk96pfj499hpmaww8xllavbvlqspfpr7ips9id"))))
9c45c519
JD
171 (build-system gnu-build-system)
172 (inputs
0ef54303 173 `(("fortran" ,gfortran)))
a3947cb1 174 (synopsis "Visualizing and demonstrating convolution")
9c45c519 175 (description
0ef54303 176 "GNU C-Graph is a tool for demonstrating the theory of convolution.
a3947cb1
LC
177Thus, it can serve as an excellent aid to students of signal and systems
178theory in visualizing the convolution process. Rather than forcing the
179student to write code, the program offers an intuitive interface with
180interactive dialogs to guide them.")
9c45c519 181 (license license:gpl3+)
6fd52309 182 (home-page "https://www.gnu.org/software/c-graph/")))
9c45c519 183
d91025e3
TD
184(define-public coda
185 (package
186 (name "coda")
9285f8bb 187 (version "2.19")
d91025e3
TD
188 (source
189 (origin
190 (method url-fetch)
191 (uri (string-append "https://github.com/stcorp/coda/releases/download/"
192 version "/coda-" version ".tar.gz"))
193 (sha256
9285f8bb 194 (base32 "1fbxd2afm7dshd92p10yy8dwbr9gc1h1fmnnnmr7d0c5lnw80245"))
4b12fe5c
TD
195 (patches (search-patches "coda-use-system-libs.patch"))
196 (modules '((guix build utils)))
197 (snippet
198 ;; Make sure we don't use the bundled software.
6cbee49d
MW
199 '(begin
200 (for-each (lambda (d)
201 (delete-file-recursively (string-append "libcoda/" d)))
202 '("zlib" "pcre" "expat"))
203 #t))))
d91025e3
TD
204 (native-inputs
205 `(("fortran" ,gfortran)
206 ("python" ,python)
207 ("python-numpy" ,python-numpy)))
208 (inputs
209 `(("zlib" ,zlib)
4b12fe5c
TD
210 ("pcre" ,pcre)
211 ("expat" ,expat)
d91025e3
TD
212 ("hdf4" ,hdf4-alt)
213 ("hdf5" ,hdf5)))
214 (build-system gnu-build-system)
215 (arguments
4b12fe5c
TD
216 '(#:configure-flags '("--with-hdf4" "--with-hdf5" "--enable-python"
217 "LIBS= -lz -lpcre -lexpat")))
d91025e3
TD
218 (synopsis "A common interface to various earth observation data formats")
219 (description
220 "The Common Data Access toolbox (CODA) provides a set of interfaces for
221reading remote sensing data from earth observation data files. It consists of
222command line applications and interfaces to the C, Fortran, Python, and Java
223programming languages.")
224 (home-page "https://stcorp.nl/coda")
225 (license license:gpl2+)))
226
d65f0661
KK
227(define-public qhull
228 (package
229 (name "qhull")
230 (version "2015.2")
231 (source (origin
232 (method url-fetch)
233 (uri (string-append "http://www.qhull.org/download/qhull-"
234 (car (string-split version #\.))
235 "-src-7.2.0.tgz"))
236 (sha256
237 (base32
238 "0dm4b2xr3asy6w74khq2zg4gf26zsy3qf9sq7pf7lmrvbj911c3q"))))
239 (build-system cmake-build-system)
240 (synopsis "Calculate convex hulls and related structures")
241 (description
242 "@code{Qhull} computes the convex hull, Delaunay triangulation, Voronoi
243diagram, halfspace intersection about a point, furthest-site Delaunay
244triangulation, and furthest-site Voronoi diagram. The source code runs in 2-d,
2453-d, 4-d, and higher dimensions. @code{Qhull} implements the Quickhull
246algorithm for computing the convex hull. It handles roundoff errors from
247floating point arithmetic. It computes volumes, surface areas, and
248approximations to the convex hull.
249
250@code{Qhull} does not support triangulation of non-convex surfaces, mesh
251generation of non-convex objects, medium-sized inputs in 9-D and higher, alpha
252shapes, weighted Voronoi diagrams, Voronoi volumes, or constrained Delaunay
253triangulations.")
254 (home-page "http://qhull.org")
255 (license (license:non-copyleft "file://COPYING.txt"
256 "See COPYING in the distribution."))))
257
a8fa86c4
RW
258(define-public python-cvxopt
259 (package
260 (name "python-cvxopt")
a7c7015a 261 (version "1.2.3")
a8fa86c4
RW
262 (source (origin
263 (method git-fetch)
264 (uri (git-reference
265 (url "https://github.com/cvxopt/cvxopt.git")
266 (commit version)))
267 (file-name (git-file-name name version))
268 (sha256
269 (base32
a7c7015a 270 "1kiy2m62xgs2d5id6dnnwy4vap85cd70p7pgkb9nh23qf9xnak7b"))))
a8fa86c4
RW
271 (build-system python-build-system)
272 (arguments
273 `(#:phases
274 (modify-phases %standard-phases
275 (add-after 'unpack 'find-libraries
276 (lambda* (#:key inputs #:allow-other-keys)
277 (setenv "CVXOPT_BLAS_LIB" "openblas")
278 (setenv "CVXOPT_BUILD_FFTW" "1")
279 (setenv "CVXOPT_BUILD_GLPK" "1")
280 (setenv "CVXOPT_BUILD_GSL" "1")
281 #t)))))
282 (inputs
283 `(("fftw" ,fftw)
284 ("glpk" ,glpk)
285 ("gsl" ,gsl)
286 ("lapack" ,lapack)
287 ("openblas" ,openblas)
288 ("suitesparse" ,suitesparse)))
289 (home-page "https://www.cvxopt.org")
290 (synopsis "Python library for convex optimization")
291 (description
292 "CVXOPT is a package for convex optimization based on the Python
293programming language. Its main purpose is to make the development of software
294for convex optimization applications straightforward by building on Python’s
295extensive standard library and on the strengths of Python as a high-level
296programming language.")
297 (license license:gpl3+)))
298
299(define-public python2-cvxopt
300 (package-with-python2 python-cvxopt))
301
8f8b2451
AE
302(define-public units
303 (package
304 (name "units")
494a8cd0 305 (version "2.19")
8f8b2451
AE
306 (source (origin
307 (method url-fetch)
308 (uri (string-append "mirror://gnu/units/units-" version
309 ".tar.gz"))
310 (sha256 (base32
494a8cd0 311 "0mk562g7dnidjgfgvkxxpvlba66fh1ykmfd9ylzvcln1vxmi6qj2"))))
8f8b2451 312 (build-system gnu-build-system)
0498d248 313 (inputs
a2549713
EB
314 `(("readline" ,readline)
315 ("python" ,python-wrapper) ;for 'units_cur' script
0498d248
EB
316 ("python-requests" ,python-requests)))
317 (arguments
318 `(#:phases (modify-phases %standard-phases
319 (add-after 'install 'wrap-units_cur
320 (lambda* (#:key outputs #:allow-other-keys)
321 (let* ((out (assoc-ref outputs "out"))
322 (bin (string-append out "/bin")))
323 (wrap-program (string-append bin "/units_cur")
324 `("PYTHONPATH" ":" prefix
325 ,(search-path-as-string->list (getenv "PYTHONPATH"))))
326 #t))))))
8f8b2451
AE
327 (synopsis "Conversion between thousands of scales")
328 (description
574e86f9 329 "GNU Units converts numeric quantities between units of measure. It
7c125ce0
AK
330can handle scale changes through adaptive usage of standard scale
331prefixes (micro-, kilo-, etc.). It can also handle nonlinear
332conversions such as Fahrenheit to Celsius. Its interpreter is powerful
333enough to be used effectively as a scientific calculator.")
8f8b2451 334 (license license:gpl3+)
6fd52309 335 (home-page "https://www.gnu.org/software/units/")))
c9dfa3c7 336
61a529b4
RW
337(define-public double-conversion
338 (package
339 (name "double-conversion")
1c7d7f3f 340 (version "3.1.5")
b343850e 341 (home-page "https://github.com/google/double-conversion")
61a529b4 342 (source (origin
2bdc73fb 343 (method git-fetch)
a4de1a65
MB
344 (uri (git-reference (url home-page)
345 (commit (string-append "v" version))))
2bdc73fb 346 (file-name (git-file-name name version))
61a529b4
RW
347 (sha256
348 (base32
1c7d7f3f 349 "0csy4pjw1p8rp6g5qxi2h0ychhhp1fldv7gb761627fs2mclw9gv"))))
61a529b4
RW
350 (build-system cmake-build-system)
351 (arguments
352 '(#:test-target "test"
353 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
354 "-DBUILD_TESTING=ON")))
61a529b4
RW
355 (synopsis "Conversion routines for IEEE doubles")
356 (description
357 "The double-conversion library provides binary-decimal and decimal-binary
358routines for IEEE doubles. The library consists of efficient conversion
359routines that have been extracted from the V8 JavaScript engine.")
360 (license license:bsd-3)))
361
182d6311
ML
362(define-public dionysus
363 (package
364 (name "dionysus")
bd041e7f 365 (version "1.4.0")
182d6311
ML
366 (source (origin
367 (method url-fetch)
368 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
bd041e7f 369 ".tar.xz"))
182d6311
ML
370 (sha256
371 (base32
bd041e7f 372 "194pzs1mlsj4ww6v37qq3961h5hckm5h805cv0r14xj3g9wfx2sk"))))
182d6311
ML
373 (build-system gnu-build-system)
374 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
375 (synopsis "Local search for universal constants and scientific values")
376 (description
377 "GNU Dionysus is a convenient system for quickly retrieving the values of
378mathematical constants used in science and engineering. Values can be
379searched using a simple command-line tool, choosing from three databases:
380universal constants, atomic numbers, and constants related to
381semiconductors.")
382 (license license:gpl3+)
6fd52309 383 (home-page "https://www.gnu.org/software/dionysus/")))
182d6311 384
b60e2d48
NB
385(define-public dsfmt
386 (package
387 (name "dsfmt")
388 (version "2.2.3")
389 (source
390 (origin
391 (method url-fetch)
392 (uri
393 (string-append
394 "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/"
395 "dSFMT-src-" version ".tar.gz"))
396 (sha256
397 (base32
398 "03kaqbjbi6viz0n33dk5jlf6ayxqlsq4804n7kwkndiga9s4hd42"))
399 (modules '((guix build utils)))
400 ;; Don't distribute html documentation with bundled jquery.
401 (snippet
402 '(begin
403 (delete-file-recursively "html") #t))
404 ;; Add patches borrowed from Julia.
405 (patches
406 (list
407 (origin
408 (method url-fetch)
409 (uri (string-append
410 "https://raw.githubusercontent.com/JuliaLang/julia/"
411 "v1.3.0/deps/patches/dSFMT.c.patch"))
412 (sha256 (base32
413 "09mhv11bms8jsmkmdqvlcgljwhzw3b6n9nncpi2b6dla9798hw2y"))
414 (file-name "dSFMT.c.patch"))
415 (origin
416 (method url-fetch)
417 (uri (string-append
418 "https://raw.githubusercontent.com/JuliaLang/julia/"
419 "v1.3.0/deps/patches/dSFMT.h.patch"))
420 (sha256 (base32
421 "1py5rd0yxic335lzka23f6x2dhncrpizpyrk57gi2f28c0p98y5n"))
422 (file-name "dSFMT.h.patch"))))))
423 (build-system gnu-build-system)
424 (arguments
425 `(#:phases
426 (modify-phases %standard-phases
427 (delete 'configure) ; no configure script
428 (replace 'build
429 ;; Upstream Makefile does not build a shared library. Borrow from Julia
430 ;; https://github.com/JuliaLang/julia/blob/v1.3.0/deps/dsfmt.mk
431 (lambda _
432 (invoke
433 "gcc" "-DNDEBUG" "-DDSFMT_MEXP=19937"
434 "-fPIC" "-DDSFMT_DO_NOT_USE_OLD_NAMES"
435 "-O3" "-finline-functions" "-fomit-frame-pointer"
436 "-fno-strict-aliasing" "--param" "max-inline-insns-single=1800"
437 "-Wmissing-prototypes" "-Wall" "-std=c99" "-shared" "dSFMT.c"
438 "-o" "libdSFMT.so")))
439 (replace 'install ; no "install" target
440 (lambda* (#:key outputs #:allow-other-keys)
441 (let* ((out (assoc-ref outputs "out"))
442 (lib (string-append out "/lib"))
443 (inc (string-append out "/include"))
444 (doc (string-append out "/share/doc/" ,name "-" ,version)))
445 (install-file "libdSFMT.so" lib)
446 (install-file "dSFMT.h" inc)
447 (install-file "LICENSE.txt" doc)
448 #t))))))
449 (synopsis "Double precision SIMD-oriented Fast Mersenne Twister")
450 (description
451 "The dSMFT package speeds up Fast Mersenne Twister generation by avoiding
452the expensive conversion of integer to double (floating point). dSFMT directly
453generates double precision floating point pseudorandom numbers which have the
454IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std 754-1985)
455format. dSFMT is only available on the CPUs which use IEEE 754 format double
456precision floating point numbers.")
457 (home-page "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/")
458 (license license:bsd-3)))
459
88bd1804
AE
460(define-public gsl
461 (package
462 (name "gsl")
f3a34b9d 463 (version "2.5")
ab2cc5cd
LC
464 (source (origin
465 (method url-fetch)
466 (uri (string-append "mirror://gnu/gsl/gsl-"
467 version ".tar.gz"))
468 (sha256
469 (base32
f3a34b9d 470 "1395y9hlhqadn5g9j8q22224fds5sd92jxi9czfavjj24myasq04"))
ab2cc5cd 471 (patches (search-patches "gsl-test-i686.patch"))))
88bd1804 472 (build-system gnu-build-system)
71e0f288 473 (arguments
f885fc05 474 `(;; Currently there are numerous tests that fail on "exotic"
6f766069
EF
475 ;; architectures such as aarch64 and ppc64le.
476 ,@(if (string-prefix? "aarch64-linux"
477 (or (%current-target-system) (%current-system)))
478 '(#:tests? #f)
479 '())))
480 (home-page "https://www.gnu.org/software/gsl/")
88bd1804
AE
481 (synopsis "Numerical library for C and C++")
482 (description
a22dc0c4
LC
483 "The GNU Scientific Library is a library for numerical analysis in C
484and C++. It includes a wide range of mathematical routines, with over 1000
485functions in total. Subject areas covered by the library include:
486differential equations, linear algebra, Fast Fourier Transforms and random
487numbers.")
88bd1804
AE
488 (license license:gpl3+)))
489
b92eee75
AE
490(define-public glpk
491 (package
492 (name "glpk")
445929e0 493 (version "4.65")
b92eee75
AE
494 (source
495 (origin
496 (method url-fetch)
497 (uri (string-append "mirror://gnu/glpk/glpk-"
498 version ".tar.gz"))
499 (sha256
500 (base32
445929e0 501 "040sfaa9jclg2nqdh83w71sv9rc1sznpnfiripjdyr48cady50a2"))))
b92eee75
AE
502 (build-system gnu-build-system)
503 (inputs
504 `(("gmp" ,gmp)))
505 (arguments
506 `(#:configure-flags '("--with-gmp")))
82110ef6 507 (home-page "https://www.gnu.org/software/glpk/")
79c311b8 508 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
b92eee75
AE
509 (description
510 "GLPK is a C library for solving large-scale linear programming (LP),
511mixed integer programming (MIP), and other related problems. It supports the
512GNU MathProg modeling language, a subset of the AMPL language, and features a
513translator for the language. In addition to the C library, a stand-alone
514LP/MIP solver is included in the package.")
515 (license license:gpl3+)))
516
b146763a
AE
517(define-public 4ti2
518 (package
519 (name "4ti2")
eea4a091 520 (version "1.6.9")
b146763a
AE
521 (source
522 (origin
eea4a091
TGR
523 (method url-fetch)
524 (uri (string-append "https://github.com/4ti2/4ti2/releases/download/"
525 "Release_"
526 (string-map (lambda (c) (if (char=? c #\.) #\_ c))
527 version)
528 "/4ti2-" version ".tar.gz"))
529 (sha256
530 (base32 "0rj92x6p9m3la5gasjbj7sa569im527ffmka5y2sv1amgd3fflrh"))))
b146763a
AE
531 (build-system gnu-build-system)
532 (native-inputs
533 `(("which" ,(@ (gnu packages base) which)))) ; for the tests
534 (inputs
535 `(("glpk" ,glpk)
536 ("gmp" ,gmp)))
537 (home-page "http://www.4ti2.de/")
538 (synopsis "Mathematical tool suite for problems on linear spaces")
539 (description
540 "4ti2 implements algorithms for solving algebraic, geometric and
541combinatorial problems on linear spaces. Among others, it solves systems
542of linear equations, computes extreme rays of polyhedral cones, solves
543integer programming problems and computes Markov bases for statistics.")
544 (license license:gpl2+)))
545
53696f10
AE
546(define-public cddlib
547 (package
548 (name "cddlib")
7fe491fb 549 (version "0.94i")
53696f10
AE
550 (source
551 (origin
552 (method url-fetch)
182dde82 553 (uri (string-append "ftp://ftp.math.ethz.ch/users/fukudak/cdd/cddlib-"
53696f10
AE
554 (string-delete #\. version) ".tar.gz"))
555 (sha256
556 (base32
7fe491fb 557 "00zdgiqb91vx6gd2103h3ijij0llspsxc6zz3iw2bll39fvkl4xq"))))
53696f10
AE
558 (build-system gnu-build-system)
559 (inputs
560 `(("gmp" ,gmp)))
561 (home-page "https://www.inf.ethz.ch/personal/fukudak/cdd_home/index.html")
562 (synopsis "Library for convex hulls and extreme rays of polyhedra")
563 (description
564 "The C-library cddlib implements the Double Description Method of
565Motzkin et al. for generating all vertices (i.e. extreme points) and extreme
566rays of a general convex polyhedron given by a system of linear inequalities
567in arbitrary dimension. It can also be used for the converse operation of
568computing convex hulls.")
569 (license license:gpl2+)))
570
0ffc2d53
AE
571(define-public lrslib
572 (package
573 (name "lrslib")
574 (version "7.0a")
575 (source
576 (origin
577 (method url-fetch)
578 (uri (string-append "http://cgm.cs.mcgill.ca/~avis/C/lrslib/archive/"
579 "lrslib-0"
580 (string-delete #\. version) ".tar.gz"))
581 (sha256
582 (base32
583 "034fa45r9hwx6ljmgpxk2872q34nklkalpdkc6s9hqw57rivi36k"))))
584 (build-system gnu-build-system)
585 (inputs
586 `(("gmp" ,gmp)))
587 (arguments
588 `(#:tests? #f ; no check phase
589 #:make-flags `("CC=gcc"
590 ,(string-append "prefix=" (assoc-ref %outputs "out"))
591 "all-shared")
592 #:phases
593 (modify-phases %standard-phases
594 (replace 'configure
595 (lambda _
596 (substitute* "makefile"
597 (("-L \\.") "-L . -Wl,-rpath='$$ORIGIN/../lib'"))
598 #t)))))
599 (home-page "http://cgm.cs.mcgill.ca/~avis/C/lrs.html")
600 (synopsis "Convex hulls of polyhedra with exact arithmetic")
601 (description
602 "The C code of lrslib implements the reverse search algorithm for
603vertex enumeration and convex hull problems. Its input file format is
604compatible with cddlib. All computations are done exactly in either
605multiple precision or fixed integer arithmetic. Output is not stored
606in memory, so even problems with very large output sizes can sometimes
607be solved.")
608 (license license:gpl2+)))
609
b457f3cc
AE
610(define-public vinci
611 (package
612 (name "vinci")
613 (version "1.0.5")
614 (source
615 (origin
616 (method url-fetch)
617 (uri (string-append "https://www.math.u-bordeaux.fr/~aenge/software/"
618 "vinci/vinci-" version ".tar.gz"))
619 (sha256
620 (base32
621 "1aq0qc1y27iw9grhgnyji3290wwfznsrk3sg6ynqpxwjdda53h4m"))))
622 (build-system gnu-build-system)
623 (inputs
624 `(("lrslib" ,lrslib)))
625 (arguments
626 `(#:tests? #f ; no check phase
627 #:phases
628 (modify-phases %standard-phases
629 (replace 'configure
630 ;; register the lrs location in the config file
631 (lambda* (#:key inputs #:allow-other-keys)
632 (let* ((lrs (assoc-ref inputs "lrslib"))
633 (lrsexec (string-append lrs "/bin/lrs")))
634 (substitute* "vinci.h"
635 (("#define LRS_EXEC \"lrs\"")
636 (string-append "#define LRS_EXEC \"" lrsexec "\""))))
637 #t))
638 (replace 'install
639 (lambda* (#:key outputs #:allow-other-keys)
640 (let* ((out (assoc-ref outputs "out"))
641 (bin (string-append out "/bin")))
642 (install-file "vinci" bin))
643 #t)))))
644 (home-page
645 "https://www.math.u-bordeaux.fr/~aenge/?category=software&page=vinci")
646 (synopsis "Volume computation for polytopes")
647 (description
648 "Vinci implements a number of volume computation algorithms for convex
649polytopes in arbitrary dimension. The polytopes can be given by their
650V-representation (as the convex hull of a finite number of vertices), by
651their H-representation (as the bounded intersection of a finite number of
652halfspaces) or by their double description with both representations.")
653 (license license:gpl2+)))
654
865a69dd
RW
655(define-public arpack-ng
656 (package
657 (name "arpack-ng")
f03c4ec6 658 (version "3.6.3")
c0edb5b5 659 (home-page "https://github.com/opencollab/arpack-ng")
622ef2b9
MB
660 (source (origin
661 (method git-fetch)
662 (uri (git-reference (url home-page) (commit version)))
663 (file-name (git-file-name name version))
664 (sha256
665 (base32
f03c4ec6 666 "1wljl96yqxc9v8r49c37lscwkdp58kaacfb9p6s6nvpm31haax4y"))))
865a69dd 667 (build-system gnu-build-system)
c0edb5b5
LC
668 (native-inputs
669 `(("autoconf" ,autoconf)
670 ("automake" ,automake)
671 ("libtool" ,libtool)))
865a69dd
RW
672 (inputs
673 `(("lapack" ,lapack)
19afbea1 674 ("fortran" ,gfortran)))
865a69dd
RW
675 (synopsis "Fortran subroutines for solving eigenvalue problems")
676 (description
677 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
678large scale eigenvalue problems.")
166191b3 679 (license (license:non-copyleft "file://COPYING"
865a69dd
RW
680 "See COPYING in the distribution."))))
681
c0edb5b5
LC
682(define-public arpack-ng-3.3.0
683 (package
684 (inherit arpack-ng)
685 (version "3.3.0")
686 (name (package-name arpack-ng))
687 (home-page (package-home-page arpack-ng))
688 (source
689 (origin
690 (method url-fetch)
691 (uri (string-append home-page "/archive/" version ".tar.gz"))
692 (file-name (string-append name "-" version ".tar.gz"))
693 (sha256
694 (base32
695 "1cz53wqzcf6czmcpfb3vb61xi0rn5bwhinczl65hpmbrglg82ndd"))))))
696
8c94c886
EB
697(define-public arpack-ng-openmpi
698 (package (inherit arpack-ng)
699 (name "arpack-ng-openmpi")
700 (inputs
701 `(("mpi" ,openmpi)
702 ,@(package-inputs arpack-ng)))
4f387541
LC
703 (arguments
704 (substitute-keyword-arguments (package-arguments arpack-ng)
705 ((#:configure-flags _ '())
aa82260b
PG
706 ''("--enable-mpi"))
707 ((#:phases phases '%standard-phases)
708 `(modify-phases ,phases
bbe46a4a
EB
709 (add-before 'check 'mpi-setup
710 ,%openmpi-setup)))))
8c94c886
EB
711 (synopsis "Fortran subroutines for solving eigenvalue problems with MPI")))
712
da95c817
NK
713(define-public lapack
714 (package
715 (name "lapack")
e6de152d 716 (version "3.9.0")
da95c817
NK
717 (source
718 (origin
719 (method url-fetch)
720 (uri (string-append "http://www.netlib.org/lapack/lapack-"
721 version ".tgz"))
722 (sha256
723 (base32
e6de152d 724 "1155qixp26c12yrxc76z9mlfw2h3xxymxxv5znpgzh5gaykpndgj"))))
da95c817
NK
725 (build-system cmake-build-system)
726 (home-page "http://www.netlib.org/lapack/")
19afbea1 727 (inputs `(("fortran" ,gfortran)
e6de152d 728 ("python" ,python-wrapper)))
da95c817 729 (arguments
3ab869b6 730 `(#:configure-flags (list
3ab869b6
LC
731 "-DBUILD_SHARED_LIBS:BOOL=YES"
732 "-DLAPACKE=ON"
3ab869b6 733 ;; Build the 'LAPACKE_clatms' functions.
e6de152d
KH
734 "-DLAPACKE_WITH_TMG=ON"
735 "-DBUILD_TESTING=ON")))
da95c817
NK
736 (synopsis "Library for numerical linear algebra")
737 (description
738 "LAPACK is a Fortran 90 library for solving the most commonly occurring
739problems in numerical linear algebra.")
166191b3 740 (license (license:non-copyleft "file://LICENSE"
da95c817 741 "See LICENSE in the distribution."))))
73fed4f8 742
e1ff597a
EB
743(define-public scalapack
744 (package
745 (name "scalapack")
746 (version "2.0.2")
747 (source
748 (origin
749 (method url-fetch)
750 (uri (string-append "http://www.netlib.org/scalapack/scalapack-"
751 version ".tgz"))
752 (sha256
753 (base32
f73750e6
EB
754 "0p1r61ss1fq0bs8ynnx7xq4wwsdvs32ljvwjnx6yxr8gd6pawx0c"))
755 (patches (search-patches "scalapack-blacs-mpi-deprecations.patch"))))
e1ff597a
EB
756 (build-system cmake-build-system)
757 (inputs
758 `(("mpi" ,openmpi)
759 ("fortran" ,gfortran)
760 ("lapack" ,lapack))) ;for testing only
761 (arguments
6df2a50a
LC
762 `(#:configure-flags `("-DBUILD_SHARED_LIBS:BOOL=YES")
763 #:phases (modify-phases %standard-phases
bbe46a4a
EB
764 (add-before 'check 'mpi-setup
765 ,%openmpi-setup))))
e1ff597a
EB
766 (home-page "http://www.netlib.org/scalapack/")
767 (synopsis "Library for scalable numerical linear algebra")
768 (description
769 "ScaLAPACK is a Fortran 90 library of high-performance linear algebra
770routines on parallel distributed memory machines. ScaLAPACK solves dense and
771banded linear systems, least squares problems, eigenvalue problems, and
772singular value problems.")
adb223b8
LC
773 (license (license:non-copyleft "file://LICENSE"
774 "See LICENSE in the distribution."))))
e1ff597a 775
73fed4f8 776(define-public gnuplot
5f800540
KK
777 (package
778 (name "gnuplot")
cb1d8aee 779 (version "5.2.7")
5f800540
KK
780 (source (origin
781 (method url-fetch)
782 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
783 version "/gnuplot-"
784 version ".tar.gz"))
785 (sha256
cb1d8aee 786 (base32 "1vglp4la40f5dpj0zdj63zprrkyjgzy068p35bz5dqxjyczm1zlp"))))
5f800540
KK
787 (build-system gnu-build-system)
788 (inputs `(("readline" ,readline)
789 ("cairo" ,cairo)
790 ("pango" ,pango)
6e64766a
DM
791 ("gd" ,gd)
792 ("lua" ,lua)))
612a387f
RW
793 (native-inputs
794 `(("pkg-config" ,pkg-config)
795 ("texlive" ,texlive-tiny)))
07254d8b
AM
796 (arguments `(#:configure-flags (list (string-append
797 "--with-texdir=" %output
798 "/texmf-local/tex/latex/gnuplot"))))
5f800540
KK
799 (home-page "http://www.gnuplot.info")
800 (synopsis "Command-line driven graphing utility")
801 (description "Gnuplot is a portable command-line driven graphing
35b9e423 802utility. It was originally created to allow scientists and students to
73fed4f8 803visualize mathematical functions and data interactively, but has grown to
35b9e423 804support many non-interactive uses such as web scripting. It is also used as a
73fed4f8 805plotting engine by third-party applications like Octave.")
5f800540
KK
806 ;; X11 Style with the additional restriction that derived works may only be
807 ;; distributed as patches to the original.
808 (license (license:fsf-free
809 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
668c06ac 810
32f70e1f
TD
811(define-public gctp
812 (package
813 (name "gctp")
814 (version "2.0.0")
815 (source
816 (origin
5db874d1
TGR
817 (method git-fetch)
818 (uri (git-reference
819 (url "https://github.com/OkoSanto/GCTP.git")
820 (commit (string-append "v" version))))
821 (file-name (git-file-name name version))
32f70e1f 822 (sha256
5db874d1 823 (base32 "11wqmd443b4nksdbzp1msdws3av948nmwq1xz80w6hka3ss2aigd"))))
32f70e1f
TD
824 (native-inputs
825 `(("fortran" ,gfortran)))
826 (build-system gnu-build-system)
827 (synopsis "General Cartographic Transformation Package (GCTP)")
828 (description
829 "The General Cartographic Transformation Package (GCTP) is a system of
830software routines designed to permit the transformation of coordinate pairs
831from one map projection to another. The GCTP is the standard computer
832software used by the National Mapping Division for map projection
833computations.")
834 (home-page "https://github.com/OkoSanto/GCTP")
0f7cd95b 835 (license license:public-domain))) ;https://www2.usgs.gov/laws/info_policies.html
32f70e1f 836
becbbefc
TD
837(define-public hdf4
838 (package
839 (name "hdf4")
c959d99f 840 (version "4.2.14")
becbbefc
TD
841 (source
842 (origin
843 (method url-fetch)
844 (uri (string-append "https://support.hdfgroup.org/ftp/HDF/releases/HDF"
845 version "/src/hdf-" version ".tar.bz2"))
846 (sha256
c959d99f 847 (base32 "0n29klrrbwan9307np0d9hr128dlpc4nnlf57a140080ll3jmp8l"))
15ca49b2
AE
848 (patches (search-patches "hdf4-architectures.patch"
849 "hdf4-reproducibility.patch"
bd3d71cb
MB
850 "hdf4-shared-fortran.patch"
851 "hdf4-tirpc.patch"))))
becbbefc
TD
852 (build-system gnu-build-system)
853 (native-inputs
854 `(("gfortran" ,gfortran)
855 ("bison" ,bison)
856 ("flex" ,flex)))
857 (inputs
858 `(("zlib" ,zlib)
bd3d71cb
MB
859 ("libjpeg" ,libjpeg)
860 ("libtirpc" ,libtirpc)))
becbbefc
TD
861 (arguments
862 `(#:parallel-tests? #f
bd3d71cb
MB
863 #:configure-flags (list "--enable-shared"
864 (string-append "CPPFLAGS=-I"
865 (assoc-ref %build-inputs "libtirpc")
866 "/include/tirpc"))
becbbefc
TD
867 #:phases
868 (modify-phases %standard-phases
953a12fa
EF
869 ;; This is inspired by two of Debian's patches.
870 (add-before 'configure 'add-more-aarch64-support
871 (lambda _
872 (substitute* '("mfhdf/ncgen/ncgen.l"
873 "mfhdf/ncgen/ncgenyy.c"
874 "mfhdf/libsrc/netcdf.h.in")
875 (("AIX5L64") "__aarch64__"))
876 #t))
becbbefc
TD
877 (add-before 'configure 'patchbuild
878 (lambda _
879 (substitute*
880 '("mfhdf/hdfimport/testutil.sh.in" "hdf/util/testutil.sh.in")
881 (("/bin/rm") "rm")
882 (("/bin/mkdir") "mkdir"))
883 (substitute* (find-files "." "^Makefile\\.in$")
884 (("@HDF_BUILD_XDR_TRUE@XDR_ADD = \
885-R\\$\\(abs_top_builddir\\)/mfhdf/xdr/\\.libs") "")
886 (("@HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = \
887-R\\$\\(abs_top_builddir\\)/mfhdf/libsrc/\\.libs \
953a12fa 888-R\\$\\(abs_top_builddir\\)/hdf/src/\\.libs \\$\\(XDR_ADD\\)") ""))
e464b455
TD
889 #t))
890 (add-after 'configure 'patch-settings
891 (lambda _
892 ;; libhdf4.settings contains the full path of the
893 ;; compilers used, and its contents are included in
894 ;; .so-files. We truncate the hashes to avoid
895 ;; unnecessary store references to those compilers:
896 (substitute* "libhdf4.settings"
897 (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
898 (string-append prefix (string-take hash 10) "...")))
899 #t))
900 )))
becbbefc
TD
901 (home-page "https://www.hdfgroup.org/products/hdf4/")
902 (synopsis
903 "Library and multi-object file format for storing and managing data")
904 (description "HDF4 is a library and multi-object file format for storing
905and managing data between machines. HDF4 is an older hierarchical data format,
906incompatible with HDF5.")
907 (license
908 (license:non-copyleft
909 "https://www.hdfgroup.org/ftp/HDF/HDF_Current/src/unpacked/COPYING"))))
910
911(define-public hdf4-alt
912 (package
913 (inherit hdf4)
914 (name "hdf4-alt")
915 (arguments
916 (substitute-keyword-arguments (package-arguments hdf4)
917 ((#:configure-flags flags) `(cons* "--disable-netcdf" ,flags))))
918 (synopsis
919 "HDF4 without netCDF API, can be combined with the regular netCDF library")))
920
7ee3f1a2
JD
921(define-public hdf5
922 (package
923 (name "hdf5")
7b84610e 924 (version "1.8.21")
7ee3f1a2
JD
925 (source
926 (origin
927 (method url-fetch)
2da63064
TD
928 (uri (list (string-append "https://support.hdfgroup.org/ftp/HDF5/releases/"
929 "hdf5-" (version-major+minor version)
930 "/hdf5-" version "/src/hdf5-"
dcd9d163
LF
931 version ".tar.bz2")
932 (string-append "https://support.hdfgroup.org/ftp/HDF5/"
933 "current"
7b84610e
EB
934 (match (string-split version #\.)
935 ((major minor _ ...)
936 (string-append major minor)))
dcd9d163 937 "/src/hdf5-" version ".tar.bz2")))
7ee3f1a2 938 (sha256
7b84610e 939 (base32 "03glk4w4wyb1jyb443g53y3y1ncnf6mj2cqwm6avfr2awkgb3cg5"))
7fedc3fd
EB
940 (patches (search-patches "hdf5-config-date.patch"
941 "hdf5-1.8-mpi-deprecations.patch"))))
7ee3f1a2 942 (build-system gnu-build-system)
12ed1216
AE
943 (inputs
944 `(("zlib" ,zlib)))
e3a1a1de 945 (native-inputs
3ea420f3
LC
946 `(("gfortran" ,gfortran)
947 ("perl" ,perl))) ;part of the test machinery needs Perl
e3a1a1de
TD
948 (outputs '("out" ; core library
949 "fortran")) ; fortran interface
7ee3f1a2 950 (arguments
62126576 951 `(;; Some of the users, notably Flann, need the C++ interface.
e3a1a1de
TD
952 #:configure-flags '("--enable-cxx"
953 "--enable-fortran"
549d1571
LC
954 "--enable-fortran2003"
955
956 ;; Build a thread-safe library. Unfortunately,
957 ;; 'configure' invites you to either turn off C++,
958 ;; Fortran, and the high-level interface (HL), or
959 ;; to pass '--enable-unsupported'. Debian
960 ;; packagers chose to pass '--enable-unsupported'
961 ;; and we follow their lead here.
962 "--enable-threadsafe"
963 "--with-pthread"
964 "--enable-unsupported")
4dba441c
RW
965 ;; Use -fPIC to allow the R bindings to link with the static libraries
966 #:make-flags (list "CFLAGS=-fPIC"
967 "CXXFLAGS=-fPIC")
62126576 968 #:phases
f622e212
EB
969 (modify-phases %standard-phases
970 (add-before 'configure 'patch-configure
e3a1a1de 971 (lambda* (#:key outputs #:allow-other-keys)
f622e212 972 (substitute* "configure"
b8d9c93b 973 (("/bin/mv") "mv"))
e3a1a1de
TD
974 (substitute* "fortran/src/Makefile.in"
975 (("libhdf5_fortran_la_LDFLAGS =")
976 (string-append "libhdf5_fortran_la_LDFLAGS = -Wl-rpath="
977 (assoc-ref outputs "fortran") "/lib")))
978 (substitute* "hl/fortran/src/Makefile.in"
979 (("libhdf5hl_fortran_la_LDFLAGS =")
980 (string-append "libhdf5hl_fortran_la_LDFLAGS = -Wl,-rpath="
981 (assoc-ref outputs "fortran") "/lib")))
b8d9c93b 982 #t))
fd0378a1
TD
983 (add-after 'configure 'patch-settings
984 (lambda _
985 ;; libhdf5.settings contains the full path of the
986 ;; compilers used, and its contents are included in
987 ;; libhdf5.so. We truncate the hashes to avoid
988 ;; unnecessary store references to those compilers:
989 (substitute* "src/libhdf5.settings"
990 (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
d8f46d52
RW
991 (string-append prefix (string-take hash 10) "..."))
992 ;; Don't record the build-time kernel version to make the
993 ;; settings file reproducible.
994 (("Uname information:.*")
995 "Uname information: Linux\n"))
b8d9c93b 996 #t))
f622e212
EB
997 (add-after 'install 'patch-references
998 (lambda* (#:key inputs outputs #:allow-other-keys)
999 (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
1000 (zlib (assoc-ref inputs "zlib")))
1001 (substitute* (find-files bin "h5p?cc")
1002 (("-lz" lib)
1003 (string-append "-L" zlib "/lib " lib)))
e3a1a1de
TD
1004 #t)))
1005 (add-after 'install 'split
1006 (lambda* (#:key inputs outputs #:allow-other-keys)
1007 ;; Move all fortran-related files
1008 (let* ((out (assoc-ref outputs "out"))
1009 (bin (string-append out "/bin"))
1010 (lib (string-append out "/lib"))
1011 (inc (string-append out "/include"))
1012 (ex (string-append out "/share/hdf5_examples/fortran"))
1013 (fort (assoc-ref outputs "fortran"))
1014 (fbin (string-append fort "/bin"))
1015 (flib (string-append fort "/lib"))
1016 (finc (string-append fort "/include"))
1017 (fex (string-append fort "/share/hdf5_examples/fortran")))
1018 (mkdir-p fbin)
1019 (mkdir-p flib)
1020 (mkdir-p finc)
1021 (mkdir-p fex)
b0d1e60f
PG
1022 ;; Note: When built with --enable-parallel, the 'h5fc' file
1023 ;; doesn't exist, hence this condition.
1024 (when (file-exists? (string-append bin "/h5fc"))
1025 (rename-file (string-append bin "/h5fc")
1026 (string-append fbin "/h5fc")))
e3a1a1de
TD
1027 (for-each (lambda (file)
1028 (rename-file file
1029 (string-append flib "/" (basename file))))
1030 (find-files lib ".*fortran.*"))
1031 (for-each (lambda (file)
1032 (rename-file file
1033 (string-append finc "/" (basename file))))
1034 (find-files inc ".*mod"))
1035 (for-each (lambda (file)
1036 (rename-file file
1037 (string-append fex "/" (basename file))))
1038 (find-files ex ".*"))
1039 (delete-file-recursively ex))
1040 #t)))))
0a44f9c4 1041 (home-page "https://www.hdfgroup.org")
516e93f8 1042 (synopsis "Management suite for extremely large and complex data")
7ee3f1a2
JD
1043 (description "HDF5 is a suite that makes possible the management of
1044extremely large and complex data collections.")
d4bf49b1 1045 (license (license:x11-style
0a44f9c4 1046 "https://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
7ee3f1a2 1047
bb47aca5
RW
1048(define-public hdf5-1.10
1049 (package (inherit hdf5)
cb169aae 1050 (version "1.10.6")
bb47aca5
RW
1051 (source
1052 (origin
1053 (method url-fetch)
1054 (uri (list (string-append "https://support.hdfgroup.org/ftp/HDF5/releases/"
1055 "hdf5-" (version-major+minor version)
1056 "/hdf5-" version "/src/hdf5-"
1057 version ".tar.bz2")
1058 (string-append "https://support.hdfgroup.org/ftp/HDF5/"
1059 "current"
1060 (apply string-append
1061 (take (string-split version #\.) 2))
1062 "/src/hdf5-" version ".tar.bz2")))
1063 (sha256
cb169aae 1064 (base32 "1gf38x51128hn00744358w27xgzjk0ff4wra4yxh2lk804ck1mh9"))
94fea21b 1065 (patches (search-patches "hdf5-config-date.patch"))))))
bb47aca5 1066
2fd26d05
TD
1067(define-public hdf-java
1068 (package
2a509880
RW
1069 (name "hdf-java")
1070 (version "3.3.2")
1071 (source
1072 (origin
1073 (method url-fetch)
1074 (uri (string-append
0a44f9c4 1075 "https://www.hdfgroup.org/ftp/HDF5/releases/HDF-JAVA/hdfjni-"
2a509880
RW
1076 version "/src/CMake-hdfjava-" version ".tar.gz"))
1077 (sha256
1078 (base32 "0m1gp2aspcblqzmpqbdpfp6giskws85ds6p5gz8sx7asyp7wznpr"))
1079 (modules '((guix build utils)))
1080 (snippet ; Make sure we don't use the bundled sources and binaries.
1081 `(begin
1082 (for-each delete-file
1083 (list "SZip.tar.gz" "ZLib.tar.gz" "JPEG8d.tar.gz"
1084 "HDF4.tar.gz" "HDF5.tar.gz"))
1085 (delete-file-recursively ,(string-append "hdfjava-" version "/lib"))
1086 #t))))
1087 (build-system gnu-build-system)
1088 (native-inputs
1089 `(("jdk" ,icedtea "jdk")
1090 ("automake" ,automake) ; For up to date 'config.guess' and 'config.sub'.
1091 ;; For tests:
1092 ("hamcrest-core" ,java-hamcrest-core)
1093 ("junit" ,java-junit)
1094 ("slf4j-simple" ,java-slf4j-simple)))
1095 (inputs
1096 `(("hdf4" ,hdf4)
1097 ("hdf5" ,hdf5)
1098 ("zlib" ,zlib)
1099 ("libjpeg" ,libjpeg)
1100 ("slf4j-api" ,java-slf4j-api)))
1101 (arguments
1102 `(#:configure-flags
1103 (list (string-append "--target=" ,(or (%current-target-system) (%current-system)))
1104 (string-append "--with-jdk=" (assoc-ref %build-inputs "jdk") "/include,"
1105 (assoc-ref %build-inputs "jdk") "/lib" )
1106 (string-append "--with-hdf4=" (assoc-ref %build-inputs "hdf4") "/lib")
1107 (string-append "--with-hdf5=" (assoc-ref %build-inputs "hdf5") "/lib"))
2fd26d05 1108
2a509880
RW
1109 #:make-flags
1110 (list (string-append "HDFLIB=" (assoc-ref %build-inputs "hdf4") "/lib")
1111 (string-append "HDF5LIB=" (assoc-ref %build-inputs "hdf5") "/lib")
1112 (string-append "ZLIB=" (assoc-ref %build-inputs "zlib") "/lib/libz.so")
1113 (string-append "JPEGLIB="
1114 (assoc-ref %build-inputs "libjpeg") "/lib/libjpeg.so")
1115 "LLEXT=so")
2fd26d05 1116
2a509880
RW
1117 #:phases
1118 (modify-phases %standard-phases
1119 (add-before 'configure 'chdir-to-source
1120 (lambda _ (chdir ,(string-append "hdfjava-" version)) #t))
1121 (add-before 'configure 'patch-build
1122 (lambda* (#:key inputs outputs #:allow-other-keys)
1123 (substitute* "configure"
1124 (("COPT=\"") "COPT=\"-O2 ") ; CFLAGS is ignored in Makefiles
1125 (("/bin/cat") (which "cat")))
1126 ;; Set classpath for compilation
1127 (substitute* '("hdf/hdf5lib/Makefile.in"
1128 "hdf/hdf5lib/exceptions/Makefile.in"
1129 "hdf/hdflib/Makefile.in")
1130 (("\\$\\(TOP\\)/lib/slf4j-api-1\\.7\\.5\\.jar")
1131 (string-append (assoc-ref inputs "slf4j-api")
1132 "/share/java/slf4j-api.jar")))
1133 ;; Replace outdated config.sub and config.guess:
1134 (with-directory-excursion "config"
1135 (for-each (lambda (file)
1136 (install-file
1137 (string-append (assoc-ref inputs "automake")
1138 "/share/automake-"
1139 ,(version-major+minor (package-version automake))
1140 "/" file) "."))
1141 '("config.sub" "config.guess")))
64dc8b0b 1142
2a509880
RW
1143 ;; Fix embedded version number
1144 (let ((hdf5version (list ,@(string-split (package-version hdf5) #\.))))
1145 (substitute* "hdf/hdf5lib/H5.java"
1146 (("1, 8, 19")
1147 (string-join hdf5version ", "))))
64dc8b0b 1148
2a509880
RW
1149 (mkdir-p (string-append (assoc-ref outputs "out")))
1150 ;; Set classpath for tests
1151 (let* ((build-dir (getcwd))
1152 (lib (string-append build-dir "/lib"))
1153 (jhdf (string-append lib "/jhdf.jar"))
1154 (jhdf5 (string-append lib "/jhdf5.jar"))
1155 (testjars
1156 (map (lambda (i)
1157 (string-append (assoc-ref inputs i)
1158 "/share/java/" i ".jar"))
1159 '("junit" "hamcrest-core" "slf4j-api" "slf4j-simple")))
1160 (class-path
1161 (string-join `("." ,build-dir ,jhdf ,jhdf5 ,@testjars) ":")))
2fd26d05 1162
2a509880
RW
1163 (substitute* '("test/hdf5lib/Makefile.in"
1164 "test/hdf5lib/junit.sh.in"
1165 "examples/runExample.sh.in")
1166 (("/usr/bin/test")
1167 (string-append (assoc-ref inputs "coreutils")
1168 "/bin/test"))
1169 (("/usr/bin/uname")
1170 (string-append (assoc-ref inputs "coreutils")
1171 "/bin/uname"))
1172 (("CLASSPATH=[^\n]*")
1173 (string-append "CLASSPATH=" class-path)))
1174 (setenv "CLASSPATH" class-path))
1175 #t))
1176 (add-before 'check 'build-examples
1177 (lambda _
1178 (apply invoke `("javac"
1179 ,@(find-files "examples" ".*\\.java"))))))
2fd26d05 1180
2a509880 1181 #:parallel-build? #f
2fd26d05 1182
2a509880
RW
1183 #:parallel-tests? #f ))
1184 (home-page "https://support.hdfgroup.org/products/java")
1185 (synopsis "Java interface for the HDF4 and HDF5 libraries")
1186 (description "Java HDF Interface (JHI) and Java HDF5 Interface (JHI5) use
2fd26d05
TD
1187the Java Native Interface to wrap the HDF4 and HDF5 libraries, which are
1188implemented in C.")
1189
2a509880
RW
1190 ;; BSD-style license:
1191 (license (license:x11-style
1192 "https://support.hdfgroup.org/ftp/HDF5/hdf-java\
2fd26d05
TD
1193/current/src/unpacked/COPYING"))))
1194
d3c4f3bb
TD
1195(define-public hdf-eos2
1196 (package
1197 (name "hdf-eos2")
1198 (version "19.1.0")
1199 (source
1200 (origin
1201 (method url-fetch)
1202 (uri "ftp://edhs1.gsfc.nasa.gov\
1203/edhs/hdfeos/latest_release/HDF-EOS2.19v1.00.tar.Z")
1204 (sha256
1205 (base32 "0c9fcz25s292ldap12wxmlrvnyz99z24p63d8fwx51bf8s0s1zrz"))
1206 (patches (search-patches "hdf-eos2-remove-gctp.patch"
1207 "hdf-eos2-build-shared.patch"
1208 "hdf-eos2-fortrantests.patch"))))
1209 (build-system gnu-build-system)
1210 (native-inputs
1211 `(("gfortran" ,gfortran)))
1212 (inputs
1213 `(("hdf4" ,hdf4-alt) ; assume most HDF-EOS2 users won't use the HDF4 netCDF API
25bdbb61 1214 ;; XXX: These inputs are really dependencies of hdf4.
d3c4f3bb
TD
1215 ("zlib" ,zlib)
1216 ("libjpeg" ,libjpeg)
25bdbb61
MB
1217 ("libtirpc" ,libtirpc)
1218
d3c4f3bb
TD
1219 ("gctp" ,gctp)))
1220 (arguments
1221 `( #:configure-flags '("--enable-install-include" "--enable-shared"
1222 "CC=h4cc -Df2cFortran" "LIBS=-lgctp")
1223 #:parallel-tests? #f))
2aaa09f1 1224 (home-page "https://hdfeos.org/software/library.php#HDF-EOS2")
d3c4f3bb
TD
1225 (synopsis "HDF4-based data format for NASA's Earth Observing System")
1226 (description "HDF-EOS2 is a software library built on HDF4 which supports
1227the construction of data structures used in NASA's Earth Observing
1228System (Grid, Point and Swath).")
1229
1230 ;; Source files carry a permissive license header.
1231 (license (license:non-copyleft home-page))))
1232
0f43f835
TD
1233(define-public hdf-eos5
1234 (package
1235 (name "hdf-eos5")
1236 (version "1.15")
1237 (source (origin
1238 (method url-fetch)
1239 (uri (string-append "ftp://edhs1.gsfc.nasa.gov\
1240/edhs/hdfeos5/latest_release/HDF-EOS5." version ".tar.Z"))
1241 (sha256
1242 (base32
1243 "1p83333nzzy8rn5chxlm0hrkjjnhh2w1ji8ac0f9q4xzg838i58i"))
1244 (patches (search-patches "hdf-eos5-build-shared.patch"
1245 "hdf-eos5-remove-gctp.patch"
1246 "hdf-eos5-fix-szip.patch"
1247 "hdf-eos5-fortrantests.patch"))))
1248 (native-inputs
1249 `(("gfortran" ,gfortran)))
1250 (build-system gnu-build-system)
1251 (inputs
1252 `(("hdf5" ,hdf5)
1253 ("zlib" ,zlib)
1254 ("gctp" ,gctp)))
1255 (arguments
1256 `(#:configure-flags '("--enable-install-include" "--enable-shared"
1257 "CC=h5cc -Df2cFortran" "LIBS=-lgctp")
1258 #:parallel-tests? #f))
1259 (synopsis "HDF5-based data format for NASA's Earth Observing System")
1260 (description
1261 "HDF-EOS5 is a software library built on HDF5 to support the construction
1262of data structures used in NASA's Earth Observing System (Grid, Point and
1263Swath).")
1264 (home-page "http://www.hdfeos.org/software/library.php#HDF-EOS5")
1265
1266 ;; Source files carry a permissive license header.
1267 (license (license:non-copyleft home-page))))
1268
c8378eea
EB
1269(define-public hdf5-parallel-openmpi
1270 (package (inherit hdf5)
1271 (name "hdf5-parallel-openmpi")
1272 (inputs
1273 `(("mpi" ,openmpi)
1274 ,@(package-inputs hdf5)))
1275 (arguments
45201bf2
PG
1276 (substitute-keyword-arguments (package-arguments hdf5)
1277 ((#:configure-flags flags)
549d1571
LC
1278 ``("--enable-parallel"
1279 ,@(delete "--enable-cxx"
1280 (delete "--enable-threadsafe" ,flags))))
c8378eea
EB
1281 ((#:phases phases)
1282 `(modify-phases ,phases
45201bf2
PG
1283 (add-after 'build 'mpi-setup
1284 ,%openmpi-setup)
c8378eea
EB
1285 (add-before 'check 'patch-tests
1286 (lambda _
1287 ;; OpenMPI's mpirun will exit with non-zero status if it
1288 ;; detects an "abnormal termination", i.e. any process not
784c3da1 1289 ;; calling MPI_Finalize(). Since the test is explicitly
c8378eea
EB
1290 ;; avoiding MPI_Finalize so as not to have at_exit and thus
1291 ;; H5C_flush_cache from being called, mpirun will always
1292 ;; complain, so turn this test off.
1293 (substitute* "testpar/Makefile"
1294 (("(^TEST_PROG_PARA.*)t_pflush1(.*)" front back)
1295 (string-append front back "\n")))
1296 (substitute* "tools/h5diff/testph5diff.sh"
1297 (("/bin/sh") (which "sh")))
1298 #t))))))
1299 (synopsis "Management suite for data with parallel IO support")))
1300
0b2c8838
RW
1301(define-public hdf5-blosc
1302 (package
1303 (name "hdf5-blosc")
1304 (version "1.0.0")
1305 (source
1306 (origin
1307 (method git-fetch)
1308 (uri (git-reference
1309 (url "https://github.com/Blosc/hdf5-blosc.git")
1310 (commit (string-append "v" version))))
1311 (file-name (git-file-name name version))
1312 (sha256
1313 (base32 "1nj2bm1v6ymm3fmyvhbn6ih5fgdiapavlfghh1pvbmhw71cysyqs"))))
1314 (build-system cmake-build-system)
1315 (arguments
1316 `(#:configure-flags
1317 (list (string-append "-DBLOSC_INSTALL_DIR="
1318 (assoc-ref %build-inputs "c-blosc"))
1319 (string-append "-DPLUGIN_INSTALL_PATH="
1320 (assoc-ref %outputs "out")
1321 "/hdf5/lib/plugin"))
1322 #:phases
1323 (modify-phases %standard-phases
1324 (add-after 'unpack 'do-not-build-blosc
1325 (lambda _
1326 (substitute* "CMakeLists.txt"
1327 (("set\\(BLOSC_INSTALL_DIR.*") "")
1328 (("ExternalProject_Add\\(project_blosc") "message("))
1329 #t)))))
1330 (inputs
1331 `(("c-blosc" ,c-blosc)
1332 ("hdf5" ,hdf5-1.10)))
1333 (home-page "https://github.com/Blosc/hdf5-blosc")
1334 (synopsis "Filter for HDF5 using the Blosc compressor")
1335 (description "This is a filter for HDF5 that uses the Blosc compressor; by
1336installing this filter, you can read and write HDF5 files with
1337Blosc-compressed datasets.")
1338 (license license:expat)))
1339
00775104
EB
1340(define-public h5check
1341 (package
1342 (name "h5check")
1343 (version "2.0.1")
1344 (source
1345 (origin
1346 (method url-fetch)
0a44f9c4 1347 (uri (string-append "https://www.hdfgroup.org/ftp/HDF5/tools/"
00775104
EB
1348 "h5check/src/h5check-" version ".tar.gz"))
1349 (sha256
1350 (base32
1351 "1gm76jbwhz9adbxgn14zx8cj33dmjdr2g5xcy0m9c2gakp8w59kj"))))
1352 (build-system gnu-build-system)
1353 (inputs `(("hdf5" ,hdf5))) ;h5cc for tests
1354 (home-page "https://www.hdfgroup.org/products/hdf5_tools/h5check.html")
1355 (synopsis "HDF5 format checker")
1356 (description "@code{h5check} is a validation tool for verifying that an
1357HDF5 file is encoded according to the HDF File Format Specification.")
1358 (license (license:x11-style "file://COPYING"))))
1359
a53d6719
JD
1360(define-public itpp
1361 (package
1362 (name "itpp")
1363 (version "4.3.1")
1364 (source (origin
1365 (method url-fetch)
1366 (uri (string-append "mirror://sourceforge/itpp/itpp/"
1367 version "/itpp-"
1368 version ".tar.gz"))
1369 (sha256
1370 (base32
1371 "14ddy2xnb6sgp4hiax9v5sv4pr4l4dd4ps76nfha3nrpr1ikhcqm"))))
1372 (build-system cmake-build-system)
1373 (arguments `(#:tests? #f)) ; Tests require googletest *sources*
1374 (inputs `(("lapack" ,lapack)
1375 ("fftw" ,fftw)))
3a4d5df2
RW
1376 ;; FIXME: Even though the fonts are available dvips complains:
1377 ;; "Font cmmi10 not found; characters will be left blank."
1378 (native-inputs
1379 `(("texlive" ,texlive-tiny)
1380 ("ghostscript" ,ghostscript)
1381 ("doxygen" ,doxygen)))
a53d6719
JD
1382 (home-page "http://itpp.sourceforge.net")
1383 (synopsis "C++ library of maths, signal processing and communication classes")
1384 (description "IT++ is a C++ library of mathematical, signal processing and
1385communication classes and functions. Its main use is in simulation of
1386communication systems and for performing research in the area of
1387communications. The kernel of the library consists of generic vector and
1388matrix classes, and a set of accompanying routines. Such a kernel makes IT++
1389similar to MATLAB, GNU Octave or SciPy.")
1390 (license license:gpl3+)))
1391
889187a4
EB
1392(define-public netcdf
1393 (package
1394 (name "netcdf")
a4b0bfb1 1395 (version "4.4.1.1")
889187a4
EB
1396 (source
1397 (origin
1398 (method url-fetch)
1399 (uri (string-append "ftp://ftp.unidata.ucar.edu/pub/netcdf/"
1400 "netcdf-" version ".tar.gz"))
1401 (sha256
1402 (base32
a4b0bfb1
EB
1403 "1blc7ik5yin7i0ls2kag0a9xjk12m0dzx6v1x88az3ras3scci2d"))
1404 (patches (search-patches "netcdf-date-time.patch"
1405 "netcdf-tst_h_par.patch"))))
889187a4
EB
1406 (build-system gnu-build-system)
1407 (native-inputs
1408 `(("m4" ,m4)
1409 ("doxygen" ,doxygen)
1410 ("graphviz" ,graphviz)))
1411 (inputs
db825570
TD
1412 `(("hdf4" ,hdf4-alt)
1413 ("hdf5" ,hdf5)
1414 ("zlib" ,zlib)
1415 ("libjpeg" ,libjpeg)))
889187a4 1416 (arguments
db825570 1417 `(#:configure-flags '("--enable-doxygen" "--enable-dot" "--enable-hdf4")
43d01672
TD
1418
1419 #:phases (modify-phases %standard-phases
1420 (add-before 'configure 'fix-source-date
1421 (lambda _
1422 ;; As we ${SOURCE_DATE_EPOCH} evaluates to "1" in the build
1423 ;; environment, `date -u -d ${SOURCE_DATE_EPOCH}` will evaluate
1424 ;; to '1st hour of the current day', and therefore makes the
1425 ;; package not reproducible.
1426 (substitute* "./configure"
1427 (("date -u -d \"\\$\\{SOURCE_DATE_EPOCH\\}\"")
1428 "date --date='@0'"))
1429 #t))
1430 (add-after 'configure 'patch-settings
1431 (lambda _
1432 ;; libnetcdf.settings contains the full filename of the compilers
1433 ;; used to build the library. We truncate the hashes of those
1434 ;; filenames to avoid unnecessary references to the corresponding
1435 ;; store items.
1436 (substitute* "libnetcdf.settings"
1437 (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
1438 (string-append prefix (string-take hash 10) "...")))
1439 #t)))
1440
889187a4 1441 #:parallel-tests? #f)) ;various race conditions
821aa687 1442 (home-page "https://www.unidata.ucar.edu/software/netcdf/")
889187a4
EB
1443 (synopsis "Library for scientific data")
1444 (description "NetCDF is an interface for scientific data access and a
1445software library that provides an implementation of the interface. The netCDF
1446library defines a machine-independent format for representing scientific data.
1447Together, the interface, library, and format support the creation, access, and
1448sharing of scientific data.")
1449 (license (license:x11-style "file://COPYRIGHT"))))
1450
1451(define-public netcdf-parallel-openmpi
1452 (package (inherit netcdf)
1453 (name "netcdf-parallel-openmpi")
1454 (inputs
1455 `(("mpi" ,openmpi)
1456 ,@(alist-replace "hdf5" (list hdf5-parallel-openmpi)
1457 (package-inputs netcdf))))
1458 ;; TODO: Replace pkg-config references in nc-config with absolute references
1459 (arguments
1460 (substitute-keyword-arguments (package-arguments netcdf)
1461 ((#:configure-flags flags)
1462 `(cons* "CC=mpicc" "CXX=mpicxx"
1463 "--enable-parallel-tests"
1464 ;; Shared libraries not supported with parallel IO.
1465 "--disable-shared" "--with-pic"
1466 ,flags))))))
1467
300200b6
TD
1468(define-public netcdf-fortran
1469 (package
1470 (name "netcdf-fortran")
1471 (version "4.4.4")
1472 (source (origin
1473 (method url-fetch)
1474 (uri (string-append
1475 "ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-fortran-"
1476 version ".tar.gz"))
1477 (sha256
1478 (base32
1479 "0xaxdcg1p83zmypwml3swsnr3ccn38inwldyr1l3wa4dbwbrblxj"))))
1480 (build-system gnu-build-system)
1481 (arguments
1482 `(#:parallel-tests? #f))
1483 (inputs
1484 `(("netcdf" ,netcdf)))
1485 (native-inputs
1486 `(("gfortran" ,gfortran)))
1487 (synopsis "Fortran interface for the netCDF library")
1488 (description (package-description netcdf))
1489 (home-page (package-home-page netcdf))
1490 (license (package-license netcdf))))
1491
1b39a196
RJ
1492(define-public nlopt
1493 (package
1494 (name "nlopt")
1495 (version "2.4.2")
1496 (source (origin
1497 (method url-fetch)
1498 (uri (string-append "http://ab-initio.mit.edu/nlopt/nlopt-"
1499 version ".tar.gz"))
1500 (sha256
1501 (base32 "12cfkkhcdf4zmb6h7y6qvvdvqjs2xf9sjpa3rl3bq76px4yn76c0"))))
1502 (build-system gnu-build-system)
1503 (arguments
1504 `(;; Shared libraries are not built by default. They are required to
1505 ;; build the Guile, Octave, and Python bindings.
1506 #:configure-flags '("--enable-shared")
1507
1508 #:phases
1509 (modify-phases %standard-phases
1510 (add-before 'configure 'set-libnlopt-file-name
1511 (lambda* (#:key outputs #:allow-other-keys)
1512 ;; Make sure the Scheme module refers to the library by its
1513 ;; absolute file name (we cannot do that from a snippet
1514 ;; because the expansion of @libdir@ contains
1515 ;; ${exec_prefix}.)
1516 (let ((out (assoc-ref outputs "out")))
1517 (substitute* "swig/nlopt.scm.in"
1518 (("libnlopt")
1519 (string-append out "/lib/libnlopt")))
1520 #t))))))
1521 (inputs `(("guile" ,guile-2.0)))
1522 (native-inputs `(("pkg-config" ,pkg-config)))
1523 (home-page "http://ab-initio.mit.edu/wiki/")
1524 (synopsis "Library for nonlinear optimization")
1525 (description "NLopt is a library for nonlinear optimization, providing a
1526common interface for a number of different free optimization routines available
1527online as well as original implementations of various other algorithms.")
1528 (license license:lgpl2.1+)))
1529
005c787d
LC
1530(define-public ipopt
1531 (package
1532 (name "ipopt")
98a5cd51 1533 (version "3.12.12")
005c787d
LC
1534 (source (origin
1535 (method url-fetch)
1536 (uri (string-append
1537 "http://www.coin-or.org/download/source/Ipopt/Ipopt-"
1538 version".tgz"))
1539 (sha256
1540 (base32
98a5cd51 1541 "07yn9rzdswjk8n246qq6ci9ssf2bcplkifcpsfz9j6cdxw9vgbkv"))
005c787d
LC
1542 (modules '((guix build utils)))
1543 (snippet
1544 ;; Make sure we don't use the bundled software.
6cbee49d
MW
1545 '(begin
1546 (delete-file-recursively "ThirdParty")
1547 #t))))
005c787d 1548 (build-system gnu-build-system)
ad1c4537
LC
1549 (arguments
1550 '(#:phases (modify-phases %standard-phases
1551 (add-after 'install 'add--L-flags-in-ipopt.pc
1552 (lambda* (#:key inputs outputs #:allow-other-keys)
1553 ;; The '.pc' file lists '-llapack -lblas' in "Libs";
1554 ;; move it to "Libs.private" where it belongs, and add a
1555 ;; '-L' flag for LAPACK.
1556 (let ((out (assoc-ref outputs "out"))
1557 (lapack (assoc-ref inputs "lapack")))
1558 (substitute* (string-append out "/lib/pkgconfig/"
1559 "ipopt.pc")
1560 (("Libs: (.*)-llapack -lblas(.*)$" _ before after)
1561 (string-append "Libs: " before " " after "\n"
1562 "Libs.private: " before
1563 "-L" lapack "/lib -llapack -lblas "
1564 after "\n")))
1565 #t))))))
005c787d
LC
1566 (native-inputs
1567 `(("gfortran" ,gfortran)))
1568 (inputs
1569 ;; TODO: Maybe add dependency on COIN-MUMPS, ASL, and HSL.
ad1c4537 1570 `(("lapack" ,lapack))) ;for both libblas and liblapack
005c787d
LC
1571 (home-page "http://www.coin-or.org")
1572 (synopsis "Large-scale nonlinear optimizer")
1573 (description
1574 "The Interior Point Optimizer (IPOPT) is a software package for
1575large-scale nonlinear optimization. It provides C++, C, and Fortran
1576interfaces.")
1577 (license license:epl1.0)))
1578
ecfbc51f
RW
1579(define-public clp
1580 (package
1581 (name "clp")
1582 (version "1.17.1")
1583 (source (origin
1584 (method url-fetch)
1585 (uri (string-append "https://www.coin-or.org/download/source/"
1586 "Clp/Clp-" version ".tgz"))
1587 (sha256
1588 (base32
1589 "1wdg820g3iikf9344ijwsc8sy6c0m6im42bzzizm6rlmkvnmxhk9"))
1590 (modules '((guix build utils)))
1591 (snippet
1592 ;; Make sure we don't use the bundled software.
1593 '(begin
1594 (delete-file-recursively "ThirdParty")
1595 #t))))
1596 (build-system gnu-build-system)
1597 (native-inputs
1598 `(("gfortran" ,gfortran)
1599 ("pkg-config" ,pkg-config)))
1600 (inputs
1601 `(("openblas" ,openblas)))
1602 (home-page "https://www.coin-or.org")
1603 (synopsis "Linear programming solver")
1604 (description
1605 "CLP is a high quality linear programming solver. Its main strengths are
1606its dual and primal Simplex algorithms. It also has a barrier algorithm for
1607linear and quadratic objectives. There are limited facilities for nonlinear
1608and quadratic objectives using the Simplex algorithm.")
1609 (license license:epl1.0)))
1610
f9940ef1
LC
1611(define-public ceres
1612 (package
1613 (name "ceres-solver")
e0bee0de 1614 (version "1.14.0")
f9940ef1
LC
1615 (home-page "http://ceres-solver.org/")
1616 (source (origin
1617 (method url-fetch)
1618 (uri (string-append home-page "ceres-solver-"
1619 version ".tar.gz"))
1620 (sha256
1621 (base32
e0bee0de 1622 "13lfxy8x58w8vprr0nkbzziaijlh0vvqshgahvcgw0mrqdgh0i27"))))
f9940ef1
LC
1623 (build-system cmake-build-system)
1624 (arguments
1625 ;; TODO: Build HTML user documentation and install separately.
bc3a2e35 1626 '(#:configure-flags '("-DBUILD_EXAMPLES=OFF"
f9940ef1
LC
1627 "-DBUILD_SHARED_LIBS=ON")
1628
1629 #:phases (modify-phases %standard-phases
1630 (add-before 'configure 'set-library-directory
1631 (lambda _
1632 ;; Install libraries to lib/, not lib64/.
1633 (substitute* "internal/ceres/CMakeLists.txt"
1634 (("set\\(LIB_SUFFIX \"64\"\\)")
1635 "set(LIB_SUFFIX \"\")"))
1636 #t)))))
1637 (native-inputs
1638 `(("pkg-config" ,pkg-config)))
468e0b18
LC
1639 (propagated-inputs
1640 `(("glog" ,glog))) ;for #include <glog/glog.h>
f9940ef1
LC
1641 (inputs
1642 `(("eigen" ,eigen)
1643 ("blas" ,openblas)
1644 ("lapack" ,lapack)
1645 ("suitesparse" ,suitesparse)
1646 ("gflags" ,gflags)))
1647 (synopsis "C++ library for solving large optimization problems")
1648 (description
1649 "Ceres Solver is a C++ library for modeling and solving large,
1650complicated optimization problems. It is a feature rich, mature and
1651performant library which has been used in production since 2010. Ceres Solver
1652can solve two kinds of problems:
1653@enumerate
1654@item non-linear least squares problems with bounds constraints;
1655@item general unconstrained optimization problems.
1656@end enumerate\n")
1657 (license license:bsd-3)))
1658
b66741ed 1659;; For a fully featured Octave, users are strongly recommended also to install
5ca4fe96 1660;; the following packages: less, ghostscript, gnuplot.
5537603f 1661(define-public octave-cli
668c06ac 1662 (package
5537603f 1663 (name "octave-cli")
8a0dd289 1664 (version "5.2.0")
668c06ac
JD
1665 (source
1666 (origin
1667 (method url-fetch)
1668 (uri (string-append "mirror://gnu/octave/octave-"
f5a077b1 1669 version ".tar.lz"))
668c06ac
JD
1670 (sha256
1671 (base32
8a0dd289 1672 "1848dq6nxzal8gwjrcp6xhi5gq96w89nss9d9rz75q408gb3mbl6"))))
668c06ac
JD
1673 (build-system gnu-build-system)
1674 (inputs
697df13f
EF
1675 `(("alsa-lib" ,alsa-lib)
1676 ("arpack" ,arpack-ng)
8a0dd289 1677 ("bdb" ,bdb)
697df13f 1678 ("curl" ,curl)
1ec78e9d
EB
1679 ("fftw" ,fftw)
1680 ("fftwf" ,fftwf)
668c06ac
JD
1681 ("fltk" ,fltk)
1682 ("fontconfig" ,fontconfig)
1683 ("freetype" ,freetype)
697df13f
EF
1684 ("gl2ps" ,gl2ps)
1685 ("glpk" ,glpk)
1ec78e9d 1686 ("glu" ,glu)
ab5f3f21 1687 ("graphicsmagick" ,graphicsmagick)
697df13f
EF
1688 ("hdf5" ,hdf5)
1689 ("lapack" ,lapack)
ab5f3f21 1690 ("libsndfile" ,libsndfile)
697df13f
EF
1691 ("libxft" ,libxft)
1692 ("mesa" ,mesa)
1693 ("pcre" ,pcre)
ab5f3f21 1694 ("portaudio" ,portaudio)
697df13f
EF
1695 ("qhull" ,qhull)
1696 ("readline" ,readline)
1697 ("suitesparse" ,suitesparse)
1698 ("texinfo" ,texinfo)
1699 ("zlib" ,zlib)))
668c06ac 1700 (native-inputs
f5a077b1
EF
1701 `(("lzip" ,lzip)
1702 ("gfortran" ,gfortran)
668c06ac
JD
1703 ("pkg-config" ,pkg-config)
1704 ("perl" ,perl)
1ec78e9d
EB
1705 ;; The following inputs are not actually used in the build process.
1706 ;; However, the ./configure gratuitously tests for their existence and
1707 ;; assumes that programs not present at build time are also not, and
1708 ;; can never be, available at run time! If these inputs are therefore
1709 ;; not present, support for them will be built out. However, Octave
1710 ;; will still run without them, albeit without the features they
668c06ac
JD
1711 ;; provide.
1712 ("less" ,less)
668c06ac
JD
1713 ("ghostscript" ,ghostscript)
1714 ("gnuplot" ,gnuplot)))
116af86f
KK
1715 ;; Octave code uses this variable to detect directories holding multiple CA
1716 ;; certificates to verify peers with. This is required for the networking
1717 ;; functions that require encryption to work properly.
1718 (native-search-paths
1719 (list (search-path-specification
1720 (variable "CURLOPT_CAPATH")
1721 (files '("etc/ssl/certs")))))
668c06ac 1722 (arguments
b7b27a8f
KY
1723 `(#:configure-flags
1724 (list (string-append "--with-shell="
1725 (assoc-ref %build-inputs "bash")
5ca4fe96
AI
1726 "/bin/sh"))
1727 #:phases
1728 (modify-phases %standard-phases
1729 (add-after 'configure 'configure-makeinfo
1730 (lambda* (#:key inputs #:allow-other-keys)
b18b9d20
AI
1731 (substitute* "libinterp/corefcn/help.h"
1732 (("\"makeinfo\"")
1733 (string-append
1734 "\"" (assoc-ref inputs "texinfo") "/bin/makeinfo\"")))
5ca4fe96 1735 #t)))))
f5a077b1 1736 (home-page "https://www.gnu.org/software/octave/")
668c06ac 1737 (synopsis "High-level language for numerical computation")
1ec78e9d
EB
1738 (description "GNU Octave is a high-level interpreted language that is
1739specialized for numerical computations. It can be used for both linear and
1740non-linear applications and it provides great support for visualizing results.
1741Work may be performed both at the interactive command-line as well as via
1742script files.")
668c06ac 1743 (license license:gpl3+)))
3de01d3f 1744
e0ae7e73 1745(define-public octave
5537603f 1746 (package (inherit octave-cli)
e0ae7e73 1747 (name "octave")
7a3772b3 1748 (source (origin
5537603f 1749 (inherit (package-source octave-cli))))
36ce25f0
KK
1750 (inputs
1751 `(("qscintilla" ,qscintilla)
1752 ("qt" ,qtbase)
5537603f 1753 ,@(package-inputs octave-cli)))
36ce25f0
KK
1754 (native-inputs
1755 `(("qttools" , qttools) ;for lrelease
70bb5d88 1756 ("texlive" ,(texlive-union (list texlive-epsf))) ; for texi2dvi
5537603f 1757 ,@(package-native-inputs octave-cli)))
36ce25f0 1758 (arguments
5537603f 1759 (substitute-keyword-arguments (package-arguments octave-cli)
36ce25f0
KK
1760 ((#:phases phases)
1761 `(modify-phases ,phases
1762 (add-before 'configure 'patch-qscintilla-library-name
1763 (lambda* (#:key inputs #:allow-other-keys)
1764 ;; The QScintilla library that the Octave configure script tries
1765 ;; to link with should be named libqscintilla-qt5.so, but the
1766 ;; QScintilla input provides the shared library as
1767 ;; libqscintilla2_qt5.so.
1768 (substitute* "configure"
1769 (("qscintilla2-qt5")
1770 "qscintilla2_qt5"))
1771 #t))))))))
1772
5d4bd4cc
PG
1773(define-public opencascade-oce
1774 (package
1775 (name "opencascade-oce")
1776 (version "0.17.2")
1777 (source
1778 (origin
830971bf
TGR
1779 (method git-fetch)
1780 (uri (git-reference
1781 (url "https://github.com/tpaviot/oce.git")
1782 (commit (string-append "OCE-" version))))
1783 (file-name (git-file-name name version))
a4f393b7 1784 (patches (search-patches "opencascade-oce-glibc-2.26.patch"))
5d4bd4cc 1785 (sha256
830971bf 1786 (base32 "0rg5wzkvfmzfl6v2amyryb8dnjad0nn9kyr607wy2gch6rciah69"))))
5d4bd4cc
PG
1787 (build-system cmake-build-system)
1788 (arguments
1789 '(#:configure-flags
1790 (list "-DOCE_TESTING:BOOL=ON"
1791 "-DOCE_USE_TCL_TEST_FRAMEWORK:BOOL=ON"
1792 "-DOCE_DRAW:BOOL=ON"
1793 (string-append "-DOCE_INSTALL_PREFIX:PATH="
1794 (assoc-ref %outputs "out"))
1795 "-UCMAKE_INSTALL_RPATH")))
1796 (inputs
1797 `(("freetype" ,freetype)
1798 ("glu" ,glu)
1799 ("libxmu" ,libxmu)
1800 ("mesa" ,mesa)
1801 ("tcl" ,tcl)
1802 ("tk" ,tk)))
1803 (native-inputs
1804 `(("python" ,python-wrapper)))
1805 (home-page "https://github.com/tpaviot/oce")
1806 (synopsis "Libraries for 3D modeling and numerical simulation")
1807 (description
1808 "Open CASCADE is a set of libraries for the development of applications
1809dealing with 3D CAD data or requiring industrial 3D capabilities. It includes
1810C++ class libraries providing services for 3D surface and solid modeling, CAD
1811data exchange, and visualization. It is used for development of specialized
1812software dealing with 3D models in design (CAD), manufacturing (CAM),
1813numerical simulation (CAE), measurement equipment (CMM), and quality
1814control (CAQ) domains.
1815
1816This is the ``Community Edition'' (OCE) of Open CASCADE, which gathers
1817patches, improvements, and experiments contributed by users over the official
1818Open CASCADE library.")
1819 (license (list license:lgpl2.1; OCE libraries, with an exception for the
1820 ; use of header files; see
1821 ; OCCT_LGPL_EXCEPTION.txt
1822 license:public-domain; files
1823 ; src/Standard/Standard_StdAllocator.hxx and
1824 ; src/NCollection/NCollection_StdAllocator.hxx
1825 license:expat; file src/OpenGl/OpenGl_glext.h
1826 license:bsd-3)))); test framework gtest
1827
37dc2920
PG
1828(define-public opencascade-occt
1829 (package
1830 (name "opencascade-occt")
1831 (version "7.3.0p3")
1832 (source
1833 (origin
1834 (method git-fetch)
1835 (uri (git-reference
1836 (url "https://git.dev.opencascade.org/repos/occt.git")
1837 (commit
1838 (string-append "V"
1839 (string-map (lambda (x) (if (eq? x #\.) #\_ x))
1840 version)))))
1841 (file-name (git-file-name name version))
1842 (sha256
1843 (base32 "0bdywwxb6mk0ykbiajlvsb37295akqjp0a60y672qjfa67k0ljv4"))
1844 (modules '((guix build utils)))
1845 (snippet
1846 '(begin
1847 ;; Remove files specific to non-free operating systems.
1848 (delete-file-recursively "samples/ios")
1849 (delete-file-recursively "samples/mfc")
1850 (delete-file-recursively "samples/qt/FuncDemo")
1851 (delete-file "genconf.bat")
1852 (delete-file "gendoc.bat")
1853 (delete-file "genproj.bat")
1854 (delete-file "upgrade.bat")
1855 ;; Remove references to deleted files.
1856 (substitute* "dox/FILES_HTML.txt"
1857 ((".*standard.*") "" )
1858 ((".*UIKitSample.*") ""))
1859 #t))))
1860 (build-system cmake-build-system)
1861 (arguments
1862 '(;; There is no test target for make. OCCT provides an
1863 ;; 'Automated Testing System', which may be accessed after
1864 ;; installation via the draw.sh script. draw.sh is located in
1865 ;; the bin directory. For details see:
1866 ;; https://www.opencascade.com/doc/occt-7.3.0/overview/html/\
1867 ;; occt_dev_guides__tests.html
1868 #:tests? #f
1869 ;; Configure without freeimage: attempting to link against the
1870 ;; freeimage version 3.17 library leads to 'undefined
1871 ;; reference' errors.
1872 #:configure-flags
1873 (list "-DUSE_FREEIMAGE:BOOL=OFF"
1874 "-DUSE_TBB:BOOL=ON"
1875 "-DUSE_VTK:BOOL=OFF"
1876 "-DBUILD_DOC_Overview:BOOL=OFF"
1877 "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON"
1878 "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON"
1879 "-UCMAKE_INSTALL_LIBDIR")))
1880 (inputs
1881 `(("doxygen" ,doxygen)
1882 ;("freeimage" ,freeimage)
1883 ("freetype" ,freetype)
1884 ("glu" ,glu)
1885 ("libxext" ,libxext)
1886 ("libxi" ,libxi)
1887 ("libxmu" ,libxmu)
1888 ("mesa" ,mesa)
1889 ("tbb" ,tbb)
1890 ("tcl" ,tcl)
1891 ("tk" ,tk)))
1892 ;; TODO: build Overview documentation and add 'doc' output.
1893 (home-page "https://www.opencascade.com")
1894 (synopsis "Libraries for 3D modeling and numerical simulation")
1895 (description
1896 "Open CASCADE is a set of libraries for the development of applications
1897dealing with 3D CAD data or requiring industrial 3D capabilities. It includes
1898C++ class libraries providing services for 3D surface and solid modeling, CAD
1899data exchange, and visualization. It is used for development of specialized
1900software dealing with 3D models in design (CAD), manufacturing (CAM),
1901numerical simulation (CAE), measurement equipment (CMM), and quality
1902control (CAQ) domains.
1903
1904This is the certified version of the Open Cascade Technology (OCCT) library.")
1905 (license (list ;; OCCT library:
1906 license:lgpl2.1; with an exception for the use of header
1907 ; files, see OCCT_LGPL_EXCEPTION.txt.
1908 ;; Files src/OpenGl/glext.h, adm/cmake/cotire.cmake and
1909 ;; src/OpenGl/OpenGl_HaltonSampler.hxx:
1910 license:expat
1911 ;; Files src/ExprIntrp/ExprIntrp.tab.* and
1912 ;; src/StepFile/step.tab.*:
1913 license:gpl3+ ; with Bison 2.2 exception.
1914 ;; File src/NCollection/NCollection_UtfIterator.lxx:
1915 (license:non-copyleft
1916 "https://www.unicode.org/license.html")
1917 ;; File src/NCollection/NCollection_StdAllocator.hxx:
1918 license:public-domain))))
1919
3de01d3f
EB
1920(define-public gmsh
1921 (package
1922 (name "gmsh")
8a4d14fa 1923 (version "2.16.0")
3de01d3f
EB
1924 (source
1925 (origin
abed5df7
PG
1926 (method git-fetch)
1927 (uri (git-reference
1928 (url "https://gitlab.onelab.info/gmsh/gmsh.git")
1929 (commit
1930 (string-append "gmsh_"
1931 (string-map (lambda (x) (if (eq? x #\.) #\_ x))
1932 version)))))
1933 (file-name (git-file-name name version))
3de01d3f 1934 (sha256
abed5df7 1935 (base32 "08rq4jajwmlpivnm9yifz2jhaivnz065lnk0h2zv773nwl9wf162"))
3de01d3f
EB
1936 (modules '((guix build utils)))
1937 (snippet
1938 ;; Remove non-free METIS code
6cbee49d
MW
1939 '(begin
1940 (delete-file-recursively "contrib/Metis")
1941 #t))))
3de01d3f 1942 (build-system cmake-build-system)
3de01d3f
EB
1943 (propagated-inputs
1944 `(("fltk" ,fltk)
19afbea1 1945 ("gfortran" ,gfortran)
3de01d3f 1946 ("gmp" ,gmp)
40029cbe 1947 ("hdf5" ,hdf5)
3de01d3f
EB
1948 ("lapack" ,lapack)
1949 ("mesa" ,mesa)
85f41902 1950 ("glu" ,glu)
45548139 1951 ("opencascade-oce" ,opencascade-oce)
3de01d3f
EB
1952 ("libx11" ,libx11)
1953 ("libxext" ,libxext)))
66395a61
EF
1954 (inputs
1955 `(("fontconfig" ,fontconfig)
1956 ("libxft" ,libxft)))
3de01d3f
EB
1957 (arguments
1958 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
1959 "-DENABLE_BUILD_SHARED:BOOL=ON"
45548139 1960 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")))
0746c33e 1961 (home-page "http://gmsh.info/")
3de01d3f 1962 (synopsis "3D finite element grid generator")
edf684ef
EB
1963 (description "Gmsh is a 3D finite element grid generator with a built-in
1964CAD engine and post-processor. Its design goal is to provide a fast, light
1965and user-friendly meshing tool with parametric input and advanced
1966visualization capabilities. Gmsh is built around four modules: geometry,
1967mesh, solver and post-processing. The specification of any input to these
1968modules is done either interactively using the graphical user interface or in
1969ASCII text files using Gmsh's own scripting language.")
3de01d3f 1970 (license license:gpl2+)))
b9100e2f 1971
6d5f63b6
JD
1972(define-public maxflow
1973 (package
1974 (name "maxflow")
0af12a13
TGR
1975 ;; Versioning is ambiguous: the git tag matching this commit is ‘3.0.5’,
1976 ;; which matches CMakeLists.txt, but README.md and CHANGES say ‘3.04’.
1977 (version "3.0.5")
6d5f63b6
JD
1978 (source (origin
1979 (method git-fetch)
1980 (uri (git-reference
1981 (url "https://github.com/gerddie/maxflow.git")
0af12a13 1982 (commit version)))
2dc0a6cf 1983 (file-name (git-file-name name version))
6d5f63b6
JD
1984 (sha256
1985 (base32
1986 "0rll38whw55h0vcjrrwdnh9ascvxby0ph7n1l0d12z17cg215kkb"))))
1987 (build-system cmake-build-system)
0be9038c 1988 (home-page "https://pub.ist.ac.at/~vnk/software.html")
6d5f63b6
JD
1989 (synopsis "Library implementing Maxflow algorithm")
1990 (description "An implementation of the maxflow algorithm described in
1991@cite{An Experimental Comparison of Min-Cut/Max-Flow Algorithms for
1992Energy Minimization in Computer Vision.\n
1993Yuri Boykov and Vladimir Kolmogorov.\n
1994In IEEE Transactions on Pattern Analysis and Machine Intelligence,\n
1995September 2004}")
1996 (license license:gpl3+)))
1997
b9100e2f
EB
1998(define-public petsc
1999 (package
2000 (name "petsc")
4f7a4a06 2001 (version "3.11.2")
b9100e2f
EB
2002 (source
2003 (origin
2004 (method url-fetch)
2005 ;; The *-lite-* tarball does not contain the *large* documentation
2006 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
2007 "petsc-lite-" version ".tar.gz"))
2008 (sha256
4f7a4a06 2009 (base32 "1645nwwcp9bcnfnxikk480mhbbacdvhsay2c401818hk97dqj5nx"))))
b2c52fc9
TGR
2010 (outputs '("out" ; libraries and headers
2011 "examples")) ; ~30MiB of examples
b9100e2f
EB
2012 (build-system gnu-build-system)
2013 (native-inputs
6fec298d 2014 `(("python" ,python-2)))
b9100e2f 2015 (inputs
19afbea1 2016 `(("gfortran" ,gfortran)
b9100e2f 2017 ("lapack" ,lapack)
f258212d 2018 ("superlu" ,superlu)
b9100e2f
EB
2019 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
2020 ;; leaving out opengl, as configuration seems to only be for mac
2021 ))
2022 (arguments
2023 `(#:test-target "test"
b2c52fc9 2024 #:parallel-build? #f ; build is parallel by default
b9100e2f
EB
2025 #:configure-flags
2026 `("--with-mpi=0"
f258212d 2027 "--with-openmp=1"
c15be128 2028 "--with-superlu=1")
9731c412
EB
2029 #:make-flags
2030 ;; Honor (parallel-job-count) for build. Do not use --with-make-np,
2031 ;; whose value is dumped to $out/lib/petsc/conf/petscvariables.
2032 (list (format #f "MAKE_NP=~a" (parallel-job-count)))
b9100e2f 2033 #:phases
64dcc289
EB
2034 (modify-phases %standard-phases
2035 (replace 'configure
2036 ;; PETSc's configure script is actually a python script, so we can't
2037 ;; run it with bash.
2038 (lambda* (#:key outputs (configure-flags '())
2039 #:allow-other-keys)
2040 (let* ((prefix (assoc-ref outputs "out"))
2041 (flags `(,(string-append "--prefix=" prefix)
2042 ,@configure-flags)))
2043 (format #t "build directory: ~s~%" (getcwd))
2044 (format #t "configure flags: ~s~%" flags)
49fdd357 2045 (apply invoke "./configure" flags))))
64dcc289 2046 (add-after 'configure 'clean-local-references
9731c412 2047 (lambda* (#:key outputs #:allow-other-keys)
64dcc289
EB
2048 (let ((out (assoc-ref outputs "out")))
2049 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
b730b437
EB
2050 ;; Prevent build directory from leaking into compiled code
2051 (((getcwd)) out)
2052 ;; Scrub timestamp for reproducibility
fafd623e 2053 ((".*Libraries compiled on.*") ""))
9731c412
EB
2054 (substitute* (find-files "." "petscvariables")
2055 ;; Do not expose build machine characteristics, set to defaults.
2056 (("MAKE_NP = [:digit:]+") "MAKE_NP = 2")
2057 (("NPMAX = [:digit:]+") "NPMAX = 2"))
fafd623e 2058 #t)))
64dcc289 2059 (add-after 'install 'clean-install
10b11968
EB
2060 ;; Try to keep installed files from leaking build directory names.
2061 (lambda* (#:key inputs outputs #:allow-other-keys)
64dcc289 2062 (let ((out (assoc-ref outputs "out")))
10b11968 2063 (substitute* (map (lambda (file)
9a899cce 2064 (string-append out "/lib/petsc/conf/" file))
fafd623e 2065 '("petscvariables"))
10b11968
EB
2066 (((getcwd)) out))
2067 ;; Make compiler references point to the store
9a899cce 2068 (substitute* (string-append out "/lib/petsc/conf/petscvariables")
dfdf5716
EB
2069 (("= (gcc|g\\+\\+|gfortran)" _ compiler)
2070 (string-append "= " (which compiler))))
10b11968
EB
2071 ;; PETSc installs some build logs, which aren't necessary.
2072 (for-each (lambda (file)
9a899cce 2073 (let ((f (string-append out "/lib/petsc/conf/" file)))
10b11968
EB
2074 (when (file-exists? f)
2075 (delete-file f))))
9a899cce
EB
2076 '("configure.log" "make.log" "gmake.log"
2077 "test.log" "error.log" "RDict.db"
fafd623e 2078 "PETScBuildInternal.cmake"
10b11968 2079 ;; Once installed, should uninstall with Guix
fafd623e 2080 "uninstall.py"))
a3a99e27
EB
2081 #t)))
2082 (add-after 'install 'move-examples
2083 (lambda* (#:key outputs #:allow-other-keys)
2084 (let* ((out (assoc-ref outputs "out"))
2085 (examples (assoc-ref outputs "examples"))
2086 (exdir (string-append out "/share/petsc/examples"))
2087 (exdir' (string-append examples "/share/petsc/examples")))
2088 (copy-recursively exdir exdir')
2089 (delete-file-recursively exdir)
fafd623e 2090 #t))))))
2299d83e 2091 (home-page "https://www.mcs.anl.gov/petsc")
16ecf3ff 2092 (synopsis "Library to solve PDEs")
b9100e2f
EB
2093 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
2094data structures and routines for the scalable (parallel) solution of
2095scientific applications modeled by partial differential equations.")
166191b3 2096 (license (license:non-copyleft
2299d83e 2097 "https://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
b9100e2f
EB
2098
2099(define-public petsc-complex
2100 (package (inherit petsc)
2101 (name "petsc-complex")
2102 (arguments
2103 (substitute-keyword-arguments (package-arguments petsc)
2104 ((#:configure-flags cf)
2105 `(cons "--with-scalar-type=complex" ,cf))))
16ecf3ff 2106 (synopsis "Library to solve PDEs (with complex scalars)")))
183e44ae 2107
d8c7eeb9
EB
2108(define-public petsc-openmpi
2109 (package (inherit petsc)
2110 (name "petsc-openmpi")
2111 (inputs
9e2aa70b 2112 `(("hdf5" ,hdf5-parallel-openmpi)
af523673 2113 ("hypre" ,hypre-openmpi)
9e2aa70b
PG
2114 ("metis" ,metis)
2115 ("mumps" ,mumps-openmpi)
2116 ("openmpi" ,openmpi)
2117 ("scalapack" ,scalapack)
72f95783 2118 ("scotch" ,pt-scotch32)
d8c7eeb9
EB
2119 ,@(package-inputs petsc)))
2120 (arguments
2121 (substitute-keyword-arguments (package-arguments petsc)
2122 ((#:configure-flags cf)
af523673
PG
2123 ``("--with-hypre=1"
2124 "--with-mpiexec=mpirun"
9e2aa70b
PG
2125 "--with-metis=1"
2126 "--with-mumps=1"
2127 "--with-scalapack=1"
2128 "--with-ptscotch=1"
d8c7eeb9
EB
2129 ,(string-append "--with-mpi-dir="
2130 (assoc-ref %build-inputs "openmpi"))
71ca16b5
PG
2131 ,(string-append "--with-hdf5-include="
2132 (assoc-ref %build-inputs "hdf5") "/include")
2133 ,(string-append "--with-hdf5-lib="
2134 (assoc-ref %build-inputs "hdf5") "/lib/libhdf5.a")
2135 ,@(delete "--with-mpi=0" ,cf)))
2136 ((#:phases phases)
2137 `(modify-phases ,phases
9e2aa70b 2138 (add-before 'configure 'mpi-setup
bbe46a4a 2139 ,%openmpi-setup)))))
9e2aa70b 2140 (synopsis "Library to solve PDEs (with MUMPS and MPI support)")))
d8c7eeb9
EB
2141
2142(define-public petsc-complex-openmpi
2143 (package (inherit petsc-complex)
2144 (name "petsc-complex-openmpi")
2145 (inputs
2146 `(("openmpi" ,openmpi)
2147 ,@(package-inputs petsc-complex)))
2148 (arguments
2149 (substitute-keyword-arguments (package-arguments petsc-complex)
2150 ((#:configure-flags cf)
2151 ``("--with-mpiexec=mpirun"
2152 ,(string-append "--with-mpi-dir="
2153 (assoc-ref %build-inputs "openmpi"))
e586c6fa
EB
2154 ,@(delete "--with-mpi=0" ,cf)))
2155 ((#:phases phases)
2156 `(modify-phases ,phases
2157 (add-before 'configure 'mpi-setup
2158 ,%openmpi-setup)))))
16ecf3ff 2159 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
d8c7eeb9 2160
90ff2874
PG
2161(define-public python-petsc4py
2162 (package
2163 (name "python-petsc4py")
f1cc312e 2164 (version "3.11.0")
90ff2874
PG
2165 (source
2166 (origin
2167 (method url-fetch)
2168 (uri (pypi-uri "petsc4py" version))
2169 (sha256
2170 (base32
f1cc312e 2171 "1rm1qj5wlkhxl39by9n78lh3gbmii31wsnb8j1rr5hvfr5xgbx2q"))))
90ff2874
PG
2172 (build-system python-build-system)
2173 (arguments
2174 `(#:phases
2175 (modify-phases %standard-phases
2176 (add-before 'build 'pre-build
2177 (lambda _
2178 ;; Define path to PETSc installation.
2179 (setenv "PETSC_DIR" (assoc-ref %build-inputs "petsc"))
2180 #t))
2181 (add-before 'check 'mpi-setup
2182 ,%openmpi-setup))))
2183 (inputs
2184 `(("petsc" ,petsc-openmpi)
2185 ("python-numpy" ,python-numpy)))
2186 (home-page "https://bitbucket.org/petsc/petsc4py/")
2187 (synopsis "Python bindings for PETSc")
2188 (description "PETSc, the Portable, Extensible Toolkit for
2189Scientific Computation, is a suite of data structures and routines for
2190the scalable (parallel) solution of scientific applications modeled by
2191partial differential equations. It employs the MPI standard for all
2192message-passing communication. @code{petsc4py} provides Python
2193bindings to almost all functions of PETSc.")
2194 (license license:bsd-3)))
2195
560acf25
MB
2196(define-public python-kiwisolver
2197 (package
2198 (name "python-kiwisolver")
2199 (version "1.0.1")
2200 (source (origin
2201 (method url-fetch)
2202 (uri (pypi-uri "kiwisolver" version))
2203 (sha256
2204 (base32
2205 "0y22ci86znwwwfhbmvbgdfnbi6lv5gv2xkdlxvjw7lml43ayafyf"))))
2206 (build-system python-build-system)
2207 (home-page "https://github.com/nucleic/kiwi")
2208 (synopsis "Fast implementation of the Cassowary constraint solver")
2209 (description
2210 "Kiwi is an efficient C++ implementation of the Cassowary constraint
2211solving algorithm. Kiwi has been designed from the ground up to be
2212lightweight and fast. Kiwi ranges from 10x to 500x faster than the original
2213Cassowary solver with typical use cases gaining a 40x improvement. Memory
2214savings are consistently > 5x.")
2215 (license license:bsd-3)))
2216
2217(define-public python2-kiwisolver
2218 (package-with-python2 python-kiwisolver))
2219
a7f01414
EB
2220(define-public slepc
2221 (package
2222 (name "slepc")
a13e0f3d 2223 (version "3.11.1")
a7f01414
EB
2224 (source
2225 (origin
2226 (method url-fetch)
baeaf882
EB
2227 (uri (string-append "http://slepc.upv.es/download/distrib/slepc-"
2228 version ".tar.gz"))
a7f01414
EB
2229 (sha256
2230 (base32
a13e0f3d 2231 "1yq84q9wannc8xwapxpay4ypdd675picwi395hhsdvng9q6hf5j8"))))
a7f01414
EB
2232 (build-system gnu-build-system)
2233 (native-inputs
a13e0f3d
EB
2234 `(("python" ,python-2)
2235 ("petsc:examples" ,petsc "examples"))) ;for gmakegen.py script
a7f01414
EB
2236 (inputs
2237 `(("arpack" ,arpack-ng)
2238 ("gfortran" ,gfortran)))
2239 (propagated-inputs
2240 `(("petsc" ,petsc)))
2241 (arguments
2242 `(#:parallel-build? #f ;build is parallel by default
2243 #:configure-flags
2244 `(,(string-append "--with-arpack-dir="
9cf52454 2245 (assoc-ref %build-inputs "arpack") "/lib"))
9731c412 2246 #:make-flags ;honor (parallel-job-count)
a13e0f3d
EB
2247 `(,(format #f "MAKE_NP=~a" (parallel-job-count))
2248 ,(string-append "PETSCCONFIGDIR="
2249 (assoc-ref %build-inputs "petsc:examples")
2250 "/share/petsc/examples/config"))
a7f01414
EB
2251 #:phases
2252 (modify-phases %standard-phases
8787c555 2253 (replace 'configure
a7f01414
EB
2254 ;; configure is a python script, so we can't run it with bash.
2255 (lambda* (#:key inputs outputs (configure-flags '())
2256 #:allow-other-keys)
2257 (let* ((prefix (assoc-ref outputs "out"))
2258 (flags `(,(string-append "--prefix=" prefix)
2259 ,@configure-flags)))
2260 (format #t "build directory: ~s~%" (getcwd))
2261 (format #t "configure flags: ~s~%" flags)
2262 (setenv "SLEPC_DIR" (getcwd))
9cf52454 2263 (setenv "PETSC_DIR" (assoc-ref inputs "petsc"))
c6840089 2264 (apply invoke "./configure" flags))))
8787c555 2265 (add-after 'install 'delete-doc
a7f01414
EB
2266 ;; TODO: SLEPc installs HTML documentation alongside headers in
2267 ;; $out/include. We'd like to move them to share/doc, but delete
2268 ;; them for now, as they are incomplete and installing the complete
2269 ;; documentation is difficult.
2270 (lambda* (#:key outputs #:allow-other-keys)
2271 (let* ((out (assoc-ref outputs "out")))
0f6dc120
TGR
2272 (for-each delete-file (find-files out "\\.html$"))
2273 #t)))
8787c555 2274 (add-after 'install 'clean-install
a7f01414
EB
2275 ;; Clean up unnecessary build logs from installation.
2276 (lambda* (#:key outputs #:allow-other-keys)
2277 (let ((out (assoc-ref outputs "out")))
2278 (for-each (lambda (file)
2279 (let ((f (string-append out "/lib/slepc/conf/" file)))
2280 (when (file-exists? f)
2281 (delete-file f))))
2282 '("configure.log" "make.log" "gmake.log"
2283 "test.log" "error.log" "RDict.db"
0f6dc120
TGR
2284 "uninstall.py"))
2285 #t))))))
a7f01414
EB
2286 (home-page "http://slepc.upv.es")
2287 (synopsis "Scalable library for eigenproblems")
2288 (description "SLEPc is a software library for the solution of large sparse
2289eigenproblems on parallel computers. It can be used for the solution of
2290linear eigenvalue problems formulated in either standard or generalized form,
2291as well as other related problems such as the singular value decomposition.
2292The emphasis of the software is on methods and techniques appropriate for
2293problems in which the associated matrices are sparse, for example, those
2294arising after the discretization of partial differential equations.")
3c524f21 2295 (license license:bsd-2)))
a7f01414
EB
2296
2297(define-public slepc-complex
2298 (package (inherit slepc)
2299 (name "slepc-complex")
2300 (propagated-inputs
2301 `(("petsc" ,petsc-complex)
2302 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
2303 (synopsis "Scalable library for eigenproblems (with complex scalars)")))
2304
2305(define-public slepc-openmpi
2306 (package (inherit slepc)
2307 (name "slepc-openmpi")
6df2a50a
LC
2308 (arguments
2309 (substitute-keyword-arguments (package-arguments slepc)
2310 ((#:phases phases '%standard-phases)
2311 `(modify-phases ,phases
bbe46a4a
EB
2312 (add-before 'check 'mpi-setup
2313 ,%openmpi-setup)))))
a7f01414
EB
2314 (inputs
2315 `(("mpi" ,openmpi)
2316 ("arpack" ,arpack-ng-openmpi)
2317 ,@(alist-delete "arpack" (package-inputs slepc))))
2318 (propagated-inputs
2319 `(("petsc" ,petsc-openmpi)
2320 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
2321 (synopsis "Scalable library for eigenproblems (with MPI support)")))
2322
2323(define-public slepc-complex-openmpi
2324 (package (inherit slepc-openmpi)
2325 (name "slepc-complex-openmpi")
2326 (propagated-inputs
2327 `(("petsc" ,petsc-complex-openmpi)
2328 ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
2329 (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
2330
6b5687d0
PG
2331(define-public python-slepc4py
2332 (package
2333 (name "python-slepc4py")
09bad3cd 2334 (version "3.11.0")
6b5687d0
PG
2335 (source
2336 (origin
2337 (method url-fetch)
2338 (uri (pypi-uri "slepc4py" version))
2339 (sha256
2340 (base32
09bad3cd 2341 "1ksp08kxf4wg408b9nn39z3qfhy643j22d4rfbl30vzxk2rxh4lq"))))
6b5687d0
PG
2342 (build-system python-build-system)
2343 (arguments
2344 `(#:phases
2345 (modify-phases %standard-phases
2346 (add-before 'build 'pre-build
2347 (lambda _
2348 ;; Define path to PETSc installation.
2349 (setenv "PETSC_DIR" (assoc-ref %build-inputs "petsc"))
2350 ;; Define path to SLEPc installation.
2351 (setenv "SLEPC_DIR" (assoc-ref %build-inputs "slepc"))
2352 #t))
2353 (add-before 'check 'mpi-setup
2354 ,%openmpi-setup))))
2355 (inputs
2356 `(("python-numpy" ,python-numpy)
2357 ("python-petsc4py" ,python-petsc4py)
2358 ("slepc" ,slepc-openmpi)))
2359 (home-page "https://bitbucket.org/slepc/slepc4py/")
2360 (synopsis "Python bindings for SLEPc")
2361 (description "SLEPc, the Scalable Library for Eigenvalue Problem
2362Computations, is based on PETSc, the Portable, Extensible Toolkit for
2363Scientific Computation. It employs the MPI standard for all
2364message-passing communication. @code{slepc4py} provides Python
2365bindings to almost all functions of SLEPc.")
2366 (license license:bsd-3)))
2367
cec86422
EB
2368(define-public mumps
2369 (package
2370 (name "mumps")
5dbc79eb 2371 (version "5.2.1")
cec86422
EB
2372 (source
2373 (origin
2374 (method url-fetch)
2375 (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
2376 version ".tar.gz"))
2377 (sha256
2378 (base32
5dbc79eb 2379 "0jklh54x4y3ik1zkw6db7766kakjm5910diyaghfxxf8vwsgr26r"))
06e12395
MB
2380 (patches (search-patches "mumps-build-parallelism.patch"
2381 "mumps-shared-libseq.patch"
2382 "mumps-shared-mumps.patch"
2383 "mumps-shared-pord.patch"))))
cec86422
EB
2384 (build-system gnu-build-system)
2385 (inputs
2386 `(("fortran" ,gfortran)
2387 ;; These are required for linking against mumps, but we let the user
2388 ;; declare the dependency.
2389 ("blas" ,openblas)
2390 ("metis" ,metis)
2391 ("scotch" ,scotch)))
2392 (arguments
2393 `(#:modules ((ice-9 match)
2394 (ice-9 popen)
2395 (srfi srfi-1)
2396 ,@%gnu-build-system-modules)
2397 #:phases
2398 (modify-phases %standard-phases
fba78d18 2399 (replace 'configure
cec86422
EB
2400 (lambda* (#:key inputs #:allow-other-keys)
2401 (call-with-output-file "Makefile.inc"
2402 (lambda (port)
2403 (format port "
2404PLAT =
2405LIBEXT = .a
2406OUTC = -o
2407OUTF = -o
2408RM = rm -f~:[
2409CC = gcc
2410FC = gfortran
2411FL = gfortran
2412INCSEQ = -I$(topdir)/libseq
06e12395 2413LIBSEQ = $(topdir)/libseq/libmpiseq.a
cec86422
EB
2414LIBSEQNEEDED = libseqneeded~;
2415CC = mpicc
2416FC = mpifort
2417FL = mpifort~]
2418AR = ar vr # rules require trailing space, ugh...
2419RANLIB = ranlib
06e12395
MB
2420BLASDIR = ~a
2421LIBBLAS = -Wl,-rpath=$(BLASDIR) -Wl,-rpath='$$ORIGIN' -L$(BLASDIR) -lopenblas~@[
2422SCALAPDIR = ~a
2423SCALAP = -Wl,-rpath=$(SCALAPDIR) -Wl,-rpath='$$ORIGIN' -L$(SCALAPDIR) -lscalapack~]
cec86422
EB
2424LIBOTHERS = -pthread
2425CDEFS = -DAdd_
2426PIC = -fPIC
2427OPTF = -O2 -DALLOW_NON_INIT $(PIC)
2428OPTL = -O2 $(PIC)
2429OPTC = -O2 $(PIC)
2430INCS = $(INCSEQ)
2431LIBS = $(SCALAP) $(LIBSEQ)
2432LPORDDIR = $(topdir)/PORD/lib
2433IPORD = -I$(topdir)/PORD/include
06e12395 2434LPORD = $(LPORDDIR)/libpord.a
cec86422
EB
2435ORDERINGSF = -Dpord~@[
2436METISDIR = ~a
2437IMETIS = -I$(METISDIR)/include
06e12395 2438LMETIS = -Wl,-rpath $(METISDIR)/lib -L$(METISDIR)/lib -lmetis
cec86422
EB
2439ORDERINGSF += -Dmetis~]~@[~:{
2440SCOTCHDIR = ~a
2441ISCOTCH = -I$(SCOTCHDIR)/include
06e12395 2442LSCOTCH = -Wl,-rpath $(SCOTCHDIR)/lib -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
cec86422
EB
2443ORDERINGSF += ~a~}~]
2444ORDERINGSC = $(ORDERINGSF)
06e12395 2445LORDERINGS = $(LPORD) $(LMETIS) $(LSCOTCH) $(LIBSEQ)
cec86422
EB
2446IORDERINGSF = $(ISCOTCH)
2447IORDERINGSC = $(IPORD) $(IMETIS) $(ISCOTCH)"
2448 (assoc-ref inputs "mpi")
2449 (assoc-ref inputs "blas")
2450 (assoc-ref inputs "scalapack")
2451 (assoc-ref inputs "metis")
2452 (match (list (assoc-ref inputs "pt-scotch")
2453 (assoc-ref inputs "scotch"))
2454 ((#f #f)
2455 #f)
2456 ((#f scotch)
2457 `((,scotch "" "-Dscotch")))
2458 ((ptscotch _)
2459 `((,ptscotch
2460 "-lptesmumps -lptscotch -lptscotcherr "
2461 "-Dptscotch")))))))))
fba78d18 2462 (replace 'build
cec86422
EB
2463 ;; By default only the d-precision library is built. Make with "all"
2464 ;; target so that all precision libraries and examples are built.
2465 (lambda _
b414cf52
TGR
2466 (invoke "make" "all"
2467 (format #f "-j~a" (parallel-job-count)))))
fba78d18 2468 (replace 'check
cec86422
EB
2469 ;; Run the simple test drivers, which read test input from stdin:
2470 ;; from the "real" input for the single- and double-precision
2471 ;; testers, and from the "cmplx" input for complex-precision
2472 ;; testers. The EXEC-PREFIX key is used by the mumps-openmpi
2473 ;; package to prefix execution with "mpirun".
2474 (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
2475 (with-directory-excursion "examples"
2476 (every
2477 (lambda (prec type)
2478 (let ((tester (apply open-pipe*
2479 `(,OPEN_WRITE
2480 ,@exec-prefix
2481 ,(string-append "./" prec
2482 "simpletest"))))
2483 (input (open-input-file
2484 (string-append "input_simpletest_" type))))
2485 (begin
2486 (dump-port input tester)
2487 (close-port input)
2488 (zero? (close-pipe tester)))))
2489 '("s" "d" "c" "z")
2490 '("real" "real" "cmplx" "cmplx")))))
fba78d18
EB
2491 (replace 'install
2492 (lambda* (#:key outputs #:allow-other-keys)
2493 (let* ((out (assoc-ref outputs "out"))
2494 (libdir (string-append out "/lib")))
2495 (copy-recursively "lib" libdir)
2496 (copy-recursively "include" (string-append out "/include"))
2497 (when (file-exists? "libseq/libmpiseq.a")
2498 (install-file "libseq/libmpiseq.a" libdir))
06e12395
MB
2499 (when (file-exists? "libseq/libmpiseq.so")
2500 (install-file "libseq/libmpiseq.so" libdir))
fba78d18 2501 #t))))))
cec86422
EB
2502 (home-page "http://mumps.enseeiht.fr")
2503 (synopsis "Multifrontal sparse direct solver")
2504 (description
2505 "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
57e69c1d 2506sparse system of linear equations A x = b using Gaussian elimination.")
cec86422
EB
2507 (license license:cecill-c)))
2508
2509(define-public mumps-metis
2510 (package (inherit mumps)
2511 (name "mumps-metis")
2512 (inputs
2513 (alist-delete "scotch" (package-inputs mumps)))))
2514
2515(define-public mumps-openmpi
2516 (package (inherit mumps)
2517 (name "mumps-openmpi")
2518 (inputs
2519 `(("mpi" ,openmpi)
2520 ("scalapack" ,scalapack)
2521 ("pt-scotch" ,pt-scotch)
2522 ,@(alist-delete "scotch" (package-inputs mumps))))
2523 (arguments
2524 (substitute-keyword-arguments (package-arguments mumps)
2525 ((#:phases phases)
2526 `(modify-phases ,phases
bbe46a4a
EB
2527 (add-before 'check 'mpi-setup
2528 ,%openmpi-setup)
6df2a50a
LC
2529 (replace 'check
2530 (lambda _
2531 ((assoc-ref ,phases 'check)
2532 #:exec-prefix '("mpirun" "-n" "2"))))))))
cec86422
EB
2533 (synopsis "Multifrontal sparse direct solver (with MPI)")))
2534
2535(define-public mumps-metis-openmpi
2536 (package (inherit mumps-openmpi)
2537 (name "mumps-metis-openmpi")
2538 (inputs
2539 (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
2540
63e07468
BW
2541(define-public ruby-asciimath
2542 (package
2543 (name "ruby-asciimath")
2544 (version "1.0.4")
2545 (source
2546 (origin
2547 (method url-fetch)
2548 (uri (rubygems-uri "asciimath" version))
2549 (sha256
2550 (base32
2551 "1d80kiph5mc78zps7si1hv48kv4k12mzaq8jk5kb3pqpjdr72qmc"))))
2552 (build-system ruby-build-system)
2553 (arguments
2554 '(#:phases
2555 (modify-phases %standard-phases
2556 ;; Apply this patch
2557 ;; https://github.com/asciidoctor/asciimath/commit/1c06fdc8086077f4785479f78b0823a4a72d7948
2558 (add-after 'unpack 'patch-remove-spurious-backslashes
2559 (lambda _
2560 (substitute* "spec/parser_spec.rb"
2561 (("\\\\\"")
9923d5a4
TGR
2562 "\""))
2563 #t)))))
63e07468
BW
2564 (native-inputs
2565 `(("bundler" ,bundler)
2566 ("ruby-rspec" ,ruby-rspec)))
2567 (synopsis "AsciiMath parsing and conversion library")
2568 (description
2569 "A pure Ruby AsciiMath parsing and conversion library. AsciiMath is an
2570easy-to-write markup language for mathematics.")
2571 (home-page "https://github.com/asciidoctor/asciimath")
2572 (license license:expat)))
2573
183e44ae
EB
2574(define-public superlu
2575 (package
2576 (name "superlu")
995a09e0 2577 (version "5.2.1")
183e44ae
EB
2578 (source
2579 (origin
2580 (method url-fetch)
48fe5c36 2581 (uri (string-append "https://portal.nersc.gov/project/sparse/superlu/"
183e44ae
EB
2582 "superlu_" version ".tar.gz"))
2583 (sha256
995a09e0
EB
2584 (base32 "0qzlb7cd608q62kyppd0a8c65l03vrwqql6gsm465rky23b6dyr8"))
2585 (modules '((guix build utils)))
2586 (snippet
2587 ;; Replace the non-free implementation of MC64 with a stub adapted
2588 ;; from Debian
2589 '(begin
2590 (use-modules (ice-9 regex)
2591 (ice-9 rdelim))
2592 (call-with-output-file "SRC/mc64ad.c"
2593 (lambda (port)
2594 (display "
2595#include <stdio.h>
2596#include <stdlib.h>
2597void mc64id_(int *a) {
2598 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
2599 abort ();
2600}
2601void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
2602 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
2603 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
2604 abort ();
2605}\n" port)))
2606 ;; Remove the corresponding license verbiage. MC64 license follows
2607 ;; a "------" line separator.
2608 (with-atomic-file-replacement "License.txt"
2609 (let ((rx (make-regexp "-{8}")))
2610 (lambda (in out)
2611 (let loop ()
2612 (let ((line (read-line in 'concat)))
2613 (unless (regexp-exec rx line)
2614 (display line out)
6cbee49d
MW
2615 (loop))))
2616 #t)))))))
995a09e0 2617 (build-system cmake-build-system)
183e44ae
EB
2618 (native-inputs
2619 `(("tcsh" ,tcsh)))
2620 (inputs
995a09e0 2621 `(("blas" ,openblas)
19afbea1 2622 ("gfortran" ,gfortran)))
183e44ae 2623 (arguments
995a09e0
EB
2624 `(#:configure-flags '("-Denable_blaslib:BOOL=NO" ;do not use internal cblas
2625 "-DTPL_BLAS_LIBRARIES=openblas"
677bc34d 2626 "-DBUILD_SHARED_LIBS:BOOL=YES")))
48fe5c36 2627 (home-page "https://portal.nersc.gov/project/sparse/superlu/")
183e44ae
EB
2628 (synopsis "Supernodal direct solver for sparse linear systems")
2629 (description
2630 "SuperLU is a general purpose library for the direct solution of large,
2631sparse, nonsymmetric systems of linear equations on high performance machines.
2632The library is written in C and is callable from either C or Fortran. The
2633library routines perform an LU decomposition with partial pivoting and
2634triangular system solves through forward and back substitution. The library
2635also provides threshold-based ILU factorization preconditioners.")
995a09e0
EB
2636 (license (list license:bsd-3
2637 license:gpl2+ ;EXAMPLE/*fgmr.c
2638 (license:fsf-free "file://SRC/colamd.h")))))
f8ed036a 2639
a54aefea
EB
2640(define-public superlu-dist
2641 (package
2642 (name "superlu-dist")
aa2e83cc 2643 (version "6.2.0")
a54aefea
EB
2644 (source
2645 (origin
2646 (method url-fetch)
aa2e83cc 2647 (uri (string-append "https://portal.nersc.gov/project/sparse/superlu/"
a54aefea
EB
2648 "superlu_dist_" version ".tar.gz"))
2649 (sha256
aa2e83cc 2650 (base32 "1ynmwqajc9sc3my2hssa5k9s58ggvizqv9rdss0j7w99pbh5mnvw"))
0921eff2 2651 (modules '((guix build utils)))
29080870
EB
2652 (snippet
2653 ;; Replace the non-free implementation of MC64 with a stub
2654 '(begin
0921eff2 2655 (call-with-output-file "SRC/mc64ad_dist.c"
29080870
EB
2656 (lambda (port)
2657 (display "
2658#include <stdio.h>
2659#include <stdlib.h>
0921eff2 2660void mc64id_dist(int *a) {
29080870
EB
2661 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
2662 abort ();
2663}
0921eff2 2664void mc64ad_dist (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
29080870
EB
2665 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
2666 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
2667 abort ();
2668}\n" port)))
29080870 2669 (substitute* "SRC/util.c" ;adjust default algorithm
6161141e
EB
2670 (("RowPerm[[:blank:]]*=[[:blank:]]*LargeDiag_MC64;")
2671 ;; TODO: set to "LargeDiag_AWPM" once combinatorial-blas has
2672 ;; general (i.e. non-square) processor-grid support.
2673 "RowPerm = NOROWPERM;"))
6cbee49d 2674 #t))
6161141e 2675 (patches (search-patches "superlu-dist-scotchmetis.patch"
aa2e83cc 2676 "superlu-dist-awpm-grid.patch"))))
6161141e 2677 (build-system cmake-build-system)
a54aefea
EB
2678 (native-inputs
2679 `(("tcsh" ,tcsh)))
2680 (inputs
6161141e
EB
2681 `(("gfortran" ,gfortran)
2682 ("blas" ,openblas)
2683 ("lapack" ,lapack)
2684 ("combblas" ,combinatorial-blas)))
a54aefea 2685 (propagated-inputs
6161141e
EB
2686 `(("mpi" ,openmpi) ;headers include MPI heades
2687 ("parmetis" ,pt-scotch32 "metis")
2688 ("pt-scotch" ,pt-scotch32)))
a54aefea 2689 (arguments
6161141e
EB
2690 `(#:parallel-tests? #f ;tests use MPI and OpenMP
2691 #:configure-flags (list "-DBUILD_SHARED_LIBS:BOOL=YES"
2692 "-DTPL_ENABLE_COMBBLASLIB=YES"
2693 "-DTPL_BLAS_LIBRARIES=-lopenblas"
2694 "-DTPL_LAPACK_LIBRARIES=-llapack"
2695 (string-append "-DTPL_PARMETIS_LIBRARIES="
2696 (string-join
2697 '("ptscotchparmetis" "ptscotch" "ptscotcherr"
2698 "scotchmetis" "scotch" "scotcherr")
2699 ";"))
2700 (string-append "-DTPL_PARMETIS_INCLUDE_DIRS="
2701 (assoc-ref %build-inputs "parmetis")
2702 "/include")
2703 "-DTPL_ENABLE_COMBBLASLIB=ON"
2704 (string-append "-DTPL_COMBBLAS_INCLUDE_DIRS="
2705 (assoc-ref %build-inputs "combblas")
2706 "/include/CombBLAS;"
2707 (assoc-ref %build-inputs "combblas")
2708 "/include/BipartiteMatchings")
2709 "-DTPL_COMBBLAS_LIBRARIES=CombBLAS")
a54aefea 2710 #:phases
dc1d3cde 2711 (modify-phases %standard-phases
6161141e 2712 (add-before 'configure 'set-c++-standard
dc1d3cde 2713 (lambda _
6161141e
EB
2714 (substitute* "CMakeLists.txt"
2715 ;; AWPM headers require C++14
2716 (("CMAKE_CXX_STANDARD 11") "CMAKE_CXX_STANDARD 14"))))
bbe46a4a
EB
2717 (add-before 'check 'mpi-setup
2718 ,%openmpi-setup)
6161141e
EB
2719 (add-before 'check 'omp-setup
2720 (lambda _ (setenv "OMP_NUM_THREADS" "1") #t)))))
a54aefea
EB
2721 (home-page (package-home-page superlu))
2722 (synopsis "Parallel supernodal direct solver")
2723 (description
2724 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
2725It is targeted for distributed memory parallel machines. SuperLU_DIST is
2726implemented in ANSI C, and MPI for communications.")
2727 (license license:bsd-3)))
2728
f8ed036a
EB
2729(define-public scotch
2730 (package
2731 (name "scotch")
fd373343 2732 (version "6.0.6")
f8ed036a
EB
2733 (source
2734 (origin
2735 (method url-fetch)
1dc31097
TGR
2736 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
2737 "latestfile/298/scotch_" version ".tar.gz"))
f8ed036a 2738 (sha256
fd373343
EB
2739 (base32 "1ky4k9r6jvajhqaqnnx6h8fkmds2yxgp70dpr1qzwcyhi2nhqvv8"))
2740 (patches (search-patches "scotch-build-parallelism.patch"
2741 "scotch-integer-declarations.patch"))))
f8ed036a
EB
2742 (build-system gnu-build-system)
2743 (inputs
525e83ec
VL
2744 `(("zlib" ,zlib)))
2745 (native-inputs
2746 `(("flex" ,flex)
f8ed036a 2747 ("bison" ,bison)))
fd373343 2748 (outputs '("out" "metis"))
f8ed036a 2749 (arguments
fd373343
EB
2750 `(#:make-flags (list (string-append "prefix=" %output))
2751 #:phases
d6602ee9
EB
2752 (modify-phases %standard-phases
2753 (add-after
2754 'unpack 'chdir-to-src
d67a7e9e 2755 (lambda _ (chdir "src") #t))
d6602ee9
EB
2756 (replace
2757 'configure
2758 (lambda _
2759 (call-with-output-file "Makefile.inc"
2760 (lambda (port)
2761 (format port "
f8ed036a
EB
2762EXE =
2763LIB = .a
2764OBJ = .o
2765MAKE = make
2766AR = ar
2767ARFLAGS = -ruv
cf0ec6c4 2768CAT = cat
f8ed036a
EB
2769CCS = gcc
2770CCP = mpicc
2771CCD = gcc
2772CPPFLAGS =~{ -D~a~}
6c798540 2773CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
f8ed036a
EB
2774LDFLAGS = -lz -lm -lrt -lpthread
2775CP = cp
2776LEX = flex -Pscotchyy -olex.yy.c
2777LN = ln
2778MKDIR = mkdir
2779MV = mv
2780RANLIB = ranlib
2781YACC = bison -pscotchyy -y -b y
2782"
d6602ee9
EB
2783 '("COMMON_FILE_COMPRESS_GZ"
2784 "COMMON_PTHREAD"
2785 "COMMON_RANDOM_FIXED_SEED"
fd373343 2786 "INTSIZE64" ;use 'int64_t'
cf0ec6c4
EB
2787 ;; Prevents symbolc clashes with libesmumps
2788 "SCOTCH_RENAME"
d6602ee9
EB
2789 ;; XXX: Causes invalid frees in superlu-dist tests
2790 ;; "SCOTCH_PTHREAD"
2791 ;; "SCOTCH_PTHREAD_NUMBER=2"
d67a7e9e
TGR
2792 "restrict=__restrict"))))
2793 #t))
bbe46a4a 2794 (add-after 'build 'build-esmumps
cf0ec6c4 2795 (lambda _
d67a7e9e
TGR
2796 (invoke "make"
2797 (format #f "-j~a" (parallel-job-count))
2798 "esmumps")))
fd373343
EB
2799 (add-before 'install 'make-install-dirs
2800 (lambda* (#:key outputs #:allow-other-keys)
2801 (mkdir (assoc-ref outputs "out"))))
2802 (add-after 'install 'install-metis
2803 (lambda* (#:key outputs #:allow-other-keys)
2804 (let ((out (assoc-ref outputs "metis")))
2805 (mkdir out)
2806 ;; metis files are not installed with 'make install'
2807 (for-each (lambda (f)
2808 (install-file f (string-append out "/include")))
2809 (find-files "../include/" ".*metis\\.h"))
2810 (for-each (lambda (f)
2811 (install-file f (string-append out "/lib")))
2812 (find-files "../lib/" ".*metis\\..*"))
2813 #t))))))
d5730000 2814 (home-page "https://www.labri.fr/perso/pelegrin/scotch/")
f8ed036a
EB
2815 (synopsis "Programs and libraries for graph algorithms")
2816 (description "SCOTCH is a set of programs and libraries which implement
2817the static mapping and sparse matrix reordering algorithms developed within
2818the SCOTCH project. Its purpose is to apply graph theory, with a divide and
2819conquer approach, to scientific computing problems such as graph and mesh
2820partitioning, static mapping, and sparse matrix ordering, in application
2821domains ranging from structural mechanics to operating systems or
2822bio-chemistry.")
2823 ;; See LICENSE_en.txt
2824 (license license:cecill-c)))
6acb4adb 2825
1c39f3b8
PG
2826(define-public scotch32
2827 ;; This is the 'INTSIZE32' variant, which uses 32-bit integers, as needed by
2828 ;; some applications.
2829 (package (inherit scotch)
2830 (name "scotch32")
2831 (arguments
2832 (substitute-keyword-arguments (package-arguments scotch)
2833 ((#:phases scotch-phases)
2834 `(modify-phases ,scotch-phases
2835 (replace
2836 'configure
2837 (lambda _
2838 (call-with-output-file "Makefile.inc"
2839 (lambda (port)
2840 (format port "
2841EXE =
2842LIB = .a
2843OBJ = .o
2844MAKE = make
2845AR = ar
2846ARFLAGS = -ruv
2847CAT = cat
2848CCS = gcc
2849CCP = mpicc
2850CCD = gcc
2851CPPFLAGS =~{ -D~a~}
2852CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
2853LDFLAGS = -lz -lm -lrt -lpthread
2854CP = cp
2855LEX = flex -Pscotchyy -olex.yy.c
2856LN = ln
2857MKDIR = mkdir
2858MV = mv
2859RANLIB = ranlib
2860YACC = bison -pscotchyy -y -b y
2861"
2862 '("COMMON_FILE_COMPRESS_GZ"
2863 "COMMON_PTHREAD"
2864 "COMMON_RANDOM_FIXED_SEED"
2865 "INTSIZE32" ;use 32-bit integers. See INSTALL.txt
2866 ;; Prevents symbolc clashes with libesmumps
2867 "SCOTCH_RENAME"
2868 ;; XXX: Causes invalid frees in superlu-dist tests
2869 ;; "SCOTCH_PTHREAD"
2870 ;; "SCOTCH_PTHREAD_NUMBER=2"
2871 "restrict=__restrict"))))))))))
2872 (synopsis
2873 "Programs and libraries for graph algorithms (32-bit integers)")))
2874
6acb4adb
EB
2875(define-public pt-scotch
2876 (package (inherit scotch)
2877 (name "pt-scotch")
2878 (propagated-inputs
2879 `(("openmpi" ,openmpi))) ;Headers include MPI headers
2880 (arguments
2881 (substitute-keyword-arguments (package-arguments scotch)
2882 ((#:phases scotch-phases)
d6602ee9
EB
2883 `(modify-phases ,scotch-phases
2884 (replace
2885 'build
d6602ee9 2886 (lambda _
c491f7f8
LC
2887 (invoke "make" (format #f "-j~a" (parallel-job-count))
2888 "ptscotch" "ptesmumps")
2889
2890 ;; Install the serial metis compatibility library
2891 (invoke "make" "-C" "libscotchmetis" "install")))
2892 (add-before 'check 'mpi-setup
2893 ,%openmpi-setup)
2894 (replace 'check
2895 (lambda _
2896 (invoke "make" "ptcheck")))))))
6acb4adb 2897 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
5698b8b8 2898
1c25a52c
PG
2899(define-public pt-scotch32
2900 (package (inherit scotch32)
2901 (name "pt-scotch32")
2902 (propagated-inputs
2903 `(("openmpi" ,openmpi))) ;headers include MPI headers
2904 (arguments
c4d4a779
PG
2905 (substitute-keyword-arguments (package-arguments scotch32)
2906 ((#:phases scotch32-phases)
2907 `(modify-phases ,scotch32-phases
1c25a52c
PG
2908 (replace 'build
2909 (lambda _
c491f7f8
LC
2910 (invoke "make" (format #f "-j~a" (parallel-job-count))
2911 "ptscotch" "ptesmumps")
2912 ;; Install the serial metis compatibility library
2913 (invoke "make" "-C" "libscotchmetis" "install")))
2914 (add-before 'check 'mpi-setup
2915 ,%openmpi-setup)
1c25a52c
PG
2916 (replace 'check
2917 (lambda _
c491f7f8 2918 (invoke "make" "ptcheck")))))))
1c25a52c
PG
2919 (synopsis
2920 "Programs and libraries for graph algorithms (with MPI and 32-bit integers)")))
2921
aa75ad00
EB
2922(define-public metis
2923 (package
2924 (name "metis")
2925 (version "5.1.0")
2926 (source
2927 (origin
2928 (method url-fetch)
2929 (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
2930 "metis-" version ".tar.gz"))
2931 (sha256
2932 (base32
2933 "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
2934 (build-system cmake-build-system)
2935 (inputs
2936 `(("blas" ,openblas)))
2937 (arguments
2938 `(#:tests? #f ;no tests
2939 #:configure-flags `("-DSHARED=ON"
2940 ,(string-append "-DGKLIB_PATH=" (getcwd)
2941 "/metis-" ,version "/GKlib"))))
2942 (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
2943 (synopsis "Graph partitioning and fill-reducing matrix ordering library")
2944 (description
2945 "METIS is a set of serial programs for partitioning graphs, partitioning
2946finite element meshes, and producing fill-reducing orderings for sparse
2947matrices. The algorithms implemented in METIS are based on the multilevel
2948recursive-bisection, multilevel k-way, and multi-constraint partitioning
2949schemes.")
2950 (license license:asl2.0))) ;As of version 5.0.3
2951
700ff222
EB
2952(define-public p4est
2953 (package
2954 (name "p4est")
4150da63 2955 (version "2.0")
700ff222
EB
2956 (source
2957 (origin
2958 (method url-fetch)
2959 (uri (string-append "http://p4est.github.io/release/p4est-"
2960 version ".tar.gz"))
2961 (sha256
2962 (base32
4150da63 2963 "16h267z256kxcxfjs390qqzv19hr58vrj4x8lndb7alnk2vca8n5"))))
700ff222
EB
2964 (build-system gnu-build-system)
2965 (inputs
2966 `(("fortran" ,gfortran)
2967 ("blas" ,openblas)
2968 ("lapack" ,lapack)
2969 ("zlib" ,zlib)))
2970 (arguments
2971 `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
2972 (assoc-ref %build-inputs "blas")
2973 " -lopenblas")
2974 ,(string-append "LAPACK_LIBS=-L"
2975 (assoc-ref %build-inputs "lapack")
6df2a50a
LC
2976 " -llapack"))
2977 #:phases (modify-phases %standard-phases
bbe46a4a
EB
2978 (add-before 'check 'mpi-setup
2979 ,%openmpi-setup))))
700ff222
EB
2980 (home-page "http://www.p4est.org")
2981 (synopsis "Adaptive mesh refinement on forests of octrees")
2982 (description
2983 "The p4est software library enables the dynamic management of a
2984collection of adaptive octrees, conveniently called a forest of octrees.
2985p4est is designed to work in parallel and scales to hundreds of thousands of
2986processor cores.")
2987 (license license:gpl2+)))
2988
2989(define-public p4est-openmpi
2990 (package (inherit p4est)
2991 (name "p4est-openmpi")
2992 (inputs
2993 `(("mpi" ,openmpi)
2994 ,@(package-inputs p4est)))
2995 (arguments
2996 (substitute-keyword-arguments (package-arguments p4est)
2997 ((#:configure-flags cf)
2998 ``("--enable-mpi" ,@,cf))))
2999 (synopsis "Parallel adaptive mesh refinement on forests of octrees")))
3000
5698b8b8
JD
3001(define-public gsegrafix
3002 (package
3003 (name "gsegrafix")
3004 (version "1.0.6")
3005 (source
3006 (origin
3007 (method url-fetch)
3008 (uri (string-append "mirror://gnu/" name "/" name "-"
3009 version ".tar.gz"))
3010 (sha256
3011 (base32
3012 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
3013 (build-system gnu-build-system)
3014 (arguments
3015 `(#:configure-flags '("LDFLAGS=-lm")))
3016 (inputs
3017 `(("libgnomecanvas" ,libgnomecanvas)
3018 ("libbonoboui" ,libbonoboui)
3019 ("libgnomeui" ,libgnomeui)
3020 ("libgnomeprintui" ,libgnomeprintui)
3021 ("popt" ,popt)))
3022 (native-inputs
3023 `(("pkg-config" ,pkg-config)))
6fd52309 3024 (home-page "https://www.gnu.org/software/gsegrafix/")
5698b8b8
JD
3025 (synopsis "GNOME application to create scientific and engineering plots")
3026 (description "GSEGrafix is an application which produces high-quality graphical
3027plots for science and engineering. Plots are specified via simple ASCII
3028parameter files and data files and are presented in an anti-aliased GNOME
3029canvas. The program supports rectangular two-dimensional plots, histograms,
3030polar-axis plots and three-dimensional plots. Plots can be printed or saved
3031to BMP, JPEG or PNG image formats.")
3032 (license license:gpl3+)))
8731e527
JD
3033
3034(define-public maxima
3035 (package
3036 (name "maxima")
ccc963d5 3037 (version "5.43.0")
8731e527
JD
3038 (source
3039 (origin
3040 (method url-fetch)
3041 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
3042 version "-source/" name "-" version ".tar.gz"))
3043 (sha256
3044 (base32
ccc963d5 3045 "0xyahp4c6509haxh4n1swiqm3421gplkdisa0zypclh3252sbzfw"))
fc1adab1 3046 (patches (search-patches "maxima-defsystem-mkdir.patch"))))
8731e527 3047 (build-system gnu-build-system)
df354a77 3048 (inputs
6b2eafaa 3049 `(("gcl" ,gcl)
df354a77 3050 ("gnuplot" ,gnuplot) ;for plots
fc9c47bd 3051 ("sed" ,sed)
f36afe4d 3052 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
df354a77
FB
3053 (native-inputs
3054 `(("texinfo" ,texinfo)
ccbc5758
KK
3055 ("perl" ,perl)
3056 ("python" ,python)))
8731e527 3057 (arguments
df354a77
FB
3058 `(#:configure-flags
3059 (list "--enable-gcl"
3060 (string-append "--with-posix-shell="
3061 (assoc-ref %build-inputs "bash")
3062 "/bin/sh")
3063 (string-append "--with-wish="
3064 (assoc-ref %build-inputs "tk")
3065 "/bin/wish"
3066 (let ((v ,(package-version tk)))
3067 (string-take v (string-index-right v #\.)))))
df354a77 3068 ;; By default Maxima attempts to write temporary files to
77af7b24
MW
3069 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
3070 ;; Work around that.
df354a77 3071 #:make-flags (list "TMPDIR=/tmp")
0093b126
KK
3072 #:phases
3073 (modify-phases %standard-phases
fc9c47bd
KK
3074 (add-after 'unpack 'patch-paths
3075 (lambda* (#:key inputs #:allow-other-keys)
3076 (let* ((sed (string-append (assoc-ref inputs "sed") "/bin/sed"))
3077 (coreutils (assoc-ref inputs "coreutils"))
3078 (dirname (string-append coreutils "/bin/dirname"))
ccc963d5
KK
3079 (head (string-append coreutils "/bin/head"))
3080 (perl (string-append (assoc-ref inputs "perl") "/bin/perl"))
3081 (python (string-append (assoc-ref inputs "python")
3082 "/bin/python3")))
fc9c47bd
KK
3083 (substitute* "src/maxima.in"
3084 (("sed ") (string-append sed " "))
3085 (("dirname") dirname)
3086 (("head") head))
ccc963d5
KK
3087 (substitute* "doc/info/Makefile.in"
3088 (("/usr/bin/env perl") perl))
3089 (substitute* "doc/info/build_html.sh.in"
3090 (("python") python))
fc9c47bd 3091 #t)))
0093b126
KK
3092 (add-before 'check 'pre-check
3093 (lambda _
3094 (chmod "src/maxima" #o555)
3095 #t))
1472d19a
KK
3096 (replace 'check
3097 (lambda _
3098 ;; This is derived from the testing code in the "debian/rules" file
3099 ;; of Debian's Maxima package.
3100 ;; If Maxima can successfully run this, the binary to be installed
3101 ;; should be fine.
df129041
MW
3102 (invoke "sh" "-c"
3103 (string-append
3104 "./maxima-local "
3105 "--lisp=gcl "
3106 "--batch-string=\"run_testsuite();\" "
3107 "| grep -q \"No unexpected errors found\""))))
0093b126
KK
3108 ;; Make sure the doc and emacs files are found in the
3109 ;; standard location. Also configure maxima to find gnuplot
3110 ;; without having it on the PATH.
3111 (add-after 'install 'post-install
3112 (lambda* (#:key outputs inputs #:allow-other-keys)
3113 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
3114 (out (assoc-ref outputs "out"))
3115 (datadir (string-append out "/share/maxima/" ,version))
3116 (binutils (string-append (assoc-ref inputs "binutils")
3117 "/bin")))
3118 (with-directory-excursion out
3119 (mkdir-p "share/emacs")
3120 (mkdir-p "share/doc")
0093b126
KK
3121 (symlink
3122 (string-append datadir "/doc/")
3123 (string-append out "/share/doc/maxima"))
3124 (with-atomic-file-replacement
3125 (string-append datadir "/share/maxima-init.lisp")
3126 (lambda (in out)
3127 (format out "~a ~s~a~%"
3128 "(setf $gnuplot_command "
3129 (string-append gnuplot "/bin/gnuplot") ")")
3130 (dump-port in out))))
3131 ;; Ensure that Maxima will have access to the GNU binutils
3132 ;; components at runtime.
3133 (wrap-program (string-append out "/bin/maxima")
3134 `("PATH" prefix (,binutils))))
3135 #t)))))
8731e527
JD
3136 (home-page "http://maxima.sourceforge.net")
3137 (synopsis "Numeric and symbolic expression manipulation")
3138 (description "Maxima is a system for the manipulation of symbolic and
3139numerical expressions. It yields high precision numeric results by using
3140exact fractions, arbitrary precision integers, and variable precision floating
e881752c 3141point numbers.")
8731e527
JD
3142 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
3143 ;; Others simply say "GNU General Public License" without stating a
3144 ;; version (which implicitly means gpl1+).
3145 ;; At least one file (src/maxima.asd) says "version 2."
3146 ;; GPLv2 only is therefore the smallest subset.
f36afe4d 3147 (license license:gpl2)))
ec322be2 3148
9aafbc0c
MW
3149(define-public wxmaxima
3150 (package
3151 (name "wxmaxima")
6607aad5 3152 (version "20.03.1")
9aafbc0c
MW
3153 (source
3154 (origin
c93b77ad
KK
3155 (method git-fetch)
3156 (uri (git-reference
3157 (url "https://github.com/wxMaxima-developers/wxmaxima.git")
3158 (commit (string-append "Version-" version))))
3159 (file-name (git-file-name name version))
9aafbc0c 3160 (sha256
6607aad5 3161 (base32 "09ciip0wkahps5jdsqqr72bwjrd15bacw38zp23v3hm71xfk8hky"))))
0181df53 3162 (build-system cmake-build-system)
5143517c 3163 (native-inputs
1d3c6a31
KK
3164 `(("gettext" ,gettext-minimal)
3165 ("xorg-server" ,xorg-server-for-tests)))
3166 ;; TODO: Add libomp for multithreading support.
3167 ;; As of right now, enabling libomp causes the imageCells.wxm test to fail.
9aafbc0c
MW
3168 (inputs
3169 `(("wxwidgets" ,wxwidgets)
de477809
SB
3170 ("maxima" ,maxima)
3171 ;; Runtime support.
3172 ("adwaita-icon-theme" ,adwaita-icon-theme)
3173 ("gtk+" ,gtk+)
3174 ("shared-mime-info" ,shared-mime-info)))
9aafbc0c 3175 (arguments
1d3c6a31 3176 `(#:test-target "test"
0181df53 3177 #:phases
ac2ddcc6 3178 (modify-phases %standard-phases
1d3c6a31
KK
3179 (add-before 'check 'pre-check
3180 (lambda _
3181 ;; Tests require a running X server.
3182 (system "Xvfb :1 &")
3183 (setenv "DISPLAY" ":1")
3184 (setenv "HOME" (getcwd))
3185 #t))
ac2ddcc6
KK
3186 (add-after 'install 'wrap-program
3187 (lambda* (#:key inputs outputs #:allow-other-keys)
3188 (wrap-program (string-append (assoc-ref outputs "out")
3189 "/bin/wxmaxima")
3190 `("PATH" ":" prefix
3191 (,(string-append (assoc-ref inputs "maxima")
3192 "/bin")))
3193 ;; For GtkFileChooserDialog.
3194 `("GSETTINGS_SCHEMA_DIR" =
3195 (,(string-append (assoc-ref inputs "gtk+")
3196 "/share/glib-2.0/schemas")))
3197 `("XDG_DATA_DIRS" ":" prefix
3198 (;; Needed by gdk-pixbuf to know supported icon formats.
3199 ,(string-append
3200 (assoc-ref inputs "shared-mime-info") "/share")
3201 ;; The default icon theme of GTK+.
3202 ,(string-append
3203 (assoc-ref inputs "adwaita-icon-theme") "/share"))))
3204 #t)))))
48446f0f 3205 (home-page "https://wxmaxima-developers.github.io/wxmaxima/")
9aafbc0c
MW
3206 (synopsis "Graphical user interface for the Maxima computer algebra system")
3207 (description
3208 "wxMaxima is a graphical user interface for the Maxima computer algebra
3209system. It eases the use of Maxima by making most of its commands available
3210through a menu system and by providing input dialogs for commands that require
3211more than one argument. It also implements its own display engine that
3212outputs mathematical symbols directly instead of depicting them with ASCII
3213characters.
3214
3215wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
3216text and mathematical calculations to create documents, exporting of input and
3217output to TeX, and a browser for Maxima's manual including command index and
3218full text searching.")
3219 (license license:gpl2+)))
3220
b15e47f9
RW
3221(define-public armadillo
3222 (package
3223 (name "armadillo")
f133e244 3224 (version "9.100.5")
b15e47f9
RW
3225 (source (origin
3226 (method url-fetch)
3227 (uri (string-append "mirror://sourceforge/arma/armadillo-"
7397cd9e 3228 version ".tar.xz"))
b15e47f9
RW
3229 (sha256
3230 (base32
f133e244 3231 "1ka1vd9fcmvp12qkcm4888dkfqwnalvv00x04wy29f3nx3qwczby"))))
b15e47f9 3232 (build-system cmake-build-system)
e405c0bc 3233 (arguments `(#:tests? #f)) ; no test target
b15e47f9
RW
3234 (inputs
3235 `(("openblas" ,openblas)
3236 ("lapack" ,lapack)
3237 ("arpack" ,arpack-ng)))
3238 (home-page "http://arma.sourceforge.net/")
3239 (synopsis "C++ linear algebra library")
3240 (description
3241 "Armadillo is a C++ linear algebra library, aiming towards a good balance
3242between speed and ease of use. It is useful for algorithm development
3243directly in C++, or quick conversion of research code into production
3244environments. It can be used for machine learning, pattern recognition,
3245signal processing, bioinformatics, statistics, econometrics, etc. The library
3246provides efficient classes for vectors, matrices and cubes, as well as 150+
255fb17b 3247associated functions (e.g., contiguous and non-contiguous submatrix views).")
fe418cc5 3248 (license license:asl2.0)))
b15e47f9 3249
279663ef 3250(define-public muparser
d7cff656
LF
3251 ;; When switching download sites, muparser re-issued a 2.2.5 release with a
3252 ;; different hash. In order to make `guix package --upgrade` work correctly,
3253 ;; we set a Guix packaging revision.
3254 ;; When the next version of muparser is released, we can remove
3255 ;; UPSTREAM-VERSION and REVISION and use the plain VERSION.
3256 (let ((upstream-version "2.2.5")
3257 (revision "2"))
3258 (package
3259 (name "muparser")
3260 (version (string-append upstream-version "-" revision))
3261 (source
3262 (origin
67f1db38
TGR
3263 (method git-fetch)
3264 (uri (git-reference
3265 (url "https://github.com/beltoforion/muparser.git")
3266 (commit (string-append "v" upstream-version))))
3267 (file-name (git-file-name name version))
d7cff656 3268 (sha256
67f1db38 3269 (base32 "0f0g4995xngf1pp3zr4p6ai2f8v6f8bxwa0k8ayjjiv1l8h44m24"))))
d7cff656
LF
3270 (build-system gnu-build-system)
3271 (arguments
3272 `(#:configure-flags '("--enable-samples=no")
3273 #:tests? #f)) ;no "check" target
3274 (home-page "http://muparser.beltoforion.de/")
3275 (synopsis "Fast parser library for mathematical expressions")
3276 (description
3277 "muParser is an extensible high performance math parser library. It is
3278based on transforming an expression into a bytecode and precalculating constant
3279parts of it.")
3280 (license license:expat))))
279663ef 3281
e73b49fb
RW
3282(define-public openblas
3283 (package
3284 (name "openblas")
2ea09530 3285 (version "0.3.7")
e73b49fb
RW
3286 (source
3287 (origin
3288 (method url-fetch)
a617fd55
MB
3289 (uri (string-append "mirror://sourceforge/openblas/v" version "/OpenBLAS%20"
3290 version "%20version.tar.gz"))
e73b49fb
RW
3291 (file-name (string-append name "-" version ".tar.gz"))
3292 (sha256
3293 (base32
2ea09530 3294 "0jbdjsi0qsxahdcm42agnn1y7xpmg0hrhwjsxg0zbhs9wwy3p568"))))
e73b49fb
RW
3295 (build-system gnu-build-system)
3296 (arguments
5789566a 3297 `(#:test-target "test"
bd0b4379
RW
3298 ;; DYNAMIC_ARCH is only supported on x86. When it is disabled and no
3299 ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
3300 ;; we need to disable substitutions.
71923a91
AE
3301 #:substitutable?
3302 ,(let ((system (or (%current-target-system) (%current-system))))
3303 (or (string-prefix? "x86_64" system)
bd0b4379 3304 (string-prefix? "i686" system)
83a34647
EF
3305 (string-prefix? "mips" system)
3306 (string-prefix? "aarch64" system)))
e73b49fb
RW
3307 #:make-flags
3308 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
3309 "SHELL=bash"
5855756c 3310 "MAKE_NB_JOBS=0" ;use jobserver for submakes
a4384dc9
MB
3311
3312 ;; This is the maximum number of threads OpenBLAS will ever use (that
3313 ;; is, if $OPENBLAS_NUM_THREADS is greater than that, then NUM_THREADS
3314 ;; is used.) If we don't set it, the makefile sets it to the number
3315 ;; of cores of the build machine, which is obviously wrong.
3316 "NUM_THREADS=128"
3317
af5b817e
RW
3318 ;; Build the library for all supported CPUs. This allows
3319 ;; switching CPU targets at runtime with the environment variable
3320 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
71923a91
AE
3321 ;; Unfortunately, this is not supported on non-x86 architectures,
3322 ;; where it leads to failed builds.
3323 ,@(let ((system (or (%current-target-system) (%current-system))))
8a637e79
RW
3324 (cond
3325 ((or (string-prefix? "x86_64" system)
71923a91 3326 (string-prefix? "i686" system))
8a637e79
RW
3327 '("DYNAMIC_ARCH=1"))
3328 ;; On MIPS we force the "SICORTEX" TARGET, as for the other
3329 ;; two available MIPS targets special extended instructions
3330 ;; for Loongson cores are used.
3331 ((string-prefix? "mips" system)
3332 '("TARGET=SICORTEX"))
83a34647
EF
3333 ;; On aarch64 force the generic 'armv8-a' target
3334 ((string-prefix? "aarch64" system)
3335 '("TARGET=ARMV8"))
8a637e79 3336 (else '()))))
e73b49fb 3337 ;; no configure script
493937ae
DL
3338 #:phases
3339 (modify-phases %standard-phases
3340 (delete 'configure)
3341 (add-before 'build 'set-extralib
3342 (lambda* (#:key inputs #:allow-other-keys)
3343 ;; Get libgfortran found when building in utest.
3344 (setenv "FEXTRALIB"
3345 (string-append "-L" (assoc-ref inputs "fortran-lib")
3346 "/lib"))
3347 #t)))))
e73b49fb 3348 (inputs
493937ae 3349 `(("fortran-lib" ,gfortran "lib")))
e73b49fb
RW
3350 (native-inputs
3351 `(("cunit" ,cunit)
493937ae 3352 ("fortran" ,gfortran)
e73b49fb 3353 ("perl" ,perl)))
59695981 3354 (home-page "https://www.openblas.net/")
e73b49fb
RW
3355 (synopsis "Optimized BLAS library based on GotoBLAS")
3356 (description
3357 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
3358 (license license:bsd-3)))
3359
daa6036f 3360(define-public openblas-ilp64
ba05be22 3361 (package/inherit openblas
daa6036f
EB
3362 (name "openblas-ilp64")
3363 (supported-systems '("x86_64-linux" "aarch64-linux" "mips64el-linux"))
3364 (arguments
3365 (substitute-keyword-arguments (package-arguments openblas)
3366 ((#:make-flags flags '())
3367 `(append (list "INTERFACE64=1" "LIBNAMESUFFIX=ilp64")
3368 ,flags))))
3369 (synopsis "Optimized BLAS library based on GotoBLAS (ILP64 version)")
3370 (license license:bsd-3)))
3371
5a7deb11
LC
3372(define* (make-blis implementation #:optional substitutable?)
3373 "Return a BLIS package with the given IMPLEMENTATION (see config/ in the
3374source tree for a list of implementations.)
3375
3376SUBSTITUTABLE? determines whether the package is made available as a
3377substitute.
3378
3379Currently the specialization must be selected at configure-time, but work is
3380underway to allow BLIS to select the right optimized kernels at run time:
3381<https://github.com/flame/blis/issues/129>."
3382 (package
3383 (name (if (string=? implementation "reference")
3384 "blis"
3385 (string-append "blis-" implementation)))
3386 (version "0.2.2")
3387 (home-page "https://github.com/flame/blis")
3388 (source (origin
3389 (method git-fetch)
3390 (uri (git-reference (url home-page) (commit version)))
3391 (sha256
3392 (base32
3393 "1wr79a50nm4abhw8w3sn96nmwp5mrzifcigk7khw9qcgyyyqayfh"))
3394 (file-name (git-file-name "blis" version))))
3395 (build-system gnu-build-system)
3396 (arguments
3397 `(#:test-target "test"
3398
3399 #:substitutable? ,substitutable?
3400
3401 #:phases (modify-phases %standard-phases
3402 (replace 'configure
3403 (lambda* (#:key outputs #:allow-other-keys)
3404 ;; This is a home-made 'configure' script.
3405 (let ((out (assoc-ref outputs "out")))
1ec17821
RW
3406 (invoke "./configure" "-p" out
3407 "-d" "opt"
3408 "--disable-static"
3409 "--enable-shared"
3410 "--enable-threading=openmp"
5a7deb11 3411
1ec17821 3412 ,implementation))))
5a7deb11
LC
3413 (add-before 'check 'show-test-output
3414 (lambda _
3415 ;; By default "make check" is silent. Make it verbose.
3416 (system "tail -F output.testsuite &")
3417 #t)))))
3418 (synopsis "High-performance basic linear algebra (BLAS) routines")
3419 (description
3420 "BLIS is a portable software framework for instantiating high-performance
3421BLAS-like dense linear algebra libraries. The framework was designed to
3422isolate essential kernels of computation that, when optimized, immediately
3423enable optimized implementations of most of its commonly used and
3424computationally intensive operations. While BLIS exports a new BLAS-like API,
3425it also includes a BLAS compatibility layer which gives application developers
3426access to BLIS implementations via traditional BLAS routine calls.")
3427 (license license:bsd-3)))
3428
3429(define-public blis
3430 ;; This is the "reference" implementation, which is the non-optimized but
3431 ;; portable variant (no assembly).
3432 (make-blis "reference" #t))
3433
3434(define ignorance blis)
3435
3436(define-syntax-rule (blis/x86_64 processor)
3437 "Expand to a package specialized for PROCESSOR."
3438 (package
3439 (inherit (make-blis processor))
3440 (supported-systems '("x86_64-linux"))))
3441
3442(define-public blis-sandybridge
3443 ;; BLIS specialized for Sandy Bridge processors (launched 2011):
3444 ;; <http://ark.intel.com/products/codename/29900/Sandy-Bridge>.
3445 (blis/x86_64 "sandybridge"))
3446
3447(define-public blis-haswell
3448 ;; BLIS specialized for Haswell processors (launched 2013):
3449 ;; <http://ark.intel.com/products/codename/42174/Haswell>.
3450 (blis/x86_64 "haswell"))
3451
3452(define-public blis-knl
3453 ;; BLIS specialized for Knights Landing processor (launched 2016):
3454 ;; <http://ark.intel.com/products/series/92650/Intel-Xeon-Phi-x200-Product-Family>.
3455 (blis/x86_64 "knl"))
3456
3457
e1605e36
RW
3458(define-public openlibm
3459 (package
3460 (name "openlibm")
48d7ac17 3461 (version "0.6.0")
e1605e36
RW
3462 (source
3463 (origin
ca72dd2c
TGR
3464 (method git-fetch)
3465 (uri (git-reference
3466 (url "https://github.com/JuliaLang/openlibm.git")
3467 (commit (string-append "v" version))))
3468 (file-name (git-file-name name version))
e1605e36 3469 (sha256
ca72dd2c 3470 (base32 "08wfchmmr5200fvmn1kwq9byc1fhsq46hn0y5k8scdl74771c7gh"))))
e1605e36
RW
3471 (build-system gnu-build-system)
3472 (arguments
3473 `(#:make-flags
3474 (list (string-append "prefix=" (assoc-ref %outputs "out")))
3475 #:phases
3476 ;; no configure script
dc1d3cde 3477 (modify-phases %standard-phases (delete 'configure))
e1605e36 3478 #:tests? #f)) ;the tests are part of the default target
d3be5220 3479 (home-page "https://openlibm.org/")
e1605e36
RW
3480 (synopsis "Portable C mathematical library (libm)")
3481 (description
3482 "OpenLibm is an effort to have a high quality, portable, standalone C
3483mathematical library (libm). It can be used standalone in applications and
3484programming language implementations. The project was born out of a need to
e881752c 3485have a good libm for the Julia programming language that worked consistently
e1605e36
RW
3486across compilers and operating systems, and in 32-bit and 64-bit
3487environments.")
538c0e3b
EF
3488 ;; Each architecture has its own make target, and there is none for mips.
3489 (supported-systems (delete "mips64el-linux" %supported-systems))
e1605e36
RW
3490 ;; See LICENSE.md for details.
3491 (license (list license:expat
3492 license:isc
3493 license:bsd-2
3494 license:public-domain
3495 license:lgpl2.1+))))
3496
e62be58f
RW
3497(define-public openspecfun
3498 (package
3499 (name "openspecfun")
59cd0ba4 3500 (version "0.5.3")
e62be58f
RW
3501 (source
3502 (origin
90cea671
TGR
3503 (method git-fetch)
3504 (uri (git-reference
3505 (url "https://github.com/JuliaLang/openspecfun.git")
3506 (commit (string-append "v" version))))
3507 (file-name (git-file-name name version))
e62be58f 3508 (sha256
90cea671 3509 (base32 "0pfw6l3ch7isz403llx7inxlvavqh01jh1hb9dpidi86sjjx9kfh"))))
e62be58f
RW
3510 (build-system gnu-build-system)
3511 (arguments
59cd0ba4 3512 '(#:tests? #f ; no "check" target
e62be58f
RW
3513 #:make-flags
3514 (list (string-append "prefix=" (assoc-ref %outputs "out")))
59cd0ba4
TGR
3515 #:phases
3516 (modify-phases %standard-phases
3517 (delete 'configure)))) ; no configure script
e62be58f 3518 (inputs
19afbea1 3519 `(("fortran" ,gfortran)))
e62be58f
RW
3520 (home-page "https://github.com/JuliaLang/openspecfun")
3521 (synopsis "Collection of special mathematical functions")
3522 (description
3523 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
3524portable package for Bessel Functions of a Complex Argument and Nonnegative
3525Order; it contains subroutines for computing Bessel functions and Airy
3526functions. Faddeeva allows computing the various error functions of arbitrary
3527complex arguments (Faddeeva function, error function, complementary error
3528function, scaled complementary error function, imaginary error function, and
3529Dawson function); given these, one can also easily compute Voigt functions,
3530Fresnel integrals, and similar related functions as well.")
3531 ;; Faddeeva is released under the Expat license; AMOS is included as
3532 ;; public domain software.
3533 (license (list license:expat license:public-domain))))
3534
2742f87e
RW
3535(define-public suitesparse
3536 (package
3537 (name "suitesparse")
aac148a8 3538 (version "5.7.1")
2742f87e
RW
3539 (source
3540 (origin
aac148a8
FG
3541 (method git-fetch)
3542 (uri (git-reference
3543 (url "https://github.com/DrTimothyAldenDavis/SuiteSparse.git")
3544 (commit (string-append "v" version))))
3545 (file-name (git-file-name name version))
2742f87e
RW
3546 (sha256
3547 (base32
aac148a8
FG
3548 "174p3l78kv9gaa0i5hflyai2ydwnjzh34k9938sl4aa3li0543s8"))
3549 (patches (search-patches "suitesparse-mongoose-cmake.patch"))
bd5b5ac0
EB
3550 (modules '((guix build utils)))
3551 (snippet
3552 ;; Remove bundled metis source
6cbee49d
MW
3553 '(begin
3554 (delete-file-recursively "metis-5.1.0")
3555 #t))))
2742f87e
RW
3556 (build-system gnu-build-system)
3557 (arguments
bd5b5ac0 3558 '(#:tests? #f ;no "check" target
2742f87e
RW
3559 #:make-flags
3560 (list "CC=gcc"
3561 "BLAS=-lblas"
3562 "TBB=-ltbb"
bd5b5ac0 3563 "MY_METIS_LIB=-lmetis"
aac148a8
FG
3564 ;; Flags for cmake (required to build GraphBLAS and Mongoose)
3565 (string-append "CMAKE_OPTIONS=-DCMAKE_INSTALL_PREFIX="
3566 (assoc-ref %outputs "out")
3567 " -DCMAKE_VERBOSE_MAKEFILE=ON"
3568 " -DCMAKE_C_FLAGS_RELEASE=\"$(CFLAGS) $(CPPFLAGS)\""
3569 " -DCMAKE_CXX_FLAGS_RELEASE=\"$(CXXFLAGS) $(CPPFLAGS)\""
3570 " -DCMAKE_SKIP_RPATH=TRUE"
3571 " -DCMAKE_BUILD_TYPE=Release")
2742f87e
RW
3572 (string-append "INSTALL_LIB="
3573 (assoc-ref %outputs "out") "/lib")
3574 (string-append "INSTALL_INCLUDE="
bd5b5ac0
EB
3575 (assoc-ref %outputs "out") "/include")
3576 "library")
2742f87e 3577 #:phases
2509522c 3578 (modify-phases %standard-phases
bd5b5ac0 3579 (delete 'configure)))) ;no configure script
2742f87e
RW
3580 (inputs
3581 `(("tbb" ,tbb)
bd5b5ac0
EB
3582 ("lapack" ,lapack)
3583 ("metis" ,metis)))
aac148a8 3584 (native-inputs
b471337d 3585 `(("cmake" ,cmake-minimal)
aac148a8 3586 ("m4" ,m4)))
2742f87e
RW
3587 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
3588 (synopsis "Suite of sparse matrix software")
3589 (description
3590 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
3591multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
3592multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
3593simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
3594CXSparse, a concise sparse Cholesky factorization package; and many other
3595packages.")
3596 ;; LGPLv2.1+:
3597 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
3598 ;; GPLv2+:
3599 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
3600 (license (list license:gpl2+ license:lgpl2.1+))))
3601
ec322be2
FB
3602(define-public atlas
3603 (package
3604 (name "atlas")
3c98ac02 3605 (version "3.10.3")
ec322be2
FB
3606 (source (origin
3607 (method url-fetch)
de67e922
LF
3608 (uri (string-append "mirror://sourceforge/math-atlas/Stable/"
3609 version "/atlas" version ".tar.bz2"))
ec322be2
FB
3610 (sha256
3611 (base32
3c98ac02 3612 "1dyjlq3fiparvm8ypwk6rsmjzmnwk81l88gkishphpvc79ryp216"))))
ec322be2
FB
3613 (build-system gnu-build-system)
3614 (home-page "http://math-atlas.sourceforge.net/")
19afbea1 3615 (inputs `(("gfortran" ,gfortran)
ec322be2
FB
3616 ("lapack-tar" ,(package-source lapack))))
3617 (outputs '("out" "doc"))
01480b9e
FB
3618 ;; For the moment we drop support for MIPS at it fails to compile. See
3619 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
3620 (supported-systems (delete "mips64el-linux" %supported-systems))
ec322be2
FB
3621 (arguments
3622 `(#:parallel-build? #f
3623 #:parallel-tests? #f
f15615b1
LC
3624
3625 ;; ATLAS tunes itself for the machine it is built on, as explained at
3626 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
3627 ;; For this reason, we want users to build it locally instead of using
3628 ;; substitutes.
3629 #:substitutable? #f
3630
ec322be2 3631 #:modules ((srfi srfi-26)
ec322be2
FB
3632 (guix build gnu-build-system)
3633 (guix build utils))
40029cbe 3634 #:configure-flags
ec322be2
FB
3635 `(;; Generate position independent code suitable for dynamic libraries
3636 ;; and use WALL timer to get more accurate timing.
3637 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
3638 ;; Set word width.
3639 "-b"
3640 ,,(if (string-match "64" (%current-system))
3641 "64"
3642 "32")
3643 ;; Disable parallel build as it gives errors: atlas_pthread.h is
3644 ;; needed to compile C files before it is generated.
3645 "-Ss" "pmake" "make -j 1"
af89a667
FB
3646 ;; Probe is failing for MIPS. We therefore define the system
3647 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
3648 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
3649 ,,@(if (string-prefix? "mips" (%current-system))
3650 (list "-A" "49" "-V" "1")
3651 (list))
ec322be2
FB
3652 ;; Generate shared libraries.
3653 "--shared"
3654 ;; Build a full LAPACK library.
3655 ,(string-append "--with-netlib-lapack-tarfile="
3656 (assoc-ref %build-inputs "lapack-tar")))
3657 #:phases
e5b4b96b
EF
3658 (modify-phases %standard-phases
3659 (add-after 'install 'install-doc
3660 (lambda* (#:key outputs inputs #:allow-other-keys)
3661 (let ((doc (string-append (assoc-ref outputs "doc")
3662 "/share/doc/atlas")))
3663 (mkdir-p doc)
cb6f44d4
RW
3664 (for-each (cut install-file <> doc)
3665 (find-files "../ATLAS/doc" ".*"))
3666 #t)))
e5b4b96b 3667 (add-after 'check 'check-pt
cb6f44d4 3668 (lambda _ (invoke "make" "ptcheck")))
e5b4b96b
EF
3669 ;; Fix files required to run configure.
3670 (add-before 'configure 'fix-/bin/sh
ec322be2
FB
3671 (lambda _
3672 ;; Use `sh', not `/bin/sh'.
3673 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
3674 (("/bin/sh")
5b786db8
EF
3675 "sh"))
3676 #t))
e5b4b96b
EF
3677 ;; Fix /bin/sh in generated make files.
3678 (add-after 'configure 'fix-/bin/sh-in-generated-files
3679 (lambda _
3680 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
3681 (("/bin/sh")
5b786db8
EF
3682 "sh"))
3683 #t))
e5b4b96b
EF
3684 ;; ATLAS configure program does not accepts the default flags
3685 ;; passed by the 'gnu-build-system'.
3686 (replace 'configure
3687 (lambda* (#:key native-inputs inputs outputs
3688 (configure-flags '())
3689 #:allow-other-keys #:rest args)
3690 (let* ((prefix (assoc-ref outputs "out"))
3691 (bash (or (and=> (assoc-ref
3692 (or native-inputs inputs) "bash")
3693 (cut string-append <> "/bin/bash"))
3694 "/bin/sh"))
3695 (flags `(,(string-append "--prefix=" prefix)
3696 ,@configure-flags))
3697 (abs-srcdir (getcwd))
3698 (srcdir (string-append "../" (basename abs-srcdir))))
3699 (format #t "source directory: ~s (relative from build: ~s)~%"
3700 abs-srcdir srcdir)
3701 (mkdir "../build")
3702 (chdir "../build")
3703 (format #t "build directory: ~s~%" (getcwd))
3704 (format #t "configure flags: ~s~%" flags)
cb6f44d4
RW
3705 (apply invoke bash
3706 (string-append srcdir "/configure")
3707 flags)))))))
ec322be2
FB
3708 (synopsis "Automatically Tuned Linear Algebra Software")
3709 (description
3710 "ATLAS is an automatically tuned linear algebra software library
3711providing C and Fortran77 interfaces to a portably efficient BLAS
3712implementation, as well as a few routines from LAPACK.
3713
f15615b1
LC
3714Optimization occurs at build time. For this reason, the library is built on
3715the machine where it is installed, without resorting to pre-built substitutes.
ec322be2 3716
f15615b1 3717Before building the library, CPU throttling should be disabled. This can be
d97c429a 3718done in the BIOS, or, on GNU/Linux, with the following command:
ec322be2 3719
8e9ba611 3720@example
d97c429a 3721# cpupower --governor performance
8e9ba611 3722@end example
ec322be2 3723
d97c429a 3724Failure to do so will result in a library with poor performance.")
ec322be2 3725 (license license:bsd-3)))
c12efc72
AE
3726
3727(define-public glm
3728 (package
3729 (name "glm")
3f55b7be 3730 (version "0.9.9.6")
c12efc72
AE
3731 (source
3732 (origin
3733 (method url-fetch)
5ea4b594
MB
3734 (uri (string-append "https://github.com/g-truc/glm/releases/download/"
3735 version "/glm-" version ".zip"))
c12efc72 3736 (sha256
3f55b7be
TGR
3737 (base32 "1l0pi1qi37mk6s0yrkrw07lspv4gcqnr9ryg3521hrl77ff37dwx"))
3738 (patches (search-patches "glm-restore-install-target.patch"))))
c12efc72
AE
3739 (build-system cmake-build-system)
3740 (native-inputs
3741 `(("unzip" ,unzip)))
46bda5eb 3742 (home-page "https://glm.g-truc.net/")
c12efc72
AE
3743 (synopsis "OpenGL Mathematics library")
3744 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
3745library for graphics software based on the OpenGL Shading Language (GLSL)
3746specifications.")
3747 (license license:expat)))
7f18257b
AE
3748
3749(define-public lpsolve
3750 (package
3751 (name "lpsolve")
a89e0cf5 3752 (version "5.5.2.5")
7f18257b
AE
3753 (source
3754 (origin
3755 (method url-fetch)
3756 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
3757 "/lp_solve_" version "_source.tar.gz"))
3758 (sha256
3759 (base32
a89e0cf5 3760 "12pj1idjz31r7c2mb5w03vy1cmvycvbkx9z29s40qdmkp1i7q6i0"))
7f18257b
AE
3761 (modules '((guix build utils)))
3762 (snippet
6cbee49d
MW
3763 '(begin
3764 (substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
3765 (("^c=cc") "c=gcc")
3766 ;; Pretend to be on a 64 bit platform to obtain a common directory
3767 ;; name for the build results on all architectures; nothing else
3768 ;; seems to depend on it.
3769 (("^PLATFORM=.*$") "PLATFORM=ux64\n")
3770
3771 ;; The check for 'isnan' as it is written fails with
3772 ;; "non-floating-point argument in call to function
3773 ;; ‘__builtin_isnan’", which leads to the 'NOISNAN' cpp macro
3774 ;; definition, which in turn leads to bad things. Fix the feature
3775 ;; test.
3776 (("isnan\\(0\\)") "isnan(0.)"))
3777 #t))))
7f18257b
AE
3778 (build-system gnu-build-system)
3779 (arguments
6c96b545 3780 `(#:tests? #f ; no check target
7f18257b
AE
3781 #:phases
3782 (modify-phases %standard-phases
6c96b545 3783 (delete 'configure) ; no configure script
7f18257b
AE
3784 (replace 'build
3785 (lambda _
6c96b545
TGR
3786 (with-directory-excursion "lpsolve55"
3787 (invoke "bash" "ccc"))
3788 (with-directory-excursion "lp_solve"
3789 (invoke "bash" "ccc"))
3790 #t))
7f18257b
AE
3791 (replace 'install
3792 (lambda* (#:key outputs #:allow-other-keys)
3793 (let* ((out (assoc-ref outputs "out"))
3794 (bin (string-append out "/bin"))
3795 (lib (string-append out "/lib"))
3796 ;; This is where LibreOffice expects to find the header
3797 ;; files, and where they are installed by Debian.
3798 (include (string-append out "/include/lpsolve")))
6c96b545
TGR
3799 (install-file "lpsolve55/bin/ux64/liblpsolve55.a" lib)
3800 (install-file "lpsolve55/bin/ux64/liblpsolve55.so" lib)
96c46210
LC
3801 (install-file "lp_solve/bin/ux64/lp_solve" bin)
3802
7f18257b
AE
3803 ;; Install a subset of the header files as on Debian
3804 ;; (plus lp_bit.h, which matches the regular expression).
96c46210
LC
3805 (for-each (lambda (name)
3806 (install-file name include))
3807 (find-files "." "lp_[HMSa-z].*\\.h$"))
7f18257b 3808 (with-directory-excursion "shared"
96c46210
LC
3809 (for-each (lambda (name)
3810 (install-file name include))
3811 (find-files "." "\\.h$")))
7f18257b
AE
3812 #t))))))
3813 (home-page "http://lpsolve.sourceforge.net/")
3814 (synopsis "Mixed integer linear programming (MILP) solver")
3815 (description
3816 "lp_solve is a mixed integer linear programming solver based on the
3817revised simplex and the branch-and-bound methods.")
3818 (license license:lgpl2.1+)))
a17d4564
EB
3819
3820(define-public dealii
3821 (package
3822 (name "dealii")
ba567cae 3823 (version "9.1.1")
a17d4564
EB
3824 (source
3825 (origin
3826 (method url-fetch)
3827 (uri (string-append "https://github.com/dealii/dealii/releases/"
3828 "download/v" version "/dealii-" version ".tar.gz"))
3829 (sha256
3830 (base32
ba567cae 3831 "0xhjv0gzswpjbc43xbrpwfc5848g508l01855nszx3g5gwzlhnzw"))
a17d4564
EB
3832 (modules '((guix build utils)))
3833 (snippet
3834 ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
6cbee49d
MW
3835 '(begin
3836 (delete-file-recursively "bundled")
3837 #t))))
a17d4564
EB
3838 (build-system cmake-build-system)
3839 (inputs
3840 `(("tbb" ,tbb)
3841 ("zlib" ,zlib)
3842 ("boost" ,boost)
3843 ("p4est" ,p4est)
3844 ("blas" ,openblas)
3845 ("lapack" ,lapack)
3846 ("arpack" ,arpack-ng)
3847 ("muparser" ,muparser)
3848 ("gfortran" ,gfortran)
3849 ("suitesparse" ,suitesparse))) ;for UMFPACK
3850 (arguments
3851 `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease
d84b09e9
EB
3852 #:configure-flags
3853 ;; Work around a bug in libsuitesparseconfig linking
3854 ;; see https://github.com/dealii/dealii/issues/4745
3855 '("-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON")))
a17d4564
EB
3856 (home-page "https://www.dealii.org")
3857 (synopsis "Finite element library")
3858 (description
3859 "Deal.II is a C++ program library targeted at the computational solution
3860of partial differential equations using adaptive finite elements. The main
3861aim of deal.II is to enable rapid development of modern finite element codes,
3862using among other aspects adaptive meshes and a wide array of tools often used
3863in finite element programs.")
3864 (license license:lgpl2.1+)))
3865
3866(define-public dealii-openmpi
3867 (package (inherit dealii)
3868 (name "dealii-openmpi")
3869 (inputs
3870 `(("mpi" ,openmpi)
3871 ;;Supported only with MPI:
4d44bcad 3872 ("hdf5" ,hdf5-parallel-openmpi) ;TODO: have petsc-openmpi propagate?
a17d4564
EB
3873 ("p4est" ,p4est-openmpi)
3874 ("petsc" ,petsc-openmpi)
3875 ("slepc" ,slepc-openmpi)
3876 ("metis" ,metis) ;for MUMPS
3877 ("scalapack" ,scalapack) ;for MUMPS
3878 ("mumps" ,mumps-metis-openmpi) ;configure supports only metis orderings
3879 ("arpack" ,arpack-ng-openmpi)
3880 ,@(fold alist-delete (package-inputs dealii)
3881 '("p4est" "arpack"))))
3882 (arguments
3883 (substitute-keyword-arguments (package-arguments dealii)
3884 ((#:configure-flags cf)
40b114c0
EB
3885 `(cons "-DDEAL_II_WITH_MPI:BOOL=ON"
3886 ,cf))
7e309e8a
EB
3887 ((#:phases phases '%standard-phases)
3888 `(modify-phases ,phases
3889 (add-before 'check 'mpi-setup
3890 ,%openmpi-setup)))))
a17d4564 3891 (synopsis "Finite element library (with MPI support)")))
194c7f95
AE
3892
3893(define-public flann
3894 (package
3895 (name "flann")
3896 (version "1.8.4")
3897 (source
3898 (origin
3899 (method url-fetch)
3900 (uri
3901 (string-append
3902 "http://www.cs.ubc.ca/research/flann/uploads/FLANN/flann-"
3903 version "-src.zip"))
3904 (sha256
3905 (base32
b5edc479
LC
3906 "022w8hph7bli5zbpnk3z1qh1c2sl5hm8fw2ccim651ynn0hr7fyz"))
3907 (patches (search-patches "flann-cmake-3.11.patch"))))
194c7f95 3908 (build-system cmake-build-system)
6b6aca9b
LC
3909 (outputs '("out"
3910 "octave")) ;46 MiB .mex file that pulls Octave
194c7f95
AE
3911 (native-inputs
3912 `(("unzip" ,unzip)))
3913 (inputs
3914 `(("hdf5" ,hdf5)
5537603f 3915 ("octave" ,octave-cli)
194c7f95
AE
3916 ("python" ,python-2) ; print syntax
3917 ;; ("python2-numpy" ,python2-numpy) ; only required for the tests
3918 ("zlib" ,zlib)))
3919 (arguments
39b30337
LC
3920 `(;; The 'share/flann/octave' contains a .mex file, which is an ELF file
3921 ;; taken 46 MiB unstripped, and 6 MiB stripped.
3922 #:strip-directories '("lib" "lib64" "libexec"
3923 "bin" "sbin" "share/flann/octave")
3924
9684e30b
LC
3925 ;; Save 12 MiB by not installing .a files. Passing
3926 ;; '-DBUILD_STATIC_LIBS=OFF' has no effect.
3927 #:phases (modify-phases %standard-phases
6b6aca9b
LC
3928 (add-before 'configure 'set-octave-directory
3929 (lambda* (#:key outputs #:allow-other-keys)
3930 ;; Install the .mex file in the "octave" output.
3931 (let ((out (assoc-ref outputs "octave")))
3932 (substitute* "src/matlab/CMakeLists.txt"
3933 (("share/flann/octave")
3934 (string-append out "/share/flann/octave")))
3935 #t)))
9684e30b
LC
3936 (add-after 'install 'remove-static-libraries
3937 (lambda* (#:key outputs #:allow-other-keys)
3938 (let* ((out (assoc-ref outputs "out"))
3939 (lib (string-append out "/lib")))
3940 (for-each delete-file
3941 (find-files lib "\\.a$"))
3942 #t))))
3943
39b30337 3944 #:tests? #f)) ; The test data are downloaded from the Internet.
194c7f95
AE
3945 (home-page "http://www.cs.ubc.ca/research/flann/")
3946 (synopsis "Library for approximate nearest neighbors computation")
3947 (description "FLANN is a library for performing fast approximate
3948nearest neighbor searches in high dimensional spaces. It implements a
3949collection of algorithms and a system for automatically choosing the best
3950algorithm and optimum parameters depending on the dataset.
3951
3952FLANN is written in C++ and contains bindings for C, Octave and Python.")
3953 (license (license:non-copyleft "file://COPYING"
3954 "See COPYING in the distribution."))))
d8c97beb
EF
3955
3956(define-public wcalc
3957 (package
3958 (name "wcalc")
3959 (version "2.5")
3960 (source
3961 (origin
3962 (method url-fetch)
de67e922
LF
3963 (uri (string-append "mirror://sourceforge/w-calc/Wcalc/" version "/"
3964 "wcalc-" version ".tar.bz2"))
d8c97beb
EF
3965 (sha256
3966 (base32
3967 "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
3968 (build-system gnu-build-system)
3969 (inputs
3970 `(("mpfr" ,mpfr)
3971 ("readline" ,readline)))
3972 (home-page "http://w-calc.sourceforge.net/index.php")
3973 (synopsis "Flexible command-line scientific calculator")
3974 (description "Wcalc is a very capable calculator. It has standard functions
3975(sin, asin, and sinh for example, in either radians or degrees), many
3976pre-defined constants (pi, e, c, etc.), support for using variables, \"active\"
3977variables, a command history, hex/octal/binary input and output, unit
3978conversions, embedded comments, and an expandable expression entry field. It
3979evaluates expressions using the standard order of operations.")
3980 (license license:gpl2+)))
45147b0c
FH
3981
3982(define-public xaos
3983 (package
3984 (name "xaos")
3985 (version "3.6")
3986 (source (origin
3987 (method url-fetch)
de67e922
LF
3988 (uri (string-append "mirror://sourceforge/xaos/XaoS/" version
3989 "/xaos-" version ".tar.gz"))
45147b0c
FH
3990 (sha256
3991 (base32
3992 "15cd1cx1dyygw6g2nhjqq3bsfdj8sj8m4va9n75i0f3ryww3x7wq"))))
3993 (build-system gnu-build-system)
b94a6ca0 3994 (native-inputs `(("gettext" ,gettext-minimal)))
45147b0c
FH
3995 (inputs `(("libx11" ,libx11)
3996 ("zlib" ,zlib)
3997 ("libpng" ,libpng)
3998 ("gsl" ,gsl)))
3999 (arguments
4000 `(#:tests? #f ;no "check" target
4001 #:make-flags '("LOCALEDIR=$DATAROOTDIR/locale")))
4002 (synopsis "Real-time fractal zoomer")
4003 (description "GNU XaoS is a graphical program that generates fractal
4004patterns and allows you to zoom in and out of them infinitely in a fluid,
4005continuous manner. It also includes tutorials that help to explain how fractals
4006are built. It can generate many different fractal types such as the Mandelbrot
4007set.")
6fd52309 4008 (home-page "https://www.gnu.org/software/xaos/")
45147b0c 4009 (license license:gpl2+)))
528bb464
EB
4010
4011(define-public hypre
4012 (package
4013 (name "hypre")
be099727 4014 (version "2.15.1")
fabcbf32
TGR
4015 (source
4016 (origin
4017 (method git-fetch)
4018 (uri (git-reference
4019 (url "https://github.com/LLNL/hypre.git")
4020 (commit (string-append "v" version))))
4021 (file-name (git-file-name name version))
4022 (sha256
be099727 4023 (base32 "1lvh4ybqkriyqfg2zmic6mrg1981qv1i9vry1fdgsabn81hb71g4"))
fabcbf32
TGR
4024 (modules '((guix build utils)))
4025 (snippet
4026 '(begin
4027 ;; Remove use of __DATE__ and __TIME__ for reproducibility;
be099727 4028 ;; substitute the release date.
fabcbf32
TGR
4029 (substitute* "src/utilities/HYPRE_utilities.h"
4030 (("Date Compiled: .*$")
be099727 4031 "Date Compiled: Oct 19 2018 15:23:00 +0000\"\n"))
fabcbf32 4032 #t))))
528bb464 4033 (build-system gnu-build-system)
be099727
TGR
4034 (outputs '("out" ; 6.1 MiB of headers and libraries
4035 "doc")) ; 4.8 MiB of documentation
528bb464
EB
4036 (native-inputs
4037 `(("doc++" ,doc++)
4038 ("netpbm" ,netpbm)
be099727 4039 ("perl" ,perl) ; needed to run 'ppmquant' during tests
8b35c8cd
RW
4040 ("texlive" ,(texlive-union (list texlive-xypic
4041 texlive-cm
9b405aea 4042 texlive-latex-hyperref
9b405aea 4043 texlive-bibtex)))
528bb464
EB
4044 ("ghostscript" ,ghostscript)))
4045 (inputs
4046 `(("blas" ,openblas)
4047 ("lapack" ,lapack)))
4048 (arguments
4049 `(#:modules ((srfi srfi-1)
4050 ,@%gnu-build-system-modules)
4051 #:configure-flags '("--enable-shared"
4052 "--disable-fortran"
4053 "--without-MPI"
4054 "--with-openmp"
4055 "--with-fei"
4056 "--with-lapack"
4057 "--with-blas")
4058 #:phases
4059 (modify-phases %standard-phases
9b405aea
PN
4060 (add-before 'build 'set-HOME
4061 (lambda _
4062 ;; FIXME: texlive-union does not find the built
4063 ;; metafonts, so it tries to generate them in HOME.
4064 (setenv "HOME" "/tmp")
4065 #t))
528bb464
EB
4066 (add-before 'configure 'chdir-src
4067 (lambda _ (chdir "src")))
4068 (replace 'configure
4069 (lambda* (#:key build target configure-flags
4070 #:allow-other-keys #:rest args)
4071 (let* ((configure (assoc-ref %standard-phases 'configure)))
4072 (apply configure
4073 (append args
4074 (list #:configure-flags
4075 (cons (string-append
4076 "--host=" (or target build))
4077 configure-flags)))))))
4078 (add-after 'build 'build-docs
4079 (lambda _
9b405aea 4080 (invoke "make" "-Cdocs" "pdf" "html")))
528bb464
EB
4081 (replace 'check
4082 (lambda _
4083 (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/hypre/lib"))
4084 (setenv "PATH" (string-append "." ":" (getenv "PATH")))
6b1c7ac8
RW
4085 (invoke "make" "check" "CHECKRUN=")
4086 (for-each (lambda (filename)
4087 (let ((size (stat:size (stat filename))))
4088 (when (positive? size)
4089 (error (format #f "~a size ~d; error indication~%"
4090 filename size)))))
4091 (find-files "test" ".*\\.err$"))
4092 #t))
528bb464
EB
4093 (add-after 'install 'install-docs
4094 (lambda* (#:key outputs #:allow-other-keys)
4095 ;; Custom install because docs/Makefile doesn't honor ${docdir}.
4096 (let* ((doc (assoc-ref outputs "doc"))
4097 (docdir (string-append doc "/share/doc/hypre-" ,version)))
528bb464
EB
4098 (with-directory-excursion "docs"
4099 (for-each (lambda (base)
4100 (install-file (string-append base ".pdf") docdir)
be099727 4101 (copy-recursively base docdir)) ; html docs
528bb464
EB
4102 '("HYPRE_usr_manual"
4103 "HYPRE_ref_manual")))
4104 #t))))))
4105 (home-page "http://www.llnl.gov/casc/hypre/")
4106 (synopsis "Library of solvers and preconditioners for linear equations")
4107 (description
4108 "HYPRE is a software library of high performance preconditioners and
4109solvers for the solution of large, sparse linear systems of equations. It
4110features multigrid solvers for both structured and unstructured grid
4111problems.")
4112 (license license:lgpl2.1)))
4113
4114(define-public hypre-openmpi
4115 (package (inherit hypre)
4116 (name "hypre-openmpi")
4117 (inputs
4118 `(("mpi" ,openmpi)
4119 ,@(package-inputs hypre)))
4120 (arguments
4121 (substitute-keyword-arguments (package-arguments hypre)
4122 ((#:configure-flags flags)
4123 ``("--with-MPI"
6df2a50a
LC
4124 ,@(delete "--without-MPI" ,flags)))
4125 ((#:phases phases)
4126 `(modify-phases ,phases
bbe46a4a
EB
4127 (add-before 'check 'mpi-setup
4128 ,%openmpi-setup)))))
528bb464
EB
4129 (synopsis "Parallel solvers and preconditioners for linear equations")
4130 (description
4131 "HYPRE is a software library of high performance preconditioners and
4132solvers for the solution of large, sparse linear systems of equations on
4133parallel computers. It features parallel multigrid solvers for both
4134structured and unstructured grid problems.")))
6c90e183
EB
4135
4136(define-public matio
4137 (package
4138 (name "matio")
4139 (version "1.5.6")
4140 (source
4141 (origin
4142 (method url-fetch)
de67e922 4143 (uri (string-append "mirror://sourceforge/matio/matio/" version "/"
6c90e183
EB
4144 "matio-" version ".tar.gz"))
4145 (sha256
4146 (base32
4147 "0y2qymgxank8wdiwc68ap8bxdzrhvyw86i29yh3xgn4z1njfd9ir"))))
4148 (build-system gnu-build-system)
4149 (inputs
4150 `(("zlib" ,zlib)
4151 ("hdf5" ,hdf5)))
4152 (home-page "http://matio.sourceforge.net/")
4153 (synopsis "Library for reading and writing MAT files")
4154 (description "Matio is a library for reading and writing MAT files. It
4155supports compressed MAT files, as well as newer (version 7.3) MAT files.")
4156 (license license:bsd-2)))
d721c83a 4157
517318ad
LF
4158(define-public vc
4159 (package
4160 (name "vc")
9d731fb6 4161 (version "1.4.1")
517318ad
LF
4162 (source
4163 (origin (method url-fetch)
4164 (uri (string-append "https://github.com/VcDevel/Vc/releases/"
4165 "download/" version "/Vc-" version ".tar.gz"))
4166 (sha256
4167 (base32
9d731fb6 4168 "17qili8bf8r78cng65yf4qmgna8kiqjqbgcqbric6v9j6nkhkrk8"))))
517318ad
LF
4169 (build-system cmake-build-system)
4170 (arguments
4171 '(#:configure-flags
33d82486
MB
4172 '("-DBUILD_TESTING=ON"
4173 ;; By default, Vc will optimize for the CPU of the build machine.
4174 ;; Setting this to "none" makes it create portable binaries. See
4175 ;; "cmake/OptimizeForArchitecture.cmake".
9d731fb6
MB
4176 "-DTARGET_ARCHITECTURE=none")
4177 #:phases (modify-phases %standard-phases
4178 (add-after 'unpack 'copy-testdata
4179 (lambda* (#:key inputs native-inputs #:allow-other-keys)
4180 (let ((testdata (assoc-ref (or native-inputs inputs)
4181 "testdata")))
4182 (copy-recursively testdata "tests/testdata")
4183 #t))))))
4184 (native-inputs
4185 `(("virtest" ,virtest)
4186
4187 ;; This is a submodule in the git project, but not part of the
4188 ;; released sources. See the git branch for the commit to take.
4189 ("testdata" ,(let ((commit "9ada1f34d6a41f1b5553d6223f277eae72c039d3"))
4190 (origin
4191 (method git-fetch)
4192 (uri (git-reference
4193 (url "https://github.com/VcDevel/vc-testdata")
4194 (commit "9ada1f34d6a41f1b5553d6223f277eae72c039d3")))
4195 (file-name (git-file-name "vc-testdata"
4196 (string-take commit 7)))
4197 (sha256
4198 (base32
4199 "1hkhqib03qlcq412ym2dciynfxcdr2ygqhnplz4l1vissr1wnqn2")))))))
517318ad
LF
4200 (synopsis "SIMD vector classes for C++")
4201 (description "Vc provides portable, zero-overhead C++ types for explicitly
4202data-parallel programming. It is a library designed to ease explicit
4203vectorization of C++ code. Its types enable explicitly stating data-parallel
4204operations on multiple values. The parallelism is therefore added via the type
4205system. Vc has an intuitive API and provides portability between different
4206compilers and compiler versions as well as portability between different vector
4207instruction sets. Thus, an application written with Vc can be compiled for:
4208@enumerate
4209@item AVX and AVX2
d1e4ad1b 4210@item SSE2 up to SSE4.2 or SSE4a
517318ad
LF
4211@item Scalar
4212@item MIC
4213@item NEON (in development)
4214@item NVIDIA GPUs / CUDA (in development)
4215@end enumerate\n")
4216 (home-page "https://github.com/VcDevel/Vc")
a8ead6f9
EF
4217 ;; "No support_???.cpp file exists for this architecture."
4218 (supported-systems '("x86_64-linux" "i686-linux"))
517318ad 4219 (license license:bsd-3)))
54052a54 4220
4221(define-public reducelcs
4222 ;; This is the last commit which is available upstream, no
4223 ;; release happened since 2010.
4224 (let ((commit "474f88deb968061abe8cf11c959e02319b8ae5c0")
4225 (revision "1"))
4226 (package
4227 (name "reducelcs")
4228 (version (string-append "1.0-" revision "." (string-take commit 7)))
4229 (source
4230 (origin
4231 (method git-fetch)
4232 (uri (git-reference
4233 (url "https://github.com/gdv/Reduce-Expand-for-LCS")
4234 (commit commit)))
4235 (file-name (string-append name "-" version "-checkout"))
4236 (sha256
4237 (base32
4238 "1rllzcfwc042c336mhq262a8ha90x6afq30kvk60r7i4761j4yjm"))))
4239 (build-system gnu-build-system)
4240 (inputs
4241 `(("openlibm" ,openlibm)))
4242 (arguments
4243 `(#:tests? #f ; no tests
4244 #:phases
4245 (modify-phases %standard-phases
4246 (delete 'configure) ; No configure script exists.
4247 (replace 'install ; No install phase exists.
4248 (lambda* (#:key outputs #:allow-other-keys)
4249 (let* ((out (assoc-ref outputs "out"))
4250 (bin (string-append out "/bin")))
4251 (install-file "Approximation" bin)
4252 (install-file "CollectResults" bin)
4253 (install-file "GenerateInstances" bin)
4254 #t))))))
4255 (synopsis "Approximate Longest Commons Subsequence computation tool")
4256 (description
4257 "@code{reduceLCS} is an implementation of the Reduce-Expand
4258algorithm for LCS. It is a fast program to compute the approximate
4259Longest Commons Subsequence of a set of strings.")
4260 (home-page "https://github.com/gdv/Reduce-Expand-for-LCS")
c000b6b1 4261 (license license:gpl3+))))
479c4273
JD
4262
4263(define-public jacal
4264 (package
4265 (name "jacal")
4266 (version "1c4")
4267 (source (origin
4268 (method url-fetch)
4269 (uri (string-append
4270 "http://groups.csail.mit.edu/mac/ftpdir/scm/jacal-"
4271 version ".zip"))
4272 (sha256 (base32
4273 "055zrn12a1dmy0dqkwrkq3fklbhg3yir6vn0lacp4mvbg8573a3q"))
4274 (patches (search-patches "jacal-fix-texinfo.patch"))))
4275 (build-system gnu-build-system)
4276 (arguments
4277 `(#:phases
4278 (modify-phases %standard-phases
4279 (add-before 'build 'pre-build
4280 ;; Don't use upstream's script - it really doesn't fit into
4281 ;; Guix's functional paradigm.
4282 (lambda* (#:key inputs outputs #:allow-other-keys)
4283 (substitute* "Makefile"
4284 (("^install: install-script") "install: "))))
4285 (add-after 'install 'post-install
4286 ;; Instead, we provide our own simplified script.
4287 (lambda* (#:key inputs outputs #:allow-other-keys)
4288 (let ((wrapper (string-append (assoc-ref outputs "out")
4289 "/bin/jacal")))
4290 (format (open wrapper (logior O_WRONLY O_CREAT))
4291 (string-append "#!~a\nexec ~a/bin/scm -ip1 "
4292 "-e '(slib:load \"~a/lib/jacal/math\") "
4293 "(math)' \"$@\"\n")
4294 (which "bash")
4295 (assoc-ref inputs "scm")
4296 (assoc-ref outputs "out"))
4297 (chmod wrapper #o555))))
4298 (replace 'configure
9cd82b1c
RW
4299 (lambda* (#:key outputs #:allow-other-keys)
4300 (invoke "./configure"
4301 (string-append "--prefix="
4302 (assoc-ref outputs "out"))))))))
479c4273
JD
4303 (inputs `(("scm" ,scm)))
4304 (native-inputs `(("unzip" ,unzip)
4305 ("texinfo" ,texinfo)))
4306 (synopsis "Symbolic mathematics system")
4307 (description "GNU JACAL is an interactive symbolic mathematics program based on
4308Scheme. It manipulate and simplify a range of mathematical expressions such
4309as equations, scalars, vectors, and matrices.")
6fd52309 4310 (home-page "https://www.gnu.org/software/jacal/")
479c4273
JD
4311 (license license:gpl3+)))
4312
313844d9
TF
4313(define-public z3
4314 (package
4315 (name "z3")
dbef037f 4316 (version "4.8.7")
fb525bfd 4317 (home-page "https://github.com/Z3Prover/z3")
313844d9 4318 (source (origin
fb525bfd
MB
4319 (method git-fetch)
4320 (uri (git-reference (url home-page)
4321 (commit (string-append "z3-" version))))
2d7b99b3 4322 (file-name (git-file-name name version))
313844d9
TF
4323 (sha256
4324 (base32
dbef037f 4325 "0hprcdwhhyjigmhhk6514m71bnmvqci9r8gglrqilgx424r6ff7q"))))
fa574a6d 4326 (build-system gnu-build-system)
313844d9 4327 (arguments
f6b4d395
JK
4328 `(#:imported-modules ((guix build python-build-system)
4329 ,@%gnu-build-system-modules)
4330 #:modules (((guix build python-build-system) #:select (site-packages))
4331 (guix build gnu-build-system)
4332 (guix build utils))
4333 #:phases
313844d9 4334 (modify-phases %standard-phases
8b87d095
JK
4335 (add-after 'unpack 'enable-bytecode-determinism
4336 (lambda _
4337 (setenv "PYTHONHASHSEED" "0")
4338 #t))
ad6c6a5b
EF
4339 (add-after 'unpack 'fix-compatability
4340 ;; Versions after 4.8.3 have immintrin.h IFDEFed for Windows only.
4341 (lambda _
4342 (substitute* "src/util/mpz.cpp"
4343 (("#include <immintrin.h>") ""))
4344 #t))
cf684d87
TF
4345 (add-before 'configure 'bootstrap
4346 (lambda _
32d5360f 4347 (invoke "python" "scripts/mk_make.py")))
fa574a6d
AB
4348 ;; work around gnu-build-system's setting --enable-fast-install
4349 ;; (z3's `configure' is a wrapper around the above python file,
4350 ;; which fails when passed --enable-fast-install)
4351 (replace 'configure
4352 (lambda* (#:key inputs outputs #:allow-other-keys)
4353 (invoke "./configure"
f6b4d395
JK
4354 "--python"
4355 (string-append "--prefix=" (assoc-ref outputs "out"))
4356 (string-append "--pypkgdir=" (site-packages inputs outputs)))))
fa574a6d
AB
4357 (add-after 'configure 'change-directory
4358 (lambda _
4359 (chdir "build")
4360 #t))
cf684d87 4361 (add-before 'check 'make-test-z3
313844d9 4362 (lambda _
cf684d87 4363 ;; Build the test suite executable.
32d5360f
RW
4364 (invoke "make" "test-z3" "-j"
4365 (number->string (parallel-job-count)))))
cf684d87
TF
4366 (replace 'check
4367 (lambda _
4368 ;; Run all the tests that don't require arguments.
32d5360f 4369 (invoke "./test-z3" "/a"))))))
313844d9 4370 (native-inputs
fa574a6d
AB
4371 `(("which" ,which)
4372 ("python" ,python-wrapper)))
313844d9
TF
4373 (synopsis "Theorem prover")
4374 (description "Z3 is a theorem prover and @dfn{satisfiability modulo
cf684d87 4375theories} (SMT) solver. It provides a C/C++ API, as well as Python bindings.")
313844d9 4376 (license license:expat)))
3d5d87a3 4377
6d433d6e
EB
4378(define-public elpa
4379 (package
4380 (name "elpa")
4381 (version "2018.11.001")
4382 (source (origin
4383 (method url-fetch)
4384 (uri (string-append "http://elpa.mpcdf.mpg.de/html/Releases/"
4385 version "/elpa-" version ".tar.gz"))
4386 (sha256
4387 (base32
4388 "05hv3v5i6xmziaizw350ff72y1c3k662r85fm3xfdrkclj5zw9yc"))))
4389 (build-system gnu-build-system)
4390 (native-inputs
4391 `(("fortran" ,gfortran)
4392 ("perl" ,perl))) ;for configure and deps
4393 (inputs
4394 `(("blas" ,openblas)))
4395 (arguments
4396 `(#:configure-flags
4397 `("--enable-openmp"
4398 "--with-mpi=no"
4399 ;; ELPA unfortunately does not support runtime dispatch, so we can
4400 ;; only enable the "generic" kernels. See the "Cross compilation"
4401 ;; section of INSTALL.md.
4402 "--enable-generic"
4403 "--disable-sse" "--disable-sse-assembly" ;Require SSE3
4404 "--disable-avx" "--disable-avx2" "--disable-avx512"
4405 ,(string-append "CFLAGS=-O3 "
4406 "-funsafe-loop-optimizations -funsafe-math-optimizations "
4407 "-ftree-vect-loop-version -ftree-vectorize "
4408 ,(let ((system (or (%current-target-system)
4409 (%current-system))))
4410 (cond
4411 ((or (string-prefix? "x86_64" system)
4412 (string-prefix? "i686" system))
4413 "-msse2")
4414 (else "")))))
4415 #:parallel-tests? #f ;tests are multi-threaded, via BLAS
4416 #:phases
4417 (modify-phases %standard-phases
4418 (add-before 'configure 'patch-header-generation
4419 (lambda _
4420 (substitute* "configure"
4421 (("^ *make.*top_srcdir=\"\\$srcdir\"" &)
4422 (string-append & " CPP=\"$CPP\"")))
4423 #t))
4424 (add-before 'check 'setup-tests
4425 (lambda _
4426 ;; Decrease test time and RAM use by computing fewer eigenvalues.
4427 ;; The flags are (MATRIX-SIZE, EIGENVALUES, BLOCK-SIZE), where
4428 ;; the default is (500, 250, 16) for C tests and (5000, 150, 16)
4429 ;; for Fortran. This also causes several tests to pass that
4430 ;; otherwise would otherwise fail with matrix size 5000; possibly
4431 ;; due to floating point tolerances that are too tight.
4432 (setenv "TEST_FLAGS" "1500 50 16") ;from elpa.spec
4433 (setenv "OMP_NUM_THREADS" (number->string (parallel-job-count)))
4434 (substitute* "Makefile"
4435 ;; Test scripts are generated, patch the shebang
4436 (("#!/bin/bash") (string-append "#!" (which "sh"))))
4437 #t)))))
4438 (home-page "http://elpa.mpcdf.mpg.de")
4439 (synopsis "Eigenvalue solvers for symmetric matrices")
4440 (description
4441 "The ELPA library provides efficient and scalable direct eigensolvers for
4442symmetric matrices.")
4443 (license license:lgpl3)))
4444
4445(define-public elpa-openmpi
4446 (package (inherit elpa)
4447 (name "elpa-openmpi")
4448 (inputs
4449 `(("mpi" ,openmpi)
4450 ("scalapack" ,scalapack)
4451 ,@(package-inputs elpa)))
4452 (arguments
4453 (substitute-keyword-arguments (package-arguments elpa)
4454 ((#:configure-flags cf '())
4455 `(cons "--with-mpi=yes" (delete "--with-mpi=no" ,cf)))
4456 ((#:phases phases '%standard-phases)
4457 `(modify-phases ,phases
4458 (add-before 'check 'mpi-setup
4459 (lambda _
4460 ;; Tests use 2 mpi tasks by default, use our remaining build
4461 ;; cores as OpenMP threads.
4462 (setenv "OMP_NUM_THREADS" (number->string
4463 (max (quotient (parallel-job-count) 2)
4464 1)))
4465 (,%openmpi-setup)))))))
4466 (synopsis "Eigenvalue solvers for symmetric matrices (with MPI support)")))
4467
e01397b4
EB
4468(define-public elemental
4469 (package
4470 (name "elemental")
4471 (version "0.87.7")
4472 (source (origin
5c0b6d1b
EF
4473 (method git-fetch)
4474 (uri (git-reference
4475 (url "https://github.com/elemental/Elemental.git")
4476 (commit (string-append "v" version))))
4477 (file-name (git-file-name name version))
e01397b4
EB
4478 (sha256
4479 (base32
5c0b6d1b 4480 "1687xpjjzig27y2pnqv7hv09smpijyfdpz7qjgmcxf4shfajlfkc"))))
e01397b4 4481 (build-system cmake-build-system)
1e05e837 4482 (home-page "https://github.com/elemental/Elemental")
e01397b4
EB
4483 (native-inputs
4484 `(("gfortran" ,gfortran)))
4485 (inputs
4486 `(("blas" ,openblas)
4487 ("gfortran:lib" ,gfortran "lib")
4488 ("gmp" ,gmp)
4489 ("lapack" ,lapack)
4490 ("metis" ,metis)
4491 ("mpc" ,mpc)
4492 ("mpfr" ,mpfr)
4493 ("mpi" ,openmpi)
4494 ("qd" ,qd)))
4495 (arguments
4496 `(#:build-type "Release" ;default RelWithDebInfo not supported
4497 #:configure-flags `("-DEL_DISABLE_PARMETIS:BOOL=YES"
4498 "-DEL_AVOID_COMPLEX_MPI:BOOL=NO"
4499 "-DEL_CACHE_WARNINGS:BOOL=YES"
4500 "-DEL_TESTS:BOOL=YES"
4501 "-DCMAKE_INSTALL_LIBDIR=lib"
4502 "-DGFORTRAN_LIB=gfortran")
4503 #:phases (modify-phases %standard-phases
3b42e2be
EF
4504 (add-before 'check 'mpi-setup
4505 ,%openmpi-setup)
e01397b4
EB
4506 (add-before 'check 'setup-tests
4507 (lambda _
4508 ;; Parallelism is done at the MPI layer.
4509 (setenv "OMP_NUM_THREADS" "1")
4510 #t))
4511 (add-after 'install 'remove-tests
4512 (lambda* (#:key outputs #:allow-other-keys)
4513 ;; Tests are installed, with no easy configuration
4514 ;; switch to prevent this, so delete them.
4515 (delete-file-recursively
3b42e2be 4516 (string-append (assoc-ref outputs "out") "/bin"))
e01397b4
EB
4517 #t)))))
4518 (synopsis "Dense and sparse-direct linear algebra and optimization")
4519 (description "Elemental is a modern C++ library for distributed-memory
4520dense and sparse-direct linear algebra, conic optimization, and lattice
4521reduction.")
4522 (license license:bsd-2)))
5b05dce7
JN
4523
4524(define-public mcrl2
4525 (package
4526 (name "mcrl2")
3bc74090 4527 (version "201908.0")
5b05dce7
JN
4528 (source (origin
4529 (method url-fetch)
185152e3
JN
4530 (uri (string-append
4531 "https://www.mcrl2.org/download/release/mcrl2-"
4532 version ".tar.gz"))
5b05dce7
JN
4533 (sha256
4534 (base32
3bc74090 4535 "1i4xgl2d5fgiz1mwi50cyfkrrcpm8nxfayfjgmhq7chs58wlhfsz"))))
5b05dce7
JN
4536 (inputs
4537 `(("boost" ,boost)
4538 ("glu" ,glu)
4539 ("mesa" ,mesa)
077d66ed 4540 ("qtbase" ,qtbase)))
5b05dce7 4541 (build-system cmake-build-system)
ed0c5d3c 4542 (synopsis "Toolset for the mCRL2 formal specification language")
5b05dce7 4543 (description
ed0c5d3c
TGR
4544 "@dfn{mCRL2} (micro Common Representation Language 2) is a formal
4545specification language for describing concurrent discrete event systems. Its
4546toolset supports analysis and automatic verification, linearisation, simulation,
4547state-space exploration and generation, and tools to optimise and analyse
5b05dce7
JN
4548specifications. Also, state spaces can be manipulated, visualised and
4549analysed.")
b3882709 4550 (home-page "https://mcrl2.org")
5b05dce7 4551 (license license:boost1.0)))
41835f94 4552
e03b9126
JN
4553(define-public mcrl2-minimal
4554 (package
4555 (inherit mcrl2)
4556 (name "mcrl2-minimal")
4557 (inputs
4558 `(("boost" ,boost)))
4559 (arguments
4560 '(#:configure-flags '("-DMCRL2_ENABLE_GUI_TOOLS=OFF")))))
4561
910deec6
NV
4562(define-public tcalc
4563 (package
4564 (name "tcalc")
4565 (version "2.0")
4566 (source
4567 (origin
4568 (method url-fetch)
4569 (uri (string-append "https://sites.google.com/site/mohammedisam2000/tcalc/tcalc-"
4570 version ".tar.gz"))
4571 (sha256
4572 (base32
4573 "0jq806m4dqfia85nppfm75mml9w57g0cgv4cdw9bp3zymda83s0m"))))
4574 (build-system gnu-build-system)
4575 (synopsis "The terminal calculator")
4576 (description
4577 "The terminal calculator is a small program to help users of the GNU/Linux
4578terminal do calculations simply and quickly. The formula to be calculated can
4579be fed to @command{tcalc} through the command line.")
4580 (home-page "https://sites.google.com/site/mohammedisam2000/tcalc")
4581 (license license:gpl3+)))
b26e4f26
EB
4582
4583(define-public sundials
4584 (package
4585 (name "sundials")
4586 (version "3.1.1")
4587 (source
4588 (origin
4589 (method url-fetch)
4590 (uri (string-append "https://computation.llnl.gov/projects/sundials/download/"
4591 "sundials-" version ".tar.gz"))
4592 (sha256
4593 (base32
4594 "090s8ymhd0g1s1d44fa73r5yi32hb4biwahhbfi327zd64yn8kd2"))))
4595 (build-system cmake-build-system)
4596 (native-inputs
4597 `(("python" ,python-2))) ;for tests; syntax incompatible with python 3
4598 (inputs
4599 `(("fortran" ,gfortran) ;for fcmix
4600 ("blas" ,openblas)
4601 ("suitesparse" ,suitesparse))) ;TODO: Add hypre
4602 (arguments
4603 `(#:configure-flags `("-DEXAMPLES_ENABLE_C:BOOL=ON"
4604 "-DEXAMPLES_ENABLE_CXX:BOOL=ON"
4605 "-DEXAMPLES_ENABLE_F77:BOOL=ON"
4606 "-DEXAMPLES_ENABLE_F90:BOOL=ON"
4607 "-DEXAMPLES_INSTALL:BOOL=OFF"
4608
4609 "-DFCMIX_ENABLE:BOOL=ON"
4610
4611 "-DKLU_ENABLE:BOOL=ON"
4612 ,(string-append "-DKLU_INCLUDE_DIR="
4613 (assoc-ref %build-inputs "suitesparse")
4614 "/include")
4615 ,(string-append "-DKLU_LIBRARY_DIR="
4616 (assoc-ref %build-inputs "suitesparse")
4617 "/lib"))))
4618 (home-page "https://computation.llnl.gov/projects/sundials")
4619 (synopsis "Suite of nonlinear and differential/algebraic equation solvers")
4620 (description "SUNDIALS is a family of software packages implemented with
4621the goal of providing robust time integrators and nonlinear solvers that can
4622easily be incorporated into existing simulation codes.")
4623 (license license:bsd-3)))
4624
4625(define-public sundials-openmpi
4626 (package (inherit sundials)
4627 (name "sundials-openmpi")
4628 (inputs
4629 `(("mpi" ,openmpi)
4630 ("petsc" ,petsc-openmpi) ;support in SUNDIALS requires MPI
4631 ,@(package-inputs sundials)))
4632 (arguments
4633 (substitute-keyword-arguments (package-arguments sundials)
4634 ((#:configure-flags flags '())
4635 `(cons* "-DMPI_ENABLE:BOOL=ON"
4636 "-DPETSC_ENABLE:BOOL=ON"
4637 (string-append "-DPETSC_INCLUDE_DIR="
4638 (assoc-ref %build-inputs "petsc")
4639 "/include")
4640 (string-append "-DPETSC_LIBRARY_DIR="
4641 (assoc-ref %build-inputs "petsc")
4642 "/lib")
4643 ,flags))
4644 ((#:phases phases '%standard-phases)
4645 `(modify-phases ,phases
bbe46a4a
EB
4646 (add-before 'check 'mpi-setup
4647 ,%openmpi-setup)))))
b26e4f26 4648 (synopsis "SUNDIALS with OpenMPI support")))
a6b9ebc2
EB
4649
4650(define-public combinatorial-blas
4651 (package
4652 (name "combinatorial-blas")
4653 (version "1.6.2")
4654 (source
4655 (origin
4656 (method url-fetch)
4657 (uri (string-append "http://eecs.berkeley.edu/~aydin/CombBLAS_FILES/"
4658 "CombBLAS_beta_"
4659 (match (string-split version #\.)
4660 ((major minor patch)
4661 (string-append major minor "_" patch))) ;e.g. "16_2"
4662 ".tgz"))
4663 (sha256
4664 (base32
4665 "1a9wbgdqyy1whhfc0yl0yqkax3amnqa6iihhq48d063gc0jwfd9a"))
4666 (patches (search-patches "combinatorial-blas-awpm.patch"
4667 "combinatorial-blas-io-fix.patch"))))
4668 (build-system cmake-build-system)
4669 (inputs
4670 `(("mpi" ,openmpi)
4671 ("test-data" ,(origin
4672 (method url-fetch)
4673 (uri (string-append "https://people.eecs.berkeley.edu/~aydin/"
4674 "CombBLAS_FILES/testdata_combblas1.6.1.tgz"))
4675 (sha256
4676 (base32
4677 "01y2781cy3fww7znmidrp85mf8zx0c905w5vzvk1mgrmhhynim87"))))))
4678 (arguments
4679 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES"
4680 "-DCMAKE_CXX_FLAGS=-DUSE_FUNNEL")
4681 #:parallel-tests? #f ;tests use 'mpiexec -n4'
4682 #:phases
4683 (modify-phases %standard-phases
4684 (add-before 'check 'mpi-setup
4685 ,%openmpi-setup)
4686 (add-before 'check 'test-setup
4687 (lambda* (#:key inputs #:allow-other-keys)
4688 (setenv "OMP_NUM_THREADS" "2")
4689 (invoke "tar" "xf" (assoc-ref inputs "test-data")))))))
4690 (home-page "https://people.eecs.berkeley.edu/~aydin/CombBLAS/html/")
4691 (synopsis "Linear algebra primitives for graph analytics")
4692 (description "The Combinatorial BLAS (CombBLAS) is an extensible
4693distributed-memory parallel graph library offering a small but powerful set of
4694linear algebra primitives specifically targeting graph analytics.")
4695 (license (list
4696 license:gpl2+ ;include/psort/(funnel|sort)*.h
4697 license:x11 ;usort and psort
4698 license:bsd-3)))) ;CombBLAS and MersenneTwister.h
3847d1f2
RW
4699
4700(define-public dune-common
4701 (package
4702 (name "dune-common")
6ca2d7da 4703 (version "2.7.0")
3847d1f2
RW
4704 (source
4705 (origin
4706 (method url-fetch)
4707 (uri (string-append "https://dune-project.org/download/"
4708 version "/dune-common-" version ".tar.gz"))
4709 (sha256
4710 (base32
6ca2d7da 4711 "140q1zh44cr5yrjwg4b5ga803rkqv55vk30l2cqm29aklj1wb0rw"))))
3847d1f2
RW
4712 (build-system cmake-build-system)
4713 (arguments
4714 `(#:phases
4715 (modify-phases %standard-phases
4716 (add-after 'build 'build-tests
4717 (lambda* (#:key make-flags #:allow-other-keys)
393dc1cc 4718 (apply invoke "make" "build_tests" make-flags))))))
3847d1f2
RW
4719 (inputs
4720 `(("gmp" ,gmp)
4721 ("metis" ,metis)
3847d1f2
RW
4722 ("openblas" ,openblas)
4723 ("python" ,python)
4724 ("superlu" ,superlu)))
4725 (native-inputs
4726 `(("gfortran" ,gfortran)
4727 ("pkg-config" ,pkg-config)))
4728 (home-page "https://dune-project.org/")
4729 (synopsis "Distributed and Unified Numerics Environment")
4730 (description "DUNE, the Distributed and Unified Numerics Environment is a
4731modular toolbox for solving @dfn{partial differential equations} (PDEs) with
4732grid-based methods. It supports the easy implementation of methods like
4733@dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
4734Differences} (FD).")
4735 ;; GPL version 2 with "runtime exception" to make it behave like LGPLv2.
4736 (license license:gpl2)))
242dbd8e
RW
4737
4738(define-public dune-geometry
4739 (package
4740 (name "dune-geometry")
6ca2d7da 4741 (version "2.7.0")
242dbd8e
RW
4742 (source
4743 (origin
4744 (method url-fetch)
4745 (uri (string-append "https://dune-project.org/download/"
4746 version "/dune-geometry-" version ".tar.gz"))
4747 (sha256
4748 (base32
6ca2d7da 4749 "1cicvlwbyyw76npicnblxckyvhbfn3ip8isydiv3hlrlz8zcg5nr"))))
242dbd8e
RW
4750 (build-system cmake-build-system)
4751 (arguments
4752 `(#:phases
4753 (modify-phases %standard-phases
4754 (add-after 'build 'build-tests
4755 (lambda* (#:key make-flags #:allow-other-keys)
4756 (apply invoke "make" "build_tests" make-flags))))))
4757 (inputs
4758 `(("dune-common" ,dune-common)
242dbd8e
RW
4759 ;; Optional
4760 ("openblas" ,openblas)
4761 ("gmp" ,gmp)
4762 ("python" ,python)))
4763 (native-inputs
4764 `(("gfortran" ,gfortran)
4765 ("pkg-config" ,pkg-config)))
4766 (home-page "https://dune-project.org/")
4767 (synopsis "Distributed and Unified Numerics Environment")
4768 (description "DUNE, the Distributed and Unified Numerics Environment is a
4769modular toolbox for solving @dfn{partial differential equations} (PDEs) with
4770grid-based methods. It supports the easy implementation of methods like
4771@dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
4772Differences} (FD).
4773
4774This package contains the basic DUNE geometry classes.")
4775 ;; GPL version 2 with "runtime exception"
4776 (license license:gpl2)))
ef6e69fd 4777
07ebb75d
FG
4778(define-public dune-uggrid
4779 (package
4780 (name "dune-uggrid")
6ca2d7da 4781 (version "2.7.0")
07ebb75d
FG
4782 (source
4783 (origin
6ca2d7da
FG
4784 (method git-fetch)
4785 (uri (git-reference
4786 (url "https://gitlab.dune-project.org/staging/dune-uggrid.git")
4787 (commit (string-append "v" version))))
4788 (file-name (git-file-name name version))
07ebb75d
FG
4789 (sha256
4790 (base32
6ca2d7da 4791 "192miqgmfj6jwk969gydzpbv9ki7jg5nky3ydnrwa2nq29b5xkh0"))))
07ebb75d
FG
4792 (build-system cmake-build-system)
4793 (arguments
4794 `(#:phases
4795 (modify-phases %standard-phases
4796 (add-after 'build 'build-tests
4797 (lambda* (#:key make-flags #:allow-other-keys)
4798 (apply invoke "make" "build_tests" make-flags))))))
4799 (inputs
393dc1cc 4800 `(("dune-common" ,dune-common)))
07ebb75d
FG
4801 (native-inputs
4802 `(("gfortran" ,gfortran)
4803 ("pkg-config" ,pkg-config)))
4804 (home-page "https://dune-project.org/")
4805 (synopsis "Distributed and Unified Numerics Environment")
4806 (description "DUNE, the Distributed and Unified Numerics Environment is a
4807modular toolbox for solving @dfn{partial differential equations} (PDEs) with
4808grid-based methods. It supports the easy implementation of methods like
4809@dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
4810Differences} (FD).
4811
4812This package contains the DUNE UG grid classes.")
4813 (license license:lgpl2.1)))
4814
ef6e69fd
RW
4815(define-public dune-grid
4816 (package
4817 (name "dune-grid")
6ca2d7da 4818 (version "2.7.0")
ef6e69fd
RW
4819 (source
4820 (origin
4821 (method url-fetch)
4822 (uri (string-append "https://dune-project.org/download/"
4823 version "/dune-grid-" version ".tar.gz"))
4824 (sha256
4825 (base32
6ca2d7da 4826 "17fjz30qazjgl11sryyxnw9klai4yz1ji4bs68013xcxc5hdv27s"))))
ef6e69fd
RW
4827 (build-system cmake-build-system)
4828 (arguments
4829 `(#:phases
4830 (modify-phases %standard-phases
4831 (add-after 'build 'build-tests
4832 (lambda* (#:key make-flags #:allow-other-keys)
393dc1cc 4833 (apply invoke "make" "build_tests" make-flags))))))
ef6e69fd
RW
4834 (inputs
4835 `(("dune-common" ,dune-common)
4836 ("dune-geometry" ,dune-geometry)
4837 ("gmp" ,gmp)
4838 ("metis" ,metis)
4839 ("openblas" ,openblas)
ef6e69fd 4840 ("python" ,python)))
07ebb75d
FG
4841 (propagated-inputs
4842 `(("dune-uggrid" ,dune-uggrid)))
ef6e69fd
RW
4843 (native-inputs
4844 `(("gfortran" ,gfortran)
4845 ("pkg-config" ,pkg-config)))
4846 (home-page "https://dune-project.org/")
4847 (synopsis "Distributed and Unified Numerics Environment")
4848 (description "DUNE, the Distributed and Unified Numerics Environment is a
4849modular toolbox for solving @dfn{partial differential equations} (PDEs) with
4850grid-based methods. It supports the easy implementation of methods like
4851@dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
4852Differences} (FD).
4853
4854This package contains the basic DUNE grid classes.")
4855 ;; GPL version 2 with "runtime exception"
4856 (license license:gpl2)))
ea51d357
RW
4857
4858(define-public dune-istl
4859 (package
4860 (name "dune-istl")
6ca2d7da 4861 (version "2.7.0")
ea51d357
RW
4862 (source
4863 (origin
4864 (method url-fetch)
4865 (uri (string-append "https://dune-project.org/download/"
4866 version "/dune-istl-" version ".tar.gz"))
4867 (sha256
4868 (base32
6ca2d7da
FG
4869 "0gl3wgz5rs6sb4m83440ny45sbx7z7lnbi3gx6r9nm3rvy5j33f9"))
4870 (patches (search-patches "dune-istl-2.7-fix-non-mpi-tests.patch"))))
ea51d357
RW
4871 (build-system cmake-build-system)
4872 (arguments
4873 `(#:phases
4874 (modify-phases %standard-phases
4875 (add-after 'build 'build-tests
4876 (lambda* (#:key make-flags #:allow-other-keys)
393dc1cc 4877 (apply invoke "make" "build_tests" make-flags))))))
ea51d357
RW
4878 (inputs
4879 `(("dune-common" ,dune-common)
ea51d357
RW
4880 ;; Optional
4881 ("metis" ,metis)
0a703c04 4882 ("suitesparse" ,suitesparse)
ea51d357
RW
4883 ("superlu" ,superlu)
4884 ("openblas" ,openblas)
4885 ("gmp" ,gmp)
4886 ("python" ,python)))
4887 (native-inputs
4888 `(("gfortran" ,gfortran)
4889 ("pkg-config" ,pkg-config)))
4890 (home-page "https://dune-project.org/")
4891 (synopsis "Distributed and Unified Numerics Environment")
4892 (description "DUNE, the Distributed and Unified Numerics Environment is a
4893modular toolbox for solving @dfn{partial differential equations} (PDEs) with
4894grid-based methods.
4895
4896This is the iterative solver template library which provides generic sparse
4897matrix/vector classes and a variety of solvers based on these classes. A
4898special feature is the use of templates to exploit the recursive block
4899structure of finite element matrices at compile time. Available solvers
4900include Krylov methods, (block-) incomplete decompositions and
4901aggregation-based algebraic multigrid.")
4902 ;; GPL version 2 with "runtime exception"
4903 (license license:gpl2)))
5a70aa7d
RW
4904
4905(define-public dune-localfunctions
4906 (package
4907 (name "dune-localfunctions")
6ca2d7da 4908 (version "2.7.0")
5a70aa7d
RW
4909 (source
4910 (origin
4911 (method url-fetch)
4912 (uri (string-append "https://dune-project.org/download/"
4913 version "/dune-localfunctions-" version ".tar.gz"))
4914 (sha256
4915 (base32
6ca2d7da 4916 "1yih59h6vngii696bx1c2vil02lriij4kz0nc583mjn9kiaqxfqd"))))
5a70aa7d
RW
4917 (build-system cmake-build-system)
4918 (arguments
4919 `(#:phases
4920 (modify-phases %standard-phases
4921 (add-after 'build 'build-tests
4922 (lambda* (#:key make-flags #:allow-other-keys)
4923 (apply invoke "make" "build_tests" make-flags))))))
4924 (inputs
4925 `(("dune-common" ,dune-common)
4926 ("dune-geometry" ,dune-geometry)
5a70aa7d
RW
4927 ;; Optional
4928 ("metis" ,metis)
4929 ("superlu" ,superlu)
4930 ("gmp" ,gmp)))
4931 (native-inputs
4932 `(("gfortran" ,gfortran)
4933 ("pkg-config" ,pkg-config)))
4934 (home-page "https://dune-project.org/")
4935 (synopsis "Distributed and Unified Numerics Environment") ; TODO
4936 (description "This DUNE module provides interface and implementation for
4937shape functions defined on the DUNE reference elements. In addition to the
4938shape function, interpolation operators and special keys are provided which
4939can be used to assemble global function spaces on finite-element grids.
4940
4941This package provides an interface and implementation for shape functions
4942defined on the DUNE reference elements. In addition to the shape function,
4943interpolation operators and special keys are provided which can be used to
4944assemble global function spaces on finite-element grids.")
4945 ;; GPL version 2 with "runtime exception"
4946 (license license:gpl2)))
ab03d899
RW
4947
4948(define-public dune-alugrid
4949 (package
4950 (name "dune-alugrid")
6ca2d7da 4951 (version "2.7.0-git-81d35682")
ab03d899
RW
4952 (source
4953 (origin
6ca2d7da
FG
4954 (method git-fetch)
4955 (uri (git-reference
4956 (url "https://gitlab.dune-project.org/extensions/dune-alugrid.git")
4957 (commit "81d356827c84454b971937db02c02b90bbcd7fe5")))
4958 (file-name (git-file-name name version))
ab03d899
RW
4959 (sha256
4960 (base32
6ca2d7da 4961 "0z54lwfp53prcrs94k8gwh047l9z642jll3l56xlyfr69z0b2zz1"))))
ab03d899
RW
4962 (build-system cmake-build-system)
4963 (arguments
a669f6e2 4964 `(#:phases
ab03d899
RW
4965 (modify-phases %standard-phases
4966 (add-after 'unpack 'patch-include
4967 (lambda _
4968 (substitute* "dune/alugrid/test/test-alugrid.cc"
4969 (("doc/grids/gridfactory/testgrids")
4970 "doc/dune-grid/grids/gridfactory/testgrids"))
4971 #t))
4972 (add-after 'build 'build-tests
4973 (lambda* (#:key inputs make-flags #:allow-other-keys)
4974 (setenv "CPLUS_INCLUDE_PATH"
97149c57 4975 (string-append (assoc-ref inputs "dune-grid") "/share"))
393dc1cc 4976 (apply invoke "make" "build_tests" make-flags))))))
ab03d899
RW
4977 (inputs
4978 `(("dune-common" ,dune-common)
4979 ("dune-geometry" ,dune-geometry)
4980 ("dune-grid" ,dune-grid)
ab03d899
RW
4981 ;; Optional
4982 ("metis" ,metis)
4983 ("openblas" ,openblas)
4984 ("python" ,python)
4985 ("superlu" ,superlu)
4986 ("gmp" ,gmp)
4987 ("zlib" ,zlib)))
4988 (native-inputs
4989 `(("gfortran" ,gfortran)
4990 ("pkg-config" ,pkg-config)))
4991 (home-page "https://dune-project.org/")
4992 (synopsis "Distributed and Unified Numerics Environment")
4993 (description "ALUGrid is an adaptive, loadbalancing, unstructured
4994implementation of the DUNE grid interface supporting either simplices or
4995cubes.")
4996 (license license:gpl2+)))
0e50630f 4997
f1f9466e
FG
4998(define-public dune-subgrid
4999 (package
5000 (name "dune-subgrid")
6ca2d7da 5001 (version "2.7.0-git-2103a363")
f1f9466e
FG
5002 (source
5003 (origin
5004 (method git-fetch)
5005 (uri (git-reference
5006 (url "https://git.imp.fu-berlin.de/agnumpde/dune-subgrid")
6ca2d7da 5007 (commit "2103a363f32e8d7b60e66eee7ddecf969f6cf762")))
f1f9466e
FG
5008 (file-name (git-file-name name version))
5009 (sha256
5010 (base32
6ca2d7da 5011 "1wsjlypd3835c3arqjkw836cxx5q67zy447wa65q634lf6f6v9ia"))))
f1f9466e
FG
5012 (build-system cmake-build-system)
5013 (arguments
5014 `(#:phases
5015 (modify-phases %standard-phases
5016 (add-after 'build 'build-tests
5017 (lambda* (#:key make-flags #:allow-other-keys)
393dc1cc 5018 (apply invoke "make" "build_tests" make-flags))))))
f1f9466e
FG
5019 (inputs
5020 `(("dune-common" ,dune-common)
5021 ("dune-geometry" ,dune-geometry)
5022 ("dune-grid" ,dune-grid)
f1f9466e
FG
5023 ;; Optional
5024 ("metis" ,metis)
5025 ("openblas" ,openblas)
5026 ("gmp" ,gmp)))
5027 (native-inputs
5028 `(("gfortran" ,gfortran)
5029 ("pkg-config" ,pkg-config)))
5030 (home-page "http://numerik.mi.fu-berlin.de/dune-subgrid/index.php")
5031 (synopsis "Distributed and Unified Numerics Environment")
48b0d9c0 5032 (description "The dune-subgrid module marks elements of
f1f9466e
FG
5033another hierarchical dune grid. The set of marked elements can then be
5034accessed as a hierarchical dune grid in its own right. Dune-Subgrid
5035provides the full grid interface including adaptive mesh refinement.")
5036 (license license:gpl2+)))
5037
0e50630f
RW
5038(define-public dune-typetree
5039 (package
5040 (name "dune-typetree")
6ca2d7da 5041 (version "2.7.0")
0e50630f
RW
5042 (source
5043 (origin
5044 (method git-fetch)
5045 (uri (git-reference
5046 (url "https://gitlab.dune-project.org/staging/dune-typetree.git")
5047 (commit (string-append "v" version))))
5048 (file-name (git-file-name name version))
5049 (sha256
5050 (base32
6ca2d7da 5051 "1rhv25yg0q1hw50c8wlfqhgwrjl4mh62zq9v14ilwgzbfgxmpiy7"))))
0e50630f
RW
5052 (build-system cmake-build-system)
5053 (arguments
5054 `(#:phases
5055 (modify-phases %standard-phases
5056 (add-after 'build 'build-tests
5057 (lambda* (#:key make-flags #:allow-other-keys)
5058 (apply invoke "make" "build_tests" make-flags))))))
5059 (inputs
5060 `(("dune-common" ,dune-common)
0e50630f
RW
5061 ;; Optional
5062 ("openblas" ,openblas)
5063 ("python" ,python)
5064 ("metis" ,metis)
5065 ("superlu" ,superlu)
5066 ("gmp" ,gmp)))
5067 (native-inputs
5068 `(("gfortran" ,gfortran)
5069 ("pkg-config" ,pkg-config)))
5070 (home-page "https://dune-project.org/")
5071 (synopsis "Distributed and Unified Numerics Environment")
5072 (description "TypeTree is a template library for constructing and
5073operating on statically typed trees of objects.")
5074 ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
5075 (license (list license:lgpl3+ license:gpl2))))
85b9371c
RW
5076
5077(define-public dune-functions
5078 (package
5079 (name "dune-functions")
6ca2d7da 5080 (version "2.7.0")
85b9371c
RW
5081 (source
5082 (origin
5083 (method git-fetch)
5084 (uri (git-reference
5085 (url "https://gitlab.dune-project.org/staging/dune-functions.git")
5086 (commit (string-append "v" version))))
5087 (file-name (git-file-name name version))
5088 (sha256
5089 (base32
6ca2d7da 5090 "1na4gcih0kin37ksj2xj07ds04v7zx53pjdhm1hzy55jjfqdjk8h"))))
85b9371c 5091 (build-system cmake-build-system)
07ebb75d
FG
5092 (arguments
5093 `(#:phases
5094 (modify-phases %standard-phases
5095 (add-after 'unpack 'disable-failing-tests
5096 (lambda _
5097 (setenv "ARGS"
5098 ;; unable to load GMSH file in this test
5099 "--exclude-regex gridviewfunctionspacebasistest")
5100 #t))
5101 (add-after 'build 'build-tests
5102 (lambda* (#:key make-flags #:allow-other-keys)
393dc1cc 5103 (apply invoke "make" "build_tests" make-flags))))))
85b9371c
RW
5104 (inputs
5105 `(("dune-common" ,dune-common)
5106 ("dune-istl" ,dune-istl)
5107 ("dune-localfunctions" ,dune-localfunctions)
5108 ("dune-grid" ,dune-grid)
5109 ("dune-geometry" ,dune-geometry)
5110 ("dune-typetree" ,dune-typetree)
85b9371c
RW
5111 ("openblas" ,openblas)
5112 ("metis" ,metis)
5113 ("python" ,python)
5114 ("superlu" ,superlu)
5115 ("gmp" ,gmp)))
5116 (native-inputs
5117 `(("gfortran" ,gfortran)
5118 ("pkg-config" ,pkg-config)))
5119 (home-page "https://dune-project.org/")
5120 (synopsis "Distributed and Unified Numerics Environment")
5121 (description "The dune-functions module provides an abstraction layer for
5122global finite element functions. Its two main concepts are functions
5123implemented as callable objects, and bases of finite element spaces.")
5124 ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
5125 (license (list license:lgpl3+ license:gpl2))))
4714b00e
RW
5126
5127(define-public dune-pdelab
5128 (package
5129 (name "dune-pdelab")
6ca2d7da 5130 (version "2.7.0-git-476fe437")
4714b00e
RW
5131 (source
5132 (origin
5133 (method git-fetch)
5134 (uri (git-reference
5135 (url "https://gitlab.dune-project.org/pdelab/dune-pdelab")
6ca2d7da 5136 (commit "476fe43763fa6f459c5e4658e2a2b4b5582db834")))
4714b00e
RW
5137 (file-name (git-file-name name version))
5138 (sha256
5139 (base32
6ca2d7da 5140 "0cs36piqzn6rq0j2ih3ab3q3q9yg199wk72k5qi86pkzh7i7fdn1"))))
4714b00e
RW
5141 (build-system cmake-build-system)
5142 (arguments '(#:tests? #f)) ; XXX: the tests cannot be compiled
5143 (inputs
5144 `(("dune-common" ,dune-common)
5145 ("dune-istl" ,dune-istl)
5146 ("dune-localfunctions" ,dune-localfunctions)
5147 ("dune-geometry" ,dune-geometry)
5148 ("dune-grid" ,dune-grid)
5149 ("dune-typetree" ,dune-typetree)
5150 ("dune-functions" ,dune-functions)
4714b00e
RW
5151 ;; Optional
5152 ("openblas" ,openblas)
5153 ("eigen" ,eigen)
5154 ("metis" ,metis)
5155 ("python" ,python)
5156 ("superlu" ,superlu)
5157 ("gmp" ,gmp)))
5158 (native-inputs
5159 `(("gfortran" ,gfortran)
5160 ("pkg-config" ,pkg-config)))
5161 (home-page "https://dune-project.org/")
5162 (synopsis "Differential equations solver toolbox")
5163 (description "PDELab is a partial differential equations solver toolbox
5164built on top of DUNE, the Distributed and Unified Numerics Environment.")
5165 ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
5166 (license (list license:lgpl3+ license:gpl2))))
413f6126 5167
6ceb7716
FG
5168(define add-openmpi-to-dune-package
5169 (let ((dune-package?
5170 (lambda (p) (string-prefix? "dune-" (package-name p)))))
5171 (package-mapping
5172 (lambda (p)
5173 (if (dune-package? p)
5174 (package (inherit p)
5175 (name (string-append (package-name p) "-openmpi"))
5176 (inputs `(,@(package-inputs p)
5177 ("openmpi" ,openmpi)))
5178 (arguments
5179 (substitute-keyword-arguments (package-arguments p)
5180 ((#:phases phases '%standard-phases)
5181 `(modify-phases ,phases
5182 (add-before 'check 'mpi-setup
5183 ,%openmpi-setup)))))
5184 (synopsis (string-append (package-synopsis p) " (with MPI support)")))
5185 p))
5186 (negate dune-package?))))
5187
5188(define-public dune-common-openmpi
5189 (add-openmpi-to-dune-package dune-common))
5190
5191(define-public dune-geometry-openmpi
5192 (add-openmpi-to-dune-package dune-geometry))
5193
5194(define-public dune-istl-openmpi
5195 (add-openmpi-to-dune-package dune-istl))
5196
5197(define-public dune-typetree-openmpi
5198 (add-openmpi-to-dune-package dune-typetree))
5199
5200(define-public dune-uggrid-openmpi
5201 (add-openmpi-to-dune-package dune-uggrid))
5202
5203(define-public dune-grid-openmpi
5204 (add-openmpi-to-dune-package dune-grid))
5205
5206(define-public dune-alugrid-openmpi
5207 (add-openmpi-to-dune-package dune-alugrid))
5208
5209(define-public dune-subgrid-openmpi
5210 (add-openmpi-to-dune-package dune-subgrid))
5211
5212(define-public dune-localfunctions-openmpi
5213 (add-openmpi-to-dune-package dune-localfunctions))
5214
5215(define-public dune-functions-openmpi
5216 (add-openmpi-to-dune-package dune-functions))
5217
5218(define-public dune-pdelab-openmpi
5219 (add-openmpi-to-dune-package dune-pdelab))
5220
413f6126
AI
5221(define-public mlucas
5222 (package
5223 (name "mlucas")
5224 (version "18")
5225 (source
5226 (origin
5227 (method url-fetch)
5228 (uri (string-append
5229 "https://mersenneforum.org/mayer/src/C/mlucas_v" version ".txz"))
5230 (sha256
a36efdbc 5231 (base32 "0h4xj6pyyac79ka5ibqjilfa3s9j3yxnzgpwc57b54kfh2bj3447"))))
413f6126
AI
5232 (build-system gnu-build-system)
5233 (inputs
5234 `(("python2" ,python-2)))
5235 (arguments
a36efdbc 5236 `(#:tests? #f ; no tests
413f6126
AI
5237 #:phases
5238 (modify-phases %standard-phases
5239 (replace 'configure
5240 (lambda _
5241 (chdir "src")
5242 (call-with-output-file "Makefile"
5243 (lambda (port)
5244 (format port "CC = gcc
5245CFLAGS = -O3 ~a -DUSE_THREADS
5246LDLIBS = -lm -lpthread -lrt
5247Mlucas: $(addsuffix .o,$(basename $(wildcard *.c)))
5248"
5249 ,(let ((system (or (%current-target-system)
5250 (%current-system))))
5251 (cond
5252 ((string-prefix? "x86_64" system) "-DUSE_SSE2")
5253 (else ""))))))
5254 #t))
5255 (replace 'install
5256 (lambda* (#:key outputs #:allow-other-keys)
5257 (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
5258 (install-file "Mlucas" bin)
5259 (install-file "primenet.py" bin))
5260 #t)))))
5261 (home-page "https://www.mersenne.org")
5262 (synopsis "Great Internet Mersenne Prime Search (GIMPS) distributed computing client")
5263 (description "Mlucas performs Lucas-Lehmer primality testing of Mersenne
5264numbers in search of a world-record prime. You may use it to test any
5265suitable number as you wish, but it is preferable that you do so in a
5266coordinated fashion, as part of the Great Internet Mersenne Prime
5267Search (GIMPS). Mlucas also includes a simple Python script for assignment
5268management via the GIMPS project's Primenet server.")
5269 (license license:gpl2+)))
6f8c4195
NG
5270
5271(define-public nauty
5272 (package
5273 (name "nauty")
1ff64c50 5274 (version "2.6r12")
6f8c4195
NG
5275 (source (origin
5276 (method url-fetch)
5277 (uri (string-append
5278 "https://pallini.di.uniroma1.it/"
5279 "nauty" (string-join (string-split version #\.) "")
5280 ".tar.gz"))
5281 (sha256
5282 (base32
1ff64c50 5283 "1p4mxf8q5wm47nxyskxbqwa5p1vvkycv1zgswvnk9nsn6vff0al6"))))
6f8c4195
NG
5284 (build-system gnu-build-system)
5285 (outputs '("out" "lib"))
5286 (arguments
5287 `(#:test-target "checks"
5288 #:phases
5289 (modify-phases %standard-phases
5290 ;; Default make target does not build all available
5291 ;; executables. Create them now.
5292 (add-after 'build 'build-extra-programs
5293 (lambda _
5294 (for-each (lambda (target) (invoke "make" target))
5295 '("blisstog" "bliss2dre" "checks6" "sumlines"))
5296 #t))
5297 ;; Upstream does not provide any install target.
5298 (replace 'install
5299 (lambda* (#:key outputs #:allow-other-keys)
5300 (let* ((out (assoc-ref outputs "out"))
5301 (lib-output (assoc-ref outputs "lib"))
5302 (bin (string-append out "/bin"))
5303 (doc (string-append out "/share/doc/nauty/"))
5304 (include (string-append lib-output "/include/nauty"))
5305 (lib (string-append lib-output "/lib/nauty")))
5306 (for-each (lambda (f) (install-file f bin))
5307 '("dreadnaut" "NRswitchg" "addedgeg" "amtog" "biplabg"
5308 "blisstog" "bliss2dre" "catg" "checks6" "complg"
5309 "converseg" "copyg" "countg" "cubhamg" "deledgeg"
5310 "delptg" "directg" "dretodot" "dretog" "genbg"
5311 "genbgL" "geng" "genquarticg" "genrang" "genspecialg"
5312 "gentourng" "gentreeg" "hamheuristic" "labelg"
5313 "linegraphg" "listg" "multig" "newedgeg" "pickg"
5314 "planarg" "ranlabg" "shortg" "showg" "subdivideg"
5315 "sumlines" "twohamg" "vcolg" "watercluster2"))
5316 (for-each (lambda (f) (install-file f include))
5317 (find-files "." "\\.h$"))
5318 (for-each (lambda (f) (install-file f lib))
5319 (find-files "." "\\.a$"))
5320 (for-each (lambda (f) (install-file f doc))
5321 (append '("formats.txt" "README" "schreier.txt")
5322 (find-files "." "\\.pdf$")))))))))
5323 (inputs
5324 `(("gmp" ,gmp))) ;for sumlines
5325 (home-page "https://pallini.di.uniroma1.it/")
5326 (synopsis "Library for graph automorphisms")
5327 (description "@code{nauty} (No AUTomorphisms, Yes?) is a set of
5328procedures for computing automorphism groups of graphs and digraphs.
5329
5330@code{nauty} computes graph information in the form of a set of
5331generators, the size of the group, and the orbits of the group; it can
5332also produce a canonical label. The @code{nauty} suite is written in
5333C and comes with a command-line interface, a collection of
5334command-line tools, and an Application Programming Interface (API).
5335
5336This package provides the static libraries required to run programs
5337compiled against the nauty library.")
5338 (license license:asl2.0)))
26433471
AE
5339
5340(define-public ppl
5341 (package
5342 (name "ppl")
5343 (version "1.2")
5344 (source
5345 (origin
5346 (method url-fetch)
5347 (uri (string-append "https://www.bugseng.com/products/ppl/download/"
5348 "ftp/releases/" version
5349 "/ppl-" version ".tar.gz"))
5350 (sha256
5351 (base32
5352 "1j5aji1g2vmdvc0gqz45n2ll2l2f6czca04wiyfl5g3sm3a6vhvb"))))
5353 (build-system gnu-build-system)
5354 (native-inputs
5355 `(("m4", m4)))
5356 (inputs
5357 `(("glpk" ,glpk)
5358 ("gmp", gmp)))
5359 (home-page "https://www.bugseng.com/parma-polyhedra-library")
5360 (synopsis
5361 "Parma Polyhedra Library for computations with polyhedra")
5362 (description
5363 "The Parma Polyhedra Library (PPL) provides numerical abstractions
5364especially targeted at applications in the field of analysis and
5365verification of complex systems. These abstractions include convex
5366polyhedra, defined as the intersection of a finite number of (open or
5367closed) halfspaces, each described by a linear inequality (strict or
5368non-strict) with rational coefficients; some special classes of polyhedra
5369shapes that offer interesting complexity/precision tradeoffs; and grids
5370which represent regularly spaced points that satisfy a set of linear
5371congruence relations. The library also supports finite powersets and
5372products of (any kind of) polyhedra and grids, a mixed integer linear
5373programming problem solver using an exact-arithmetic version of the simplex
5374algorithm, a parametric integer programming solver, and primitives for
5375termination analysis via the automatic synthesis of linear ranking
5376functions.")
5377 (license license:gpl3+)))
4cb5d251
SS
5378
5379(define-public speedcrunch
5380 (package
5381 (name "speedcrunch")
5382 (version "0.12.0")
5383 (source
5384 (origin
5385 (method git-fetch)
5386 (uri (git-reference
5387 (url "https://bitbucket.org/heldercorreia/speedcrunch.git")
5388 (commit (string-append "release-" version))))
5389 (file-name (git-file-name name version))
5390 (sha256
5391 (base32
5392 "0vh7cd1915bjqzkdp3sk25ngy8cq624mkh8c53c5bnzk357kb0fk"))))
5393 (build-system cmake-build-system)
5394 (inputs `(("qtbase" ,qtbase)))
5395 (native-inputs `(("qttools" ,qttools)))
5396 (arguments
5397 `(#:phases
5398 (modify-phases %standard-phases
5399 (add-after 'unpack 'chdir-to-src
5400 (lambda _ (chdir "src") #t)))))
5401 (synopsis "High-precision scientific calculator")
5402 (description
5403 "SpeedCrunch is a high-precision scientific calculator. It features a
5404syntax-highlighted scrollable display and is designed to be fully used via
5405keyboard. Some distinctive features are auto-completion of functions and
5406variables, a formula book, and quick insertion of constants from various
5407fields of knowledge.")
80fafdba 5408 (home-page "https://speedcrunch.org/")
4cb5d251
SS
5409 (license license:gpl2+)))
5410
3b7828cc
RS
5411(define-public minisat
5412 ;; This is the last commit which is available upstream, no
5413 ;; release happened since 2010.
5414 (let ((commit "37dc6c67e2af26379d88ce349eb9c4c6160e8543")
5415 (revision "1"))
5416 (package
5417 (name "minisat")
5418 (version (string-append "2.2.0-" revision "." (string-take commit 7)))
5419 (source
5420 (origin
5421 (method git-fetch)
5422 (uri (git-reference
5423 (url "https://github.com/niklasso/minisat.git")
5424 (commit commit)))
5425 (file-name (string-append name "-" version "-checkout"))
5426 (sha256
5427 (base32
5428 "091hf3qkm197s5r7xcr3m07xsdwyz2rqk1hc9kj0hn13imz09irq"))
5429 (patches
5430 (search-patches "minisat-friend-declaration.patch"
5431 "minisat-install.patch"))))
5432 (build-system gnu-build-system)
5433 (arguments
5434 '(#:make-flags (list (string-append "prefix=" %output))
5435 #:tests? #f ;no check target
5436 #:phases
5437 (modify-phases %standard-phases
5438 (delete 'configure))))
5439 (inputs
5440 `(("zlib:static" ,zlib "static")
5441 ("zlib" ,zlib)))
5442 (synopsis
5443 "Small, yet efficient, SAT solver")
5444 (description
5445 "MiniSat is a minimalistic, open-source SAT solver, developed to help
5446researchers and developers alike to get started on SAT.")
5447 (home-page
5448 "http://minisat.se/MiniSat.html")
5449 (license license:expat))))
70c98efa
VK
5450
5451(define-public libqalculate
5452 (package
5453 (name "libqalculate")
5454 (version "3.8.0")
5455 (source
5456 (origin
5457 (method git-fetch)
5458 (uri (git-reference
5459 (url "https://github.com/Qalculate/libqalculate/")
5460 (commit (string-append "v" version))))
5461 (file-name (git-file-name name version))
5462 (sha256
9b3c231e
VK
5463 (base32 "1vbaza9c7159xf2ym90l0xkyj2mp6c3hbghhsqn29yvz08fda9df"))
5464 (patches
5465 (search-patches "libqalculate-3.8.0-libcurl-ssl-fix.patch"))))
70c98efa
VK
5466 (build-system gnu-build-system)
5467 (native-inputs
5468 `(("pkg-config" ,pkg-config)
5469 ("gettext" ,gettext-minimal)
5470 ("intltool" ,intltool)
5471 ("automake" ,automake)
5472 ("autoconf" ,autoconf)
5473 ("libtool" ,libtool)
5474 ("doxygen" ,doxygen)
5475 ("file" ,file)))
5476 (inputs
5477 `(("gmp" ,gmp)
5478 ("mpfr" ,mpfr)
5479 ("libxml2" ,libxml2)
5480 ("curl" ,curl)
5481 ("icu4c" ,icu4c)
5482 ("gnuplot" ,gnuplot)
5483 ("readline" ,readline)
5484 ("libiconv" ,libiconv)))
5485 (arguments
5486 `(#:phases
5487 (modify-phases %standard-phases
5488 (add-before 'bootstrap 'setenv
5489 ;; Prevent the autogen.sh script to carry out the configure
5490 ;; script, which has not yet been patched to replace /bin/sh.
5491 (lambda _
5492 (setenv "NOCONFIGURE" "TRUE")
5493 #t)))))
5494 (home-page "https://qalculate.github.io/")
5495 (synopsis "Multi-purpose cli desktop calculator and library")
5496 (description
5497 "Libqalculate is a multi-purpose cli desktop calculator and library.
5498It provides basic and advanced functionality. Features include customizable
5499functions, unit calculations, and conversions, physical constants, symbolic
5500calculations (including integrals and equations), arbitrary precision,
67e2e171 5501uncertainty propagation, interval arithmetic, plotting and a user-friendly
70c98efa
VK
5502cli.")
5503 (license license:gpl2+)))
72c71d24
VK
5504
5505(define-public qalculate-gtk
5506 (package
5507 (name "qalculate-gtk")
5508 (version "3.8.0")
5509 (source
5510 (origin
5511 (method git-fetch)
5512 (uri (git-reference
5513 (url "https://github.com/Qalculate/qalculate-gtk/")
5514 (commit (string-append "v" version))))
5515 (file-name (git-file-name name version))
5516 (sha256
5517 (base32 "0nsg6dzg5r7rzqr671nvrf1c50rjwpz7bxv5f20i4s7agizgv840"))))
5518 (build-system glib-or-gtk-build-system)
5519 (native-inputs
5520 `(("pkg-config" ,pkg-config)
5521 ("intltool" ,intltool)
5522 ("automake" ,automake)
5523 ("autoconf" ,autoconf)
5524 ("libtool" ,libtool)
5525 ("file" ,file)))
5526 (inputs
5527 `(("gmp" ,gmp)
5528 ("mpfr" ,mpfr)
5529 ("libqalculate" ,libqalculate)
5530 ("libxml2" ,libxml2)
5531 ("glib" ,glib)
5532 ("gtk+" ,gtk+)))
5533 (arguments
5534 `(#:phases
5535 (modify-phases %standard-phases
5536 (add-before 'bootstrap 'setenv
5537 ;; Prevent the autogen.sh script to carry out the configure
5538 ;; script, which has not yet been patched to replace /bin/sh.
5539 (lambda _
5540 (setenv "NOCONFIGURE" "TRUE")
5541 #t))
5542 (add-before 'check 'add-pot-file
5543 ;; the file contains translations and are currently not in use
5544 ;; left out on purpose so add it to POTFILES.skip
5545 (lambda _
5546 (with-output-to-file "po/POTFILES.skip"
5547 (lambda _
5548 (format #t "data/shortcuts.ui~%")
5549 #t))
5550 #t)))))
5551 (home-page "https://qalculate.github.io/")
5552 (synopsis "Multi-purpose graphical desktop calculator")
5553 (description
5554 "Qalculate-gtk is the GTK frontend for libqalculate. It is a
5555multi-purpose GUI desktop calculator. It provides basic and advanced
5556functionality. Features include customizable functions, unit calculations,
5557and conversions, physical constants, symbolic calculations (including
5558integrals and equations), arbitrary precision, uncertainity propagation,
5559interval arithmetic, plotting.")
5560 (license license:gpl2+)))