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