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