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