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