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