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