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