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