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