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