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