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