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