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