gnu: libqalculate: Fix libcurl gnutls CA cert bundle file.
[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 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 h5check
1302 (package
1303 (name "h5check")
1304 (version "2.0.1")
1305 (source
1306 (origin
1307 (method url-fetch)
1308 (uri (string-append "https://www.hdfgroup.org/ftp/HDF5/tools/"
1309 "h5check/src/h5check-" version ".tar.gz"))
1310 (sha256
1311 (base32
1312 "1gm76jbwhz9adbxgn14zx8cj33dmjdr2g5xcy0m9c2gakp8w59kj"))))
1313 (build-system gnu-build-system)
1314 (inputs `(("hdf5" ,hdf5))) ;h5cc for tests
1315 (home-page "https://www.hdfgroup.org/products/hdf5_tools/h5check.html")
1316 (synopsis "HDF5 format checker")
1317 (description "@code{h5check} is a validation tool for verifying that an
1318 HDF5 file is encoded according to the HDF File Format Specification.")
1319 (license (license:x11-style "file://COPYING"))))
1320
1321 (define-public itpp
1322 (package
1323 (name "itpp")
1324 (version "4.3.1")
1325 (source (origin
1326 (method url-fetch)
1327 (uri (string-append "mirror://sourceforge/itpp/itpp/"
1328 version "/itpp-"
1329 version ".tar.gz"))
1330 (sha256
1331 (base32
1332 "14ddy2xnb6sgp4hiax9v5sv4pr4l4dd4ps76nfha3nrpr1ikhcqm"))))
1333 (build-system cmake-build-system)
1334 (arguments `(#:tests? #f)) ; Tests require googletest *sources*
1335 (inputs `(("lapack" ,lapack)
1336 ("fftw" ,fftw)))
1337 ;; FIXME: Even though the fonts are available dvips complains:
1338 ;; "Font cmmi10 not found; characters will be left blank."
1339 (native-inputs
1340 `(("texlive" ,texlive-tiny)
1341 ("ghostscript" ,ghostscript)
1342 ("doxygen" ,doxygen)))
1343 (home-page "http://itpp.sourceforge.net")
1344 (synopsis "C++ library of maths, signal processing and communication classes")
1345 (description "IT++ is a C++ library of mathematical, signal processing and
1346 communication classes and functions. Its main use is in simulation of
1347 communication systems and for performing research in the area of
1348 communications. The kernel of the library consists of generic vector and
1349 matrix classes, and a set of accompanying routines. Such a kernel makes IT++
1350 similar to MATLAB, GNU Octave or SciPy.")
1351 (license license:gpl3+)))
1352
1353 (define-public netcdf
1354 (package
1355 (name "netcdf")
1356 (version "4.4.1.1")
1357 (source
1358 (origin
1359 (method url-fetch)
1360 (uri (string-append "ftp://ftp.unidata.ucar.edu/pub/netcdf/"
1361 "netcdf-" version ".tar.gz"))
1362 (sha256
1363 (base32
1364 "1blc7ik5yin7i0ls2kag0a9xjk12m0dzx6v1x88az3ras3scci2d"))
1365 (patches (search-patches "netcdf-date-time.patch"
1366 "netcdf-tst_h_par.patch"))))
1367 (build-system gnu-build-system)
1368 (native-inputs
1369 `(("m4" ,m4)
1370 ("doxygen" ,doxygen)
1371 ("graphviz" ,graphviz)))
1372 (inputs
1373 `(("hdf4" ,hdf4-alt)
1374 ("hdf5" ,hdf5)
1375 ("zlib" ,zlib)
1376 ("libjpeg" ,libjpeg)))
1377 (arguments
1378 `(#:configure-flags '("--enable-doxygen" "--enable-dot" "--enable-hdf4")
1379
1380 #:phases (modify-phases %standard-phases
1381 (add-before 'configure 'fix-source-date
1382 (lambda _
1383 ;; As we ${SOURCE_DATE_EPOCH} evaluates to "1" in the build
1384 ;; environment, `date -u -d ${SOURCE_DATE_EPOCH}` will evaluate
1385 ;; to '1st hour of the current day', and therefore makes the
1386 ;; package not reproducible.
1387 (substitute* "./configure"
1388 (("date -u -d \"\\$\\{SOURCE_DATE_EPOCH\\}\"")
1389 "date --date='@0'"))
1390 #t))
1391 (add-after 'configure 'patch-settings
1392 (lambda _
1393 ;; libnetcdf.settings contains the full filename of the compilers
1394 ;; used to build the library. We truncate the hashes of those
1395 ;; filenames to avoid unnecessary references to the corresponding
1396 ;; store items.
1397 (substitute* "libnetcdf.settings"
1398 (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
1399 (string-append prefix (string-take hash 10) "...")))
1400 #t)))
1401
1402 #:parallel-tests? #f)) ;various race conditions
1403 (home-page "https://www.unidata.ucar.edu/software/netcdf/")
1404 (synopsis "Library for scientific data")
1405 (description "NetCDF is an interface for scientific data access and a
1406 software library that provides an implementation of the interface. The netCDF
1407 library defines a machine-independent format for representing scientific data.
1408 Together, the interface, library, and format support the creation, access, and
1409 sharing of scientific data.")
1410 (license (license:x11-style "file://COPYRIGHT"))))
1411
1412 (define-public netcdf-parallel-openmpi
1413 (package (inherit netcdf)
1414 (name "netcdf-parallel-openmpi")
1415 (inputs
1416 `(("mpi" ,openmpi)
1417 ,@(alist-replace "hdf5" (list hdf5-parallel-openmpi)
1418 (package-inputs netcdf))))
1419 ;; TODO: Replace pkg-config references in nc-config with absolute references
1420 (arguments
1421 (substitute-keyword-arguments (package-arguments netcdf)
1422 ((#:configure-flags flags)
1423 `(cons* "CC=mpicc" "CXX=mpicxx"
1424 "--enable-parallel-tests"
1425 ;; Shared libraries not supported with parallel IO.
1426 "--disable-shared" "--with-pic"
1427 ,flags))))))
1428
1429 (define-public netcdf-fortran
1430 (package
1431 (name "netcdf-fortran")
1432 (version "4.4.4")
1433 (source (origin
1434 (method url-fetch)
1435 (uri (string-append
1436 "ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-fortran-"
1437 version ".tar.gz"))
1438 (sha256
1439 (base32
1440 "0xaxdcg1p83zmypwml3swsnr3ccn38inwldyr1l3wa4dbwbrblxj"))))
1441 (build-system gnu-build-system)
1442 (arguments
1443 `(#:parallel-tests? #f))
1444 (inputs
1445 `(("netcdf" ,netcdf)))
1446 (native-inputs
1447 `(("gfortran" ,gfortran)))
1448 (synopsis "Fortran interface for the netCDF library")
1449 (description (package-description netcdf))
1450 (home-page (package-home-page netcdf))
1451 (license (package-license netcdf))))
1452
1453 (define-public nlopt
1454 (package
1455 (name "nlopt")
1456 (version "2.4.2")
1457 (source (origin
1458 (method url-fetch)
1459 (uri (string-append "http://ab-initio.mit.edu/nlopt/nlopt-"
1460 version ".tar.gz"))
1461 (sha256
1462 (base32 "12cfkkhcdf4zmb6h7y6qvvdvqjs2xf9sjpa3rl3bq76px4yn76c0"))))
1463 (build-system gnu-build-system)
1464 (arguments
1465 `(;; Shared libraries are not built by default. They are required to
1466 ;; build the Guile, Octave, and Python bindings.
1467 #:configure-flags '("--enable-shared")
1468
1469 #:phases
1470 (modify-phases %standard-phases
1471 (add-before 'configure 'set-libnlopt-file-name
1472 (lambda* (#:key outputs #:allow-other-keys)
1473 ;; Make sure the Scheme module refers to the library by its
1474 ;; absolute file name (we cannot do that from a snippet
1475 ;; because the expansion of @libdir@ contains
1476 ;; ${exec_prefix}.)
1477 (let ((out (assoc-ref outputs "out")))
1478 (substitute* "swig/nlopt.scm.in"
1479 (("libnlopt")
1480 (string-append out "/lib/libnlopt")))
1481 #t))))))
1482 (inputs `(("guile" ,guile-2.0)))
1483 (native-inputs `(("pkg-config" ,pkg-config)))
1484 (home-page "http://ab-initio.mit.edu/wiki/")
1485 (synopsis "Library for nonlinear optimization")
1486 (description "NLopt is a library for nonlinear optimization, providing a
1487 common interface for a number of different free optimization routines available
1488 online as well as original implementations of various other algorithms.")
1489 (license license:lgpl2.1+)))
1490
1491 (define-public ipopt
1492 (package
1493 (name "ipopt")
1494 (version "3.12.12")
1495 (source (origin
1496 (method url-fetch)
1497 (uri (string-append
1498 "http://www.coin-or.org/download/source/Ipopt/Ipopt-"
1499 version".tgz"))
1500 (sha256
1501 (base32
1502 "07yn9rzdswjk8n246qq6ci9ssf2bcplkifcpsfz9j6cdxw9vgbkv"))
1503 (modules '((guix build utils)))
1504 (snippet
1505 ;; Make sure we don't use the bundled software.
1506 '(begin
1507 (delete-file-recursively "ThirdParty")
1508 #t))))
1509 (build-system gnu-build-system)
1510 (arguments
1511 '(#:phases (modify-phases %standard-phases
1512 (add-after 'install 'add--L-flags-in-ipopt.pc
1513 (lambda* (#:key inputs outputs #:allow-other-keys)
1514 ;; The '.pc' file lists '-llapack -lblas' in "Libs";
1515 ;; move it to "Libs.private" where it belongs, and add a
1516 ;; '-L' flag for LAPACK.
1517 (let ((out (assoc-ref outputs "out"))
1518 (lapack (assoc-ref inputs "lapack")))
1519 (substitute* (string-append out "/lib/pkgconfig/"
1520 "ipopt.pc")
1521 (("Libs: (.*)-llapack -lblas(.*)$" _ before after)
1522 (string-append "Libs: " before " " after "\n"
1523 "Libs.private: " before
1524 "-L" lapack "/lib -llapack -lblas "
1525 after "\n")))
1526 #t))))))
1527 (native-inputs
1528 `(("gfortran" ,gfortran)))
1529 (inputs
1530 ;; TODO: Maybe add dependency on COIN-MUMPS, ASL, and HSL.
1531 `(("lapack" ,lapack))) ;for both libblas and liblapack
1532 (home-page "http://www.coin-or.org")
1533 (synopsis "Large-scale nonlinear optimizer")
1534 (description
1535 "The Interior Point Optimizer (IPOPT) is a software package for
1536 large-scale nonlinear optimization. It provides C++, C, and Fortran
1537 interfaces.")
1538 (license license:epl1.0)))
1539
1540 (define-public clp
1541 (package
1542 (name "clp")
1543 (version "1.17.1")
1544 (source (origin
1545 (method url-fetch)
1546 (uri (string-append "https://www.coin-or.org/download/source/"
1547 "Clp/Clp-" version ".tgz"))
1548 (sha256
1549 (base32
1550 "1wdg820g3iikf9344ijwsc8sy6c0m6im42bzzizm6rlmkvnmxhk9"))
1551 (modules '((guix build utils)))
1552 (snippet
1553 ;; Make sure we don't use the bundled software.
1554 '(begin
1555 (delete-file-recursively "ThirdParty")
1556 #t))))
1557 (build-system gnu-build-system)
1558 (native-inputs
1559 `(("gfortran" ,gfortran)
1560 ("pkg-config" ,pkg-config)))
1561 (inputs
1562 `(("openblas" ,openblas)))
1563 (home-page "https://www.coin-or.org")
1564 (synopsis "Linear programming solver")
1565 (description
1566 "CLP is a high quality linear programming solver. Its main strengths are
1567 its dual and primal Simplex algorithms. It also has a barrier algorithm for
1568 linear and quadratic objectives. There are limited facilities for nonlinear
1569 and quadratic objectives using the Simplex algorithm.")
1570 (license license:epl1.0)))
1571
1572 (define-public ceres
1573 (package
1574 (name "ceres-solver")
1575 (version "1.14.0")
1576 (home-page "http://ceres-solver.org/")
1577 (source (origin
1578 (method url-fetch)
1579 (uri (string-append home-page "ceres-solver-"
1580 version ".tar.gz"))
1581 (sha256
1582 (base32
1583 "13lfxy8x58w8vprr0nkbzziaijlh0vvqshgahvcgw0mrqdgh0i27"))))
1584 (build-system cmake-build-system)
1585 (arguments
1586 ;; TODO: Build HTML user documentation and install separately.
1587 '(#:configure-flags '("-DBUILD_EXAMPLES=OFF"
1588 "-DBUILD_SHARED_LIBS=ON")
1589
1590 #:phases (modify-phases %standard-phases
1591 (add-before 'configure 'set-library-directory
1592 (lambda _
1593 ;; Install libraries to lib/, not lib64/.
1594 (substitute* "internal/ceres/CMakeLists.txt"
1595 (("set\\(LIB_SUFFIX \"64\"\\)")
1596 "set(LIB_SUFFIX \"\")"))
1597 #t)))))
1598 (native-inputs
1599 `(("pkg-config" ,pkg-config)))
1600 (propagated-inputs
1601 `(("glog" ,glog))) ;for #include <glog/glog.h>
1602 (inputs
1603 `(("eigen" ,eigen)
1604 ("blas" ,openblas)
1605 ("lapack" ,lapack)
1606 ("suitesparse" ,suitesparse)
1607 ("gflags" ,gflags)))
1608 (synopsis "C++ library for solving large optimization problems")
1609 (description
1610 "Ceres Solver is a C++ library for modeling and solving large,
1611 complicated optimization problems. It is a feature rich, mature and
1612 performant library which has been used in production since 2010. Ceres Solver
1613 can solve two kinds of problems:
1614 @enumerate
1615 @item non-linear least squares problems with bounds constraints;
1616 @item general unconstrained optimization problems.
1617 @end enumerate\n")
1618 (license license:bsd-3)))
1619
1620 ;; For a fully featured Octave, users are strongly recommended also to install
1621 ;; the following packages: less, ghostscript, gnuplot.
1622 (define-public octave-cli
1623 (package
1624 (name "octave-cli")
1625 (version "5.2.0")
1626 (source
1627 (origin
1628 (method url-fetch)
1629 (uri (string-append "mirror://gnu/octave/octave-"
1630 version ".tar.lz"))
1631 (sha256
1632 (base32
1633 "1848dq6nxzal8gwjrcp6xhi5gq96w89nss9d9rz75q408gb3mbl6"))))
1634 (build-system gnu-build-system)
1635 (inputs
1636 `(("alsa-lib" ,alsa-lib)
1637 ("arpack" ,arpack-ng)
1638 ("bdb" ,bdb)
1639 ("curl" ,curl)
1640 ("fftw" ,fftw)
1641 ("fftwf" ,fftwf)
1642 ("fltk" ,fltk)
1643 ("fontconfig" ,fontconfig)
1644 ("freetype" ,freetype)
1645 ("gl2ps" ,gl2ps)
1646 ("glpk" ,glpk)
1647 ("glu" ,glu)
1648 ("graphicsmagick" ,graphicsmagick)
1649 ("hdf5" ,hdf5)
1650 ("lapack" ,lapack)
1651 ("libsndfile" ,libsndfile)
1652 ("libxft" ,libxft)
1653 ("mesa" ,mesa)
1654 ("pcre" ,pcre)
1655 ("portaudio" ,portaudio)
1656 ("qhull" ,qhull)
1657 ("readline" ,readline)
1658 ("suitesparse" ,suitesparse)
1659 ("texinfo" ,texinfo)
1660 ("zlib" ,zlib)))
1661 (native-inputs
1662 `(("lzip" ,lzip)
1663 ("gfortran" ,gfortran)
1664 ("pkg-config" ,pkg-config)
1665 ("perl" ,perl)
1666 ;; The following inputs are not actually used in the build process.
1667 ;; However, the ./configure gratuitously tests for their existence and
1668 ;; assumes that programs not present at build time are also not, and
1669 ;; can never be, available at run time! If these inputs are therefore
1670 ;; not present, support for them will be built out. However, Octave
1671 ;; will still run without them, albeit without the features they
1672 ;; provide.
1673 ("less" ,less)
1674 ("ghostscript" ,ghostscript)
1675 ("gnuplot" ,gnuplot)))
1676 ;; Octave code uses this variable to detect directories holding multiple CA
1677 ;; certificates to verify peers with. This is required for the networking
1678 ;; functions that require encryption to work properly.
1679 (native-search-paths
1680 (list (search-path-specification
1681 (variable "CURLOPT_CAPATH")
1682 (files '("etc/ssl/certs")))))
1683 (arguments
1684 `(#:configure-flags
1685 (list (string-append "--with-shell="
1686 (assoc-ref %build-inputs "bash")
1687 "/bin/sh"))
1688 #:phases
1689 (modify-phases %standard-phases
1690 (add-after 'configure 'configure-makeinfo
1691 (lambda* (#:key inputs #:allow-other-keys)
1692 (substitute* "libinterp/corefcn/help.h"
1693 (("\"makeinfo\"")
1694 (string-append
1695 "\"" (assoc-ref inputs "texinfo") "/bin/makeinfo\"")))
1696 #t)))))
1697 (home-page "https://www.gnu.org/software/octave/")
1698 (synopsis "High-level language for numerical computation")
1699 (description "GNU Octave is a high-level interpreted language that is
1700 specialized for numerical computations. It can be used for both linear and
1701 non-linear applications and it provides great support for visualizing results.
1702 Work may be performed both at the interactive command-line as well as via
1703 script files.")
1704 (license license:gpl3+)))
1705
1706 (define-public octave
1707 (package (inherit octave-cli)
1708 (name "octave")
1709 (source (origin
1710 (inherit (package-source octave-cli))))
1711 (inputs
1712 `(("qscintilla" ,qscintilla)
1713 ("qt" ,qtbase)
1714 ,@(package-inputs octave-cli)))
1715 (native-inputs
1716 `(("qttools" , qttools) ;for lrelease
1717 ("texlive" ,(texlive-union (list texlive-epsf))) ; for texi2dvi
1718 ,@(package-native-inputs octave-cli)))
1719 (arguments
1720 (substitute-keyword-arguments (package-arguments octave-cli)
1721 ((#:phases phases)
1722 `(modify-phases ,phases
1723 (add-before 'configure 'patch-qscintilla-library-name
1724 (lambda* (#:key inputs #:allow-other-keys)
1725 ;; The QScintilla library that the Octave configure script tries
1726 ;; to link with should be named libqscintilla-qt5.so, but the
1727 ;; QScintilla input provides the shared library as
1728 ;; libqscintilla2_qt5.so.
1729 (substitute* "configure"
1730 (("qscintilla2-qt5")
1731 "qscintilla2_qt5"))
1732 #t))))))))
1733
1734 (define-public opencascade-oce
1735 (package
1736 (name "opencascade-oce")
1737 (version "0.17.2")
1738 (source
1739 (origin
1740 (method git-fetch)
1741 (uri (git-reference
1742 (url "https://github.com/tpaviot/oce.git")
1743 (commit (string-append "OCE-" version))))
1744 (file-name (git-file-name name version))
1745 (patches (search-patches "opencascade-oce-glibc-2.26.patch"))
1746 (sha256
1747 (base32 "0rg5wzkvfmzfl6v2amyryb8dnjad0nn9kyr607wy2gch6rciah69"))))
1748 (build-system cmake-build-system)
1749 (arguments
1750 '(#:configure-flags
1751 (list "-DOCE_TESTING:BOOL=ON"
1752 "-DOCE_USE_TCL_TEST_FRAMEWORK:BOOL=ON"
1753 "-DOCE_DRAW:BOOL=ON"
1754 (string-append "-DOCE_INSTALL_PREFIX:PATH="
1755 (assoc-ref %outputs "out"))
1756 "-UCMAKE_INSTALL_RPATH")))
1757 (inputs
1758 `(("freetype" ,freetype)
1759 ("glu" ,glu)
1760 ("libxmu" ,libxmu)
1761 ("mesa" ,mesa)
1762 ("tcl" ,tcl)
1763 ("tk" ,tk)))
1764 (native-inputs
1765 `(("python" ,python-wrapper)))
1766 (home-page "https://github.com/tpaviot/oce")
1767 (synopsis "Libraries for 3D modeling and numerical simulation")
1768 (description
1769 "Open CASCADE is a set of libraries for the development of applications
1770 dealing with 3D CAD data or requiring industrial 3D capabilities. It includes
1771 C++ class libraries providing services for 3D surface and solid modeling, CAD
1772 data exchange, and visualization. It is used for development of specialized
1773 software dealing with 3D models in design (CAD), manufacturing (CAM),
1774 numerical simulation (CAE), measurement equipment (CMM), and quality
1775 control (CAQ) domains.
1776
1777 This is the ``Community Edition'' (OCE) of Open CASCADE, which gathers
1778 patches, improvements, and experiments contributed by users over the official
1779 Open CASCADE library.")
1780 (license (list license:lgpl2.1; OCE libraries, with an exception for the
1781 ; use of header files; see
1782 ; OCCT_LGPL_EXCEPTION.txt
1783 license:public-domain; files
1784 ; src/Standard/Standard_StdAllocator.hxx and
1785 ; src/NCollection/NCollection_StdAllocator.hxx
1786 license:expat; file src/OpenGl/OpenGl_glext.h
1787 license:bsd-3)))); test framework gtest
1788
1789 (define-public opencascade-occt
1790 (package
1791 (name "opencascade-occt")
1792 (version "7.3.0p3")
1793 (source
1794 (origin
1795 (method git-fetch)
1796 (uri (git-reference
1797 (url "https://git.dev.opencascade.org/repos/occt.git")
1798 (commit
1799 (string-append "V"
1800 (string-map (lambda (x) (if (eq? x #\.) #\_ x))
1801 version)))))
1802 (file-name (git-file-name name version))
1803 (sha256
1804 (base32 "0bdywwxb6mk0ykbiajlvsb37295akqjp0a60y672qjfa67k0ljv4"))
1805 (modules '((guix build utils)))
1806 (snippet
1807 '(begin
1808 ;; Remove files specific to non-free operating systems.
1809 (delete-file-recursively "samples/ios")
1810 (delete-file-recursively "samples/mfc")
1811 (delete-file-recursively "samples/qt/FuncDemo")
1812 (delete-file "genconf.bat")
1813 (delete-file "gendoc.bat")
1814 (delete-file "genproj.bat")
1815 (delete-file "upgrade.bat")
1816 ;; Remove references to deleted files.
1817 (substitute* "dox/FILES_HTML.txt"
1818 ((".*standard.*") "" )
1819 ((".*UIKitSample.*") ""))
1820 #t))))
1821 (build-system cmake-build-system)
1822 (arguments
1823 '(;; There is no test target for make. OCCT provides an
1824 ;; 'Automated Testing System', which may be accessed after
1825 ;; installation via the draw.sh script. draw.sh is located in
1826 ;; the bin directory. For details see:
1827 ;; https://www.opencascade.com/doc/occt-7.3.0/overview/html/\
1828 ;; occt_dev_guides__tests.html
1829 #:tests? #f
1830 ;; Configure without freeimage: attempting to link against the
1831 ;; freeimage version 3.17 library leads to 'undefined
1832 ;; reference' errors.
1833 #:configure-flags
1834 (list "-DUSE_FREEIMAGE:BOOL=OFF"
1835 "-DUSE_TBB:BOOL=ON"
1836 "-DUSE_VTK:BOOL=OFF"
1837 "-DBUILD_DOC_Overview:BOOL=OFF"
1838 "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON"
1839 "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON"
1840 "-UCMAKE_INSTALL_LIBDIR")))
1841 (inputs
1842 `(("doxygen" ,doxygen)
1843 ;("freeimage" ,freeimage)
1844 ("freetype" ,freetype)
1845 ("glu" ,glu)
1846 ("libxext" ,libxext)
1847 ("libxi" ,libxi)
1848 ("libxmu" ,libxmu)
1849 ("mesa" ,mesa)
1850 ("tbb" ,tbb)
1851 ("tcl" ,tcl)
1852 ("tk" ,tk)))
1853 ;; TODO: build Overview documentation and add 'doc' output.
1854 (home-page "https://www.opencascade.com")
1855 (synopsis "Libraries for 3D modeling and numerical simulation")
1856 (description
1857 "Open CASCADE is a set of libraries for the development of applications
1858 dealing with 3D CAD data or requiring industrial 3D capabilities. It includes
1859 C++ class libraries providing services for 3D surface and solid modeling, CAD
1860 data exchange, and visualization. It is used for development of specialized
1861 software dealing with 3D models in design (CAD), manufacturing (CAM),
1862 numerical simulation (CAE), measurement equipment (CMM), and quality
1863 control (CAQ) domains.
1864
1865 This is the certified version of the Open Cascade Technology (OCCT) library.")
1866 (license (list ;; OCCT library:
1867 license:lgpl2.1; with an exception for the use of header
1868 ; files, see OCCT_LGPL_EXCEPTION.txt.
1869 ;; Files src/OpenGl/glext.h, adm/cmake/cotire.cmake and
1870 ;; src/OpenGl/OpenGl_HaltonSampler.hxx:
1871 license:expat
1872 ;; Files src/ExprIntrp/ExprIntrp.tab.* and
1873 ;; src/StepFile/step.tab.*:
1874 license:gpl3+ ; with Bison 2.2 exception.
1875 ;; File src/NCollection/NCollection_UtfIterator.lxx:
1876 (license:non-copyleft
1877 "https://www.unicode.org/license.html")
1878 ;; File src/NCollection/NCollection_StdAllocator.hxx:
1879 license:public-domain))))
1880
1881 (define-public gmsh
1882 (package
1883 (name "gmsh")
1884 (version "2.16.0")
1885 (source
1886 (origin
1887 (method git-fetch)
1888 (uri (git-reference
1889 (url "https://gitlab.onelab.info/gmsh/gmsh.git")
1890 (commit
1891 (string-append "gmsh_"
1892 (string-map (lambda (x) (if (eq? x #\.) #\_ x))
1893 version)))))
1894 (file-name (git-file-name name version))
1895 (sha256
1896 (base32 "08rq4jajwmlpivnm9yifz2jhaivnz065lnk0h2zv773nwl9wf162"))
1897 (modules '((guix build utils)))
1898 (snippet
1899 ;; Remove non-free METIS code
1900 '(begin
1901 (delete-file-recursively "contrib/Metis")
1902 #t))))
1903 (build-system cmake-build-system)
1904 (propagated-inputs
1905 `(("fltk" ,fltk)
1906 ("gfortran" ,gfortran)
1907 ("gmp" ,gmp)
1908 ("hdf5" ,hdf5)
1909 ("lapack" ,lapack)
1910 ("mesa" ,mesa)
1911 ("glu" ,glu)
1912 ("opencascade-oce" ,opencascade-oce)
1913 ("libx11" ,libx11)
1914 ("libxext" ,libxext)))
1915 (inputs
1916 `(("fontconfig" ,fontconfig)
1917 ("libxft" ,libxft)))
1918 (arguments
1919 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
1920 "-DENABLE_BUILD_SHARED:BOOL=ON"
1921 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")))
1922 (home-page "http://gmsh.info/")
1923 (synopsis "3D finite element grid generator")
1924 (description "Gmsh is a 3D finite element grid generator with a built-in
1925 CAD engine and post-processor. Its design goal is to provide a fast, light
1926 and user-friendly meshing tool with parametric input and advanced
1927 visualization capabilities. Gmsh is built around four modules: geometry,
1928 mesh, solver and post-processing. The specification of any input to these
1929 modules is done either interactively using the graphical user interface or in
1930 ASCII text files using Gmsh's own scripting language.")
1931 (license license:gpl2+)))
1932
1933 (define-public maxflow
1934 (package
1935 (name "maxflow")
1936 ;; Versioning is ambiguous: the git tag matching this commit is ‘3.0.5’,
1937 ;; which matches CMakeLists.txt, but README.md and CHANGES say ‘3.04’.
1938 (version "3.0.5")
1939 (source (origin
1940 (method git-fetch)
1941 (uri (git-reference
1942 (url "https://github.com/gerddie/maxflow.git")
1943 (commit version)))
1944 (file-name (git-file-name name version))
1945 (sha256
1946 (base32
1947 "0rll38whw55h0vcjrrwdnh9ascvxby0ph7n1l0d12z17cg215kkb"))))
1948 (build-system cmake-build-system)
1949 (home-page "https://pub.ist.ac.at/~vnk/software.html")
1950 (synopsis "Library implementing Maxflow algorithm")
1951 (description "An implementation of the maxflow algorithm described in
1952 @cite{An Experimental Comparison of Min-Cut/Max-Flow Algorithms for
1953 Energy Minimization in Computer Vision.\n
1954 Yuri Boykov and Vladimir Kolmogorov.\n
1955 In IEEE Transactions on Pattern Analysis and Machine Intelligence,\n
1956 September 2004}")
1957 (license license:gpl3+)))
1958
1959 (define-public petsc
1960 (package
1961 (name "petsc")
1962 (version "3.11.2")
1963 (source
1964 (origin
1965 (method url-fetch)
1966 ;; The *-lite-* tarball does not contain the *large* documentation
1967 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
1968 "petsc-lite-" version ".tar.gz"))
1969 (sha256
1970 (base32 "1645nwwcp9bcnfnxikk480mhbbacdvhsay2c401818hk97dqj5nx"))))
1971 (outputs '("out" ; libraries and headers
1972 "examples")) ; ~30MiB of examples
1973 (build-system gnu-build-system)
1974 (native-inputs
1975 `(("python" ,python-2)))
1976 (inputs
1977 `(("gfortran" ,gfortran)
1978 ("lapack" ,lapack)
1979 ("superlu" ,superlu)
1980 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
1981 ;; leaving out opengl, as configuration seems to only be for mac
1982 ))
1983 (arguments
1984 `(#:test-target "test"
1985 #:parallel-build? #f ; build is parallel by default
1986 #:configure-flags
1987 `("--with-mpi=0"
1988 "--with-openmp=1"
1989 "--with-superlu=1")
1990 #:make-flags
1991 ;; Honor (parallel-job-count) for build. Do not use --with-make-np,
1992 ;; whose value is dumped to $out/lib/petsc/conf/petscvariables.
1993 (list (format #f "MAKE_NP=~a" (parallel-job-count)))
1994 #:phases
1995 (modify-phases %standard-phases
1996 (replace 'configure
1997 ;; PETSc's configure script is actually a python script, so we can't
1998 ;; run it with bash.
1999 (lambda* (#:key outputs (configure-flags '())
2000 #:allow-other-keys)
2001 (let* ((prefix (assoc-ref outputs "out"))
2002 (flags `(,(string-append "--prefix=" prefix)
2003 ,@configure-flags)))
2004 (format #t "build directory: ~s~%" (getcwd))
2005 (format #t "configure flags: ~s~%" flags)
2006 (apply invoke "./configure" flags))))
2007 (add-after 'configure 'clean-local-references
2008 (lambda* (#:key outputs #:allow-other-keys)
2009 (let ((out (assoc-ref outputs "out")))
2010 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
2011 ;; Prevent build directory from leaking into compiled code
2012 (((getcwd)) out)
2013 ;; Scrub timestamp for reproducibility
2014 ((".*Libraries compiled on.*") ""))
2015 (substitute* (find-files "." "petscvariables")
2016 ;; Do not expose build machine characteristics, set to defaults.
2017 (("MAKE_NP = [:digit:]+") "MAKE_NP = 2")
2018 (("NPMAX = [:digit:]+") "NPMAX = 2"))
2019 #t)))
2020 (add-after 'install 'clean-install
2021 ;; Try to keep installed files from leaking build directory names.
2022 (lambda* (#:key inputs outputs #:allow-other-keys)
2023 (let ((out (assoc-ref outputs "out")))
2024 (substitute* (map (lambda (file)
2025 (string-append out "/lib/petsc/conf/" file))
2026 '("petscvariables"))
2027 (((getcwd)) out))
2028 ;; Make compiler references point to the store
2029 (substitute* (string-append out "/lib/petsc/conf/petscvariables")
2030 (("= (gcc|g\\+\\+|gfortran)" _ compiler)
2031 (string-append "= " (which compiler))))
2032 ;; PETSc installs some build logs, which aren't necessary.
2033 (for-each (lambda (file)
2034 (let ((f (string-append out "/lib/petsc/conf/" file)))
2035 (when (file-exists? f)
2036 (delete-file f))))
2037 '("configure.log" "make.log" "gmake.log"
2038 "test.log" "error.log" "RDict.db"
2039 "PETScBuildInternal.cmake"
2040 ;; Once installed, should uninstall with Guix
2041 "uninstall.py"))
2042 #t)))
2043 (add-after 'install 'move-examples
2044 (lambda* (#:key outputs #:allow-other-keys)
2045 (let* ((out (assoc-ref outputs "out"))
2046 (examples (assoc-ref outputs "examples"))
2047 (exdir (string-append out "/share/petsc/examples"))
2048 (exdir' (string-append examples "/share/petsc/examples")))
2049 (copy-recursively exdir exdir')
2050 (delete-file-recursively exdir)
2051 #t))))))
2052 (home-page "https://www.mcs.anl.gov/petsc")
2053 (synopsis "Library to solve PDEs")
2054 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
2055 data structures and routines for the scalable (parallel) solution of
2056 scientific applications modeled by partial differential equations.")
2057 (license (license:non-copyleft
2058 "https://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
2059
2060 (define-public petsc-complex
2061 (package (inherit petsc)
2062 (name "petsc-complex")
2063 (arguments
2064 (substitute-keyword-arguments (package-arguments petsc)
2065 ((#:configure-flags cf)
2066 `(cons "--with-scalar-type=complex" ,cf))))
2067 (synopsis "Library to solve PDEs (with complex scalars)")))
2068
2069 (define-public petsc-openmpi
2070 (package (inherit petsc)
2071 (name "petsc-openmpi")
2072 (inputs
2073 `(("hdf5" ,hdf5-parallel-openmpi)
2074 ("hypre" ,hypre-openmpi)
2075 ("metis" ,metis)
2076 ("mumps" ,mumps-openmpi)
2077 ("openmpi" ,openmpi)
2078 ("scalapack" ,scalapack)
2079 ("scotch" ,pt-scotch32)
2080 ,@(package-inputs petsc)))
2081 (arguments
2082 (substitute-keyword-arguments (package-arguments petsc)
2083 ((#:configure-flags cf)
2084 ``("--with-hypre=1"
2085 "--with-mpiexec=mpirun"
2086 "--with-metis=1"
2087 "--with-mumps=1"
2088 "--with-scalapack=1"
2089 "--with-ptscotch=1"
2090 ,(string-append "--with-mpi-dir="
2091 (assoc-ref %build-inputs "openmpi"))
2092 ,(string-append "--with-hdf5-include="
2093 (assoc-ref %build-inputs "hdf5") "/include")
2094 ,(string-append "--with-hdf5-lib="
2095 (assoc-ref %build-inputs "hdf5") "/lib/libhdf5.a")
2096 ,@(delete "--with-mpi=0" ,cf)))
2097 ((#:phases phases)
2098 `(modify-phases ,phases
2099 (add-before 'configure 'mpi-setup
2100 ,%openmpi-setup)))))
2101 (synopsis "Library to solve PDEs (with MUMPS and MPI support)")))
2102
2103 (define-public petsc-complex-openmpi
2104 (package (inherit petsc-complex)
2105 (name "petsc-complex-openmpi")
2106 (inputs
2107 `(("openmpi" ,openmpi)
2108 ,@(package-inputs petsc-complex)))
2109 (arguments
2110 (substitute-keyword-arguments (package-arguments petsc-complex)
2111 ((#:configure-flags cf)
2112 ``("--with-mpiexec=mpirun"
2113 ,(string-append "--with-mpi-dir="
2114 (assoc-ref %build-inputs "openmpi"))
2115 ,@(delete "--with-mpi=0" ,cf)))
2116 ((#:phases phases)
2117 `(modify-phases ,phases
2118 (add-before 'configure 'mpi-setup
2119 ,%openmpi-setup)))))
2120 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
2121
2122 (define-public python-petsc4py
2123 (package
2124 (name "python-petsc4py")
2125 (version "3.11.0")
2126 (source
2127 (origin
2128 (method url-fetch)
2129 (uri (pypi-uri "petsc4py" version))
2130 (sha256
2131 (base32
2132 "1rm1qj5wlkhxl39by9n78lh3gbmii31wsnb8j1rr5hvfr5xgbx2q"))))
2133 (build-system python-build-system)
2134 (arguments
2135 `(#:phases
2136 (modify-phases %standard-phases
2137 (add-before 'build 'pre-build
2138 (lambda _
2139 ;; Define path to PETSc installation.
2140 (setenv "PETSC_DIR" (assoc-ref %build-inputs "petsc"))
2141 #t))
2142 (add-before 'check 'mpi-setup
2143 ,%openmpi-setup))))
2144 (inputs
2145 `(("petsc" ,petsc-openmpi)
2146 ("python-numpy" ,python-numpy)))
2147 (home-page "https://bitbucket.org/petsc/petsc4py/")
2148 (synopsis "Python bindings for PETSc")
2149 (description "PETSc, the Portable, Extensible Toolkit for
2150 Scientific Computation, is a suite of data structures and routines for
2151 the scalable (parallel) solution of scientific applications modeled by
2152 partial differential equations. It employs the MPI standard for all
2153 message-passing communication. @code{petsc4py} provides Python
2154 bindings to almost all functions of PETSc.")
2155 (license license:bsd-3)))
2156
2157 (define-public python-kiwisolver
2158 (package
2159 (name "python-kiwisolver")
2160 (version "1.0.1")
2161 (source (origin
2162 (method url-fetch)
2163 (uri (pypi-uri "kiwisolver" version))
2164 (sha256
2165 (base32
2166 "0y22ci86znwwwfhbmvbgdfnbi6lv5gv2xkdlxvjw7lml43ayafyf"))))
2167 (build-system python-build-system)
2168 (home-page "https://github.com/nucleic/kiwi")
2169 (synopsis "Fast implementation of the Cassowary constraint solver")
2170 (description
2171 "Kiwi is an efficient C++ implementation of the Cassowary constraint
2172 solving algorithm. Kiwi has been designed from the ground up to be
2173 lightweight and fast. Kiwi ranges from 10x to 500x faster than the original
2174 Cassowary solver with typical use cases gaining a 40x improvement. Memory
2175 savings are consistently > 5x.")
2176 (license license:bsd-3)))
2177
2178 (define-public python2-kiwisolver
2179 (package-with-python2 python-kiwisolver))
2180
2181 (define-public slepc
2182 (package
2183 (name "slepc")
2184 (version "3.11.1")
2185 (source
2186 (origin
2187 (method url-fetch)
2188 (uri (string-append "http://slepc.upv.es/download/distrib/slepc-"
2189 version ".tar.gz"))
2190 (sha256
2191 (base32
2192 "1yq84q9wannc8xwapxpay4ypdd675picwi395hhsdvng9q6hf5j8"))))
2193 (build-system gnu-build-system)
2194 (native-inputs
2195 `(("python" ,python-2)
2196 ("petsc:examples" ,petsc "examples"))) ;for gmakegen.py script
2197 (inputs
2198 `(("arpack" ,arpack-ng)
2199 ("gfortran" ,gfortran)))
2200 (propagated-inputs
2201 `(("petsc" ,petsc)))
2202 (arguments
2203 `(#:parallel-build? #f ;build is parallel by default
2204 #:configure-flags
2205 `(,(string-append "--with-arpack-dir="
2206 (assoc-ref %build-inputs "arpack") "/lib"))
2207 #:make-flags ;honor (parallel-job-count)
2208 `(,(format #f "MAKE_NP=~a" (parallel-job-count))
2209 ,(string-append "PETSCCONFIGDIR="
2210 (assoc-ref %build-inputs "petsc:examples")
2211 "/share/petsc/examples/config"))
2212 #:phases
2213 (modify-phases %standard-phases
2214 (replace 'configure
2215 ;; configure is a python script, so we can't run it with bash.
2216 (lambda* (#:key inputs outputs (configure-flags '())
2217 #:allow-other-keys)
2218 (let* ((prefix (assoc-ref outputs "out"))
2219 (flags `(,(string-append "--prefix=" prefix)
2220 ,@configure-flags)))
2221 (format #t "build directory: ~s~%" (getcwd))
2222 (format #t "configure flags: ~s~%" flags)
2223 (setenv "SLEPC_DIR" (getcwd))
2224 (setenv "PETSC_DIR" (assoc-ref inputs "petsc"))
2225 (apply invoke "./configure" flags))))
2226 (add-after 'install 'delete-doc
2227 ;; TODO: SLEPc installs HTML documentation alongside headers in
2228 ;; $out/include. We'd like to move them to share/doc, but delete
2229 ;; them for now, as they are incomplete and installing the complete
2230 ;; documentation is difficult.
2231 (lambda* (#:key outputs #:allow-other-keys)
2232 (let* ((out (assoc-ref outputs "out")))
2233 (for-each delete-file (find-files out "\\.html$"))
2234 #t)))
2235 (add-after 'install 'clean-install
2236 ;; Clean up unnecessary build logs from installation.
2237 (lambda* (#:key outputs #:allow-other-keys)
2238 (let ((out (assoc-ref outputs "out")))
2239 (for-each (lambda (file)
2240 (let ((f (string-append out "/lib/slepc/conf/" file)))
2241 (when (file-exists? f)
2242 (delete-file f))))
2243 '("configure.log" "make.log" "gmake.log"
2244 "test.log" "error.log" "RDict.db"
2245 "uninstall.py"))
2246 #t))))))
2247 (home-page "http://slepc.upv.es")
2248 (synopsis "Scalable library for eigenproblems")
2249 (description "SLEPc is a software library for the solution of large sparse
2250 eigenproblems on parallel computers. It can be used for the solution of
2251 linear eigenvalue problems formulated in either standard or generalized form,
2252 as well as other related problems such as the singular value decomposition.
2253 The emphasis of the software is on methods and techniques appropriate for
2254 problems in which the associated matrices are sparse, for example, those
2255 arising after the discretization of partial differential equations.")
2256 (license license:bsd-2)))
2257
2258 (define-public slepc-complex
2259 (package (inherit slepc)
2260 (name "slepc-complex")
2261 (propagated-inputs
2262 `(("petsc" ,petsc-complex)
2263 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
2264 (synopsis "Scalable library for eigenproblems (with complex scalars)")))
2265
2266 (define-public slepc-openmpi
2267 (package (inherit slepc)
2268 (name "slepc-openmpi")
2269 (arguments
2270 (substitute-keyword-arguments (package-arguments slepc)
2271 ((#:phases phases '%standard-phases)
2272 `(modify-phases ,phases
2273 (add-before 'check 'mpi-setup
2274 ,%openmpi-setup)))))
2275 (inputs
2276 `(("mpi" ,openmpi)
2277 ("arpack" ,arpack-ng-openmpi)
2278 ,@(alist-delete "arpack" (package-inputs slepc))))
2279 (propagated-inputs
2280 `(("petsc" ,petsc-openmpi)
2281 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
2282 (synopsis "Scalable library for eigenproblems (with MPI support)")))
2283
2284 (define-public slepc-complex-openmpi
2285 (package (inherit slepc-openmpi)
2286 (name "slepc-complex-openmpi")
2287 (propagated-inputs
2288 `(("petsc" ,petsc-complex-openmpi)
2289 ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
2290 (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
2291
2292 (define-public python-slepc4py
2293 (package
2294 (name "python-slepc4py")
2295 (version "3.11.0")
2296 (source
2297 (origin
2298 (method url-fetch)
2299 (uri (pypi-uri "slepc4py" version))
2300 (sha256
2301 (base32
2302 "1ksp08kxf4wg408b9nn39z3qfhy643j22d4rfbl30vzxk2rxh4lq"))))
2303 (build-system python-build-system)
2304 (arguments
2305 `(#:phases
2306 (modify-phases %standard-phases
2307 (add-before 'build 'pre-build
2308 (lambda _
2309 ;; Define path to PETSc installation.
2310 (setenv "PETSC_DIR" (assoc-ref %build-inputs "petsc"))
2311 ;; Define path to SLEPc installation.
2312 (setenv "SLEPC_DIR" (assoc-ref %build-inputs "slepc"))
2313 #t))
2314 (add-before 'check 'mpi-setup
2315 ,%openmpi-setup))))
2316 (inputs
2317 `(("python-numpy" ,python-numpy)
2318 ("python-petsc4py" ,python-petsc4py)
2319 ("slepc" ,slepc-openmpi)))
2320 (home-page "https://bitbucket.org/slepc/slepc4py/")
2321 (synopsis "Python bindings for SLEPc")
2322 (description "SLEPc, the Scalable Library for Eigenvalue Problem
2323 Computations, is based on PETSc, the Portable, Extensible Toolkit for
2324 Scientific Computation. It employs the MPI standard for all
2325 message-passing communication. @code{slepc4py} provides Python
2326 bindings to almost all functions of SLEPc.")
2327 (license license:bsd-3)))
2328
2329 (define-public mumps
2330 (package
2331 (name "mumps")
2332 (version "5.2.1")
2333 (source
2334 (origin
2335 (method url-fetch)
2336 (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
2337 version ".tar.gz"))
2338 (sha256
2339 (base32
2340 "0jklh54x4y3ik1zkw6db7766kakjm5910diyaghfxxf8vwsgr26r"))
2341 (patches (search-patches "mumps-build-parallelism.patch"
2342 "mumps-shared-libseq.patch"
2343 "mumps-shared-mumps.patch"
2344 "mumps-shared-pord.patch"))))
2345 (build-system gnu-build-system)
2346 (inputs
2347 `(("fortran" ,gfortran)
2348 ;; These are required for linking against mumps, but we let the user
2349 ;; declare the dependency.
2350 ("blas" ,openblas)
2351 ("metis" ,metis)
2352 ("scotch" ,scotch)))
2353 (arguments
2354 `(#:modules ((ice-9 match)
2355 (ice-9 popen)
2356 (srfi srfi-1)
2357 ,@%gnu-build-system-modules)
2358 #:phases
2359 (modify-phases %standard-phases
2360 (replace 'configure
2361 (lambda* (#:key inputs #:allow-other-keys)
2362 (call-with-output-file "Makefile.inc"
2363 (lambda (port)
2364 (format port "
2365 PLAT =
2366 LIBEXT = .a
2367 OUTC = -o
2368 OUTF = -o
2369 RM = rm -f~:[
2370 CC = gcc
2371 FC = gfortran
2372 FL = gfortran
2373 INCSEQ = -I$(topdir)/libseq
2374 LIBSEQ = $(topdir)/libseq/libmpiseq.a
2375 LIBSEQNEEDED = libseqneeded~;
2376 CC = mpicc
2377 FC = mpifort
2378 FL = mpifort~]
2379 AR = ar vr # rules require trailing space, ugh...
2380 RANLIB = ranlib
2381 BLASDIR = ~a
2382 LIBBLAS = -Wl,-rpath=$(BLASDIR) -Wl,-rpath='$$ORIGIN' -L$(BLASDIR) -lopenblas~@[
2383 SCALAPDIR = ~a
2384 SCALAP = -Wl,-rpath=$(SCALAPDIR) -Wl,-rpath='$$ORIGIN' -L$(SCALAPDIR) -lscalapack~]
2385 LIBOTHERS = -pthread
2386 CDEFS = -DAdd_
2387 PIC = -fPIC
2388 OPTF = -O2 -DALLOW_NON_INIT $(PIC)
2389 OPTL = -O2 $(PIC)
2390 OPTC = -O2 $(PIC)
2391 INCS = $(INCSEQ)
2392 LIBS = $(SCALAP) $(LIBSEQ)
2393 LPORDDIR = $(topdir)/PORD/lib
2394 IPORD = -I$(topdir)/PORD/include
2395 LPORD = $(LPORDDIR)/libpord.a
2396 ORDERINGSF = -Dpord~@[
2397 METISDIR = ~a
2398 IMETIS = -I$(METISDIR)/include
2399 LMETIS = -Wl,-rpath $(METISDIR)/lib -L$(METISDIR)/lib -lmetis
2400 ORDERINGSF += -Dmetis~]~@[~:{
2401 SCOTCHDIR = ~a
2402 ISCOTCH = -I$(SCOTCHDIR)/include
2403 LSCOTCH = -Wl,-rpath $(SCOTCHDIR)/lib -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
2404 ORDERINGSF += ~a~}~]
2405 ORDERINGSC = $(ORDERINGSF)
2406 LORDERINGS = $(LPORD) $(LMETIS) $(LSCOTCH) $(LIBSEQ)
2407 IORDERINGSF = $(ISCOTCH)
2408 IORDERINGSC = $(IPORD) $(IMETIS) $(ISCOTCH)"
2409 (assoc-ref inputs "mpi")
2410 (assoc-ref inputs "blas")
2411 (assoc-ref inputs "scalapack")
2412 (assoc-ref inputs "metis")
2413 (match (list (assoc-ref inputs "pt-scotch")
2414 (assoc-ref inputs "scotch"))
2415 ((#f #f)
2416 #f)
2417 ((#f scotch)
2418 `((,scotch "" "-Dscotch")))
2419 ((ptscotch _)
2420 `((,ptscotch
2421 "-lptesmumps -lptscotch -lptscotcherr "
2422 "-Dptscotch")))))))))
2423 (replace 'build
2424 ;; By default only the d-precision library is built. Make with "all"
2425 ;; target so that all precision libraries and examples are built.
2426 (lambda _
2427 (invoke "make" "all"
2428 (format #f "-j~a" (parallel-job-count)))))
2429 (replace 'check
2430 ;; Run the simple test drivers, which read test input from stdin:
2431 ;; from the "real" input for the single- and double-precision
2432 ;; testers, and from the "cmplx" input for complex-precision
2433 ;; testers. The EXEC-PREFIX key is used by the mumps-openmpi
2434 ;; package to prefix execution with "mpirun".
2435 (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
2436 (with-directory-excursion "examples"
2437 (every
2438 (lambda (prec type)
2439 (let ((tester (apply open-pipe*
2440 `(,OPEN_WRITE
2441 ,@exec-prefix
2442 ,(string-append "./" prec
2443 "simpletest"))))
2444 (input (open-input-file
2445 (string-append "input_simpletest_" type))))
2446 (begin
2447 (dump-port input tester)
2448 (close-port input)
2449 (zero? (close-pipe tester)))))
2450 '("s" "d" "c" "z")
2451 '("real" "real" "cmplx" "cmplx")))))
2452 (replace 'install
2453 (lambda* (#:key outputs #:allow-other-keys)
2454 (let* ((out (assoc-ref outputs "out"))
2455 (libdir (string-append out "/lib")))
2456 (copy-recursively "lib" libdir)
2457 (copy-recursively "include" (string-append out "/include"))
2458 (when (file-exists? "libseq/libmpiseq.a")
2459 (install-file "libseq/libmpiseq.a" libdir))
2460 (when (file-exists? "libseq/libmpiseq.so")
2461 (install-file "libseq/libmpiseq.so" libdir))
2462 #t))))))
2463 (home-page "http://mumps.enseeiht.fr")
2464 (synopsis "Multifrontal sparse direct solver")
2465 (description
2466 "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
2467 sparse system of linear equations A x = b using Gaussian elimination.")
2468 (license license:cecill-c)))
2469
2470 (define-public mumps-metis
2471 (package (inherit mumps)
2472 (name "mumps-metis")
2473 (inputs
2474 (alist-delete "scotch" (package-inputs mumps)))))
2475
2476 (define-public mumps-openmpi
2477 (package (inherit mumps)
2478 (name "mumps-openmpi")
2479 (inputs
2480 `(("mpi" ,openmpi)
2481 ("scalapack" ,scalapack)
2482 ("pt-scotch" ,pt-scotch)
2483 ,@(alist-delete "scotch" (package-inputs mumps))))
2484 (arguments
2485 (substitute-keyword-arguments (package-arguments mumps)
2486 ((#:phases phases)
2487 `(modify-phases ,phases
2488 (add-before 'check 'mpi-setup
2489 ,%openmpi-setup)
2490 (replace 'check
2491 (lambda _
2492 ((assoc-ref ,phases 'check)
2493 #:exec-prefix '("mpirun" "-n" "2"))))))))
2494 (synopsis "Multifrontal sparse direct solver (with MPI)")))
2495
2496 (define-public mumps-metis-openmpi
2497 (package (inherit mumps-openmpi)
2498 (name "mumps-metis-openmpi")
2499 (inputs
2500 (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
2501
2502 (define-public ruby-asciimath
2503 (package
2504 (name "ruby-asciimath")
2505 (version "1.0.4")
2506 (source
2507 (origin
2508 (method url-fetch)
2509 (uri (rubygems-uri "asciimath" version))
2510 (sha256
2511 (base32
2512 "1d80kiph5mc78zps7si1hv48kv4k12mzaq8jk5kb3pqpjdr72qmc"))))
2513 (build-system ruby-build-system)
2514 (arguments
2515 '(#:phases
2516 (modify-phases %standard-phases
2517 ;; Apply this patch
2518 ;; https://github.com/asciidoctor/asciimath/commit/1c06fdc8086077f4785479f78b0823a4a72d7948
2519 (add-after 'unpack 'patch-remove-spurious-backslashes
2520 (lambda _
2521 (substitute* "spec/parser_spec.rb"
2522 (("\\\\\"")
2523 "\""))
2524 #t)))))
2525 (native-inputs
2526 `(("bundler" ,bundler)
2527 ("ruby-rspec" ,ruby-rspec)))
2528 (synopsis "AsciiMath parsing and conversion library")
2529 (description
2530 "A pure Ruby AsciiMath parsing and conversion library. AsciiMath is an
2531 easy-to-write markup language for mathematics.")
2532 (home-page "https://github.com/asciidoctor/asciimath")
2533 (license license:expat)))
2534
2535 (define-public superlu
2536 (package
2537 (name "superlu")
2538 (version "5.2.1")
2539 (source
2540 (origin
2541 (method url-fetch)
2542 (uri (string-append "https://portal.nersc.gov/project/sparse/superlu/"
2543 "superlu_" version ".tar.gz"))
2544 (sha256
2545 (base32 "0qzlb7cd608q62kyppd0a8c65l03vrwqql6gsm465rky23b6dyr8"))
2546 (modules '((guix build utils)))
2547 (snippet
2548 ;; Replace the non-free implementation of MC64 with a stub adapted
2549 ;; from Debian
2550 '(begin
2551 (use-modules (ice-9 regex)
2552 (ice-9 rdelim))
2553 (call-with-output-file "SRC/mc64ad.c"
2554 (lambda (port)
2555 (display "
2556 #include <stdio.h>
2557 #include <stdlib.h>
2558 void mc64id_(int *a) {
2559 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
2560 abort ();
2561 }
2562 void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
2563 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
2564 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
2565 abort ();
2566 }\n" port)))
2567 ;; Remove the corresponding license verbiage. MC64 license follows
2568 ;; a "------" line separator.
2569 (with-atomic-file-replacement "License.txt"
2570 (let ((rx (make-regexp "-{8}")))
2571 (lambda (in out)
2572 (let loop ()
2573 (let ((line (read-line in 'concat)))
2574 (unless (regexp-exec rx line)
2575 (display line out)
2576 (loop))))
2577 #t)))))))
2578 (build-system cmake-build-system)
2579 (native-inputs
2580 `(("tcsh" ,tcsh)))
2581 (inputs
2582 `(("blas" ,openblas)
2583 ("gfortran" ,gfortran)))
2584 (arguments
2585 `(#:configure-flags '("-Denable_blaslib:BOOL=NO" ;do not use internal cblas
2586 "-DTPL_BLAS_LIBRARIES=openblas"
2587 "-DBUILD_SHARED_LIBS:BOOL=YES")))
2588 (home-page "https://portal.nersc.gov/project/sparse/superlu/")
2589 (synopsis "Supernodal direct solver for sparse linear systems")
2590 (description
2591 "SuperLU is a general purpose library for the direct solution of large,
2592 sparse, nonsymmetric systems of linear equations on high performance machines.
2593 The library is written in C and is callable from either C or Fortran. The
2594 library routines perform an LU decomposition with partial pivoting and
2595 triangular system solves through forward and back substitution. The library
2596 also provides threshold-based ILU factorization preconditioners.")
2597 (license (list license:bsd-3
2598 license:gpl2+ ;EXAMPLE/*fgmr.c
2599 (license:fsf-free "file://SRC/colamd.h")))))
2600
2601 (define-public superlu-dist
2602 (package
2603 (name "superlu-dist")
2604 (version "6.2.0")
2605 (source
2606 (origin
2607 (method url-fetch)
2608 (uri (string-append "https://portal.nersc.gov/project/sparse/superlu/"
2609 "superlu_dist_" version ".tar.gz"))
2610 (sha256
2611 (base32 "1ynmwqajc9sc3my2hssa5k9s58ggvizqv9rdss0j7w99pbh5mnvw"))
2612 (modules '((guix build utils)))
2613 (snippet
2614 ;; Replace the non-free implementation of MC64 with a stub
2615 '(begin
2616 (call-with-output-file "SRC/mc64ad_dist.c"
2617 (lambda (port)
2618 (display "
2619 #include <stdio.h>
2620 #include <stdlib.h>
2621 void mc64id_dist(int *a) {
2622 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
2623 abort ();
2624 }
2625 void mc64ad_dist (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
2626 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
2627 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
2628 abort ();
2629 }\n" port)))
2630 (substitute* "SRC/util.c" ;adjust default algorithm
2631 (("RowPerm[[:blank:]]*=[[:blank:]]*LargeDiag_MC64;")
2632 ;; TODO: set to "LargeDiag_AWPM" once combinatorial-blas has
2633 ;; general (i.e. non-square) processor-grid support.
2634 "RowPerm = NOROWPERM;"))
2635 #t))
2636 (patches (search-patches "superlu-dist-scotchmetis.patch"
2637 "superlu-dist-awpm-grid.patch"))))
2638 (build-system cmake-build-system)
2639 (native-inputs
2640 `(("tcsh" ,tcsh)))
2641 (inputs
2642 `(("gfortran" ,gfortran)
2643 ("blas" ,openblas)
2644 ("lapack" ,lapack)
2645 ("combblas" ,combinatorial-blas)))
2646 (propagated-inputs
2647 `(("mpi" ,openmpi) ;headers include MPI heades
2648 ("parmetis" ,pt-scotch32 "metis")
2649 ("pt-scotch" ,pt-scotch32)))
2650 (arguments
2651 `(#:parallel-tests? #f ;tests use MPI and OpenMP
2652 #:configure-flags (list "-DBUILD_SHARED_LIBS:BOOL=YES"
2653 "-DTPL_ENABLE_COMBBLASLIB=YES"
2654 "-DTPL_BLAS_LIBRARIES=-lopenblas"
2655 "-DTPL_LAPACK_LIBRARIES=-llapack"
2656 (string-append "-DTPL_PARMETIS_LIBRARIES="
2657 (string-join
2658 '("ptscotchparmetis" "ptscotch" "ptscotcherr"
2659 "scotchmetis" "scotch" "scotcherr")
2660 ";"))
2661 (string-append "-DTPL_PARMETIS_INCLUDE_DIRS="
2662 (assoc-ref %build-inputs "parmetis")
2663 "/include")
2664 "-DTPL_ENABLE_COMBBLASLIB=ON"
2665 (string-append "-DTPL_COMBBLAS_INCLUDE_DIRS="
2666 (assoc-ref %build-inputs "combblas")
2667 "/include/CombBLAS;"
2668 (assoc-ref %build-inputs "combblas")
2669 "/include/BipartiteMatchings")
2670 "-DTPL_COMBBLAS_LIBRARIES=CombBLAS")
2671 #:phases
2672 (modify-phases %standard-phases
2673 (add-before 'configure 'set-c++-standard
2674 (lambda _
2675 (substitute* "CMakeLists.txt"
2676 ;; AWPM headers require C++14
2677 (("CMAKE_CXX_STANDARD 11") "CMAKE_CXX_STANDARD 14"))))
2678 (add-before 'check 'mpi-setup
2679 ,%openmpi-setup)
2680 (add-before 'check 'omp-setup
2681 (lambda _ (setenv "OMP_NUM_THREADS" "1") #t)))))
2682 (home-page (package-home-page superlu))
2683 (synopsis "Parallel supernodal direct solver")
2684 (description
2685 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
2686 It is targeted for distributed memory parallel machines. SuperLU_DIST is
2687 implemented in ANSI C, and MPI for communications.")
2688 (license license:bsd-3)))
2689
2690 (define-public scotch
2691 (package
2692 (name "scotch")
2693 (version "6.0.6")
2694 (source
2695 (origin
2696 (method url-fetch)
2697 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
2698 "latestfile/298/scotch_" version ".tar.gz"))
2699 (sha256
2700 (base32 "1ky4k9r6jvajhqaqnnx6h8fkmds2yxgp70dpr1qzwcyhi2nhqvv8"))
2701 (patches (search-patches "scotch-build-parallelism.patch"
2702 "scotch-integer-declarations.patch"))))
2703 (build-system gnu-build-system)
2704 (inputs
2705 `(("zlib" ,zlib)))
2706 (native-inputs
2707 `(("flex" ,flex)
2708 ("bison" ,bison)))
2709 (outputs '("out" "metis"))
2710 (arguments
2711 `(#:make-flags (list (string-append "prefix=" %output))
2712 #:phases
2713 (modify-phases %standard-phases
2714 (add-after
2715 'unpack 'chdir-to-src
2716 (lambda _ (chdir "src") #t))
2717 (replace
2718 'configure
2719 (lambda _
2720 (call-with-output-file "Makefile.inc"
2721 (lambda (port)
2722 (format port "
2723 EXE =
2724 LIB = .a
2725 OBJ = .o
2726 MAKE = make
2727 AR = ar
2728 ARFLAGS = -ruv
2729 CAT = cat
2730 CCS = gcc
2731 CCP = mpicc
2732 CCD = gcc
2733 CPPFLAGS =~{ -D~a~}
2734 CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
2735 LDFLAGS = -lz -lm -lrt -lpthread
2736 CP = cp
2737 LEX = flex -Pscotchyy -olex.yy.c
2738 LN = ln
2739 MKDIR = mkdir
2740 MV = mv
2741 RANLIB = ranlib
2742 YACC = bison -pscotchyy -y -b y
2743 "
2744 '("COMMON_FILE_COMPRESS_GZ"
2745 "COMMON_PTHREAD"
2746 "COMMON_RANDOM_FIXED_SEED"
2747 "INTSIZE64" ;use 'int64_t'
2748 ;; Prevents symbolc clashes with libesmumps
2749 "SCOTCH_RENAME"
2750 ;; XXX: Causes invalid frees in superlu-dist tests
2751 ;; "SCOTCH_PTHREAD"
2752 ;; "SCOTCH_PTHREAD_NUMBER=2"
2753 "restrict=__restrict"))))
2754 #t))
2755 (add-after 'build 'build-esmumps
2756 (lambda _
2757 (invoke "make"
2758 (format #f "-j~a" (parallel-job-count))
2759 "esmumps")))
2760 (add-before 'install 'make-install-dirs
2761 (lambda* (#:key outputs #:allow-other-keys)
2762 (mkdir (assoc-ref outputs "out"))))
2763 (add-after 'install 'install-metis
2764 (lambda* (#:key outputs #:allow-other-keys)
2765 (let ((out (assoc-ref outputs "metis")))
2766 (mkdir out)
2767 ;; metis files are not installed with 'make install'
2768 (for-each (lambda (f)
2769 (install-file f (string-append out "/include")))
2770 (find-files "../include/" ".*metis\\.h"))
2771 (for-each (lambda (f)
2772 (install-file f (string-append out "/lib")))
2773 (find-files "../lib/" ".*metis\\..*"))
2774 #t))))))
2775 (home-page "https://www.labri.fr/perso/pelegrin/scotch/")
2776 (synopsis "Programs and libraries for graph algorithms")
2777 (description "SCOTCH is a set of programs and libraries which implement
2778 the static mapping and sparse matrix reordering algorithms developed within
2779 the SCOTCH project. Its purpose is to apply graph theory, with a divide and
2780 conquer approach, to scientific computing problems such as graph and mesh
2781 partitioning, static mapping, and sparse matrix ordering, in application
2782 domains ranging from structural mechanics to operating systems or
2783 bio-chemistry.")
2784 ;; See LICENSE_en.txt
2785 (license license:cecill-c)))
2786
2787 (define-public scotch32
2788 ;; This is the 'INTSIZE32' variant, which uses 32-bit integers, as needed by
2789 ;; some applications.
2790 (package (inherit scotch)
2791 (name "scotch32")
2792 (arguments
2793 (substitute-keyword-arguments (package-arguments scotch)
2794 ((#:phases scotch-phases)
2795 `(modify-phases ,scotch-phases
2796 (replace
2797 'configure
2798 (lambda _
2799 (call-with-output-file "Makefile.inc"
2800 (lambda (port)
2801 (format port "
2802 EXE =
2803 LIB = .a
2804 OBJ = .o
2805 MAKE = make
2806 AR = ar
2807 ARFLAGS = -ruv
2808 CAT = cat
2809 CCS = gcc
2810 CCP = mpicc
2811 CCD = gcc
2812 CPPFLAGS =~{ -D~a~}
2813 CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
2814 LDFLAGS = -lz -lm -lrt -lpthread
2815 CP = cp
2816 LEX = flex -Pscotchyy -olex.yy.c
2817 LN = ln
2818 MKDIR = mkdir
2819 MV = mv
2820 RANLIB = ranlib
2821 YACC = bison -pscotchyy -y -b y
2822 "
2823 '("COMMON_FILE_COMPRESS_GZ"
2824 "COMMON_PTHREAD"
2825 "COMMON_RANDOM_FIXED_SEED"
2826 "INTSIZE32" ;use 32-bit integers. See INSTALL.txt
2827 ;; Prevents symbolc clashes with libesmumps
2828 "SCOTCH_RENAME"
2829 ;; XXX: Causes invalid frees in superlu-dist tests
2830 ;; "SCOTCH_PTHREAD"
2831 ;; "SCOTCH_PTHREAD_NUMBER=2"
2832 "restrict=__restrict"))))))))))
2833 (synopsis
2834 "Programs and libraries for graph algorithms (32-bit integers)")))
2835
2836 (define-public pt-scotch
2837 (package (inherit scotch)
2838 (name "pt-scotch")
2839 (propagated-inputs
2840 `(("openmpi" ,openmpi))) ;Headers include MPI headers
2841 (arguments
2842 (substitute-keyword-arguments (package-arguments scotch)
2843 ((#:phases scotch-phases)
2844 `(modify-phases ,scotch-phases
2845 (replace
2846 'build
2847 (lambda _
2848 (invoke "make" (format #f "-j~a" (parallel-job-count))
2849 "ptscotch" "ptesmumps")
2850
2851 ;; Install the serial metis compatibility library
2852 (invoke "make" "-C" "libscotchmetis" "install")))
2853 (add-before 'check 'mpi-setup
2854 ,%openmpi-setup)
2855 (replace 'check
2856 (lambda _
2857 (invoke "make" "ptcheck")))))))
2858 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
2859
2860 (define-public pt-scotch32
2861 (package (inherit scotch32)
2862 (name "pt-scotch32")
2863 (propagated-inputs
2864 `(("openmpi" ,openmpi))) ;headers include MPI headers
2865 (arguments
2866 (substitute-keyword-arguments (package-arguments scotch32)
2867 ((#:phases scotch32-phases)
2868 `(modify-phases ,scotch32-phases
2869 (replace 'build
2870 (lambda _
2871 (invoke "make" (format #f "-j~a" (parallel-job-count))
2872 "ptscotch" "ptesmumps")
2873 ;; Install the serial metis compatibility library
2874 (invoke "make" "-C" "libscotchmetis" "install")))
2875 (add-before 'check 'mpi-setup
2876 ,%openmpi-setup)
2877 (replace 'check
2878 (lambda _
2879 (invoke "make" "ptcheck")))))))
2880 (synopsis
2881 "Programs and libraries for graph algorithms (with MPI and 32-bit integers)")))
2882
2883 (define-public metis
2884 (package
2885 (name "metis")
2886 (version "5.1.0")
2887 (source
2888 (origin
2889 (method url-fetch)
2890 (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
2891 "metis-" version ".tar.gz"))
2892 (sha256
2893 (base32
2894 "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
2895 (build-system cmake-build-system)
2896 (inputs
2897 `(("blas" ,openblas)))
2898 (arguments
2899 `(#:tests? #f ;no tests
2900 #:configure-flags `("-DSHARED=ON"
2901 ,(string-append "-DGKLIB_PATH=" (getcwd)
2902 "/metis-" ,version "/GKlib"))))
2903 (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
2904 (synopsis "Graph partitioning and fill-reducing matrix ordering library")
2905 (description
2906 "METIS is a set of serial programs for partitioning graphs, partitioning
2907 finite element meshes, and producing fill-reducing orderings for sparse
2908 matrices. The algorithms implemented in METIS are based on the multilevel
2909 recursive-bisection, multilevel k-way, and multi-constraint partitioning
2910 schemes.")
2911 (license license:asl2.0))) ;As of version 5.0.3
2912
2913 (define-public p4est
2914 (package
2915 (name "p4est")
2916 (version "2.0")
2917 (source
2918 (origin
2919 (method url-fetch)
2920 (uri (string-append "http://p4est.github.io/release/p4est-"
2921 version ".tar.gz"))
2922 (sha256
2923 (base32
2924 "16h267z256kxcxfjs390qqzv19hr58vrj4x8lndb7alnk2vca8n5"))))
2925 (build-system gnu-build-system)
2926 (inputs
2927 `(("fortran" ,gfortran)
2928 ("blas" ,openblas)
2929 ("lapack" ,lapack)
2930 ("zlib" ,zlib)))
2931 (arguments
2932 `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
2933 (assoc-ref %build-inputs "blas")
2934 " -lopenblas")
2935 ,(string-append "LAPACK_LIBS=-L"
2936 (assoc-ref %build-inputs "lapack")
2937 " -llapack"))
2938 #:phases (modify-phases %standard-phases
2939 (add-before 'check 'mpi-setup
2940 ,%openmpi-setup))))
2941 (home-page "http://www.p4est.org")
2942 (synopsis "Adaptive mesh refinement on forests of octrees")
2943 (description
2944 "The p4est software library enables the dynamic management of a
2945 collection of adaptive octrees, conveniently called a forest of octrees.
2946 p4est is designed to work in parallel and scales to hundreds of thousands of
2947 processor cores.")
2948 (license license:gpl2+)))
2949
2950 (define-public p4est-openmpi
2951 (package (inherit p4est)
2952 (name "p4est-openmpi")
2953 (inputs
2954 `(("mpi" ,openmpi)
2955 ,@(package-inputs p4est)))
2956 (arguments
2957 (substitute-keyword-arguments (package-arguments p4est)
2958 ((#:configure-flags cf)
2959 ``("--enable-mpi" ,@,cf))))
2960 (synopsis "Parallel adaptive mesh refinement on forests of octrees")))
2961
2962 (define-public gsegrafix
2963 (package
2964 (name "gsegrafix")
2965 (version "1.0.6")
2966 (source
2967 (origin
2968 (method url-fetch)
2969 (uri (string-append "mirror://gnu/" name "/" name "-"
2970 version ".tar.gz"))
2971 (sha256
2972 (base32
2973 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
2974 (build-system gnu-build-system)
2975 (arguments
2976 `(#:configure-flags '("LDFLAGS=-lm")))
2977 (inputs
2978 `(("libgnomecanvas" ,libgnomecanvas)
2979 ("libbonoboui" ,libbonoboui)
2980 ("libgnomeui" ,libgnomeui)
2981 ("libgnomeprintui" ,libgnomeprintui)
2982 ("popt" ,popt)))
2983 (native-inputs
2984 `(("pkg-config" ,pkg-config)))
2985 (home-page "https://www.gnu.org/software/gsegrafix/")
2986 (synopsis "GNOME application to create scientific and engineering plots")
2987 (description "GSEGrafix is an application which produces high-quality graphical
2988 plots for science and engineering. Plots are specified via simple ASCII
2989 parameter files and data files and are presented in an anti-aliased GNOME
2990 canvas. The program supports rectangular two-dimensional plots, histograms,
2991 polar-axis plots and three-dimensional plots. Plots can be printed or saved
2992 to BMP, JPEG or PNG image formats.")
2993 (license license:gpl3+)))
2994
2995 (define-public maxima
2996 (package
2997 (name "maxima")
2998 (version "5.43.0")
2999 (source
3000 (origin
3001 (method url-fetch)
3002 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
3003 version "-source/" name "-" version ".tar.gz"))
3004 (sha256
3005 (base32
3006 "0xyahp4c6509haxh4n1swiqm3421gplkdisa0zypclh3252sbzfw"))
3007 (patches (search-patches "maxima-defsystem-mkdir.patch"))))
3008 (build-system gnu-build-system)
3009 (inputs
3010 `(("gcl" ,gcl)
3011 ("gnuplot" ,gnuplot) ;for plots
3012 ("sed" ,sed)
3013 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
3014 (native-inputs
3015 `(("texinfo" ,texinfo)
3016 ("perl" ,perl)
3017 ("python" ,python)))
3018 (arguments
3019 `(#:configure-flags
3020 (list "--enable-gcl"
3021 (string-append "--with-posix-shell="
3022 (assoc-ref %build-inputs "bash")
3023 "/bin/sh")
3024 (string-append "--with-wish="
3025 (assoc-ref %build-inputs "tk")
3026 "/bin/wish"
3027 (let ((v ,(package-version tk)))
3028 (string-take v (string-index-right v #\.)))))
3029 ;; By default Maxima attempts to write temporary files to
3030 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
3031 ;; Work around that.
3032 #:make-flags (list "TMPDIR=/tmp")
3033 #:phases
3034 (modify-phases %standard-phases
3035 (add-after 'unpack 'patch-paths
3036 (lambda* (#:key inputs #:allow-other-keys)
3037 (let* ((sed (string-append (assoc-ref inputs "sed") "/bin/sed"))
3038 (coreutils (assoc-ref inputs "coreutils"))
3039 (dirname (string-append coreutils "/bin/dirname"))
3040 (head (string-append coreutils "/bin/head"))
3041 (perl (string-append (assoc-ref inputs "perl") "/bin/perl"))
3042 (python (string-append (assoc-ref inputs "python")
3043 "/bin/python3")))
3044 (substitute* "src/maxima.in"
3045 (("sed ") (string-append sed " "))
3046 (("dirname") dirname)
3047 (("head") head))
3048 (substitute* "doc/info/Makefile.in"
3049 (("/usr/bin/env perl") perl))
3050 (substitute* "doc/info/build_html.sh.in"
3051 (("python") python))
3052 #t)))
3053 (add-before 'check 'pre-check
3054 (lambda _
3055 (chmod "src/maxima" #o555)
3056 #t))
3057 (replace 'check
3058 (lambda _
3059 ;; This is derived from the testing code in the "debian/rules" file
3060 ;; of Debian's Maxima package.
3061 ;; If Maxima can successfully run this, the binary to be installed
3062 ;; should be fine.
3063 (invoke "sh" "-c"
3064 (string-append
3065 "./maxima-local "
3066 "--lisp=gcl "
3067 "--batch-string=\"run_testsuite();\" "
3068 "| grep -q \"No unexpected errors found\""))))
3069 ;; Make sure the doc and emacs files are found in the
3070 ;; standard location. Also configure maxima to find gnuplot
3071 ;; without having it on the PATH.
3072 (add-after 'install 'post-install
3073 (lambda* (#:key outputs inputs #:allow-other-keys)
3074 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
3075 (out (assoc-ref outputs "out"))
3076 (datadir (string-append out "/share/maxima/" ,version))
3077 (binutils (string-append (assoc-ref inputs "binutils")
3078 "/bin")))
3079 (with-directory-excursion out
3080 (mkdir-p "share/emacs")
3081 (mkdir-p "share/doc")
3082 (symlink
3083 (string-append datadir "/doc/")
3084 (string-append out "/share/doc/maxima"))
3085 (with-atomic-file-replacement
3086 (string-append datadir "/share/maxima-init.lisp")
3087 (lambda (in out)
3088 (format out "~a ~s~a~%"
3089 "(setf $gnuplot_command "
3090 (string-append gnuplot "/bin/gnuplot") ")")
3091 (dump-port in out))))
3092 ;; Ensure that Maxima will have access to the GNU binutils
3093 ;; components at runtime.
3094 (wrap-program (string-append out "/bin/maxima")
3095 `("PATH" prefix (,binutils))))
3096 #t)))))
3097 (home-page "http://maxima.sourceforge.net")
3098 (synopsis "Numeric and symbolic expression manipulation")
3099 (description "Maxima is a system for the manipulation of symbolic and
3100 numerical expressions. It yields high precision numeric results by using
3101 exact fractions, arbitrary precision integers, and variable precision floating
3102 point numbers.")
3103 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
3104 ;; Others simply say "GNU General Public License" without stating a
3105 ;; version (which implicitly means gpl1+).
3106 ;; At least one file (src/maxima.asd) says "version 2."
3107 ;; GPLv2 only is therefore the smallest subset.
3108 (license license:gpl2)))
3109
3110 (define-public wxmaxima
3111 (package
3112 (name "wxmaxima")
3113 (version "20.03.1")
3114 (source
3115 (origin
3116 (method git-fetch)
3117 (uri (git-reference
3118 (url "https://github.com/wxMaxima-developers/wxmaxima.git")
3119 (commit (string-append "Version-" version))))
3120 (file-name (git-file-name name version))
3121 (sha256
3122 (base32 "09ciip0wkahps5jdsqqr72bwjrd15bacw38zp23v3hm71xfk8hky"))))
3123 (build-system cmake-build-system)
3124 (native-inputs
3125 `(("gettext" ,gettext-minimal)
3126 ("xorg-server" ,xorg-server-for-tests)))
3127 ;; TODO: Add libomp for multithreading support.
3128 ;; As of right now, enabling libomp causes the imageCells.wxm test to fail.
3129 (inputs
3130 `(("wxwidgets" ,wxwidgets)
3131 ("maxima" ,maxima)
3132 ;; Runtime support.
3133 ("adwaita-icon-theme" ,adwaita-icon-theme)
3134 ("gtk+" ,gtk+)
3135 ("shared-mime-info" ,shared-mime-info)))
3136 (arguments
3137 `(#:test-target "test"
3138 #:phases
3139 (modify-phases %standard-phases
3140 (add-before 'check 'pre-check
3141 (lambda _
3142 ;; Tests require a running X server.
3143 (system "Xvfb :1 &")
3144 (setenv "DISPLAY" ":1")
3145 (setenv "HOME" (getcwd))
3146 #t))
3147 (add-after 'install 'wrap-program
3148 (lambda* (#:key inputs outputs #:allow-other-keys)
3149 (wrap-program (string-append (assoc-ref outputs "out")
3150 "/bin/wxmaxima")
3151 `("PATH" ":" prefix
3152 (,(string-append (assoc-ref inputs "maxima")
3153 "/bin")))
3154 ;; For GtkFileChooserDialog.
3155 `("GSETTINGS_SCHEMA_DIR" =
3156 (,(string-append (assoc-ref inputs "gtk+")
3157 "/share/glib-2.0/schemas")))
3158 `("XDG_DATA_DIRS" ":" prefix
3159 (;; Needed by gdk-pixbuf to know supported icon formats.
3160 ,(string-append
3161 (assoc-ref inputs "shared-mime-info") "/share")
3162 ;; The default icon theme of GTK+.
3163 ,(string-append
3164 (assoc-ref inputs "adwaita-icon-theme") "/share"))))
3165 #t)))))
3166 (home-page "https://wxmaxima-developers.github.io/wxmaxima/")
3167 (synopsis "Graphical user interface for the Maxima computer algebra system")
3168 (description
3169 "wxMaxima is a graphical user interface for the Maxima computer algebra
3170 system. It eases the use of Maxima by making most of its commands available
3171 through a menu system and by providing input dialogs for commands that require
3172 more than one argument. It also implements its own display engine that
3173 outputs mathematical symbols directly instead of depicting them with ASCII
3174 characters.
3175
3176 wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
3177 text and mathematical calculations to create documents, exporting of input and
3178 output to TeX, and a browser for Maxima's manual including command index and
3179 full text searching.")
3180 (license license:gpl2+)))
3181
3182 (define-public armadillo
3183 (package
3184 (name "armadillo")
3185 (version "9.100.5")
3186 (source (origin
3187 (method url-fetch)
3188 (uri (string-append "mirror://sourceforge/arma/armadillo-"
3189 version ".tar.xz"))
3190 (sha256
3191 (base32
3192 "1ka1vd9fcmvp12qkcm4888dkfqwnalvv00x04wy29f3nx3qwczby"))))
3193 (build-system cmake-build-system)
3194 (arguments `(#:tests? #f)) ; no test target
3195 (inputs
3196 `(("openblas" ,openblas)
3197 ("lapack" ,lapack)
3198 ("arpack" ,arpack-ng)))
3199 (home-page "http://arma.sourceforge.net/")
3200 (synopsis "C++ linear algebra library")
3201 (description
3202 "Armadillo is a C++ linear algebra library, aiming towards a good balance
3203 between speed and ease of use. It is useful for algorithm development
3204 directly in C++, or quick conversion of research code into production
3205 environments. It can be used for machine learning, pattern recognition,
3206 signal processing, bioinformatics, statistics, econometrics, etc. The library
3207 provides efficient classes for vectors, matrices and cubes, as well as 150+
3208 associated functions (e.g., contiguous and non-contiguous submatrix views).")
3209 (license license:asl2.0)))
3210
3211 (define-public muparser
3212 ;; When switching download sites, muparser re-issued a 2.2.5 release with a
3213 ;; different hash. In order to make `guix package --upgrade` work correctly,
3214 ;; we set a Guix packaging revision.
3215 ;; When the next version of muparser is released, we can remove
3216 ;; UPSTREAM-VERSION and REVISION and use the plain VERSION.
3217 (let ((upstream-version "2.2.5")
3218 (revision "2"))
3219 (package
3220 (name "muparser")
3221 (version (string-append upstream-version "-" revision))
3222 (source
3223 (origin
3224 (method git-fetch)
3225 (uri (git-reference
3226 (url "https://github.com/beltoforion/muparser.git")
3227 (commit (string-append "v" upstream-version))))
3228 (file-name (git-file-name name version))
3229 (sha256
3230 (base32 "0f0g4995xngf1pp3zr4p6ai2f8v6f8bxwa0k8ayjjiv1l8h44m24"))))
3231 (build-system gnu-build-system)
3232 (arguments
3233 `(#:configure-flags '("--enable-samples=no")
3234 #:tests? #f)) ;no "check" target
3235 (home-page "http://muparser.beltoforion.de/")
3236 (synopsis "Fast parser library for mathematical expressions")
3237 (description
3238 "muParser is an extensible high performance math parser library. It is
3239 based on transforming an expression into a bytecode and precalculating constant
3240 parts of it.")
3241 (license license:expat))))
3242
3243 (define-public openblas
3244 (package
3245 (name "openblas")
3246 (version "0.3.7")
3247 (source
3248 (origin
3249 (method url-fetch)
3250 (uri (string-append "mirror://sourceforge/openblas/v" version "/OpenBLAS%20"
3251 version "%20version.tar.gz"))
3252 (file-name (string-append name "-" version ".tar.gz"))
3253 (sha256
3254 (base32
3255 "0jbdjsi0qsxahdcm42agnn1y7xpmg0hrhwjsxg0zbhs9wwy3p568"))))
3256 (build-system gnu-build-system)
3257 (arguments
3258 `(#:test-target "test"
3259 ;; DYNAMIC_ARCH is only supported on x86. When it is disabled and no
3260 ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
3261 ;; we need to disable substitutions.
3262 #:substitutable?
3263 ,(let ((system (or (%current-target-system) (%current-system))))
3264 (or (string-prefix? "x86_64" system)
3265 (string-prefix? "i686" system)
3266 (string-prefix? "mips" system)
3267 (string-prefix? "aarch64" system)))
3268 #:make-flags
3269 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
3270 "SHELL=bash"
3271 "MAKE_NB_JOBS=0" ;use jobserver for submakes
3272
3273 ;; This is the maximum number of threads OpenBLAS will ever use (that
3274 ;; is, if $OPENBLAS_NUM_THREADS is greater than that, then NUM_THREADS
3275 ;; is used.) If we don't set it, the makefile sets it to the number
3276 ;; of cores of the build machine, which is obviously wrong.
3277 "NUM_THREADS=128"
3278
3279 ;; Build the library for all supported CPUs. This allows
3280 ;; switching CPU targets at runtime with the environment variable
3281 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
3282 ;; Unfortunately, this is not supported on non-x86 architectures,
3283 ;; where it leads to failed builds.
3284 ,@(let ((system (or (%current-target-system) (%current-system))))
3285 (cond
3286 ((or (string-prefix? "x86_64" system)
3287 (string-prefix? "i686" system))
3288 '("DYNAMIC_ARCH=1"))
3289 ;; On MIPS we force the "SICORTEX" TARGET, as for the other
3290 ;; two available MIPS targets special extended instructions
3291 ;; for Loongson cores are used.
3292 ((string-prefix? "mips" system)
3293 '("TARGET=SICORTEX"))
3294 ;; On aarch64 force the generic 'armv8-a' target
3295 ((string-prefix? "aarch64" system)
3296 '("TARGET=ARMV8"))
3297 (else '()))))
3298 ;; no configure script
3299 #:phases
3300 (modify-phases %standard-phases
3301 (delete 'configure)
3302 (add-before 'build 'set-extralib
3303 (lambda* (#:key inputs #:allow-other-keys)
3304 ;; Get libgfortran found when building in utest.
3305 (setenv "FEXTRALIB"
3306 (string-append "-L" (assoc-ref inputs "fortran-lib")
3307 "/lib"))
3308 #t)))))
3309 (inputs
3310 `(("fortran-lib" ,gfortran "lib")))
3311 (native-inputs
3312 `(("cunit" ,cunit)
3313 ("fortran" ,gfortran)
3314 ("perl" ,perl)))
3315 (home-page "https://www.openblas.net/")
3316 (synopsis "Optimized BLAS library based on GotoBLAS")
3317 (description
3318 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
3319 (license license:bsd-3)))
3320
3321 (define-public openblas-ilp64
3322 (package/inherit openblas
3323 (name "openblas-ilp64")
3324 (supported-systems '("x86_64-linux" "aarch64-linux" "mips64el-linux"))
3325 (arguments
3326 (substitute-keyword-arguments (package-arguments openblas)
3327 ((#:make-flags flags '())
3328 `(append (list "INTERFACE64=1" "LIBNAMESUFFIX=ilp64")
3329 ,flags))))
3330 (synopsis "Optimized BLAS library based on GotoBLAS (ILP64 version)")
3331 (license license:bsd-3)))
3332
3333 (define* (make-blis implementation #:optional substitutable?)
3334 "Return a BLIS package with the given IMPLEMENTATION (see config/ in the
3335 source tree for a list of implementations.)
3336
3337 SUBSTITUTABLE? determines whether the package is made available as a
3338 substitute.
3339
3340 Currently the specialization must be selected at configure-time, but work is
3341 underway to allow BLIS to select the right optimized kernels at run time:
3342 <https://github.com/flame/blis/issues/129>."
3343 (package
3344 (name (if (string=? implementation "reference")
3345 "blis"
3346 (string-append "blis-" implementation)))
3347 (version "0.2.2")
3348 (home-page "https://github.com/flame/blis")
3349 (source (origin
3350 (method git-fetch)
3351 (uri (git-reference (url home-page) (commit version)))
3352 (sha256
3353 (base32
3354 "1wr79a50nm4abhw8w3sn96nmwp5mrzifcigk7khw9qcgyyyqayfh"))
3355 (file-name (git-file-name "blis" version))))
3356 (build-system gnu-build-system)
3357 (arguments
3358 `(#:test-target "test"
3359
3360 #:substitutable? ,substitutable?
3361
3362 #:phases (modify-phases %standard-phases
3363 (replace 'configure
3364 (lambda* (#:key outputs #:allow-other-keys)
3365 ;; This is a home-made 'configure' script.
3366 (let ((out (assoc-ref outputs "out")))
3367 (invoke "./configure" "-p" out
3368 "-d" "opt"
3369 "--disable-static"
3370 "--enable-shared"
3371 "--enable-threading=openmp"
3372
3373 ,implementation))))
3374 (add-before 'check 'show-test-output
3375 (lambda _
3376 ;; By default "make check" is silent. Make it verbose.
3377 (system "tail -F output.testsuite &")
3378 #t)))))
3379 (synopsis "High-performance basic linear algebra (BLAS) routines")
3380 (description
3381 "BLIS is a portable software framework for instantiating high-performance
3382 BLAS-like dense linear algebra libraries. The framework was designed to
3383 isolate essential kernels of computation that, when optimized, immediately
3384 enable optimized implementations of most of its commonly used and
3385 computationally intensive operations. While BLIS exports a new BLAS-like API,
3386 it also includes a BLAS compatibility layer which gives application developers
3387 access to BLIS implementations via traditional BLAS routine calls.")
3388 (license license:bsd-3)))
3389
3390 (define-public blis
3391 ;; This is the "reference" implementation, which is the non-optimized but
3392 ;; portable variant (no assembly).
3393 (make-blis "reference" #t))
3394
3395 (define ignorance blis)
3396
3397 (define-syntax-rule (blis/x86_64 processor)
3398 "Expand to a package specialized for PROCESSOR."
3399 (package
3400 (inherit (make-blis processor))
3401 (supported-systems '("x86_64-linux"))))
3402
3403 (define-public blis-sandybridge
3404 ;; BLIS specialized for Sandy Bridge processors (launched 2011):
3405 ;; <http://ark.intel.com/products/codename/29900/Sandy-Bridge>.
3406 (blis/x86_64 "sandybridge"))
3407
3408 (define-public blis-haswell
3409 ;; BLIS specialized for Haswell processors (launched 2013):
3410 ;; <http://ark.intel.com/products/codename/42174/Haswell>.
3411 (blis/x86_64 "haswell"))
3412
3413 (define-public blis-knl
3414 ;; BLIS specialized for Knights Landing processor (launched 2016):
3415 ;; <http://ark.intel.com/products/series/92650/Intel-Xeon-Phi-x200-Product-Family>.
3416 (blis/x86_64 "knl"))
3417
3418
3419 (define-public openlibm
3420 (package
3421 (name "openlibm")
3422 (version "0.6.0")
3423 (source
3424 (origin
3425 (method git-fetch)
3426 (uri (git-reference
3427 (url "https://github.com/JuliaLang/openlibm.git")
3428 (commit (string-append "v" version))))
3429 (file-name (git-file-name name version))
3430 (sha256
3431 (base32 "08wfchmmr5200fvmn1kwq9byc1fhsq46hn0y5k8scdl74771c7gh"))))
3432 (build-system gnu-build-system)
3433 (arguments
3434 `(#:make-flags
3435 (list (string-append "prefix=" (assoc-ref %outputs "out")))
3436 #:phases
3437 ;; no configure script
3438 (modify-phases %standard-phases (delete 'configure))
3439 #:tests? #f)) ;the tests are part of the default target
3440 (home-page "https://openlibm.org/")
3441 (synopsis "Portable C mathematical library (libm)")
3442 (description
3443 "OpenLibm is an effort to have a high quality, portable, standalone C
3444 mathematical library (libm). It can be used standalone in applications and
3445 programming language implementations. The project was born out of a need to
3446 have a good libm for the Julia programming language that worked consistently
3447 across compilers and operating systems, and in 32-bit and 64-bit
3448 environments.")
3449 ;; Each architecture has its own make target, and there is none for mips.
3450 (supported-systems (delete "mips64el-linux" %supported-systems))
3451 ;; See LICENSE.md for details.
3452 (license (list license:expat
3453 license:isc
3454 license:bsd-2
3455 license:public-domain
3456 license:lgpl2.1+))))
3457
3458 (define-public openspecfun
3459 (package
3460 (name "openspecfun")
3461 (version "0.5.3")
3462 (source
3463 (origin
3464 (method git-fetch)
3465 (uri (git-reference
3466 (url "https://github.com/JuliaLang/openspecfun.git")
3467 (commit (string-append "v" version))))
3468 (file-name (git-file-name name version))
3469 (sha256
3470 (base32 "0pfw6l3ch7isz403llx7inxlvavqh01jh1hb9dpidi86sjjx9kfh"))))
3471 (build-system gnu-build-system)
3472 (arguments
3473 '(#:tests? #f ; no "check" target
3474 #:make-flags
3475 (list (string-append "prefix=" (assoc-ref %outputs "out")))
3476 #:phases
3477 (modify-phases %standard-phases
3478 (delete 'configure)))) ; no configure script
3479 (inputs
3480 `(("fortran" ,gfortran)))
3481 (home-page "https://github.com/JuliaLang/openspecfun")
3482 (synopsis "Collection of special mathematical functions")
3483 (description
3484 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
3485 portable package for Bessel Functions of a Complex Argument and Nonnegative
3486 Order; it contains subroutines for computing Bessel functions and Airy
3487 functions. Faddeeva allows computing the various error functions of arbitrary
3488 complex arguments (Faddeeva function, error function, complementary error
3489 function, scaled complementary error function, imaginary error function, and
3490 Dawson function); given these, one can also easily compute Voigt functions,
3491 Fresnel integrals, and similar related functions as well.")
3492 ;; Faddeeva is released under the Expat license; AMOS is included as
3493 ;; public domain software.
3494 (license (list license:expat license:public-domain))))
3495
3496 (define-public suitesparse
3497 (package
3498 (name "suitesparse")
3499 (version "5.7.1")
3500 (source
3501 (origin
3502 (method git-fetch)
3503 (uri (git-reference
3504 (url "https://github.com/DrTimothyAldenDavis/SuiteSparse.git")
3505 (commit (string-append "v" version))))
3506 (file-name (git-file-name name version))
3507 (sha256
3508 (base32
3509 "174p3l78kv9gaa0i5hflyai2ydwnjzh34k9938sl4aa3li0543s8"))
3510 (patches (search-patches "suitesparse-mongoose-cmake.patch"))
3511 (modules '((guix build utils)))
3512 (snippet
3513 ;; Remove bundled metis source
3514 '(begin
3515 (delete-file-recursively "metis-5.1.0")
3516 #t))))
3517 (build-system gnu-build-system)
3518 (arguments
3519 '(#:tests? #f ;no "check" target
3520 #:make-flags
3521 (list "CC=gcc"
3522 "BLAS=-lblas"
3523 "TBB=-ltbb"
3524 "MY_METIS_LIB=-lmetis"
3525 ;; Flags for cmake (required to build GraphBLAS and Mongoose)
3526 (string-append "CMAKE_OPTIONS=-DCMAKE_INSTALL_PREFIX="
3527 (assoc-ref %outputs "out")
3528 " -DCMAKE_VERBOSE_MAKEFILE=ON"
3529 " -DCMAKE_C_FLAGS_RELEASE=\"$(CFLAGS) $(CPPFLAGS)\""
3530 " -DCMAKE_CXX_FLAGS_RELEASE=\"$(CXXFLAGS) $(CPPFLAGS)\""
3531 " -DCMAKE_SKIP_RPATH=TRUE"
3532 " -DCMAKE_BUILD_TYPE=Release")
3533 (string-append "INSTALL_LIB="
3534 (assoc-ref %outputs "out") "/lib")
3535 (string-append "INSTALL_INCLUDE="
3536 (assoc-ref %outputs "out") "/include")
3537 "library")
3538 #:phases
3539 (modify-phases %standard-phases
3540 (delete 'configure)))) ;no configure script
3541 (inputs
3542 `(("tbb" ,tbb)
3543 ("lapack" ,lapack)
3544 ("metis" ,metis)))
3545 (native-inputs
3546 `(("cmake" ,cmake-minimal)
3547 ("m4" ,m4)))
3548 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
3549 (synopsis "Suite of sparse matrix software")
3550 (description
3551 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
3552 multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
3553 multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
3554 simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
3555 CXSparse, a concise sparse Cholesky factorization package; and many other
3556 packages.")
3557 ;; LGPLv2.1+:
3558 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
3559 ;; GPLv2+:
3560 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
3561 (license (list license:gpl2+ license:lgpl2.1+))))
3562
3563 (define-public atlas
3564 (package
3565 (name "atlas")
3566 (version "3.10.3")
3567 (source (origin
3568 (method url-fetch)
3569 (uri (string-append "mirror://sourceforge/math-atlas/Stable/"
3570 version "/atlas" version ".tar.bz2"))
3571 (sha256
3572 (base32
3573 "1dyjlq3fiparvm8ypwk6rsmjzmnwk81l88gkishphpvc79ryp216"))))
3574 (build-system gnu-build-system)
3575 (home-page "http://math-atlas.sourceforge.net/")
3576 (inputs `(("gfortran" ,gfortran)
3577 ("lapack-tar" ,(package-source lapack))))
3578 (outputs '("out" "doc"))
3579 ;; For the moment we drop support for MIPS at it fails to compile. See
3580 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
3581 (supported-systems (delete "mips64el-linux" %supported-systems))
3582 (arguments
3583 `(#:parallel-build? #f
3584 #:parallel-tests? #f
3585
3586 ;; ATLAS tunes itself for the machine it is built on, as explained at
3587 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
3588 ;; For this reason, we want users to build it locally instead of using
3589 ;; substitutes.
3590 #:substitutable? #f
3591
3592 #:modules ((srfi srfi-26)
3593 (guix build gnu-build-system)
3594 (guix build utils))
3595 #:configure-flags
3596 `(;; Generate position independent code suitable for dynamic libraries
3597 ;; and use WALL timer to get more accurate timing.
3598 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
3599 ;; Set word width.
3600 "-b"
3601 ,,(if (string-match "64" (%current-system))
3602 "64"
3603 "32")
3604 ;; Disable parallel build as it gives errors: atlas_pthread.h is
3605 ;; needed to compile C files before it is generated.
3606 "-Ss" "pmake" "make -j 1"
3607 ;; Probe is failing for MIPS. We therefore define the system
3608 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
3609 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
3610 ,,@(if (string-prefix? "mips" (%current-system))
3611 (list "-A" "49" "-V" "1")
3612 (list))
3613 ;; Generate shared libraries.
3614 "--shared"
3615 ;; Build a full LAPACK library.
3616 ,(string-append "--with-netlib-lapack-tarfile="
3617 (assoc-ref %build-inputs "lapack-tar")))
3618 #:phases
3619 (modify-phases %standard-phases
3620 (add-after 'install 'install-doc
3621 (lambda* (#:key outputs inputs #:allow-other-keys)
3622 (let ((doc (string-append (assoc-ref outputs "doc")
3623 "/share/doc/atlas")))
3624 (mkdir-p doc)
3625 (for-each (cut install-file <> doc)
3626 (find-files "../ATLAS/doc" ".*"))
3627 #t)))
3628 (add-after 'check 'check-pt
3629 (lambda _ (invoke "make" "ptcheck")))
3630 ;; Fix files required to run configure.
3631 (add-before 'configure 'fix-/bin/sh
3632 (lambda _
3633 ;; Use `sh', not `/bin/sh'.
3634 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
3635 (("/bin/sh")
3636 "sh"))
3637 #t))
3638 ;; Fix /bin/sh in generated make files.
3639 (add-after 'configure 'fix-/bin/sh-in-generated-files
3640 (lambda _
3641 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
3642 (("/bin/sh")
3643 "sh"))
3644 #t))
3645 ;; ATLAS configure program does not accepts the default flags
3646 ;; passed by the 'gnu-build-system'.
3647 (replace 'configure
3648 (lambda* (#:key native-inputs inputs outputs
3649 (configure-flags '())
3650 #:allow-other-keys #:rest args)
3651 (let* ((prefix (assoc-ref outputs "out"))
3652 (bash (or (and=> (assoc-ref
3653 (or native-inputs inputs) "bash")
3654 (cut string-append <> "/bin/bash"))
3655 "/bin/sh"))
3656 (flags `(,(string-append "--prefix=" prefix)
3657 ,@configure-flags))
3658 (abs-srcdir (getcwd))
3659 (srcdir (string-append "../" (basename abs-srcdir))))
3660 (format #t "source directory: ~s (relative from build: ~s)~%"
3661 abs-srcdir srcdir)
3662 (mkdir "../build")
3663 (chdir "../build")
3664 (format #t "build directory: ~s~%" (getcwd))
3665 (format #t "configure flags: ~s~%" flags)
3666 (apply invoke bash
3667 (string-append srcdir "/configure")
3668 flags)))))))
3669 (synopsis "Automatically Tuned Linear Algebra Software")
3670 (description
3671 "ATLAS is an automatically tuned linear algebra software library
3672 providing C and Fortran77 interfaces to a portably efficient BLAS
3673 implementation, as well as a few routines from LAPACK.
3674
3675 Optimization occurs at build time. For this reason, the library is built on
3676 the machine where it is installed, without resorting to pre-built substitutes.
3677
3678 Before building the library, CPU throttling should be disabled. This can be
3679 done in the BIOS, or, on GNU/Linux, with the following command:
3680
3681 @example
3682 # cpupower --governor performance
3683 @end example
3684
3685 Failure to do so will result in a library with poor performance.")
3686 (license license:bsd-3)))
3687
3688 (define-public glm
3689 (package
3690 (name "glm")
3691 (version "0.9.9.6")
3692 (source
3693 (origin
3694 (method url-fetch)
3695 (uri (string-append "https://github.com/g-truc/glm/releases/download/"
3696 version "/glm-" version ".zip"))
3697 (sha256
3698 (base32 "1l0pi1qi37mk6s0yrkrw07lspv4gcqnr9ryg3521hrl77ff37dwx"))
3699 (patches (search-patches "glm-restore-install-target.patch"))))
3700 (build-system cmake-build-system)
3701 (native-inputs
3702 `(("unzip" ,unzip)))
3703 (home-page "https://glm.g-truc.net/")
3704 (synopsis "OpenGL Mathematics library")
3705 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
3706 library for graphics software based on the OpenGL Shading Language (GLSL)
3707 specifications.")
3708 (license license:expat)))
3709
3710 (define-public lpsolve
3711 (package
3712 (name "lpsolve")
3713 (version "5.5.2.5")
3714 (source
3715 (origin
3716 (method url-fetch)
3717 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
3718 "/lp_solve_" version "_source.tar.gz"))
3719 (sha256
3720 (base32
3721 "12pj1idjz31r7c2mb5w03vy1cmvycvbkx9z29s40qdmkp1i7q6i0"))
3722 (modules '((guix build utils)))
3723 (snippet
3724 '(begin
3725 (substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
3726 (("^c=cc") "c=gcc")
3727 ;; Pretend to be on a 64 bit platform to obtain a common directory
3728 ;; name for the build results on all architectures; nothing else
3729 ;; seems to depend on it.
3730 (("^PLATFORM=.*$") "PLATFORM=ux64\n")
3731
3732 ;; The check for 'isnan' as it is written fails with
3733 ;; "non-floating-point argument in call to function
3734 ;; ‘__builtin_isnan’", which leads to the 'NOISNAN' cpp macro
3735 ;; definition, which in turn leads to bad things. Fix the feature
3736 ;; test.
3737 (("isnan\\(0\\)") "isnan(0.)"))
3738 #t))))
3739 (build-system gnu-build-system)
3740 (arguments
3741 `(#:tests? #f ; no check target
3742 #:phases
3743 (modify-phases %standard-phases
3744 (delete 'configure) ; no configure script
3745 (replace 'build
3746 (lambda _
3747 (with-directory-excursion "lpsolve55"
3748 (invoke "bash" "ccc"))
3749 (with-directory-excursion "lp_solve"
3750 (invoke "bash" "ccc"))
3751 #t))
3752 (replace 'install
3753 (lambda* (#:key outputs #:allow-other-keys)
3754 (let* ((out (assoc-ref outputs "out"))
3755 (bin (string-append out "/bin"))
3756 (lib (string-append out "/lib"))
3757 ;; This is where LibreOffice expects to find the header
3758 ;; files, and where they are installed by Debian.
3759 (include (string-append out "/include/lpsolve")))
3760 (install-file "lpsolve55/bin/ux64/liblpsolve55.a" lib)
3761 (install-file "lpsolve55/bin/ux64/liblpsolve55.so" lib)
3762 (install-file "lp_solve/bin/ux64/lp_solve" bin)
3763
3764 ;; Install a subset of the header files as on Debian
3765 ;; (plus lp_bit.h, which matches the regular expression).
3766 (for-each (lambda (name)
3767 (install-file name include))
3768 (find-files "." "lp_[HMSa-z].*\\.h$"))
3769 (with-directory-excursion "shared"
3770 (for-each (lambda (name)
3771 (install-file name include))
3772 (find-files "." "\\.h$")))
3773 #t))))))
3774 (home-page "http://lpsolve.sourceforge.net/")
3775 (synopsis "Mixed integer linear programming (MILP) solver")
3776 (description
3777 "lp_solve is a mixed integer linear programming solver based on the
3778 revised simplex and the branch-and-bound methods.")
3779 (license license:lgpl2.1+)))
3780
3781 (define-public dealii
3782 (package
3783 (name "dealii")
3784 (version "9.1.1")
3785 (source
3786 (origin
3787 (method url-fetch)
3788 (uri (string-append "https://github.com/dealii/dealii/releases/"
3789 "download/v" version "/dealii-" version ".tar.gz"))
3790 (sha256
3791 (base32
3792 "0xhjv0gzswpjbc43xbrpwfc5848g508l01855nszx3g5gwzlhnzw"))
3793 (modules '((guix build utils)))
3794 (snippet
3795 ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
3796 '(begin
3797 (delete-file-recursively "bundled")
3798 #t))))
3799 (build-system cmake-build-system)
3800 (inputs
3801 `(("tbb" ,tbb)
3802 ("zlib" ,zlib)
3803 ("boost" ,boost)
3804 ("p4est" ,p4est)
3805 ("blas" ,openblas)
3806 ("lapack" ,lapack)
3807 ("arpack" ,arpack-ng)
3808 ("muparser" ,muparser)
3809 ("gfortran" ,gfortran)
3810 ("suitesparse" ,suitesparse))) ;for UMFPACK
3811 (arguments
3812 `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease
3813 #:configure-flags
3814 ;; Work around a bug in libsuitesparseconfig linking
3815 ;; see https://github.com/dealii/dealii/issues/4745
3816 '("-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON")))
3817 (home-page "https://www.dealii.org")
3818 (synopsis "Finite element library")
3819 (description
3820 "Deal.II is a C++ program library targeted at the computational solution
3821 of partial differential equations using adaptive finite elements. The main
3822 aim of deal.II is to enable rapid development of modern finite element codes,
3823 using among other aspects adaptive meshes and a wide array of tools often used
3824 in finite element programs.")
3825 (license license:lgpl2.1+)))
3826
3827 (define-public dealii-openmpi
3828 (package (inherit dealii)
3829 (name "dealii-openmpi")
3830 (inputs
3831 `(("mpi" ,openmpi)
3832 ;;Supported only with MPI:
3833 ("hdf5" ,hdf5-parallel-openmpi) ;TODO: have petsc-openmpi propagate?
3834 ("p4est" ,p4est-openmpi)
3835 ("petsc" ,petsc-openmpi)
3836 ("slepc" ,slepc-openmpi)
3837 ("metis" ,metis) ;for MUMPS
3838 ("scalapack" ,scalapack) ;for MUMPS
3839 ("mumps" ,mumps-metis-openmpi) ;configure supports only metis orderings
3840 ("arpack" ,arpack-ng-openmpi)
3841 ,@(fold alist-delete (package-inputs dealii)
3842 '("p4est" "arpack"))))
3843 (arguments
3844 (substitute-keyword-arguments (package-arguments dealii)
3845 ((#:configure-flags cf)
3846 `(cons "-DDEAL_II_WITH_MPI:BOOL=ON"
3847 ,cf))
3848 ((#:phases phases '%standard-phases)
3849 `(modify-phases ,phases
3850 (add-before 'check 'mpi-setup
3851 ,%openmpi-setup)))))
3852 (synopsis "Finite element library (with MPI support)")))
3853
3854 (define-public flann
3855 (package
3856 (name "flann")
3857 (version "1.8.4")
3858 (source
3859 (origin
3860 (method url-fetch)
3861 (uri
3862 (string-append
3863 "http://www.cs.ubc.ca/research/flann/uploads/FLANN/flann-"
3864 version "-src.zip"))
3865 (sha256
3866 (base32
3867 "022w8hph7bli5zbpnk3z1qh1c2sl5hm8fw2ccim651ynn0hr7fyz"))
3868 (patches (search-patches "flann-cmake-3.11.patch"))))
3869 (build-system cmake-build-system)
3870 (outputs '("out"
3871 "octave")) ;46 MiB .mex file that pulls Octave
3872 (native-inputs
3873 `(("unzip" ,unzip)))
3874 (inputs
3875 `(("hdf5" ,hdf5)
3876 ("octave" ,octave-cli)
3877 ("python" ,python-2) ; print syntax
3878 ;; ("python2-numpy" ,python2-numpy) ; only required for the tests
3879 ("zlib" ,zlib)))
3880 (arguments
3881 `(;; The 'share/flann/octave' contains a .mex file, which is an ELF file
3882 ;; taken 46 MiB unstripped, and 6 MiB stripped.
3883 #:strip-directories '("lib" "lib64" "libexec"
3884 "bin" "sbin" "share/flann/octave")
3885
3886 ;; Save 12 MiB by not installing .a files. Passing
3887 ;; '-DBUILD_STATIC_LIBS=OFF' has no effect.
3888 #:phases (modify-phases %standard-phases
3889 (add-before 'configure 'set-octave-directory
3890 (lambda* (#:key outputs #:allow-other-keys)
3891 ;; Install the .mex file in the "octave" output.
3892 (let ((out (assoc-ref outputs "octave")))
3893 (substitute* "src/matlab/CMakeLists.txt"
3894 (("share/flann/octave")
3895 (string-append out "/share/flann/octave")))
3896 #t)))
3897 (add-after 'install 'remove-static-libraries
3898 (lambda* (#:key outputs #:allow-other-keys)
3899 (let* ((out (assoc-ref outputs "out"))
3900 (lib (string-append out "/lib")))
3901 (for-each delete-file
3902 (find-files lib "\\.a$"))
3903 #t))))
3904
3905 #:tests? #f)) ; The test data are downloaded from the Internet.
3906 (home-page "http://www.cs.ubc.ca/research/flann/")
3907 (synopsis "Library for approximate nearest neighbors computation")
3908 (description "FLANN is a library for performing fast approximate
3909 nearest neighbor searches in high dimensional spaces. It implements a
3910 collection of algorithms and a system for automatically choosing the best
3911 algorithm and optimum parameters depending on the dataset.
3912
3913 FLANN is written in C++ and contains bindings for C, Octave and Python.")
3914 (license (license:non-copyleft "file://COPYING"
3915 "See COPYING in the distribution."))))
3916
3917 (define-public wcalc
3918 (package
3919 (name "wcalc")
3920 (version "2.5")
3921 (source
3922 (origin
3923 (method url-fetch)
3924 (uri (string-append "mirror://sourceforge/w-calc/Wcalc/" version "/"
3925 "wcalc-" version ".tar.bz2"))
3926 (sha256
3927 (base32
3928 "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
3929 (build-system gnu-build-system)
3930 (inputs
3931 `(("mpfr" ,mpfr)
3932 ("readline" ,readline)))
3933 (home-page "http://w-calc.sourceforge.net/index.php")
3934 (synopsis "Flexible command-line scientific calculator")
3935 (description "Wcalc is a very capable calculator. It has standard functions
3936 (sin, asin, and sinh for example, in either radians or degrees), many
3937 pre-defined constants (pi, e, c, etc.), support for using variables, \"active\"
3938 variables, a command history, hex/octal/binary input and output, unit
3939 conversions, embedded comments, and an expandable expression entry field. It
3940 evaluates expressions using the standard order of operations.")
3941 (license license:gpl2+)))
3942
3943 (define-public xaos
3944 (package
3945 (name "xaos")
3946 (version "3.6")
3947 (source (origin
3948 (method url-fetch)
3949 (uri (string-append "mirror://sourceforge/xaos/XaoS/" version
3950 "/xaos-" version ".tar.gz"))
3951 (sha256
3952 (base32
3953 "15cd1cx1dyygw6g2nhjqq3bsfdj8sj8m4va9n75i0f3ryww3x7wq"))))
3954 (build-system gnu-build-system)
3955 (native-inputs `(("gettext" ,gettext-minimal)))
3956 (inputs `(("libx11" ,libx11)
3957 ("zlib" ,zlib)
3958 ("libpng" ,libpng)
3959 ("gsl" ,gsl)))
3960 (arguments
3961 `(#:tests? #f ;no "check" target
3962 #:make-flags '("LOCALEDIR=$DATAROOTDIR/locale")))
3963 (synopsis "Real-time fractal zoomer")
3964 (description "GNU XaoS is a graphical program that generates fractal
3965 patterns and allows you to zoom in and out of them infinitely in a fluid,
3966 continuous manner. It also includes tutorials that help to explain how fractals
3967 are built. It can generate many different fractal types such as the Mandelbrot
3968 set.")
3969 (home-page "https://www.gnu.org/software/xaos/")
3970 (license license:gpl2+)))
3971
3972 (define-public hypre
3973 (package
3974 (name "hypre")
3975 (version "2.15.1")
3976 (source
3977 (origin
3978 (method git-fetch)
3979 (uri (git-reference
3980 (url "https://github.com/LLNL/hypre.git")
3981 (commit (string-append "v" version))))
3982 (file-name (git-file-name name version))
3983 (sha256
3984 (base32 "1lvh4ybqkriyqfg2zmic6mrg1981qv1i9vry1fdgsabn81hb71g4"))
3985 (modules '((guix build utils)))
3986 (snippet
3987 '(begin
3988 ;; Remove use of __DATE__ and __TIME__ for reproducibility;
3989 ;; substitute the release date.
3990 (substitute* "src/utilities/HYPRE_utilities.h"
3991 (("Date Compiled: .*$")
3992 "Date Compiled: Oct 19 2018 15:23:00 +0000\"\n"))
3993 #t))))
3994 (build-system gnu-build-system)
3995 (outputs '("out" ; 6.1 MiB of headers and libraries
3996 "doc")) ; 4.8 MiB of documentation
3997 (native-inputs
3998 `(("doc++" ,doc++)
3999 ("netpbm" ,netpbm)
4000 ("perl" ,perl) ; needed to run 'ppmquant' during tests
4001 ("texlive" ,(texlive-union (list texlive-xypic
4002 texlive-cm
4003 texlive-latex-hyperref
4004 texlive-bibtex)))
4005 ("ghostscript" ,ghostscript)))
4006 (inputs
4007 `(("blas" ,openblas)
4008 ("lapack" ,lapack)))
4009 (arguments
4010 `(#:modules ((srfi srfi-1)
4011 ,@%gnu-build-system-modules)
4012 #:configure-flags '("--enable-shared"
4013 "--disable-fortran"
4014 "--without-MPI"
4015 "--with-openmp"
4016 "--with-fei"
4017 "--with-lapack"
4018 "--with-blas")
4019 #:phases
4020 (modify-phases %standard-phases
4021 (add-before 'build 'set-HOME
4022 (lambda _
4023 ;; FIXME: texlive-union does not find the built
4024 ;; metafonts, so it tries to generate them in HOME.
4025 (setenv "HOME" "/tmp")
4026 #t))
4027 (add-before 'configure 'chdir-src
4028 (lambda _ (chdir "src")))
4029 (replace 'configure
4030 (lambda* (#:key build target configure-flags
4031 #:allow-other-keys #:rest args)
4032 (let* ((configure (assoc-ref %standard-phases 'configure)))
4033 (apply configure
4034 (append args
4035 (list #:configure-flags
4036 (cons (string-append
4037 "--host=" (or target build))
4038 configure-flags)))))))
4039 (add-after 'build 'build-docs
4040 (lambda _
4041 (invoke "make" "-Cdocs" "pdf" "html")))
4042 (replace 'check
4043 (lambda _
4044 (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/hypre/lib"))
4045 (setenv "PATH" (string-append "." ":" (getenv "PATH")))
4046 (invoke "make" "check" "CHECKRUN=")
4047 (for-each (lambda (filename)
4048 (let ((size (stat:size (stat filename))))
4049 (when (positive? size)
4050 (error (format #f "~a size ~d; error indication~%"
4051 filename size)))))
4052 (find-files "test" ".*\\.err$"))
4053 #t))
4054 (add-after 'install 'install-docs
4055 (lambda* (#:key outputs #:allow-other-keys)
4056 ;; Custom install because docs/Makefile doesn't honor ${docdir}.
4057 (let* ((doc (assoc-ref outputs "doc"))
4058 (docdir (string-append doc "/share/doc/hypre-" ,version)))
4059 (with-directory-excursion "docs"
4060 (for-each (lambda (base)
4061 (install-file (string-append base ".pdf") docdir)
4062 (copy-recursively base docdir)) ; html docs
4063 '("HYPRE_usr_manual"
4064 "HYPRE_ref_manual")))
4065 #t))))))
4066 (home-page "http://www.llnl.gov/casc/hypre/")
4067 (synopsis "Library of solvers and preconditioners for linear equations")
4068 (description
4069 "HYPRE is a software library of high performance preconditioners and
4070 solvers for the solution of large, sparse linear systems of equations. It
4071 features multigrid solvers for both structured and unstructured grid
4072 problems.")
4073 (license license:lgpl2.1)))
4074
4075 (define-public hypre-openmpi
4076 (package (inherit hypre)
4077 (name "hypre-openmpi")
4078 (inputs
4079 `(("mpi" ,openmpi)
4080 ,@(package-inputs hypre)))
4081 (arguments
4082 (substitute-keyword-arguments (package-arguments hypre)
4083 ((#:configure-flags flags)
4084 ``("--with-MPI"
4085 ,@(delete "--without-MPI" ,flags)))
4086 ((#:phases phases)
4087 `(modify-phases ,phases
4088 (add-before 'check 'mpi-setup
4089 ,%openmpi-setup)))))
4090 (synopsis "Parallel solvers and preconditioners for linear equations")
4091 (description
4092 "HYPRE is a software library of high performance preconditioners and
4093 solvers for the solution of large, sparse linear systems of equations on
4094 parallel computers. It features parallel multigrid solvers for both
4095 structured and unstructured grid problems.")))
4096
4097 (define-public matio
4098 (package
4099 (name "matio")
4100 (version "1.5.6")
4101 (source
4102 (origin
4103 (method url-fetch)
4104 (uri (string-append "mirror://sourceforge/matio/matio/" version "/"
4105 "matio-" version ".tar.gz"))
4106 (sha256
4107 (base32
4108 "0y2qymgxank8wdiwc68ap8bxdzrhvyw86i29yh3xgn4z1njfd9ir"))))
4109 (build-system gnu-build-system)
4110 (inputs
4111 `(("zlib" ,zlib)
4112 ("hdf5" ,hdf5)))
4113 (home-page "http://matio.sourceforge.net/")
4114 (synopsis "Library for reading and writing MAT files")
4115 (description "Matio is a library for reading and writing MAT files. It
4116 supports compressed MAT files, as well as newer (version 7.3) MAT files.")
4117 (license license:bsd-2)))
4118
4119 (define-public vc
4120 (package
4121 (name "vc")
4122 (version "1.4.1")
4123 (source
4124 (origin (method url-fetch)
4125 (uri (string-append "https://github.com/VcDevel/Vc/releases/"
4126 "download/" version "/Vc-" version ".tar.gz"))
4127 (sha256
4128 (base32
4129 "17qili8bf8r78cng65yf4qmgna8kiqjqbgcqbric6v9j6nkhkrk8"))))
4130 (build-system cmake-build-system)
4131 (arguments
4132 '(#:configure-flags
4133 '("-DBUILD_TESTING=ON"
4134 ;; By default, Vc will optimize for the CPU of the build machine.
4135 ;; Setting this to "none" makes it create portable binaries. See
4136 ;; "cmake/OptimizeForArchitecture.cmake".
4137 "-DTARGET_ARCHITECTURE=none")
4138 #:phases (modify-phases %standard-phases
4139 (add-after 'unpack 'copy-testdata
4140 (lambda* (#:key inputs native-inputs #:allow-other-keys)
4141 (let ((testdata (assoc-ref (or native-inputs inputs)
4142 "testdata")))
4143 (copy-recursively testdata "tests/testdata")
4144 #t))))))
4145 (native-inputs
4146 `(("virtest" ,virtest)
4147
4148 ;; This is a submodule in the git project, but not part of the
4149 ;; released sources. See the git branch for the commit to take.
4150 ("testdata" ,(let ((commit "9ada1f34d6a41f1b5553d6223f277eae72c039d3"))
4151 (origin
4152 (method git-fetch)
4153 (uri (git-reference
4154 (url "https://github.com/VcDevel/vc-testdata")
4155 (commit "9ada1f34d6a41f1b5553d6223f277eae72c039d3")))
4156 (file-name (git-file-name "vc-testdata"
4157 (string-take commit 7)))
4158 (sha256
4159 (base32
4160 "1hkhqib03qlcq412ym2dciynfxcdr2ygqhnplz4l1vissr1wnqn2")))))))
4161 (synopsis "SIMD vector classes for C++")
4162 (description "Vc provides portable, zero-overhead C++ types for explicitly
4163 data-parallel programming. It is a library designed to ease explicit
4164 vectorization of C++ code. Its types enable explicitly stating data-parallel
4165 operations on multiple values. The parallelism is therefore added via the type
4166 system. Vc has an intuitive API and provides portability between different
4167 compilers and compiler versions as well as portability between different vector
4168 instruction sets. Thus, an application written with Vc can be compiled for:
4169 @enumerate
4170 @item AVX and AVX2
4171 @item SSE2 up to SSE4.2 or SSE4a
4172 @item Scalar
4173 @item MIC
4174 @item NEON (in development)
4175 @item NVIDIA GPUs / CUDA (in development)
4176 @end enumerate\n")
4177 (home-page "https://github.com/VcDevel/Vc")
4178 ;; "No support_???.cpp file exists for this architecture."
4179 (supported-systems '("x86_64-linux" "i686-linux"))
4180 (license license:bsd-3)))
4181
4182 (define-public reducelcs
4183 ;; This is the last commit which is available upstream, no
4184 ;; release happened since 2010.
4185 (let ((commit "474f88deb968061abe8cf11c959e02319b8ae5c0")
4186 (revision "1"))
4187 (package
4188 (name "reducelcs")
4189 (version (string-append "1.0-" revision "." (string-take commit 7)))
4190 (source
4191 (origin
4192 (method git-fetch)
4193 (uri (git-reference
4194 (url "https://github.com/gdv/Reduce-Expand-for-LCS")
4195 (commit commit)))
4196 (file-name (string-append name "-" version "-checkout"))
4197 (sha256
4198 (base32
4199 "1rllzcfwc042c336mhq262a8ha90x6afq30kvk60r7i4761j4yjm"))))
4200 (build-system gnu-build-system)
4201 (inputs
4202 `(("openlibm" ,openlibm)))
4203 (arguments
4204 `(#:tests? #f ; no tests
4205 #:phases
4206 (modify-phases %standard-phases
4207 (delete 'configure) ; No configure script exists.
4208 (replace 'install ; No install phase exists.
4209 (lambda* (#:key outputs #:allow-other-keys)
4210 (let* ((out (assoc-ref outputs "out"))
4211 (bin (string-append out "/bin")))
4212 (install-file "Approximation" bin)
4213 (install-file "CollectResults" bin)
4214 (install-file "GenerateInstances" bin)
4215 #t))))))
4216 (synopsis "Approximate Longest Commons Subsequence computation tool")
4217 (description
4218 "@code{reduceLCS} is an implementation of the Reduce-Expand
4219 algorithm for LCS. It is a fast program to compute the approximate
4220 Longest Commons Subsequence of a set of strings.")
4221 (home-page "https://github.com/gdv/Reduce-Expand-for-LCS")
4222 (license license:gpl3+))))
4223
4224 (define-public jacal
4225 (package
4226 (name "jacal")
4227 (version "1c4")
4228 (source (origin
4229 (method url-fetch)
4230 (uri (string-append
4231 "http://groups.csail.mit.edu/mac/ftpdir/scm/jacal-"
4232 version ".zip"))
4233 (sha256 (base32
4234 "055zrn12a1dmy0dqkwrkq3fklbhg3yir6vn0lacp4mvbg8573a3q"))
4235 (patches (search-patches "jacal-fix-texinfo.patch"))))
4236 (build-system gnu-build-system)
4237 (arguments
4238 `(#:phases
4239 (modify-phases %standard-phases
4240 (add-before 'build 'pre-build
4241 ;; Don't use upstream's script - it really doesn't fit into
4242 ;; Guix's functional paradigm.
4243 (lambda* (#:key inputs outputs #:allow-other-keys)
4244 (substitute* "Makefile"
4245 (("^install: install-script") "install: "))))
4246 (add-after 'install 'post-install
4247 ;; Instead, we provide our own simplified script.
4248 (lambda* (#:key inputs outputs #:allow-other-keys)
4249 (let ((wrapper (string-append (assoc-ref outputs "out")
4250 "/bin/jacal")))
4251 (format (open wrapper (logior O_WRONLY O_CREAT))
4252 (string-append "#!~a\nexec ~a/bin/scm -ip1 "
4253 "-e '(slib:load \"~a/lib/jacal/math\") "
4254 "(math)' \"$@\"\n")
4255 (which "bash")
4256 (assoc-ref inputs "scm")
4257 (assoc-ref outputs "out"))
4258 (chmod wrapper #o555))))
4259 (replace 'configure
4260 (lambda* (#:key outputs #:allow-other-keys)
4261 (invoke "./configure"
4262 (string-append "--prefix="
4263 (assoc-ref outputs "out"))))))))
4264 (inputs `(("scm" ,scm)))
4265 (native-inputs `(("unzip" ,unzip)
4266 ("texinfo" ,texinfo)))
4267 (synopsis "Symbolic mathematics system")
4268 (description "GNU JACAL is an interactive symbolic mathematics program based on
4269 Scheme. It manipulate and simplify a range of mathematical expressions such
4270 as equations, scalars, vectors, and matrices.")
4271 (home-page "https://www.gnu.org/software/jacal/")
4272 (license license:gpl3+)))
4273
4274 (define-public z3
4275 (package
4276 (name "z3")
4277 (version "4.8.7")
4278 (home-page "https://github.com/Z3Prover/z3")
4279 (source (origin
4280 (method git-fetch)
4281 (uri (git-reference (url home-page)
4282 (commit (string-append "z3-" version))))
4283 (file-name (git-file-name name version))
4284 (sha256
4285 (base32
4286 "0hprcdwhhyjigmhhk6514m71bnmvqci9r8gglrqilgx424r6ff7q"))))
4287 (build-system gnu-build-system)
4288 (arguments
4289 `(#:imported-modules ((guix build python-build-system)
4290 ,@%gnu-build-system-modules)
4291 #:modules (((guix build python-build-system) #:select (site-packages))
4292 (guix build gnu-build-system)
4293 (guix build utils))
4294 #:phases
4295 (modify-phases %standard-phases
4296 (add-after 'unpack 'enable-bytecode-determinism
4297 (lambda _
4298 (setenv "PYTHONHASHSEED" "0")
4299 #t))
4300 (add-after 'unpack 'fix-compatability
4301 ;; Versions after 4.8.3 have immintrin.h IFDEFed for Windows only.
4302 (lambda _
4303 (substitute* "src/util/mpz.cpp"
4304 (("#include <immintrin.h>") ""))
4305 #t))
4306 (add-before 'configure 'bootstrap
4307 (lambda _
4308 (invoke "python" "scripts/mk_make.py")))
4309 ;; work around gnu-build-system's setting --enable-fast-install
4310 ;; (z3's `configure' is a wrapper around the above python file,
4311 ;; which fails when passed --enable-fast-install)
4312 (replace 'configure
4313 (lambda* (#:key inputs outputs #:allow-other-keys)
4314 (invoke "./configure"
4315 "--python"
4316 (string-append "--prefix=" (assoc-ref outputs "out"))
4317 (string-append "--pypkgdir=" (site-packages inputs outputs)))))
4318 (add-after 'configure 'change-directory
4319 (lambda _
4320 (chdir "build")
4321 #t))
4322 (add-before 'check 'make-test-z3
4323 (lambda _
4324 ;; Build the test suite executable.
4325 (invoke "make" "test-z3" "-j"
4326 (number->string (parallel-job-count)))))
4327 (replace 'check
4328 (lambda _
4329 ;; Run all the tests that don't require arguments.
4330 (invoke "./test-z3" "/a"))))))
4331 (native-inputs
4332 `(("which" ,which)
4333 ("python" ,python-wrapper)))
4334 (synopsis "Theorem prover")
4335 (description "Z3 is a theorem prover and @dfn{satisfiability modulo
4336 theories} (SMT) solver. It provides a C/C++ API, as well as Python bindings.")
4337 (license license:expat)))
4338
4339 (define-public elpa
4340 (package
4341 (name "elpa")
4342 (version "2018.11.001")
4343 (source (origin
4344 (method url-fetch)
4345 (uri (string-append "http://elpa.mpcdf.mpg.de/html/Releases/"
4346 version "/elpa-" version ".tar.gz"))
4347 (sha256
4348 (base32
4349 "05hv3v5i6xmziaizw350ff72y1c3k662r85fm3xfdrkclj5zw9yc"))))
4350 (build-system gnu-build-system)
4351 (native-inputs
4352 `(("fortran" ,gfortran)
4353 ("perl" ,perl))) ;for configure and deps
4354 (inputs
4355 `(("blas" ,openblas)))
4356 (arguments
4357 `(#:configure-flags
4358 `("--enable-openmp"
4359 "--with-mpi=no"
4360 ;; ELPA unfortunately does not support runtime dispatch, so we can
4361 ;; only enable the "generic" kernels. See the "Cross compilation"
4362 ;; section of INSTALL.md.
4363 "--enable-generic"
4364 "--disable-sse" "--disable-sse-assembly" ;Require SSE3
4365 "--disable-avx" "--disable-avx2" "--disable-avx512"
4366 ,(string-append "CFLAGS=-O3 "
4367 "-funsafe-loop-optimizations -funsafe-math-optimizations "
4368 "-ftree-vect-loop-version -ftree-vectorize "
4369 ,(let ((system (or (%current-target-system)
4370 (%current-system))))
4371 (cond
4372 ((or (string-prefix? "x86_64" system)
4373 (string-prefix? "i686" system))
4374 "-msse2")
4375 (else "")))))
4376 #:parallel-tests? #f ;tests are multi-threaded, via BLAS
4377 #:phases
4378 (modify-phases %standard-phases
4379 (add-before 'configure 'patch-header-generation
4380 (lambda _
4381 (substitute* "configure"
4382 (("^ *make.*top_srcdir=\"\\$srcdir\"" &)
4383 (string-append & " CPP=\"$CPP\"")))
4384 #t))
4385 (add-before 'check 'setup-tests
4386 (lambda _
4387 ;; Decrease test time and RAM use by computing fewer eigenvalues.
4388 ;; The flags are (MATRIX-SIZE, EIGENVALUES, BLOCK-SIZE), where
4389 ;; the default is (500, 250, 16) for C tests and (5000, 150, 16)
4390 ;; for Fortran. This also causes several tests to pass that
4391 ;; otherwise would otherwise fail with matrix size 5000; possibly
4392 ;; due to floating point tolerances that are too tight.
4393 (setenv "TEST_FLAGS" "1500 50 16") ;from elpa.spec
4394 (setenv "OMP_NUM_THREADS" (number->string (parallel-job-count)))
4395 (substitute* "Makefile"
4396 ;; Test scripts are generated, patch the shebang
4397 (("#!/bin/bash") (string-append "#!" (which "sh"))))
4398 #t)))))
4399 (home-page "http://elpa.mpcdf.mpg.de")
4400 (synopsis "Eigenvalue solvers for symmetric matrices")
4401 (description
4402 "The ELPA library provides efficient and scalable direct eigensolvers for
4403 symmetric matrices.")
4404 (license license:lgpl3)))
4405
4406 (define-public elpa-openmpi
4407 (package (inherit elpa)
4408 (name "elpa-openmpi")
4409 (inputs
4410 `(("mpi" ,openmpi)
4411 ("scalapack" ,scalapack)
4412 ,@(package-inputs elpa)))
4413 (arguments
4414 (substitute-keyword-arguments (package-arguments elpa)
4415 ((#:configure-flags cf '())
4416 `(cons "--with-mpi=yes" (delete "--with-mpi=no" ,cf)))
4417 ((#:phases phases '%standard-phases)
4418 `(modify-phases ,phases
4419 (add-before 'check 'mpi-setup
4420 (lambda _
4421 ;; Tests use 2 mpi tasks by default, use our remaining build
4422 ;; cores as OpenMP threads.
4423 (setenv "OMP_NUM_THREADS" (number->string
4424 (max (quotient (parallel-job-count) 2)
4425 1)))
4426 (,%openmpi-setup)))))))
4427 (synopsis "Eigenvalue solvers for symmetric matrices (with MPI support)")))
4428
4429 (define-public elemental
4430 (package
4431 (name "elemental")
4432 (version "0.87.7")
4433 (source (origin
4434 (method git-fetch)
4435 (uri (git-reference
4436 (url "https://github.com/elemental/Elemental.git")
4437 (commit (string-append "v" version))))
4438 (file-name (git-file-name name version))
4439 (sha256
4440 (base32
4441 "1687xpjjzig27y2pnqv7hv09smpijyfdpz7qjgmcxf4shfajlfkc"))))
4442 (build-system cmake-build-system)
4443 (home-page "https://github.com/elemental/Elemental")
4444 (native-inputs
4445 `(("gfortran" ,gfortran)))
4446 (inputs
4447 `(("blas" ,openblas)
4448 ("gfortran:lib" ,gfortran "lib")
4449 ("gmp" ,gmp)
4450 ("lapack" ,lapack)
4451 ("metis" ,metis)
4452 ("mpc" ,mpc)
4453 ("mpfr" ,mpfr)
4454 ("mpi" ,openmpi)
4455 ("qd" ,qd)))
4456 (arguments
4457 `(#:build-type "Release" ;default RelWithDebInfo not supported
4458 #:configure-flags `("-DEL_DISABLE_PARMETIS:BOOL=YES"
4459 "-DEL_AVOID_COMPLEX_MPI:BOOL=NO"
4460 "-DEL_CACHE_WARNINGS:BOOL=YES"
4461 "-DEL_TESTS:BOOL=YES"
4462 "-DCMAKE_INSTALL_LIBDIR=lib"
4463 "-DGFORTRAN_LIB=gfortran")
4464 #:phases (modify-phases %standard-phases
4465 (add-before 'check 'mpi-setup
4466 ,%openmpi-setup)
4467 (add-before 'check 'setup-tests
4468 (lambda _
4469 ;; Parallelism is done at the MPI layer.
4470 (setenv "OMP_NUM_THREADS" "1")
4471 #t))
4472 (add-after 'install 'remove-tests
4473 (lambda* (#:key outputs #:allow-other-keys)
4474 ;; Tests are installed, with no easy configuration
4475 ;; switch to prevent this, so delete them.
4476 (delete-file-recursively
4477 (string-append (assoc-ref outputs "out") "/bin"))
4478 #t)))))
4479 (synopsis "Dense and sparse-direct linear algebra and optimization")
4480 (description "Elemental is a modern C++ library for distributed-memory
4481 dense and sparse-direct linear algebra, conic optimization, and lattice
4482 reduction.")
4483 (license license:bsd-2)))
4484
4485 (define-public mcrl2
4486 (package
4487 (name "mcrl2")
4488 (version "201908.0")
4489 (source (origin
4490 (method url-fetch)
4491 (uri (string-append
4492 "https://www.mcrl2.org/download/release/mcrl2-"
4493 version ".tar.gz"))
4494 (sha256
4495 (base32
4496 "1i4xgl2d5fgiz1mwi50cyfkrrcpm8nxfayfjgmhq7chs58wlhfsz"))))
4497 (inputs
4498 `(("boost" ,boost)
4499 ("glu" ,glu)
4500 ("mesa" ,mesa)
4501 ("qtbase" ,qtbase)))
4502 (build-system cmake-build-system)
4503 (synopsis "Toolset for the mCRL2 formal specification language")
4504 (description
4505 "@dfn{mCRL2} (micro Common Representation Language 2) is a formal
4506 specification language for describing concurrent discrete event systems. Its
4507 toolset supports analysis and automatic verification, linearisation, simulation,
4508 state-space exploration and generation, and tools to optimise and analyse
4509 specifications. Also, state spaces can be manipulated, visualised and
4510 analysed.")
4511 (home-page "https://mcrl2.org")
4512 (license license:boost1.0)))
4513
4514 (define-public mcrl2-minimal
4515 (package
4516 (inherit mcrl2)
4517 (name "mcrl2-minimal")
4518 (inputs
4519 `(("boost" ,boost)))
4520 (arguments
4521 '(#:configure-flags '("-DMCRL2_ENABLE_GUI_TOOLS=OFF")))))
4522
4523 (define-public tcalc
4524 (package
4525 (name "tcalc")
4526 (version "2.0")
4527 (source
4528 (origin
4529 (method url-fetch)
4530 (uri (string-append "https://sites.google.com/site/mohammedisam2000/tcalc/tcalc-"
4531 version ".tar.gz"))
4532 (sha256
4533 (base32
4534 "0jq806m4dqfia85nppfm75mml9w57g0cgv4cdw9bp3zymda83s0m"))))
4535 (build-system gnu-build-system)
4536 (synopsis "The terminal calculator")
4537 (description
4538 "The terminal calculator is a small program to help users of the GNU/Linux
4539 terminal do calculations simply and quickly. The formula to be calculated can
4540 be fed to @command{tcalc} through the command line.")
4541 (home-page "https://sites.google.com/site/mohammedisam2000/tcalc")
4542 (license license:gpl3+)))
4543
4544 (define-public sundials
4545 (package
4546 (name "sundials")
4547 (version "3.1.1")
4548 (source
4549 (origin
4550 (method url-fetch)
4551 (uri (string-append "https://computation.llnl.gov/projects/sundials/download/"
4552 "sundials-" version ".tar.gz"))
4553 (sha256
4554 (base32
4555 "090s8ymhd0g1s1d44fa73r5yi32hb4biwahhbfi327zd64yn8kd2"))))
4556 (build-system cmake-build-system)
4557 (native-inputs
4558 `(("python" ,python-2))) ;for tests; syntax incompatible with python 3
4559 (inputs
4560 `(("fortran" ,gfortran) ;for fcmix
4561 ("blas" ,openblas)
4562 ("suitesparse" ,suitesparse))) ;TODO: Add hypre
4563 (arguments
4564 `(#:configure-flags `("-DEXAMPLES_ENABLE_C:BOOL=ON"
4565 "-DEXAMPLES_ENABLE_CXX:BOOL=ON"
4566 "-DEXAMPLES_ENABLE_F77:BOOL=ON"
4567 "-DEXAMPLES_ENABLE_F90:BOOL=ON"
4568 "-DEXAMPLES_INSTALL:BOOL=OFF"
4569
4570 "-DFCMIX_ENABLE:BOOL=ON"
4571
4572 "-DKLU_ENABLE:BOOL=ON"
4573 ,(string-append "-DKLU_INCLUDE_DIR="
4574 (assoc-ref %build-inputs "suitesparse")
4575 "/include")
4576 ,(string-append "-DKLU_LIBRARY_DIR="
4577 (assoc-ref %build-inputs "suitesparse")
4578 "/lib"))))
4579 (home-page "https://computation.llnl.gov/projects/sundials")
4580 (synopsis "Suite of nonlinear and differential/algebraic equation solvers")
4581 (description "SUNDIALS is a family of software packages implemented with
4582 the goal of providing robust time integrators and nonlinear solvers that can
4583 easily be incorporated into existing simulation codes.")
4584 (license license:bsd-3)))
4585
4586 (define-public sundials-openmpi
4587 (package (inherit sundials)
4588 (name "sundials-openmpi")
4589 (inputs
4590 `(("mpi" ,openmpi)
4591 ("petsc" ,petsc-openmpi) ;support in SUNDIALS requires MPI
4592 ,@(package-inputs sundials)))
4593 (arguments
4594 (substitute-keyword-arguments (package-arguments sundials)
4595 ((#:configure-flags flags '())
4596 `(cons* "-DMPI_ENABLE:BOOL=ON"
4597 "-DPETSC_ENABLE:BOOL=ON"
4598 (string-append "-DPETSC_INCLUDE_DIR="
4599 (assoc-ref %build-inputs "petsc")
4600 "/include")
4601 (string-append "-DPETSC_LIBRARY_DIR="
4602 (assoc-ref %build-inputs "petsc")
4603 "/lib")
4604 ,flags))
4605 ((#:phases phases '%standard-phases)
4606 `(modify-phases ,phases
4607 (add-before 'check 'mpi-setup
4608 ,%openmpi-setup)))))
4609 (synopsis "SUNDIALS with OpenMPI support")))
4610
4611 (define-public combinatorial-blas
4612 (package
4613 (name "combinatorial-blas")
4614 (version "1.6.2")
4615 (source
4616 (origin
4617 (method url-fetch)
4618 (uri (string-append "http://eecs.berkeley.edu/~aydin/CombBLAS_FILES/"
4619 "CombBLAS_beta_"
4620 (match (string-split version #\.)
4621 ((major minor patch)
4622 (string-append major minor "_" patch))) ;e.g. "16_2"
4623 ".tgz"))
4624 (sha256
4625 (base32
4626 "1a9wbgdqyy1whhfc0yl0yqkax3amnqa6iihhq48d063gc0jwfd9a"))
4627 (patches (search-patches "combinatorial-blas-awpm.patch"
4628 "combinatorial-blas-io-fix.patch"))))
4629 (build-system cmake-build-system)
4630 (inputs
4631 `(("mpi" ,openmpi)
4632 ("test-data" ,(origin
4633 (method url-fetch)
4634 (uri (string-append "https://people.eecs.berkeley.edu/~aydin/"
4635 "CombBLAS_FILES/testdata_combblas1.6.1.tgz"))
4636 (sha256
4637 (base32
4638 "01y2781cy3fww7znmidrp85mf8zx0c905w5vzvk1mgrmhhynim87"))))))
4639 (arguments
4640 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES"
4641 "-DCMAKE_CXX_FLAGS=-DUSE_FUNNEL")
4642 #:parallel-tests? #f ;tests use 'mpiexec -n4'
4643 #:phases
4644 (modify-phases %standard-phases
4645 (add-before 'check 'mpi-setup
4646 ,%openmpi-setup)
4647 (add-before 'check 'test-setup
4648 (lambda* (#:key inputs #:allow-other-keys)
4649 (setenv "OMP_NUM_THREADS" "2")
4650 (invoke "tar" "xf" (assoc-ref inputs "test-data")))))))
4651 (home-page "https://people.eecs.berkeley.edu/~aydin/CombBLAS/html/")
4652 (synopsis "Linear algebra primitives for graph analytics")
4653 (description "The Combinatorial BLAS (CombBLAS) is an extensible
4654 distributed-memory parallel graph library offering a small but powerful set of
4655 linear algebra primitives specifically targeting graph analytics.")
4656 (license (list
4657 license:gpl2+ ;include/psort/(funnel|sort)*.h
4658 license:x11 ;usort and psort
4659 license:bsd-3)))) ;CombBLAS and MersenneTwister.h
4660
4661 (define-public dune-common
4662 (package
4663 (name "dune-common")
4664 (version "2.6.0")
4665 (source
4666 (origin
4667 (method url-fetch)
4668 (uri (string-append "https://dune-project.org/download/"
4669 version "/dune-common-" version ".tar.gz"))
4670 (sha256
4671 (base32
4672 "019wcr1qf7jwyxx1y5y290wdlglylskvbb2m01ljkzcza2xnlmhw"))))
4673 (build-system cmake-build-system)
4674 (arguments
4675 `(#:phases
4676 (modify-phases %standard-phases
4677 (add-after 'build 'build-tests
4678 (lambda* (#:key make-flags #:allow-other-keys)
4679 (apply invoke "make" "build_tests" make-flags))))))
4680 (inputs
4681 `(("gmp" ,gmp)
4682 ("metis" ,metis)
4683 ("openblas" ,openblas)
4684 ("python" ,python)
4685 ("superlu" ,superlu)))
4686 (native-inputs
4687 `(("gfortran" ,gfortran)
4688 ("pkg-config" ,pkg-config)))
4689 (home-page "https://dune-project.org/")
4690 (synopsis "Distributed and Unified Numerics Environment")
4691 (description "DUNE, the Distributed and Unified Numerics Environment is a
4692 modular toolbox for solving @dfn{partial differential equations} (PDEs) with
4693 grid-based methods. It supports the easy implementation of methods like
4694 @dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
4695 Differences} (FD).")
4696 ;; GPL version 2 with "runtime exception" to make it behave like LGPLv2.
4697 (license license:gpl2)))
4698
4699 (define-public dune-geometry
4700 (package
4701 (name "dune-geometry")
4702 (version "2.6.0")
4703 (source
4704 (origin
4705 (method url-fetch)
4706 (uri (string-append "https://dune-project.org/download/"
4707 version "/dune-geometry-" version ".tar.gz"))
4708 (sha256
4709 (base32
4710 "0hlaaxjyv9j05blasvb67sy02hd0w4g9znf68gdh3l731dd1aqbn"))))
4711 (build-system cmake-build-system)
4712 (arguments
4713 `(#:phases
4714 (modify-phases %standard-phases
4715 (add-after 'build 'build-tests
4716 (lambda* (#:key make-flags #:allow-other-keys)
4717 (apply invoke "make" "build_tests" make-flags))))))
4718 (inputs
4719 `(("dune-common" ,dune-common)
4720 ;; Optional
4721 ("openblas" ,openblas)
4722 ("gmp" ,gmp)
4723 ("python" ,python)))
4724 (native-inputs
4725 `(("gfortran" ,gfortran)
4726 ("pkg-config" ,pkg-config)))
4727 (home-page "https://dune-project.org/")
4728 (synopsis "Distributed and Unified Numerics Environment")
4729 (description "DUNE, the Distributed and Unified Numerics Environment is a
4730 modular toolbox for solving @dfn{partial differential equations} (PDEs) with
4731 grid-based methods. It supports the easy implementation of methods like
4732 @dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
4733 Differences} (FD).
4734
4735 This package contains the basic DUNE geometry classes.")
4736 ;; GPL version 2 with "runtime exception"
4737 (license license:gpl2)))
4738
4739 (define-public dune-uggrid
4740 (package
4741 (name "dune-uggrid")
4742 (version "2.6.0")
4743 (source
4744 (origin
4745 (method url-fetch)
4746 (uri (string-append "https://dune-project.org/download/"
4747 version "/dune-uggrid-" version ".tar.gz"))
4748 (sha256
4749 (base32
4750 "05l7a1gb78mny49anyxk6rjvn66rhgm30y72v5cjg0m5kfgr1a1f"))))
4751 (build-system cmake-build-system)
4752 (arguments
4753 `(#:phases
4754 (modify-phases %standard-phases
4755 (add-after 'build 'build-tests
4756 (lambda* (#:key make-flags #:allow-other-keys)
4757 (apply invoke "make" "build_tests" make-flags))))))
4758 (inputs
4759 `(("dune-common" ,dune-common)))
4760 (native-inputs
4761 `(("gfortran" ,gfortran)
4762 ("pkg-config" ,pkg-config)))
4763 (home-page "https://dune-project.org/")
4764 (synopsis "Distributed and Unified Numerics Environment")
4765 (description "DUNE, the Distributed and Unified Numerics Environment is a
4766 modular toolbox for solving @dfn{partial differential equations} (PDEs) with
4767 grid-based methods. It supports the easy implementation of methods like
4768 @dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
4769 Differences} (FD).
4770
4771 This package contains the DUNE UG grid classes.")
4772 (license license:lgpl2.1)))
4773
4774 (define-public dune-grid
4775 (package
4776 (name "dune-grid")
4777 (version "2.6.0")
4778 (source
4779 (origin
4780 (method url-fetch)
4781 (uri (string-append "https://dune-project.org/download/"
4782 version "/dune-grid-" version ".tar.gz"))
4783 (sha256
4784 (base32
4785 "1jp4vscm9yb9xg0lh7apzccfkhvgbnk652yahigmh3cvzpl4acd0"))))
4786 (build-system cmake-build-system)
4787 (arguments
4788 `(#:phases
4789 (modify-phases %standard-phases
4790 (add-after 'build 'build-tests
4791 (lambda* (#:key make-flags #:allow-other-keys)
4792 (apply invoke "make" "build_tests" make-flags))))))
4793 (inputs
4794 `(("dune-common" ,dune-common)
4795 ("dune-geometry" ,dune-geometry)
4796 ("gmp" ,gmp)
4797 ("metis" ,metis)
4798 ("openblas" ,openblas)
4799 ("python" ,python)))
4800 (propagated-inputs
4801 `(("dune-uggrid" ,dune-uggrid)))
4802 (native-inputs
4803 `(("gfortran" ,gfortran)
4804 ("pkg-config" ,pkg-config)))
4805 (home-page "https://dune-project.org/")
4806 (synopsis "Distributed and Unified Numerics Environment")
4807 (description "DUNE, the Distributed and Unified Numerics Environment is a
4808 modular toolbox for solving @dfn{partial differential equations} (PDEs) with
4809 grid-based methods. It supports the easy implementation of methods like
4810 @dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
4811 Differences} (FD).
4812
4813 This package contains the basic DUNE grid classes.")
4814 ;; GPL version 2 with "runtime exception"
4815 (license license:gpl2)))
4816
4817 (define-public dune-istl
4818 (package
4819 (name "dune-istl")
4820 (version "2.6.0")
4821 (source
4822 (origin
4823 (method url-fetch)
4824 (uri (string-append "https://dune-project.org/download/"
4825 version "/dune-istl-" version ".tar.gz"))
4826 (sha256
4827 (base32
4828 "0l2gyrvys5w6wsmk0ckbb7295s80b7yk7qrl7x66akv2jv1nzq2w"))))
4829 (build-system cmake-build-system)
4830 (arguments
4831 `(#:phases
4832 (modify-phases %standard-phases
4833 (add-after 'build 'build-tests
4834 (lambda* (#:key make-flags #:allow-other-keys)
4835 (apply invoke "make" "build_tests" make-flags))))))
4836 (inputs
4837 `(("dune-common" ,dune-common)
4838 ;; Optional
4839 ("metis" ,metis)
4840 ("suitesparse" ,suitesparse)
4841 ("superlu" ,superlu)
4842 ("openblas" ,openblas)
4843 ("gmp" ,gmp)
4844 ("python" ,python)))
4845 (native-inputs
4846 `(("gfortran" ,gfortran)
4847 ("pkg-config" ,pkg-config)))
4848 (home-page "https://dune-project.org/")
4849 (synopsis "Distributed and Unified Numerics Environment")
4850 (description "DUNE, the Distributed and Unified Numerics Environment is a
4851 modular toolbox for solving @dfn{partial differential equations} (PDEs) with
4852 grid-based methods.
4853
4854 This is the iterative solver template library which provides generic sparse
4855 matrix/vector classes and a variety of solvers based on these classes. A
4856 special feature is the use of templates to exploit the recursive block
4857 structure of finite element matrices at compile time. Available solvers
4858 include Krylov methods, (block-) incomplete decompositions and
4859 aggregation-based algebraic multigrid.")
4860 ;; GPL version 2 with "runtime exception"
4861 (license license:gpl2)))
4862
4863 (define-public dune-localfunctions
4864 (package
4865 (name "dune-localfunctions")
4866 (version "2.6.0")
4867 (source
4868 (origin
4869 (method url-fetch)
4870 (uri (string-append "https://dune-project.org/download/"
4871 version "/dune-localfunctions-" version ".tar.gz"))
4872 (sha256
4873 (base32
4874 "19c6zjinwwpy8jh4v4prhphyd438rapd4x80fj93apmwgw04nrhl"))))
4875 (build-system cmake-build-system)
4876 (arguments
4877 `(#:phases
4878 (modify-phases %standard-phases
4879 (add-after 'build 'build-tests
4880 (lambda* (#:key make-flags #:allow-other-keys)
4881 (apply invoke "make" "build_tests" make-flags))))))
4882 (inputs
4883 `(("dune-common" ,dune-common)
4884 ("dune-geometry" ,dune-geometry)
4885 ;; Optional
4886 ("metis" ,metis)
4887 ("superlu" ,superlu)
4888 ("gmp" ,gmp)))
4889 (native-inputs
4890 `(("gfortran" ,gfortran)
4891 ("pkg-config" ,pkg-config)))
4892 (home-page "https://dune-project.org/")
4893 (synopsis "Distributed and Unified Numerics Environment") ; TODO
4894 (description "This DUNE module provides interface and implementation for
4895 shape functions defined on the DUNE reference elements. In addition to the
4896 shape function, interpolation operators and special keys are provided which
4897 can be used to assemble global function spaces on finite-element grids.
4898
4899 This package provides an interface and implementation for shape functions
4900 defined on the DUNE reference elements. In addition to the shape function,
4901 interpolation operators and special keys are provided which can be used to
4902 assemble global function spaces on finite-element grids.")
4903 ;; GPL version 2 with "runtime exception"
4904 (license license:gpl2)))
4905
4906 (define-public dune-alugrid
4907 (package
4908 (name "dune-alugrid")
4909 (version "2.6.0")
4910 (source
4911 (origin
4912 (method url-fetch)
4913 (uri (string-append "https://dune-project.org/download/"
4914 version "/dune-alugrid-" version ".tar.gz"))
4915 (sha256
4916 (base32
4917 "1l9adgyjpra8mvwm445s0lpjshnb63jag85fb2hisbjn6bm320yj"))))
4918 (build-system cmake-build-system)
4919 (arguments
4920 `(#:phases
4921 (modify-phases %standard-phases
4922 (add-after 'unpack 'patch-include
4923 (lambda _
4924 (substitute* "dune/alugrid/test/test-alugrid.cc"
4925 (("doc/grids/gridfactory/testgrids")
4926 "doc/dune-grid/grids/gridfactory/testgrids"))
4927 #t))
4928 (add-after 'build 'build-tests
4929 (lambda* (#:key inputs make-flags #:allow-other-keys)
4930 (setenv "CPLUS_INCLUDE_PATH"
4931 (string-append (assoc-ref inputs "dune-grid") "/share"))
4932 (apply invoke "make" "build_tests" make-flags))))))
4933 (inputs
4934 `(("dune-common" ,dune-common)
4935 ("dune-geometry" ,dune-geometry)
4936 ("dune-grid" ,dune-grid)
4937 ;; Optional
4938 ("metis" ,metis)
4939 ("openblas" ,openblas)
4940 ("python" ,python)
4941 ("superlu" ,superlu)
4942 ("gmp" ,gmp)
4943 ("zlib" ,zlib)))
4944 (native-inputs
4945 `(("gfortran" ,gfortran)
4946 ("pkg-config" ,pkg-config)))
4947 (home-page "https://dune-project.org/")
4948 (synopsis "Distributed and Unified Numerics Environment")
4949 (description "ALUGrid is an adaptive, loadbalancing, unstructured
4950 implementation of the DUNE grid interface supporting either simplices or
4951 cubes.")
4952 (license license:gpl2+)))
4953
4954 (define-public dune-subgrid
4955 (package
4956 (name "dune-subgrid")
4957 (version "2.6.0")
4958 (source
4959 (origin
4960 (method git-fetch)
4961 (uri (git-reference
4962 (url "https://git.imp.fu-berlin.de/agnumpde/dune-subgrid")
4963 (commit "releases/2.6-1")))
4964 (file-name (git-file-name name version))
4965 (sha256
4966 (base32
4967 "1gcv35rx3knqd54r4pp9rzd639db4j8w2r2ibq43w1mgwdcqhs64"))))
4968 (build-system cmake-build-system)
4969 (arguments
4970 `(#:phases
4971 (modify-phases %standard-phases
4972 (add-after 'build 'build-tests
4973 (lambda* (#:key make-flags #:allow-other-keys)
4974 (apply invoke "make" "build_tests" make-flags))))))
4975 (inputs
4976 `(("dune-common" ,dune-common)
4977 ("dune-geometry" ,dune-geometry)
4978 ("dune-grid" ,dune-grid)
4979 ;; Optional
4980 ("metis" ,metis)
4981 ("openblas" ,openblas)
4982 ("gmp" ,gmp)))
4983 (native-inputs
4984 `(("gfortran" ,gfortran)
4985 ("pkg-config" ,pkg-config)))
4986 (home-page "http://numerik.mi.fu-berlin.de/dune-subgrid/index.php")
4987 (synopsis "Distributed and Unified Numerics Environment")
4988 (description "The dune-subgrid module marks elements of
4989 another hierarchical dune grid. The set of marked elements can then be
4990 accessed as a hierarchical dune grid in its own right. Dune-Subgrid
4991 provides the full grid interface including adaptive mesh refinement.")
4992 (license license:gpl2+)))
4993
4994 (define-public dune-typetree
4995 (package
4996 (name "dune-typetree")
4997 (version "2.6.0")
4998 (source
4999 (origin
5000 (method git-fetch)
5001 (uri (git-reference
5002 (url "https://gitlab.dune-project.org/staging/dune-typetree.git")
5003 (commit (string-append "v" version))))
5004 (file-name (git-file-name name version))
5005 (sha256
5006 (base32
5007 "0mnv6w2f22lz3j4bdpdjq55vjm8xxfx9v4vvhg9bd36xpsbjpjp9"))))
5008 (build-system cmake-build-system)
5009 (arguments
5010 `(#:phases
5011 (modify-phases %standard-phases
5012 (add-after 'build 'build-tests
5013 (lambda* (#:key make-flags #:allow-other-keys)
5014 (apply invoke "make" "build_tests" make-flags))))))
5015 (inputs
5016 `(("dune-common" ,dune-common)
5017 ;; Optional
5018 ("openblas" ,openblas)
5019 ("python" ,python)
5020 ("metis" ,metis)
5021 ("superlu" ,superlu)
5022 ("gmp" ,gmp)))
5023 (native-inputs
5024 `(("gfortran" ,gfortran)
5025 ("pkg-config" ,pkg-config)))
5026 (home-page "https://dune-project.org/")
5027 (synopsis "Distributed and Unified Numerics Environment")
5028 (description "TypeTree is a template library for constructing and
5029 operating on statically typed trees of objects.")
5030 ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
5031 (license (list license:lgpl3+ license:gpl2))))
5032
5033 (define-public dune-functions
5034 (package
5035 (name "dune-functions")
5036 (version "2.6.0")
5037 (source
5038 (origin
5039 (method git-fetch)
5040 (uri (git-reference
5041 (url "https://gitlab.dune-project.org/staging/dune-functions.git")
5042 (commit (string-append "v" version))))
5043 (file-name (git-file-name name version))
5044 (sha256
5045 (base32
5046 "1an8gb477n8j0kzpbrv7nr1snh8pxip0gsxq6w63jc83gg3dj200"))))
5047 (build-system cmake-build-system)
5048 (arguments
5049 `(#:phases
5050 (modify-phases %standard-phases
5051 (add-after 'unpack 'disable-failing-tests
5052 (lambda _
5053 (setenv "ARGS"
5054 ;; unable to load GMSH file in this test
5055 "--exclude-regex gridviewfunctionspacebasistest")
5056 #t))
5057 (add-after 'build 'build-tests
5058 (lambda* (#:key make-flags #:allow-other-keys)
5059 (apply invoke "make" "build_tests" make-flags))))))
5060 (inputs
5061 `(("dune-common" ,dune-common)
5062 ("dune-istl" ,dune-istl)
5063 ("dune-localfunctions" ,dune-localfunctions)
5064 ("dune-grid" ,dune-grid)
5065 ("dune-geometry" ,dune-geometry)
5066 ("dune-typetree" ,dune-typetree)
5067 ("openblas" ,openblas)
5068 ("metis" ,metis)
5069 ("python" ,python)
5070 ("superlu" ,superlu)
5071 ("gmp" ,gmp)))
5072 (native-inputs
5073 `(("gfortran" ,gfortran)
5074 ("pkg-config" ,pkg-config)))
5075 (home-page "https://dune-project.org/")
5076 (synopsis "Distributed and Unified Numerics Environment")
5077 (description "The dune-functions module provides an abstraction layer for
5078 global finite element functions. Its two main concepts are functions
5079 implemented as callable objects, and bases of finite element spaces.")
5080 ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
5081 (license (list license:lgpl3+ license:gpl2))))
5082
5083 (define-public dune-pdelab
5084 (package
5085 (name "dune-pdelab")
5086 (version "2.6.0-rc1")
5087 (source
5088 (origin
5089 (method git-fetch)
5090 (uri (git-reference
5091 (url "https://gitlab.dune-project.org/pdelab/dune-pdelab")
5092 (commit (string-append "v" version))))
5093 (file-name (git-file-name name version))
5094 (sha256
5095 (base32
5096 "07g0s9448z65vjrq88g5rv3340iifil85k170n8kbqchsvi4ny5v"))))
5097 (build-system cmake-build-system)
5098 (arguments '(#:tests? #f)) ; XXX: the tests cannot be compiled
5099 (inputs
5100 `(("dune-common" ,dune-common)
5101 ("dune-istl" ,dune-istl)
5102 ("dune-localfunctions" ,dune-localfunctions)
5103 ("dune-geometry" ,dune-geometry)
5104 ("dune-grid" ,dune-grid)
5105 ("dune-typetree" ,dune-typetree)
5106 ("dune-functions" ,dune-functions)
5107 ;; Optional
5108 ("openblas" ,openblas)
5109 ("eigen" ,eigen)
5110 ("metis" ,metis)
5111 ("python" ,python)
5112 ("superlu" ,superlu)
5113 ("gmp" ,gmp)))
5114 (native-inputs
5115 `(("gfortran" ,gfortran)
5116 ("pkg-config" ,pkg-config)))
5117 (home-page "https://dune-project.org/")
5118 (synopsis "Differential equations solver toolbox")
5119 (description "PDELab is a partial differential equations solver toolbox
5120 built on top of DUNE, the Distributed and Unified Numerics Environment.")
5121 ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
5122 (license (list license:lgpl3+ license:gpl2))))
5123
5124 (define add-openmpi-to-dune-package
5125 (let ((dune-package?
5126 (lambda (p) (string-prefix? "dune-" (package-name p)))))
5127 (package-mapping
5128 (lambda (p)
5129 (if (dune-package? p)
5130 (package (inherit p)
5131 (name (string-append (package-name p) "-openmpi"))
5132 (inputs `(,@(package-inputs p)
5133 ("openmpi" ,openmpi)))
5134 (arguments
5135 (substitute-keyword-arguments (package-arguments p)
5136 ((#:phases phases '%standard-phases)
5137 `(modify-phases ,phases
5138 (add-before 'check 'mpi-setup
5139 ,%openmpi-setup)))))
5140 (synopsis (string-append (package-synopsis p) " (with MPI support)")))
5141 p))
5142 (negate dune-package?))))
5143
5144 (define-public dune-common-openmpi
5145 (add-openmpi-to-dune-package dune-common))
5146
5147 (define-public dune-geometry-openmpi
5148 (add-openmpi-to-dune-package dune-geometry))
5149
5150 (define-public dune-istl-openmpi
5151 (add-openmpi-to-dune-package dune-istl))
5152
5153 (define-public dune-typetree-openmpi
5154 (add-openmpi-to-dune-package dune-typetree))
5155
5156 (define-public dune-uggrid-openmpi
5157 (add-openmpi-to-dune-package dune-uggrid))
5158
5159 (define-public dune-grid-openmpi
5160 (add-openmpi-to-dune-package dune-grid))
5161
5162 (define-public dune-alugrid-openmpi
5163 (add-openmpi-to-dune-package dune-alugrid))
5164
5165 (define-public dune-subgrid-openmpi
5166 (add-openmpi-to-dune-package dune-subgrid))
5167
5168 (define-public dune-localfunctions-openmpi
5169 (add-openmpi-to-dune-package dune-localfunctions))
5170
5171 (define-public dune-functions-openmpi
5172 (add-openmpi-to-dune-package dune-functions))
5173
5174 (define-public dune-pdelab-openmpi
5175 (add-openmpi-to-dune-package dune-pdelab))
5176
5177 (define-public mlucas
5178 (package
5179 (name "mlucas")
5180 (version "18")
5181 (source
5182 (origin
5183 (method url-fetch)
5184 (uri (string-append
5185 "https://mersenneforum.org/mayer/src/C/mlucas_v" version ".txz"))
5186 (sha256
5187 (base32 "0h4xj6pyyac79ka5ibqjilfa3s9j3yxnzgpwc57b54kfh2bj3447"))))
5188 (build-system gnu-build-system)
5189 (inputs
5190 `(("python2" ,python-2)))
5191 (arguments
5192 `(#:tests? #f ; no tests
5193 #:phases
5194 (modify-phases %standard-phases
5195 (replace 'configure
5196 (lambda _
5197 (chdir "src")
5198 (call-with-output-file "Makefile"
5199 (lambda (port)
5200 (format port "CC = gcc
5201 CFLAGS = -O3 ~a -DUSE_THREADS
5202 LDLIBS = -lm -lpthread -lrt
5203 Mlucas: $(addsuffix .o,$(basename $(wildcard *.c)))
5204 "
5205 ,(let ((system (or (%current-target-system)
5206 (%current-system))))
5207 (cond
5208 ((string-prefix? "x86_64" system) "-DUSE_SSE2")
5209 (else ""))))))
5210 #t))
5211 (replace 'install
5212 (lambda* (#:key outputs #:allow-other-keys)
5213 (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
5214 (install-file "Mlucas" bin)
5215 (install-file "primenet.py" bin))
5216 #t)))))
5217 (home-page "https://www.mersenne.org")
5218 (synopsis "Great Internet Mersenne Prime Search (GIMPS) distributed computing client")
5219 (description "Mlucas performs Lucas-Lehmer primality testing of Mersenne
5220 numbers in search of a world-record prime. You may use it to test any
5221 suitable number as you wish, but it is preferable that you do so in a
5222 coordinated fashion, as part of the Great Internet Mersenne Prime
5223 Search (GIMPS). Mlucas also includes a simple Python script for assignment
5224 management via the GIMPS project's Primenet server.")
5225 (license license:gpl2+)))
5226
5227 (define-public nauty
5228 (package
5229 (name "nauty")
5230 (version "2.6r12")
5231 (source (origin
5232 (method url-fetch)
5233 (uri (string-append
5234 "https://pallini.di.uniroma1.it/"
5235 "nauty" (string-join (string-split version #\.) "")
5236 ".tar.gz"))
5237 (sha256
5238 (base32
5239 "1p4mxf8q5wm47nxyskxbqwa5p1vvkycv1zgswvnk9nsn6vff0al6"))))
5240 (build-system gnu-build-system)
5241 (outputs '("out" "lib"))
5242 (arguments
5243 `(#:test-target "checks"
5244 #:phases
5245 (modify-phases %standard-phases
5246 ;; Default make target does not build all available
5247 ;; executables. Create them now.
5248 (add-after 'build 'build-extra-programs
5249 (lambda _
5250 (for-each (lambda (target) (invoke "make" target))
5251 '("blisstog" "bliss2dre" "checks6" "sumlines"))
5252 #t))
5253 ;; Upstream does not provide any install target.
5254 (replace 'install
5255 (lambda* (#:key outputs #:allow-other-keys)
5256 (let* ((out (assoc-ref outputs "out"))
5257 (lib-output (assoc-ref outputs "lib"))
5258 (bin (string-append out "/bin"))
5259 (doc (string-append out "/share/doc/nauty/"))
5260 (include (string-append lib-output "/include/nauty"))
5261 (lib (string-append lib-output "/lib/nauty")))
5262 (for-each (lambda (f) (install-file f bin))
5263 '("dreadnaut" "NRswitchg" "addedgeg" "amtog" "biplabg"
5264 "blisstog" "bliss2dre" "catg" "checks6" "complg"
5265 "converseg" "copyg" "countg" "cubhamg" "deledgeg"
5266 "delptg" "directg" "dretodot" "dretog" "genbg"
5267 "genbgL" "geng" "genquarticg" "genrang" "genspecialg"
5268 "gentourng" "gentreeg" "hamheuristic" "labelg"
5269 "linegraphg" "listg" "multig" "newedgeg" "pickg"
5270 "planarg" "ranlabg" "shortg" "showg" "subdivideg"
5271 "sumlines" "twohamg" "vcolg" "watercluster2"))
5272 (for-each (lambda (f) (install-file f include))
5273 (find-files "." "\\.h$"))
5274 (for-each (lambda (f) (install-file f lib))
5275 (find-files "." "\\.a$"))
5276 (for-each (lambda (f) (install-file f doc))
5277 (append '("formats.txt" "README" "schreier.txt")
5278 (find-files "." "\\.pdf$")))))))))
5279 (inputs
5280 `(("gmp" ,gmp))) ;for sumlines
5281 (home-page "https://pallini.di.uniroma1.it/")
5282 (synopsis "Library for graph automorphisms")
5283 (description "@code{nauty} (No AUTomorphisms, Yes?) is a set of
5284 procedures for computing automorphism groups of graphs and digraphs.
5285
5286 @code{nauty} computes graph information in the form of a set of
5287 generators, the size of the group, and the orbits of the group; it can
5288 also produce a canonical label. The @code{nauty} suite is written in
5289 C and comes with a command-line interface, a collection of
5290 command-line tools, and an Application Programming Interface (API).
5291
5292 This package provides the static libraries required to run programs
5293 compiled against the nauty library.")
5294 (license license:asl2.0)))
5295
5296 (define-public ppl
5297 (package
5298 (name "ppl")
5299 (version "1.2")
5300 (source
5301 (origin
5302 (method url-fetch)
5303 (uri (string-append "https://www.bugseng.com/products/ppl/download/"
5304 "ftp/releases/" version
5305 "/ppl-" version ".tar.gz"))
5306 (sha256
5307 (base32
5308 "1j5aji1g2vmdvc0gqz45n2ll2l2f6czca04wiyfl5g3sm3a6vhvb"))))
5309 (build-system gnu-build-system)
5310 (native-inputs
5311 `(("m4", m4)))
5312 (inputs
5313 `(("glpk" ,glpk)
5314 ("gmp", gmp)))
5315 (home-page "https://www.bugseng.com/parma-polyhedra-library")
5316 (synopsis
5317 "Parma Polyhedra Library for computations with polyhedra")
5318 (description
5319 "The Parma Polyhedra Library (PPL) provides numerical abstractions
5320 especially targeted at applications in the field of analysis and
5321 verification of complex systems. These abstractions include convex
5322 polyhedra, defined as the intersection of a finite number of (open or
5323 closed) halfspaces, each described by a linear inequality (strict or
5324 non-strict) with rational coefficients; some special classes of polyhedra
5325 shapes that offer interesting complexity/precision tradeoffs; and grids
5326 which represent regularly spaced points that satisfy a set of linear
5327 congruence relations. The library also supports finite powersets and
5328 products of (any kind of) polyhedra and grids, a mixed integer linear
5329 programming problem solver using an exact-arithmetic version of the simplex
5330 algorithm, a parametric integer programming solver, and primitives for
5331 termination analysis via the automatic synthesis of linear ranking
5332 functions.")
5333 (license license:gpl3+)))
5334
5335 (define-public speedcrunch
5336 (package
5337 (name "speedcrunch")
5338 (version "0.12.0")
5339 (source
5340 (origin
5341 (method git-fetch)
5342 (uri (git-reference
5343 (url "https://bitbucket.org/heldercorreia/speedcrunch.git")
5344 (commit (string-append "release-" version))))
5345 (file-name (git-file-name name version))
5346 (sha256
5347 (base32
5348 "0vh7cd1915bjqzkdp3sk25ngy8cq624mkh8c53c5bnzk357kb0fk"))))
5349 (build-system cmake-build-system)
5350 (inputs `(("qtbase" ,qtbase)))
5351 (native-inputs `(("qttools" ,qttools)))
5352 (arguments
5353 `(#:phases
5354 (modify-phases %standard-phases
5355 (add-after 'unpack 'chdir-to-src
5356 (lambda _ (chdir "src") #t)))))
5357 (synopsis "High-precision scientific calculator")
5358 (description
5359 "SpeedCrunch is a high-precision scientific calculator. It features a
5360 syntax-highlighted scrollable display and is designed to be fully used via
5361 keyboard. Some distinctive features are auto-completion of functions and
5362 variables, a formula book, and quick insertion of constants from various
5363 fields of knowledge.")
5364 (home-page "https://speedcrunch.org/")
5365 (license license:gpl2+)))
5366
5367 (define-public minisat
5368 ;; This is the last commit which is available upstream, no
5369 ;; release happened since 2010.
5370 (let ((commit "37dc6c67e2af26379d88ce349eb9c4c6160e8543")
5371 (revision "1"))
5372 (package
5373 (name "minisat")
5374 (version (string-append "2.2.0-" revision "." (string-take commit 7)))
5375 (source
5376 (origin
5377 (method git-fetch)
5378 (uri (git-reference
5379 (url "https://github.com/niklasso/minisat.git")
5380 (commit commit)))
5381 (file-name (string-append name "-" version "-checkout"))
5382 (sha256
5383 (base32
5384 "091hf3qkm197s5r7xcr3m07xsdwyz2rqk1hc9kj0hn13imz09irq"))
5385 (patches
5386 (search-patches "minisat-friend-declaration.patch"
5387 "minisat-install.patch"))))
5388 (build-system gnu-build-system)
5389 (arguments
5390 '(#:make-flags (list (string-append "prefix=" %output))
5391 #:tests? #f ;no check target
5392 #:phases
5393 (modify-phases %standard-phases
5394 (delete 'configure))))
5395 (inputs
5396 `(("zlib:static" ,zlib "static")
5397 ("zlib" ,zlib)))
5398 (synopsis
5399 "Small, yet efficient, SAT solver")
5400 (description
5401 "MiniSat is a minimalistic, open-source SAT solver, developed to help
5402 researchers and developers alike to get started on SAT.")
5403 (home-page
5404 "http://minisat.se/MiniSat.html")
5405 (license license:expat))))
5406
5407 (define-public libqalculate
5408 (package
5409 (name "libqalculate")
5410 (version "3.8.0")
5411 (source
5412 (origin
5413 (method git-fetch)
5414 (uri (git-reference
5415 (url "https://github.com/Qalculate/libqalculate/")
5416 (commit (string-append "v" version))))
5417 (file-name (git-file-name name version))
5418 (sha256
5419 (base32 "1vbaza9c7159xf2ym90l0xkyj2mp6c3hbghhsqn29yvz08fda9df"))
5420 (patches
5421 (search-patches "libqalculate-3.8.0-libcurl-ssl-fix.patch"))))
5422 (build-system gnu-build-system)
5423 (native-inputs
5424 `(("pkg-config" ,pkg-config)
5425 ("gettext" ,gettext-minimal)
5426 ("intltool" ,intltool)
5427 ("automake" ,automake)
5428 ("autoconf" ,autoconf)
5429 ("libtool" ,libtool)
5430 ("doxygen" ,doxygen)
5431 ("file" ,file)))
5432 (inputs
5433 `(("gmp" ,gmp)
5434 ("mpfr" ,mpfr)
5435 ("libxml2" ,libxml2)
5436 ("curl" ,curl)
5437 ("icu4c" ,icu4c)
5438 ("gnuplot" ,gnuplot)
5439 ("readline" ,readline)
5440 ("libiconv" ,libiconv)))
5441 (arguments
5442 `(#:phases
5443 (modify-phases %standard-phases
5444 (add-before 'bootstrap 'setenv
5445 ;; Prevent the autogen.sh script to carry out the configure
5446 ;; script, which has not yet been patched to replace /bin/sh.
5447 (lambda _
5448 (setenv "NOCONFIGURE" "TRUE")
5449 #t)))))
5450 (home-page "https://qalculate.github.io/")
5451 (synopsis "Multi-purpose cli desktop calculator and library")
5452 (description
5453 "Libqalculate is a multi-purpose cli desktop calculator and library.
5454 It provides basic and advanced functionality. Features include customizable
5455 functions, unit calculations, and conversions, physical constants, symbolic
5456 calculations (including integrals and equations), arbitrary precision,
5457 uncertainty propagation, interval arithmetic, plotting and a user-friendly
5458 cli.")
5459 (license license:gpl2+)))
5460
5461 (define-public qalculate-gtk
5462 (package
5463 (name "qalculate-gtk")
5464 (version "3.8.0")
5465 (source
5466 (origin
5467 (method git-fetch)
5468 (uri (git-reference
5469 (url "https://github.com/Qalculate/qalculate-gtk/")
5470 (commit (string-append "v" version))))
5471 (file-name (git-file-name name version))
5472 (sha256
5473 (base32 "0nsg6dzg5r7rzqr671nvrf1c50rjwpz7bxv5f20i4s7agizgv840"))))
5474 (build-system glib-or-gtk-build-system)
5475 (native-inputs
5476 `(("pkg-config" ,pkg-config)
5477 ("intltool" ,intltool)
5478 ("automake" ,automake)
5479 ("autoconf" ,autoconf)
5480 ("libtool" ,libtool)
5481 ("file" ,file)))
5482 (inputs
5483 `(("gmp" ,gmp)
5484 ("mpfr" ,mpfr)
5485 ("libqalculate" ,libqalculate)
5486 ("libxml2" ,libxml2)
5487 ("glib" ,glib)
5488 ("gtk+" ,gtk+)))
5489 (arguments
5490 `(#:phases
5491 (modify-phases %standard-phases
5492 (add-before 'bootstrap 'setenv
5493 ;; Prevent the autogen.sh script to carry out the configure
5494 ;; script, which has not yet been patched to replace /bin/sh.
5495 (lambda _
5496 (setenv "NOCONFIGURE" "TRUE")
5497 #t))
5498 (add-before 'check 'add-pot-file
5499 ;; the file contains translations and are currently not in use
5500 ;; left out on purpose so add it to POTFILES.skip
5501 (lambda _
5502 (with-output-to-file "po/POTFILES.skip"
5503 (lambda _
5504 (format #t "data/shortcuts.ui~%")
5505 #t))
5506 #t)))))
5507 (home-page "https://qalculate.github.io/")
5508 (synopsis "Multi-purpose graphical desktop calculator")
5509 (description
5510 "Qalculate-gtk is the GTK frontend for libqalculate. It is a
5511 multi-purpose GUI desktop calculator. It provides basic and advanced
5512 functionality. Features include customizable functions, unit calculations,
5513 and conversions, physical constants, symbolic calculations (including
5514 integrals and equations), arbitrary precision, uncertainity propagation,
5515 interval arithmetic, plotting.")
5516 (license license:gpl2+)))