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