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