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