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