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