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