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