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