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