gnu: grub: Disable tests on ARM platforms.
[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>
41a46a50 5;;; Copyright © 2014, 2015, 2016, 2017 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>
612a387f 8;;; Copyright © 2015, 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
32158110 9;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
9aafbc0c 10;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
83a34647 11;;; Copyright © 2015, 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
45147b0c 12;;; Copyright © 2015 Fabian Harfert <fhmgufs@web.de>
ec8c7e47 13;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
3c8ba11a 14;;; Copyright © 2016 Kei Kebreau <kkebreau@posteo.net>
5d4bd4cc 15;;; Copyright © 2016, 2017 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>
5d4bd4cc 18;;; Copyright © 2017 Paul Garlick <pgarlick@tourbillion-technology.com>
54052a54 19;;; Copyright © 2017 ng0 <contact.ng0@cryptolab.net>
ba1be533 20;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
d109b1e8 21;;; Copyright © 2017 Theodoros Foradis <theodoros@foradis.org>
5ca4fe96 22;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
8f8b2451
AE
23;;;
24;;; This file is part of GNU Guix.
25;;;
26;;; GNU Guix is free software; you can redistribute it and/or modify it
27;;; under the terms of the GNU General Public License as published by
28;;; the Free Software Foundation; either version 3 of the License, or (at
29;;; your option) any later version.
30;;;
31;;; GNU Guix is distributed in the hope that it will be useful, but
32;;; WITHOUT ANY WARRANTY; without even the implied warranty of
33;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34;;; GNU General Public License for more details.
35;;;
36;;; You should have received a copy of the GNU General Public License
37;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
38
39(define-module (gnu packages maths)
ec322be2 40 #:use-module (ice-9 regex)
8f8b2451 41 #:use-module (gnu packages)
b5b73a82 42 #:use-module ((guix licenses) #:prefix license:)
8f8b2451
AE
43 #:use-module (guix packages)
44 #:use-module (guix download)
54052a54 45 #:use-module (guix git-download)
0e2672ae 46 #:use-module (guix utils)
cec86422 47 #:use-module (guix build utils)
da95c817 48 #:use-module (guix build-system cmake)
c9dfa3c7 49 #:use-module (guix build-system gnu)
ba1be533 50 #:use-module (guix build-system ocaml)
ec8c7e47 51 #:use-module (guix build-system r)
3de01d3f 52 #:use-module (gnu packages algebra)
5143517c 53 #:use-module (gnu packages autotools)
3de01d3f 54 #:use-module (gnu packages bison)
a17d4564 55 #:use-module (gnu packages boost)
e73b49fb 56 #:use-module (gnu packages check)
3de01d3f 57 #:use-module (gnu packages cmake)
c9dfa3c7 58 #:use-module (gnu packages compression)
668c06ac 59 #:use-module (gnu packages curl)
b7b27a8f 60 #:use-module (gnu packages cyrus-sasl)
528bb464 61 #:use-module (gnu packages documentation)
57e544e8 62 #:use-module (gnu packages elf)
3de01d3f 63 #:use-module (gnu packages flex)
668c06ac 64 #:use-module (gnu packages fltk)
f3929800 65 #:use-module (gnu packages fontutils)
1dba6407 66 #:use-module (gnu packages gettext)
da95c817 67 #:use-module (gnu packages gcc)
73fed4f8 68 #:use-module (gnu packages gd)
668c06ac 69 #:use-module (gnu packages ghostscript)
889187a4 70 #:use-module (gnu packages graphviz)
f3929800 71 #:use-module (gnu packages gtk)
45147b0c 72 #:use-module (gnu packages image)
2fd26d05 73 #:use-module (gnu packages java)
668c06ac 74 #:use-module (gnu packages less)
8731e527 75 #:use-module (gnu packages lisp)
bc3a2e35 76 #:use-module (gnu packages logging)
6e64766a 77 #:use-module (gnu packages lua)
5698b8b8 78 #:use-module (gnu packages gnome)
1b39a196 79 #:use-module (gnu packages guile)
668c06ac
JD
80 #:use-module (gnu packages xorg)
81 #:use-module (gnu packages gl)
9f913401 82 #:use-module (gnu packages imagemagick)
8731e527 83 #:use-module (gnu packages m4)
d8c7eeb9 84 #:use-module (gnu packages mpi)
b92eee75 85 #:use-module (gnu packages multiprecision)
528bb464 86 #:use-module (gnu packages netpbm)
ba1be533 87 #:use-module (gnu packages ocaml)
668c06ac 88 #:use-module (gnu packages pcre)
5698b8b8 89 #:use-module (gnu packages popt)
c9dfa3c7
AE
90 #:use-module (gnu packages perl)
91 #:use-module (gnu packages pkg-config)
da95c817 92 #:use-module (gnu packages python)
589e3f4e 93 #:use-module (gnu packages python-web)
c9dfa3c7 94 #:use-module (gnu packages readline)
2742f87e 95 #:use-module (gnu packages tbb)
479c4273 96 #:use-module (gnu packages scheme)
b7194849 97 #:use-module (gnu packages shells)
df354a77 98 #:use-module (gnu packages tcl)
668c06ac 99 #:use-module (gnu packages texinfo)
8f9ac901 100 #:use-module (gnu packages tex)
b7b27a8f 101 #:use-module (gnu packages tls)
9aafbc0c 102 #:use-module (gnu packages wxwidgets)
c12efc72 103 #:use-module (gnu packages xml)
a17d4564 104 #:use-module (srfi srfi-1))
8f8b2451 105
193abc82
JD
106(define-public aris
107 (package
1f45f18a
JD
108 (name "aris")
109 (version "2.2")
110 (source (origin
111 (method url-fetch)
112 (uri (string-append "mirror://gnu/" name "/" name "-" version ".tar.gz"))
113 (sha256 (base32
114 "1q1887ryqdr9sn0522hc7p16kqwlxxyz5dkmma8ar2nxplhgll7q"))))
115 (build-system gnu-build-system)
116 (inputs `(("gtk+" ,gtk+)
117 ("libxml2" ,libxml2)))
118 (native-inputs `(("pkg-config" ,pkg-config)))
119 (synopsis "Natural deduction first-order logic interface")
120 (description "Aris is a program for performing logical proofs. It supports
121propositional and predicate logic, as well as Boolean algebra and
122arithmetical logic. In addition to its predefined inference and equivalence
123rules, Aris also supports references to older proofs. Its use of standard
124logical symbols and its natural deduction interface make it easy to use for
125beginners.")
126 (license license:gpl3+)
6fd52309 127 (home-page "https://www.gnu.org/software/aris/")))
193abc82 128
9c45c519
JD
129(define-public c-graph
130 (package
131 (name "c-graph")
132 (version "2.0")
133 (source (origin
134 (method url-fetch)
135 (uri (string-append "mirror://gnu/c-graph/c-graph-" version
136 ".tar.gz"))
137 (sha256 (base32
138 "1hlvpzrh7hzzf533diyfiabzskddi8zx92av9hwkjw3l46z7qv01"))))
139 (build-system gnu-build-system)
140 (inputs
141 `(("fortran" ,gfortran)))
a3947cb1 142 (synopsis "Visualizing and demonstrating convolution")
9c45c519 143 (description
a3947cb1
LC
144 "GNU C-Graph is a tool for demonstrating the theory of convolution.
145Thus, it can serve as an excellent aid to students of signal and systems
146theory in visualizing the convolution process. Rather than forcing the
147student to write code, the program offers an intuitive interface with
148interactive dialogs to guide them.")
9c45c519 149 (license license:gpl3+)
6fd52309 150 (home-page "https://www.gnu.org/software/c-graph/")))
9c45c519 151
d91025e3
TD
152(define-public coda
153 (package
154 (name "coda")
e0fbf373 155 (version "2.18.2")
d91025e3
TD
156 (source
157 (origin
158 (method url-fetch)
159 (uri (string-append "https://github.com/stcorp/coda/releases/download/"
160 version "/coda-" version ".tar.gz"))
161 (sha256
e0fbf373 162 (base32 "01fnqcby9jijvf3jxr1fk4bny059lvvq5wbqm7ns60ilykfdnm6a"))
4b12fe5c
TD
163 (patches (search-patches "coda-use-system-libs.patch"))
164 (modules '((guix build utils)))
165 (snippet
166 ;; Make sure we don't use the bundled software.
167 '(for-each (lambda (d)
168 (delete-file-recursively (string-append "libcoda/" d)))
169 '("zlib" "pcre" "expat")))))
d91025e3
TD
170 (native-inputs
171 `(("fortran" ,gfortran)
172 ("python" ,python)
173 ("python-numpy" ,python-numpy)))
174 (inputs
175 `(("zlib" ,zlib)
4b12fe5c
TD
176 ("pcre" ,pcre)
177 ("expat" ,expat)
d91025e3
TD
178 ("hdf4" ,hdf4-alt)
179 ("hdf5" ,hdf5)))
180 (build-system gnu-build-system)
181 (arguments
4b12fe5c
TD
182 '(#:configure-flags '("--with-hdf4" "--with-hdf5" "--enable-python"
183 "LIBS= -lz -lpcre -lexpat")))
d91025e3
TD
184 (synopsis "A common interface to various earth observation data formats")
185 (description
186 "The Common Data Access toolbox (CODA) provides a set of interfaces for
187reading remote sensing data from earth observation data files. It consists of
188command line applications and interfaces to the C, Fortran, Python, and Java
189programming languages.")
190 (home-page "https://stcorp.nl/coda")
191 (license license:gpl2+)))
192
8f8b2451
AE
193(define-public units
194 (package
195 (name "units")
f11d2849 196 (version "2.16")
8f8b2451
AE
197 (source (origin
198 (method url-fetch)
199 (uri (string-append "mirror://gnu/units/units-" version
200 ".tar.gz"))
201 (sha256 (base32
f11d2849 202 "11hnp3gcmcc5kci2caxw4hs6m08h2mhqs3xzqq7iafx1ha2ggwyw"))))
8f8b2451 203 (build-system gnu-build-system)
0498d248 204 (inputs
a2549713
EB
205 `(("readline" ,readline)
206 ("python" ,python-wrapper) ;for 'units_cur' script
0498d248
EB
207 ("python-requests" ,python-requests)))
208 (arguments
209 `(#:phases (modify-phases %standard-phases
210 (add-after 'install 'wrap-units_cur
211 (lambda* (#:key outputs #:allow-other-keys)
212 (let* ((out (assoc-ref outputs "out"))
213 (bin (string-append out "/bin")))
214 (wrap-program (string-append bin "/units_cur")
215 `("PYTHONPATH" ":" prefix
216 ,(search-path-as-string->list (getenv "PYTHONPATH"))))
217 #t))))))
8f8b2451
AE
218 (synopsis "Conversion between thousands of scales")
219 (description
574e86f9 220 "GNU Units converts numeric quantities between units of measure. It
7c125ce0
AK
221can handle scale changes through adaptive usage of standard scale
222prefixes (micro-, kilo-, etc.). It can also handle nonlinear
223conversions such as Fahrenheit to Celsius. Its interpreter is powerful
224enough to be used effectively as a scientific calculator.")
8f8b2451 225 (license license:gpl3+)
6fd52309 226 (home-page "https://www.gnu.org/software/units/")))
c9dfa3c7 227
61a529b4
RW
228(define-public double-conversion
229 (package
230 (name "double-conversion")
231 (version "1.1.5")
232 (source (origin
233 (method url-fetch)
234 (uri (string-append
235 "https://github.com/floitsch/double-conversion/archive/v"
236 version ".tar.gz"))
237 (file-name (string-append name "-" version ".tar.gz"))
238 (sha256
239 (base32
240 "0cnr8xhyjfxijay8ymkqcph3672wp2lj23qhdmr3m4kia5kpdf83"))))
241 (build-system cmake-build-system)
242 (arguments
243 '(#:test-target "test"
244 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
245 "-DBUILD_TESTING=ON")))
246 (home-page "https://github.com/floitsch/double-conversion")
247 (synopsis "Conversion routines for IEEE doubles")
248 (description
249 "The double-conversion library provides binary-decimal and decimal-binary
250routines for IEEE doubles. The library consists of efficient conversion
251routines that have been extracted from the V8 JavaScript engine.")
252 (license license:bsd-3)))
253
182d6311
ML
254(define-public dionysus
255 (package
256 (name "dionysus")
257 (version "1.3.0")
258 (source (origin
259 (method url-fetch)
260 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
261 ".tar.gz"))
262 (sha256
263 (base32
264 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
265 (build-system gnu-build-system)
266 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
267 (synopsis "Local search for universal constants and scientific values")
268 (description
269 "GNU Dionysus is a convenient system for quickly retrieving the values of
270mathematical constants used in science and engineering. Values can be
271searched using a simple command-line tool, choosing from three databases:
272universal constants, atomic numbers, and constants related to
273semiconductors.")
274 (license license:gpl3+)
6fd52309 275 (home-page "https://www.gnu.org/software/dionysus/")))
182d6311 276
88bd1804
AE
277(define-public gsl
278 (package
279 (name "gsl")
f885fc05 280 (version "2.4")
ab2cc5cd
LC
281 (source (origin
282 (method url-fetch)
283 (uri (string-append "mirror://gnu/gsl/gsl-"
284 version ".tar.gz"))
285 (sha256
286 (base32
f885fc05 287 "16yfs5n444s03np1naj6yp1fsysd42kdscxzkg0k2yvfjixx0ijd"))
ab2cc5cd 288 (patches (search-patches "gsl-test-i686.patch"))))
88bd1804 289 (build-system gnu-build-system)
71e0f288 290 (arguments
f885fc05 291 `(;; Currently there are numerous tests that fail on "exotic"
6f766069
EF
292 ;; architectures such as aarch64 and ppc64le.
293 ,@(if (string-prefix? "aarch64-linux"
294 (or (%current-target-system) (%current-system)))
295 '(#:tests? #f)
296 '())))
297 (home-page "https://www.gnu.org/software/gsl/")
88bd1804
AE
298 (synopsis "Numerical library for C and C++")
299 (description
a22dc0c4
LC
300 "The GNU Scientific Library is a library for numerical analysis in C
301and C++. It includes a wide range of mathematical routines, with over 1000
302functions in total. Subject areas covered by the library include:
303differential equations, linear algebra, Fast Fourier Transforms and random
304numbers.")
88bd1804
AE
305 (license license:gpl3+)))
306
ba1be533
BW
307(define-public ocaml-gsl
308 (package
309 (name "ocaml-gsl")
310 (version "1.19.3")
311 (source
312 (origin
313 (method url-fetch)
314 (uri
315 (string-append
316 "https://github.com/mmottl/gsl-ocaml/releases/download/v"
317 version"/gsl-ocaml-" version ".tar.gz"))
318 (sha256
319 (base32
320 "0nzp43hp8pbjqkrxnwp5lgjrabxayf61h18fjaydi0s5faq6f3xh"))))
321 (build-system ocaml-build-system)
322 (inputs
323 `(("gsl" ,gsl)))
324 (home-page "https://mmottl.github.io/gsl-ocaml")
325 (synopsis "Bindings to the GNU Scientific Library")
326 (description
327 "GSL-OCaml is an interface to the @dfn{GNU scientific library} (GSL) for
328the OCaml language.")
329 (license license:gpl3+)))
330
7adaab9f
BW
331(define-public ocaml4.01-gsl
332 (package-with-ocaml4.01 ocaml-gsl))
333
b92eee75
AE
334(define-public glpk
335 (package
336 (name "glpk")
1cae188e 337 (version "4.63")
b92eee75
AE
338 (source
339 (origin
340 (method url-fetch)
341 (uri (string-append "mirror://gnu/glpk/glpk-"
342 version ".tar.gz"))
343 (sha256
344 (base32
1cae188e 345 "1xp7nclmp8inp20968bvvfcwmz3mz03sbm0v3yjz8aqwlpqjfkci"))))
b92eee75
AE
346 (build-system gnu-build-system)
347 (inputs
348 `(("gmp" ,gmp)))
349 (arguments
350 `(#:configure-flags '("--with-gmp")))
82110ef6 351 (home-page "https://www.gnu.org/software/glpk/")
79c311b8 352 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
b92eee75
AE
353 (description
354 "GLPK is a C library for solving large-scale linear programming (LP),
355mixed integer programming (MIP), and other related problems. It supports the
356GNU MathProg modeling language, a subset of the AMPL language, and features a
357translator for the language. In addition to the C library, a stand-alone
358LP/MIP solver is included in the package.")
359 (license license:gpl3+)))
360
b146763a
AE
361(define-public 4ti2
362 (package
363 (name "4ti2")
364 (version "1.6.7")
365 (source
366 (origin
367 (method url-fetch)
368 (uri (string-append "http://www.4ti2.de/version_" version
369 "/4ti2-" version ".tar.gz"))
370 (sha256
371 (base32
372 "1frix3rnm9ffr93alqzw4cavxbfpf524l8rfbmcpyhwd3n1km0yl"))))
373 (build-system gnu-build-system)
374 (native-inputs
375 `(("which" ,(@ (gnu packages base) which)))) ; for the tests
376 (inputs
377 `(("glpk" ,glpk)
378 ("gmp" ,gmp)))
379 (home-page "http://www.4ti2.de/")
380 (synopsis "Mathematical tool suite for problems on linear spaces")
381 (description
382 "4ti2 implements algorithms for solving algebraic, geometric and
383combinatorial problems on linear spaces. Among others, it solves systems
384of linear equations, computes extreme rays of polyhedral cones, solves
385integer programming problems and computes Markov bases for statistics.")
386 (license license:gpl2+)))
387
53696f10
AE
388(define-public cddlib
389 (package
390 (name "cddlib")
391 (version "0.94h")
392 (source
393 (origin
394 (method url-fetch)
182dde82 395 (uri (string-append "ftp://ftp.math.ethz.ch/users/fukudak/cdd/cddlib-"
53696f10
AE
396 (string-delete #\. version) ".tar.gz"))
397 (sha256
398 (base32
399 "1dasasscwfg793q8fwzgwf64xwj7w62yfvszpr8x8g38jka08vgy"))))
400 (build-system gnu-build-system)
401 (inputs
402 `(("gmp" ,gmp)))
403 (home-page "https://www.inf.ethz.ch/personal/fukudak/cdd_home/index.html")
404 (synopsis "Library for convex hulls and extreme rays of polyhedra")
405 (description
406 "The C-library cddlib implements the Double Description Method of
407Motzkin et al. for generating all vertices (i.e. extreme points) and extreme
408rays of a general convex polyhedron given by a system of linear inequalities
409in arbitrary dimension. It can also be used for the converse operation of
410computing convex hulls.")
411 (license license:gpl2+)))
412
865a69dd
RW
413(define-public arpack-ng
414 (package
415 (name "arpack-ng")
416 (version "3.2.0")
417 (source
418 (origin
419 (method url-fetch)
420 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
421 version ".tar.gz"))
f586c877 422 (file-name (string-append name "-" version ".tar.gz"))
865a69dd
RW
423 (sha256
424 (base32
425 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
426 (build-system gnu-build-system)
427 (home-page "https://github.com/opencollab/arpack-ng")
428 (inputs
429 `(("lapack" ,lapack)
19afbea1 430 ("fortran" ,gfortran)))
865a69dd
RW
431 (synopsis "Fortran subroutines for solving eigenvalue problems")
432 (description
433 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
434large scale eigenvalue problems.")
166191b3 435 (license (license:non-copyleft "file://COPYING"
865a69dd
RW
436 "See COPYING in the distribution."))))
437
8c94c886
EB
438(define-public arpack-ng-openmpi
439 (package (inherit arpack-ng)
440 (name "arpack-ng-openmpi")
441 (inputs
442 `(("mpi" ,openmpi)
443 ,@(package-inputs arpack-ng)))
444 (arguments `(#:configure-flags '("--enable-mpi")))
445 (synopsis "Fortran subroutines for solving eigenvalue problems with MPI")))
446
da95c817
NK
447(define-public lapack
448 (package
449 (name "lapack")
ef39a177 450 (version "3.7.1")
da95c817
NK
451 (source
452 (origin
453 (method url-fetch)
454 (uri (string-append "http://www.netlib.org/lapack/lapack-"
455 version ".tgz"))
456 (sha256
457 (base32
7c0d4c3a 458 "1j51r7n5w4k7r3lrvy7710xrpkg40wf4rqnmngfz6ck9ypckzign"))))
da95c817
NK
459 (build-system cmake-build-system)
460 (home-page "http://www.netlib.org/lapack/")
19afbea1 461 (inputs `(("fortran" ,gfortran)
da95c817
NK
462 ("python" ,python-2)))
463 (arguments
3ab869b6
LC
464 `(#:configure-flags (list
465 ;; Install to PREFIX/lib (the default is
466 ;; PREFIX/lib64).
467 (string-append "-DCMAKE_INSTALL_LIBDIR="
468 (assoc-ref %outputs "out")
469 "/lib")
11f0c4e8 470
3ab869b6
LC
471 "-DBUILD_SHARED_LIBS:BOOL=YES"
472 "-DLAPACKE=ON"
473
474 ;; Build the 'LAPACKE_clatms' functions.
475 "-DLAPACKE_WITH_TMG=ON")
dc1d3cde
KK
476 #:phases
477 (modify-phases %standard-phases
478 (add-before 'check 'patch-python
479 (lambda* (#:key inputs #:allow-other-keys)
480 (let ((python (assoc-ref inputs "python")))
481 (substitute* "lapack_testing.py"
482 (("/usr/bin/env python") python)))
483 #t)))))
da95c817
NK
484 (synopsis "Library for numerical linear algebra")
485 (description
486 "LAPACK is a Fortran 90 library for solving the most commonly occurring
487problems in numerical linear algebra.")
166191b3 488 (license (license:non-copyleft "file://LICENSE"
da95c817 489 "See LICENSE in the distribution."))))
73fed4f8 490
b509efb3
TF
491(define-public lapack-3.5
492 (package
493 (inherit lapack)
494 (version "3.5.0")
495 (source
496 (origin
497 (method url-fetch)
498 (uri (string-append "http://www.netlib.org/lapack/lapack-"
499 version ".tgz"))
500 (sha256
501 (base32
502 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))))
503
e1ff597a
EB
504(define-public scalapack
505 (package
506 (name "scalapack")
507 (version "2.0.2")
508 (source
509 (origin
510 (method url-fetch)
511 (uri (string-append "http://www.netlib.org/scalapack/scalapack-"
512 version ".tgz"))
513 (sha256
514 (base32
515 "0p1r61ss1fq0bs8ynnx7xq4wwsdvs32ljvwjnx6yxr8gd6pawx0c"))))
516 (build-system cmake-build-system)
517 (inputs
518 `(("mpi" ,openmpi)
519 ("fortran" ,gfortran)
520 ("lapack" ,lapack))) ;for testing only
521 (arguments
522 `(#:configure-flags `("-DBUILD_SHARED_LIBS:BOOL=YES")))
523 (home-page "http://www.netlib.org/scalapack/")
524 (synopsis "Library for scalable numerical linear algebra")
525 (description
526 "ScaLAPACK is a Fortran 90 library of high-performance linear algebra
527routines on parallel distributed memory machines. ScaLAPACK solves dense and
528banded linear systems, least squares problems, eigenvalue problems, and
529singular value problems.")
530 (license (license:bsd-style "file://LICENSE"
531 "See LICENSE in the distribution."))))
532
73fed4f8 533(define-public gnuplot
5f800540
KK
534 (package
535 (name "gnuplot")
7d873e0c 536 (version "5.0.6")
5f800540
KK
537 (source (origin
538 (method url-fetch)
539 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
540 version "/gnuplot-"
541 version ".tar.gz"))
542 (sha256
543 (base32
7d873e0c 544 "0q5lr6nala3ln6f3yp6g17ziymb9r9gx9zylnw1y3hjmwl9lggjv"))))
5f800540
KK
545 (build-system gnu-build-system)
546 (inputs `(("readline" ,readline)
547 ("cairo" ,cairo)
548 ("pango" ,pango)
6e64766a
DM
549 ("gd" ,gd)
550 ("lua" ,lua)))
612a387f
RW
551 (native-inputs
552 `(("pkg-config" ,pkg-config)
553 ("texlive" ,texlive-tiny)))
5f800540
KK
554 (home-page "http://www.gnuplot.info")
555 (synopsis "Command-line driven graphing utility")
556 (description "Gnuplot is a portable command-line driven graphing
35b9e423 557utility. It was originally created to allow scientists and students to
73fed4f8 558visualize mathematical functions and data interactively, but has grown to
35b9e423 559support many non-interactive uses such as web scripting. It is also used as a
73fed4f8 560plotting engine by third-party applications like Octave.")
5f800540
KK
561 ;; X11 Style with the additional restriction that derived works may only be
562 ;; distributed as patches to the original.
563 (license (license:fsf-free
564 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
668c06ac 565
32f70e1f
TD
566(define-public gctp
567 (package
568 (name "gctp")
569 (version "2.0.0")
570 (source
571 (origin
572 (method url-fetch)
573 (uri (string-append "https://github.com/OkoSanto/GCTP/archive/v"
574 version ".tar.gz"))
575 (file-name (string-append name "-" version ".tar.gz"))
576 (sha256
577 (base32
578 "0l9aqnqynh9laicn5dxf3rsb1n14xiks79wbyqccirzmjqd1c1x4"))))
579 (native-inputs
580 `(("fortran" ,gfortran)))
581 (build-system gnu-build-system)
582 (synopsis "General Cartographic Transformation Package (GCTP)")
583 (description
584 "The General Cartographic Transformation Package (GCTP) is a system of
585software routines designed to permit the transformation of coordinate pairs
586from one map projection to another. The GCTP is the standard computer
587software used by the National Mapping Division for map projection
588computations.")
589 (home-page "https://github.com/OkoSanto/GCTP")
0f7cd95b 590 (license license:public-domain))) ;https://www2.usgs.gov/laws/info_policies.html
32f70e1f 591
becbbefc
TD
592(define-public hdf4
593 (package
594 (name "hdf4")
0abf5264 595 (version "4.2.13")
becbbefc
TD
596 (source
597 (origin
598 (method url-fetch)
599 (uri (string-append "https://support.hdfgroup.org/ftp/HDF/releases/HDF"
600 version "/src/hdf-" version ".tar.bz2"))
601 (sha256
0abf5264 602 (base32 "1wz0586zh91pqb95wvr0pbh71a8rz358fdj6n2ksp85x2cis9lsm"))
15ca49b2
AE
603 (patches (search-patches "hdf4-architectures.patch"
604 "hdf4-reproducibility.patch"
becbbefc 605 "hdf4-shared-fortran.patch"))))
becbbefc
TD
606 (build-system gnu-build-system)
607 (native-inputs
608 `(("gfortran" ,gfortran)
609 ("bison" ,bison)
610 ("flex" ,flex)))
611 (inputs
612 `(("zlib" ,zlib)
613 ("libjpeg" ,libjpeg)))
614 (arguments
615 `(#:parallel-tests? #f
616 #:configure-flags '("--enable-shared")
617 #:phases
618 (modify-phases %standard-phases
953a12fa
EF
619 ;; This is inspired by two of Debian's patches.
620 (add-before 'configure 'add-more-aarch64-support
621 (lambda _
622 (substitute* '("mfhdf/ncgen/ncgen.l"
623 "mfhdf/ncgen/ncgenyy.c"
624 "mfhdf/libsrc/netcdf.h.in")
625 (("AIX5L64") "__aarch64__"))
626 #t))
becbbefc
TD
627 (add-before 'configure 'patchbuild
628 (lambda _
629 (substitute*
630 '("mfhdf/hdfimport/testutil.sh.in" "hdf/util/testutil.sh.in")
631 (("/bin/rm") "rm")
632 (("/bin/mkdir") "mkdir"))
633 (substitute* (find-files "." "^Makefile\\.in$")
634 (("@HDF_BUILD_XDR_TRUE@XDR_ADD = \
635-R\\$\\(abs_top_builddir\\)/mfhdf/xdr/\\.libs") "")
636 (("@HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = \
637-R\\$\\(abs_top_builddir\\)/mfhdf/libsrc/\\.libs \
953a12fa 638-R\\$\\(abs_top_builddir\\)/hdf/src/\\.libs \\$\\(XDR_ADD\\)") ""))
e464b455
TD
639 #t))
640 (add-after 'configure 'patch-settings
641 (lambda _
642 ;; libhdf4.settings contains the full path of the
643 ;; compilers used, and its contents are included in
644 ;; .so-files. We truncate the hashes to avoid
645 ;; unnecessary store references to those compilers:
646 (substitute* "libhdf4.settings"
647 (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
648 (string-append prefix (string-take hash 10) "...")))
649 #t))
650 )))
becbbefc
TD
651 (home-page "https://www.hdfgroup.org/products/hdf4/")
652 (synopsis
653 "Library and multi-object file format for storing and managing data")
654 (description "HDF4 is a library and multi-object file format for storing
655and managing data between machines. HDF4 is an older hierarchical data format,
656incompatible with HDF5.")
657 (license
658 (license:non-copyleft
659 "https://www.hdfgroup.org/ftp/HDF/HDF_Current/src/unpacked/COPYING"))))
660
661(define-public hdf4-alt
662 (package
663 (inherit hdf4)
664 (name "hdf4-alt")
665 (arguments
666 (substitute-keyword-arguments (package-arguments hdf4)
667 ((#:configure-flags flags) `(cons* "--disable-netcdf" ,flags))))
668 (synopsis
669 "HDF4 without netCDF API, can be combined with the regular netCDF library")))
670
7ee3f1a2
JD
671(define-public hdf5
672 (package
673 (name "hdf5")
2da63064 674 (version "1.8.19")
7ee3f1a2
JD
675 (source
676 (origin
677 (method url-fetch)
2da63064
TD
678 (uri (list (string-append "https://support.hdfgroup.org/ftp/HDF5/releases/"
679 "hdf5-" (version-major+minor version)
680 "/hdf5-" version "/src/hdf5-"
dcd9d163
LF
681 version ".tar.bz2")
682 (string-append "https://support.hdfgroup.org/ftp/HDF5/"
683 "current"
684 (apply string-append
685 (take (string-split version #\.) 2))
686 "/src/hdf5-" version ".tar.bz2")))
7ee3f1a2 687 (sha256
2da63064 688 (base32 "0f3jfbqpaaq21ighi40qzs52nb52kc2d2yjk541rjmsx20b3ih2r"))
b8d9c93b 689 (patches (list (search-patch "hdf5-config-date.patch")))))
7ee3f1a2 690 (build-system gnu-build-system)
12ed1216
AE
691 (inputs
692 `(("zlib" ,zlib)))
e3a1a1de
TD
693 (native-inputs
694 `(("gfortran" ,gfortran)))
695 (outputs '("out" ; core library
696 "fortran")) ; fortran interface
7ee3f1a2 697 (arguments
62126576 698 `(;; Some of the users, notably Flann, need the C++ interface.
e3a1a1de
TD
699 #:configure-flags '("--enable-cxx"
700 "--enable-fortran"
701 "--enable-fortran2003")
62126576
LC
702
703 #:phases
f622e212
EB
704 (modify-phases %standard-phases
705 (add-before 'configure 'patch-configure
e3a1a1de 706 (lambda* (#:key outputs #:allow-other-keys)
f622e212 707 (substitute* "configure"
b8d9c93b 708 (("/bin/mv") "mv"))
e3a1a1de
TD
709 (substitute* "fortran/src/Makefile.in"
710 (("libhdf5_fortran_la_LDFLAGS =")
711 (string-append "libhdf5_fortran_la_LDFLAGS = -Wl-rpath="
712 (assoc-ref outputs "fortran") "/lib")))
713 (substitute* "hl/fortran/src/Makefile.in"
714 (("libhdf5hl_fortran_la_LDFLAGS =")
715 (string-append "libhdf5hl_fortran_la_LDFLAGS = -Wl,-rpath="
716 (assoc-ref outputs "fortran") "/lib")))
b8d9c93b 717 #t))
fd0378a1
TD
718 (add-after 'configure 'patch-settings
719 (lambda _
720 ;; libhdf5.settings contains the full path of the
721 ;; compilers used, and its contents are included in
722 ;; libhdf5.so. We truncate the hashes to avoid
723 ;; unnecessary store references to those compilers:
724 (substitute* "src/libhdf5.settings"
725 (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
726 (string-append prefix (string-take hash 10) "...")))
727 #t))
f622e212
EB
728 (add-after 'install 'patch-references
729 (lambda* (#:key inputs outputs #:allow-other-keys)
730 (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
731 (zlib (assoc-ref inputs "zlib")))
732 (substitute* (find-files bin "h5p?cc")
733 (("-lz" lib)
734 (string-append "-L" zlib "/lib " lib)))
e3a1a1de
TD
735 #t)))
736 (add-after 'install 'split
737 (lambda* (#:key inputs outputs #:allow-other-keys)
738 ;; Move all fortran-related files
739 (let* ((out (assoc-ref outputs "out"))
740 (bin (string-append out "/bin"))
741 (lib (string-append out "/lib"))
742 (inc (string-append out "/include"))
743 (ex (string-append out "/share/hdf5_examples/fortran"))
744 (fort (assoc-ref outputs "fortran"))
745 (fbin (string-append fort "/bin"))
746 (flib (string-append fort "/lib"))
747 (finc (string-append fort "/include"))
748 (fex (string-append fort "/share/hdf5_examples/fortran")))
749 (mkdir-p fbin)
750 (mkdir-p flib)
751 (mkdir-p finc)
752 (mkdir-p fex)
753 (rename-file (string-append bin "/h5fc")
754 (string-append fbin "/h5fc"))
755 (for-each (lambda (file)
756 (rename-file file
757 (string-append flib "/" (basename file))))
758 (find-files lib ".*fortran.*"))
759 (for-each (lambda (file)
760 (rename-file file
761 (string-append finc "/" (basename file))))
762 (find-files inc ".*mod"))
763 (for-each (lambda (file)
764 (rename-file file
765 (string-append fex "/" (basename file))))
766 (find-files ex ".*"))
767 (delete-file-recursively ex))
768 #t)))))
7ee3f1a2 769 (home-page "http://www.hdfgroup.org")
516e93f8 770 (synopsis "Management suite for extremely large and complex data")
7ee3f1a2
JD
771 (description "HDF5 is a suite that makes possible the management of
772extremely large and complex data collections.")
d4bf49b1
EB
773 (license (license:x11-style
774 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
7ee3f1a2 775
2fd26d05
TD
776(define-public hdf-java
777 (package
778 (name "hdf-java")
779 (version "3.3.2")
780 (source
781 (origin
782 (method url-fetch)
783 (uri (string-append
784 "http://www.hdfgroup.org/ftp/HDF5/releases/HDF-JAVA/hdfjni-"
785 version "/src/CMake-hdfjava-" version ".tar.gz"))
786 (sha256
787 (base32 "0m1gp2aspcblqzmpqbdpfp6giskws85ds6p5gz8sx7asyp7wznpr"))
788 (modules '((guix build utils)))
789 (snippet ; Make sure we don't use the bundled sources and binaries.
790 `(begin
791 (for-each delete-file
792 (list "SZip.tar.gz" "ZLib.tar.gz" "JPEG8d.tar.gz"
793 "HDF4.tar.gz" "HDF5.tar.gz"))
794 (delete-file-recursively ,(string-append "hdfjava-" version "/lib"))))))
795 (build-system gnu-build-system)
796 (native-inputs
797 `(("jdk" ,icedtea "jdk")
798 ("automake" ,automake) ; For up to date 'config.guess' and 'config.sub'.
799 ;; For tests:
800 ("hamcrest-core" ,java-hamcrest-core)
801 ("junit" ,java-junit)
802 ("slf4j-simple" ,java-slf4j-simple)))
803 (inputs
804 `(("hdf4" ,hdf4)
805 ("hdf5" ,hdf5)
806 ("zlib" ,zlib)
807 ("libjpeg" ,libjpeg)
808 ("slf4j-api" ,java-slf4j-api)))
809 (arguments
810 `(#:configure-flags
811 (list (string-append "--target=" ,(or (%current-target-system) (%current-system)))
812 (string-append "--with-jdk=" (assoc-ref %build-inputs "jdk") "/include,"
813 (assoc-ref %build-inputs "jdk") "/lib" )
814 (string-append "--with-hdf4=" (assoc-ref %build-inputs "hdf4") "/lib")
815 (string-append "--with-hdf5=" (assoc-ref %build-inputs "hdf5") "/lib"))
816
817 #:make-flags
818 (list (string-append "HDFLIB=" (assoc-ref %build-inputs "hdf4") "/lib")
819 (string-append "HDF5LIB=" (assoc-ref %build-inputs "hdf5") "/lib")
820 (string-append "ZLIB=" (assoc-ref %build-inputs "zlib") "/lib/libz.so")
821 (string-append "JPEGLIB="
822 (assoc-ref %build-inputs "libjpeg") "/lib/libjpeg.so")
823 "LLEXT=so")
824
825 #:phases
826 (modify-phases %standard-phases
827 (add-before 'configure 'chdir-to-source
828 (lambda _ (chdir ,(string-append "hdfjava-" version))))
829 (add-before 'configure 'patch-build
830 (lambda* (#:key inputs outputs #:allow-other-keys)
831 (substitute* "configure"
832 (("COPT=\"") "COPT=\"-O2 ") ; CFLAGS is ignored in Makefiles
833 (("/bin/cat") (which "cat")))
834 ;; Set classpath for compilation
835 (substitute* '("hdf/hdf5lib/Makefile.in"
836 "hdf/hdf5lib/exceptions/Makefile.in"
837 "hdf/hdflib/Makefile.in")
838 (("\\$\\(TOP\\)/lib/slf4j-api-1\\.7\\.5\\.jar")
839 (string-append (assoc-ref inputs "slf4j-api")
840 "/share/java/slf4j-api.jar")))
841 ;; Replace outdated config.sub and config.guess:
842 (with-directory-excursion "config"
843 (for-each (lambda (file)
844 (copy-file
845 (string-append (assoc-ref inputs "automake")
846 "/share/automake-1.15/" file) file))
847 '("config.sub" "config.guess")))
848 (mkdir-p (string-append (assoc-ref outputs "out")))
849 ;; Set classpath for tests
850 (let* ((build-dir (getcwd))
851 (lib (string-append build-dir "/lib"))
852 (jhdf (string-append lib "/jhdf.jar"))
853 (jhdf5 (string-append lib "/jhdf5.jar"))
854 (testjars
855 (map (lambda (i)
856 (string-append (assoc-ref inputs i)
857 "/share/java/" i ".jar"))
858 '("junit" "hamcrest-core" "slf4j-api" "slf4j-simple")))
859 (class-path
860 (string-join `("." ,build-dir ,jhdf ,jhdf5 ,@testjars) ":")))
861
862 (substitute* '("test/hdf5lib/Makefile.in"
863 "test/hdf5lib/junit.sh.in"
864 "examples/runExample.sh.in")
865 (("/usr/bin/test")
866 (string-append (assoc-ref inputs "coreutils")
867 "/bin/test"))
868 (("/usr/bin/uname")
869 (string-append (assoc-ref inputs "coreutils")
870 "/bin/uname"))
871 (("CLASSPATH=[^\n]*")
872 (string-append "CLASSPATH=" class-path)))
873 (setenv "CLASSPATH" class-path))
874 #t))
875 (add-before 'check 'build-examples
876 (lambda _
877 (zero? (apply system* `("javac"
878 ,@(find-files "examples" ".*\\.java")))))))
879
880 #:parallel-build? #f
881
882 #:parallel-tests? #f ))
883 (home-page "https://support.hdfgroup.org/products/java")
884 (synopsis "Java interface for the HDF4 and HDF5 libraries")
885 (description "Java HDF Interface (JHI) and Java HDF5 Interface (JHI5) use
886the Java Native Interface to wrap the HDF4 and HDF5 libraries, which are
887implemented in C.")
888
889 ;; BSD-style license:
890 (license (license:x11-style
891 "https://support.hdfgroup.org/ftp/HDF5/hdf-java\
892/current/src/unpacked/COPYING"))))
893
d3c4f3bb
TD
894(define-public hdf-eos2
895 (package
896 (name "hdf-eos2")
897 (version "19.1.0")
898 (source
899 (origin
900 (method url-fetch)
901 (uri "ftp://edhs1.gsfc.nasa.gov\
902/edhs/hdfeos/latest_release/HDF-EOS2.19v1.00.tar.Z")
903 (sha256
904 (base32 "0c9fcz25s292ldap12wxmlrvnyz99z24p63d8fwx51bf8s0s1zrz"))
905 (patches (search-patches "hdf-eos2-remove-gctp.patch"
906 "hdf-eos2-build-shared.patch"
907 "hdf-eos2-fortrantests.patch"))))
908 (build-system gnu-build-system)
909 (native-inputs
910 `(("gfortran" ,gfortran)))
911 (inputs
912 `(("hdf4" ,hdf4-alt) ; assume most HDF-EOS2 users won't use the HDF4 netCDF API
913 ("zlib" ,zlib)
914 ("libjpeg" ,libjpeg)
915 ("gctp" ,gctp)))
916 (arguments
917 `( #:configure-flags '("--enable-install-include" "--enable-shared"
918 "CC=h4cc -Df2cFortran" "LIBS=-lgctp")
919 #:parallel-tests? #f))
920 (home-page "http://hdfeos.org/software/library.php#HDF-EOS2")
921 (synopsis "HDF4-based data format for NASA's Earth Observing System")
922 (description "HDF-EOS2 is a software library built on HDF4 which supports
923the construction of data structures used in NASA's Earth Observing
924System (Grid, Point and Swath).")
925
926 ;; Source files carry a permissive license header.
927 (license (license:non-copyleft home-page))))
928
0f43f835
TD
929(define-public hdf-eos5
930 (package
931 (name "hdf-eos5")
932 (version "1.15")
933 (source (origin
934 (method url-fetch)
935 (uri (string-append "ftp://edhs1.gsfc.nasa.gov\
936/edhs/hdfeos5/latest_release/HDF-EOS5." version ".tar.Z"))
937 (sha256
938 (base32
939 "1p83333nzzy8rn5chxlm0hrkjjnhh2w1ji8ac0f9q4xzg838i58i"))
940 (patches (search-patches "hdf-eos5-build-shared.patch"
941 "hdf-eos5-remove-gctp.patch"
942 "hdf-eos5-fix-szip.patch"
943 "hdf-eos5-fortrantests.patch"))))
944 (native-inputs
945 `(("gfortran" ,gfortran)))
946 (build-system gnu-build-system)
947 (inputs
948 `(("hdf5" ,hdf5)
949 ("zlib" ,zlib)
950 ("gctp" ,gctp)))
951 (arguments
952 `(#:configure-flags '("--enable-install-include" "--enable-shared"
953 "CC=h5cc -Df2cFortran" "LIBS=-lgctp")
954 #:parallel-tests? #f))
955 (synopsis "HDF5-based data format for NASA's Earth Observing System")
956 (description
957 "HDF-EOS5 is a software library built on HDF5 to support the construction
958of data structures used in NASA's Earth Observing System (Grid, Point and
959Swath).")
960 (home-page "http://www.hdfeos.org/software/library.php#HDF-EOS5")
961
962 ;; Source files carry a permissive license header.
963 (license (license:non-copyleft home-page))))
964
c8378eea
EB
965(define-public hdf5-parallel-openmpi
966 (package (inherit hdf5)
967 (name "hdf5-parallel-openmpi")
968 (inputs
969 `(("mpi" ,openmpi)
970 ,@(package-inputs hdf5)))
971 (arguments
972 (substitute-keyword-arguments `(#:configure-flags '("--enable-parallel")
973 ,@(package-arguments hdf5))
974 ((#:phases phases)
975 `(modify-phases ,phases
976 (add-before 'check 'patch-tests
977 (lambda _
978 ;; OpenMPI's mpirun will exit with non-zero status if it
979 ;; detects an "abnormal termination", i.e. any process not
980 ;; calling MPI_Finalize(). Since the test is explicitely
981 ;; avoiding MPI_Finalize so as not to have at_exit and thus
982 ;; H5C_flush_cache from being called, mpirun will always
983 ;; complain, so turn this test off.
984 (substitute* "testpar/Makefile"
985 (("(^TEST_PROG_PARA.*)t_pflush1(.*)" front back)
986 (string-append front back "\n")))
987 (substitute* "tools/h5diff/testph5diff.sh"
988 (("/bin/sh") (which "sh")))
989 #t))))))
990 (synopsis "Management suite for data with parallel IO support")))
991
00775104
EB
992(define-public h5check
993 (package
994 (name "h5check")
995 (version "2.0.1")
996 (source
997 (origin
998 (method url-fetch)
999 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/tools/"
1000 "h5check/src/h5check-" version ".tar.gz"))
1001 (sha256
1002 (base32
1003 "1gm76jbwhz9adbxgn14zx8cj33dmjdr2g5xcy0m9c2gakp8w59kj"))))
1004 (build-system gnu-build-system)
1005 (inputs `(("hdf5" ,hdf5))) ;h5cc for tests
1006 (home-page "https://www.hdfgroup.org/products/hdf5_tools/h5check.html")
1007 (synopsis "HDF5 format checker")
1008 (description "@code{h5check} is a validation tool for verifying that an
1009HDF5 file is encoded according to the HDF File Format Specification.")
1010 (license (license:x11-style "file://COPYING"))))
1011
a53d6719
JD
1012(define-public itpp
1013 (package
1014 (name "itpp")
1015 (version "4.3.1")
1016 (source (origin
1017 (method url-fetch)
1018 (uri (string-append "mirror://sourceforge/itpp/itpp/"
1019 version "/itpp-"
1020 version ".tar.gz"))
1021 (sha256
1022 (base32
1023 "14ddy2xnb6sgp4hiax9v5sv4pr4l4dd4ps76nfha3nrpr1ikhcqm"))))
1024 (build-system cmake-build-system)
1025 (arguments `(#:tests? #f)) ; Tests require googletest *sources*
1026 (inputs `(("lapack" ,lapack)
1027 ("fftw" ,fftw)))
3a4d5df2
RW
1028 ;; FIXME: Even though the fonts are available dvips complains:
1029 ;; "Font cmmi10 not found; characters will be left blank."
1030 (native-inputs
1031 `(("texlive" ,texlive-tiny)
1032 ("ghostscript" ,ghostscript)
1033 ("doxygen" ,doxygen)))
a53d6719
JD
1034 (home-page "http://itpp.sourceforge.net")
1035 (synopsis "C++ library of maths, signal processing and communication classes")
1036 (description "IT++ is a C++ library of mathematical, signal processing and
1037communication classes and functions. Its main use is in simulation of
1038communication systems and for performing research in the area of
1039communications. The kernel of the library consists of generic vector and
1040matrix classes, and a set of accompanying routines. Such a kernel makes IT++
1041similar to MATLAB, GNU Octave or SciPy.")
1042 (license license:gpl3+)))
1043
889187a4
EB
1044(define-public netcdf
1045 (package
1046 (name "netcdf")
a4b0bfb1 1047 (version "4.4.1.1")
889187a4
EB
1048 (source
1049 (origin
1050 (method url-fetch)
1051 (uri (string-append "ftp://ftp.unidata.ucar.edu/pub/netcdf/"
1052 "netcdf-" version ".tar.gz"))
1053 (sha256
1054 (base32
a4b0bfb1
EB
1055 "1blc7ik5yin7i0ls2kag0a9xjk12m0dzx6v1x88az3ras3scci2d"))
1056 (patches (search-patches "netcdf-date-time.patch"
1057 "netcdf-tst_h_par.patch"))))
889187a4
EB
1058 (build-system gnu-build-system)
1059 (native-inputs
1060 `(("m4" ,m4)
1061 ("doxygen" ,doxygen)
1062 ("graphviz" ,graphviz)))
1063 (inputs
db825570
TD
1064 `(("hdf4" ,hdf4-alt)
1065 ("hdf5" ,hdf5)
1066 ("zlib" ,zlib)
1067 ("libjpeg" ,libjpeg)))
889187a4 1068 (arguments
db825570 1069 `(#:configure-flags '("--enable-doxygen" "--enable-dot" "--enable-hdf4")
43d01672
TD
1070
1071 #:phases (modify-phases %standard-phases
1072 (add-before 'configure 'fix-source-date
1073 (lambda _
1074 ;; As we ${SOURCE_DATE_EPOCH} evaluates to "1" in the build
1075 ;; environment, `date -u -d ${SOURCE_DATE_EPOCH}` will evaluate
1076 ;; to '1st hour of the current day', and therefore makes the
1077 ;; package not reproducible.
1078 (substitute* "./configure"
1079 (("date -u -d \"\\$\\{SOURCE_DATE_EPOCH\\}\"")
1080 "date --date='@0'"))
1081 #t))
1082 (add-after 'configure 'patch-settings
1083 (lambda _
1084 ;; libnetcdf.settings contains the full filename of the compilers
1085 ;; used to build the library. We truncate the hashes of those
1086 ;; filenames to avoid unnecessary references to the corresponding
1087 ;; store items.
1088 (substitute* "libnetcdf.settings"
1089 (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
1090 (string-append prefix (string-take hash 10) "...")))
1091 #t)))
1092
889187a4
EB
1093 #:parallel-tests? #f)) ;various race conditions
1094 (home-page "http://www.unidata.ucar.edu/software/netcdf/")
1095 (synopsis "Library for scientific data")
1096 (description "NetCDF is an interface for scientific data access and a
1097software library that provides an implementation of the interface. The netCDF
1098library defines a machine-independent format for representing scientific data.
1099Together, the interface, library, and format support the creation, access, and
1100sharing of scientific data.")
1101 (license (license:x11-style "file://COPYRIGHT"))))
1102
1103(define-public netcdf-parallel-openmpi
1104 (package (inherit netcdf)
1105 (name "netcdf-parallel-openmpi")
1106 (inputs
1107 `(("mpi" ,openmpi)
1108 ,@(alist-replace "hdf5" (list hdf5-parallel-openmpi)
1109 (package-inputs netcdf))))
1110 ;; TODO: Replace pkg-config references in nc-config with absolute references
1111 (arguments
1112 (substitute-keyword-arguments (package-arguments netcdf)
1113 ((#:configure-flags flags)
1114 `(cons* "CC=mpicc" "CXX=mpicxx"
1115 "--enable-parallel-tests"
1116 ;; Shared libraries not supported with parallel IO.
1117 "--disable-shared" "--with-pic"
1118 ,flags))))))
1119
300200b6
TD
1120(define-public netcdf-fortran
1121 (package
1122 (name "netcdf-fortran")
1123 (version "4.4.4")
1124 (source (origin
1125 (method url-fetch)
1126 (uri (string-append
1127 "ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-fortran-"
1128 version ".tar.gz"))
1129 (sha256
1130 (base32
1131 "0xaxdcg1p83zmypwml3swsnr3ccn38inwldyr1l3wa4dbwbrblxj"))))
1132 (build-system gnu-build-system)
1133 (arguments
1134 `(#:parallel-tests? #f))
1135 (inputs
1136 `(("netcdf" ,netcdf)))
1137 (native-inputs
1138 `(("gfortran" ,gfortran)))
1139 (synopsis "Fortran interface for the netCDF library")
1140 (description (package-description netcdf))
1141 (home-page (package-home-page netcdf))
1142 (license (package-license netcdf))))
1143
1b39a196
RJ
1144(define-public nlopt
1145 (package
1146 (name "nlopt")
1147 (version "2.4.2")
1148 (source (origin
1149 (method url-fetch)
1150 (uri (string-append "http://ab-initio.mit.edu/nlopt/nlopt-"
1151 version ".tar.gz"))
1152 (sha256
1153 (base32 "12cfkkhcdf4zmb6h7y6qvvdvqjs2xf9sjpa3rl3bq76px4yn76c0"))))
1154 (build-system gnu-build-system)
1155 (arguments
1156 `(;; Shared libraries are not built by default. They are required to
1157 ;; build the Guile, Octave, and Python bindings.
1158 #:configure-flags '("--enable-shared")
1159
1160 #:phases
1161 (modify-phases %standard-phases
1162 (add-before 'configure 'set-libnlopt-file-name
1163 (lambda* (#:key outputs #:allow-other-keys)
1164 ;; Make sure the Scheme module refers to the library by its
1165 ;; absolute file name (we cannot do that from a snippet
1166 ;; because the expansion of @libdir@ contains
1167 ;; ${exec_prefix}.)
1168 (let ((out (assoc-ref outputs "out")))
1169 (substitute* "swig/nlopt.scm.in"
1170 (("libnlopt")
1171 (string-append out "/lib/libnlopt")))
1172 #t))))))
1173 (inputs `(("guile" ,guile-2.0)))
1174 (native-inputs `(("pkg-config" ,pkg-config)))
1175 (home-page "http://ab-initio.mit.edu/wiki/")
1176 (synopsis "Library for nonlinear optimization")
1177 (description "NLopt is a library for nonlinear optimization, providing a
1178common interface for a number of different free optimization routines available
1179online as well as original implementations of various other algorithms.")
1180 (license license:lgpl2.1+)))
1181
005c787d
LC
1182(define-public ipopt
1183 (package
1184 (name "ipopt")
1185 (version "3.12.5")
1186 (source (origin
1187 (method url-fetch)
1188 (uri (string-append
1189 "http://www.coin-or.org/download/source/Ipopt/Ipopt-"
1190 version".tgz"))
1191 (sha256
1192 (base32
1193 "09bk2hqy2vgi4yi76xng9zxakddwqy3wij9nx7wf2vfbxxpazrsk"))
1194 (modules '((guix build utils)))
1195 (snippet
1196 ;; Make sure we don't use the bundled software.
1197 '(delete-file-recursively "ThirdParty"))))
1198 (build-system gnu-build-system)
ad1c4537
LC
1199 (arguments
1200 '(#:phases (modify-phases %standard-phases
1201 (add-after 'install 'add--L-flags-in-ipopt.pc
1202 (lambda* (#:key inputs outputs #:allow-other-keys)
1203 ;; The '.pc' file lists '-llapack -lblas' in "Libs";
1204 ;; move it to "Libs.private" where it belongs, and add a
1205 ;; '-L' flag for LAPACK.
1206 (let ((out (assoc-ref outputs "out"))
1207 (lapack (assoc-ref inputs "lapack")))
1208 (substitute* (string-append out "/lib/pkgconfig/"
1209 "ipopt.pc")
1210 (("Libs: (.*)-llapack -lblas(.*)$" _ before after)
1211 (string-append "Libs: " before " " after "\n"
1212 "Libs.private: " before
1213 "-L" lapack "/lib -llapack -lblas "
1214 after "\n")))
1215 #t))))))
005c787d
LC
1216 (native-inputs
1217 `(("gfortran" ,gfortran)))
1218 (inputs
1219 ;; TODO: Maybe add dependency on COIN-MUMPS, ASL, and HSL.
ad1c4537 1220 `(("lapack" ,lapack))) ;for both libblas and liblapack
005c787d
LC
1221 (home-page "http://www.coin-or.org")
1222 (synopsis "Large-scale nonlinear optimizer")
1223 (description
1224 "The Interior Point Optimizer (IPOPT) is a software package for
1225large-scale nonlinear optimization. It provides C++, C, and Fortran
1226interfaces.")
1227 (license license:epl1.0)))
1228
f9940ef1
LC
1229(define-public ceres
1230 (package
1231 (name "ceres-solver")
1232 (version "1.11.0")
1233 (home-page "http://ceres-solver.org/")
1234 (source (origin
1235 (method url-fetch)
1236 (uri (string-append home-page "ceres-solver-"
1237 version ".tar.gz"))
1238 (sha256
1239 (base32
1240 "0i7qkbf8g6pd8arxzldppga26ckv93y8zldsfz6wbd4n6b1nqrjd"))))
1241 (build-system cmake-build-system)
1242 (arguments
1243 ;; TODO: Build HTML user documentation and install separately.
bc3a2e35 1244 '(#:configure-flags '("-DBUILD_EXAMPLES=OFF"
f9940ef1
LC
1245 "-DBUILD_SHARED_LIBS=ON")
1246
1247 #:phases (modify-phases %standard-phases
1248 (add-before 'configure 'set-library-directory
1249 (lambda _
1250 ;; Install libraries to lib/, not lib64/.
1251 (substitute* "internal/ceres/CMakeLists.txt"
1252 (("set\\(LIB_SUFFIX \"64\"\\)")
1253 "set(LIB_SUFFIX \"\")"))
1254 #t)))))
1255 (native-inputs
1256 `(("pkg-config" ,pkg-config)))
468e0b18
LC
1257 (propagated-inputs
1258 `(("glog" ,glog))) ;for #include <glog/glog.h>
f9940ef1
LC
1259 (inputs
1260 `(("eigen" ,eigen)
1261 ("blas" ,openblas)
1262 ("lapack" ,lapack)
1263 ("suitesparse" ,suitesparse)
1264 ("gflags" ,gflags)))
1265 (synopsis "C++ library for solving large optimization problems")
1266 (description
1267 "Ceres Solver is a C++ library for modeling and solving large,
1268complicated optimization problems. It is a feature rich, mature and
1269performant library which has been used in production since 2010. Ceres Solver
1270can solve two kinds of problems:
1271@enumerate
1272@item non-linear least squares problems with bounds constraints;
1273@item general unconstrained optimization problems.
1274@end enumerate\n")
1275 (license license:bsd-3)))
1276
668c06ac 1277;; For a fully featured Octave, users are strongly recommended also to install
5ca4fe96 1278;; the following packages: less, ghostscript, gnuplot.
668c06ac
JD
1279(define-public octave
1280 (package
1281 (name "octave")
e9d60eba 1282 (version "4.2.1")
668c06ac
JD
1283 (source
1284 (origin
1285 (method url-fetch)
1286 (uri (string-append "mirror://gnu/octave/octave-"
f5a077b1 1287 version ".tar.lz"))
668c06ac
JD
1288 (sha256
1289 (base32
e9d60eba 1290 "09zhhch79jw3ynw39vizx0i2cbd2bjz3sp38pjdzraqrbivpwp92"))))
668c06ac
JD
1291 (build-system gnu-build-system)
1292 (inputs
1293 `(("lapack" ,lapack)
1294 ("readline" ,readline)
181170c6 1295 ("gl2ps" ,gl2ps)
668c06ac 1296 ("glpk" ,glpk)
1ec78e9d
EB
1297 ("fftw" ,fftw)
1298 ("fftwf" ,fftwf)
1299 ("arpack" ,arpack-ng)
668c06ac
JD
1300 ("pcre" ,pcre)
1301 ("fltk" ,fltk)
1302 ("fontconfig" ,fontconfig)
1303 ("freetype" ,freetype)
40029cbe 1304 ("hdf5" ,hdf5)
668c06ac
JD
1305 ("libxft" ,libxft)
1306 ("mesa" ,mesa)
1ec78e9d 1307 ("glu" ,glu)
9f913401
AI
1308 ("zlib" ,zlib)
1309 ("curl" ,curl)
5ca4fe96 1310 ("texinfo" ,texinfo)
9f913401 1311 ("graphicsmagick" ,graphicsmagick)))
668c06ac 1312 (native-inputs
f5a077b1
EF
1313 `(("lzip" ,lzip)
1314 ("gfortran" ,gfortran)
668c06ac
JD
1315 ("pkg-config" ,pkg-config)
1316 ("perl" ,perl)
1ec78e9d
EB
1317 ;; The following inputs are not actually used in the build process.
1318 ;; However, the ./configure gratuitously tests for their existence and
1319 ;; assumes that programs not present at build time are also not, and
1320 ;; can never be, available at run time! If these inputs are therefore
1321 ;; not present, support for them will be built out. However, Octave
1322 ;; will still run without them, albeit without the features they
668c06ac
JD
1323 ;; provide.
1324 ("less" ,less)
668c06ac
JD
1325 ("ghostscript" ,ghostscript)
1326 ("gnuplot" ,gnuplot)))
1327 (arguments
b7b27a8f
KY
1328 `(#:configure-flags
1329 (list (string-append "--with-shell="
1330 (assoc-ref %build-inputs "bash")
5ca4fe96
AI
1331 "/bin/sh"))
1332 #:phases
1333 (modify-phases %standard-phases
1334 (add-after 'configure 'configure-makeinfo
1335 (lambda* (#:key inputs #:allow-other-keys)
1336 (substitute* "libinterp/corefcn/help.cc"
1337 (("Vmakeinfo_program = \"makeinfo\"")
1338 (string-append "Vmakeinfo_program = \""
1339 (assoc-ref inputs "texinfo")
1340 "/bin/makeinfo\"")))
1341 #t)))))
f5a077b1 1342 (home-page "https://www.gnu.org/software/octave/")
668c06ac 1343 (synopsis "High-level language for numerical computation")
1ec78e9d
EB
1344 (description "GNU Octave is a high-level interpreted language that is
1345specialized for numerical computations. It can be used for both linear and
1346non-linear applications and it provides great support for visualizing results.
1347Work may be performed both at the interactive command-line as well as via
1348script files.")
668c06ac 1349 (license license:gpl3+)))
3de01d3f 1350
5d4bd4cc
PG
1351(define-public opencascade-oce
1352 (package
1353 (name "opencascade-oce")
1354 (version "0.17.2")
1355 (source
1356 (origin
1357 (method url-fetch)
1358 (uri (string-append
1359 "https://github.com/tpaviot/oce/archive/OCE-"
1360 version
1361 ".tar.gz"))
1362 (sha256
1363 (base32
1364 "0vpmnb0k5y2f7lpmwx9pg9yfq24zjvnsak5alzacncfm1hv9b6cd"))))
1365 (build-system cmake-build-system)
1366 (arguments
1367 '(#:configure-flags
1368 (list "-DOCE_TESTING:BOOL=ON"
1369 "-DOCE_USE_TCL_TEST_FRAMEWORK:BOOL=ON"
1370 "-DOCE_DRAW:BOOL=ON"
1371 (string-append "-DOCE_INSTALL_PREFIX:PATH="
1372 (assoc-ref %outputs "out"))
1373 "-UCMAKE_INSTALL_RPATH")))
1374 (inputs
1375 `(("freetype" ,freetype)
1376 ("glu" ,glu)
1377 ("libxmu" ,libxmu)
1378 ("mesa" ,mesa)
1379 ("tcl" ,tcl)
1380 ("tk" ,tk)))
1381 (native-inputs
1382 `(("python" ,python-wrapper)))
1383 (home-page "https://github.com/tpaviot/oce")
1384 (synopsis "Libraries for 3D modeling and numerical simulation")
1385 (description
1386 "Open CASCADE is a set of libraries for the development of applications
1387dealing with 3D CAD data or requiring industrial 3D capabilities. It includes
1388C++ class libraries providing services for 3D surface and solid modeling, CAD
1389data exchange, and visualization. It is used for development of specialized
1390software dealing with 3D models in design (CAD), manufacturing (CAM),
1391numerical simulation (CAE), measurement equipment (CMM), and quality
1392control (CAQ) domains.
1393
1394This is the ``Community Edition'' (OCE) of Open CASCADE, which gathers
1395patches, improvements, and experiments contributed by users over the official
1396Open CASCADE library.")
1397 (license (list license:lgpl2.1; OCE libraries, with an exception for the
1398 ; use of header files; see
1399 ; OCCT_LGPL_EXCEPTION.txt
1400 license:public-domain; files
1401 ; src/Standard/Standard_StdAllocator.hxx and
1402 ; src/NCollection/NCollection_StdAllocator.hxx
1403 license:expat; file src/OpenGl/OpenGl_glext.h
1404 license:bsd-3)))); test framework gtest
1405
3de01d3f
EB
1406(define-public gmsh
1407 (package
1408 (name "gmsh")
8a4d14fa 1409 (version "2.16.0")
3de01d3f
EB
1410 (source
1411 (origin
1412 (method url-fetch)
1c79e086 1413 (uri (string-append "http://gmsh.info/src/gmsh-"
3de01d3f
EB
1414 version "-source.tgz"))
1415 (sha256
8a4d14fa 1416 (base32 "1slf0bfkwrcgn6296wb4qhbk4ahz6i4wfb10hnim08x05vrylag8"))
3de01d3f
EB
1417 (modules '((guix build utils)))
1418 (snippet
1419 ;; Remove non-free METIS code
1420 '(delete-file-recursively "contrib/Metis"))))
1421 (build-system cmake-build-system)
3de01d3f
EB
1422 (propagated-inputs
1423 `(("fltk" ,fltk)
19afbea1 1424 ("gfortran" ,gfortran)
3de01d3f 1425 ("gmp" ,gmp)
40029cbe 1426 ("hdf5" ,hdf5)
3de01d3f
EB
1427 ("lapack" ,lapack)
1428 ("mesa" ,mesa)
85f41902 1429 ("glu" ,glu)
45548139 1430 ("opencascade-oce" ,opencascade-oce)
3de01d3f
EB
1431 ("libx11" ,libx11)
1432 ("libxext" ,libxext)))
66395a61
EF
1433 (inputs
1434 `(("fontconfig" ,fontconfig)
1435 ("libxft" ,libxft)))
3de01d3f
EB
1436 (arguments
1437 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
1438 "-DENABLE_BUILD_SHARED:BOOL=ON"
45548139 1439 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")))
3de01d3f
EB
1440 (home-page "http://www.geuz.org/gmsh/")
1441 (synopsis "3D finite element grid generator")
edf684ef
EB
1442 (description "Gmsh is a 3D finite element grid generator with a built-in
1443CAD engine and post-processor. Its design goal is to provide a fast, light
1444and user-friendly meshing tool with parametric input and advanced
1445visualization capabilities. Gmsh is built around four modules: geometry,
1446mesh, solver and post-processing. The specification of any input to these
1447modules is done either interactively using the graphical user interface or in
1448ASCII text files using Gmsh's own scripting language.")
3de01d3f 1449 (license license:gpl2+)))
b9100e2f 1450
6d5f63b6
JD
1451(define-public maxflow
1452 (package
1453 (name "maxflow")
1454 (version "3.04")
1455 (source (origin
1456 (method git-fetch)
1457 (uri (git-reference
1458 (url "https://github.com/gerddie/maxflow.git")
1459 (commit "42401fa54823d16b9da47716f04e5d9ef1605875")))
1460 (file-name (string-append name "-" version "-checkout"))
1461 (sha256
1462 (base32
1463 "0rll38whw55h0vcjrrwdnh9ascvxby0ph7n1l0d12z17cg215kkb"))))
1464 (build-system cmake-build-system)
1465 (home-page "http://pub.ist.ac.at/~vnk/software.html")
1466 (synopsis "Library implementing Maxflow algorithm")
1467 (description "An implementation of the maxflow algorithm described in
1468@cite{An Experimental Comparison of Min-Cut/Max-Flow Algorithms for
1469Energy Minimization in Computer Vision.\n
1470Yuri Boykov and Vladimir Kolmogorov.\n
1471In IEEE Transactions on Pattern Analysis and Machine Intelligence,\n
1472September 2004}")
1473 (license license:gpl3+)))
1474
b9100e2f
EB
1475(define-public petsc
1476 (package
1477 (name "petsc")
6fec298d 1478 (version "3.8.0")
b9100e2f
EB
1479 (source
1480 (origin
1481 (method url-fetch)
1482 ;; The *-lite-* tarball does not contain the *large* documentation
1483 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
1484 "petsc-lite-" version ".tar.gz"))
1485 (sha256
6fec298d 1486 (base32 "1lajbk3c29hnh83v6cbmm3a8wv6bdykh0p70kwrr4vrnizalk88s"))))
b9100e2f
EB
1487 (build-system gnu-build-system)
1488 (native-inputs
6fec298d 1489 `(("python" ,python-2)))
b9100e2f 1490 (inputs
19afbea1 1491 `(("gfortran" ,gfortran)
b9100e2f 1492 ("lapack" ,lapack)
f258212d 1493 ("superlu" ,superlu)
b9100e2f
EB
1494 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
1495 ;; leaving out opengl, as configuration seems to only be for mac
1496 ))
1497 (arguments
1498 `(#:test-target "test"
9a899cce 1499 #:parallel-build? #f ;build is parallel by default
b9100e2f
EB
1500 #:configure-flags
1501 `("--with-mpi=0"
f258212d
EB
1502 "--with-openmp=1"
1503 "--with-superlu=1"
1504 ,(string-append "--with-superlu-include="
1505 (assoc-ref %build-inputs "superlu") "/include")
1506 ,(string-append "--with-superlu-lib="
1507 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
9731c412
EB
1508 #:make-flags
1509 ;; Honor (parallel-job-count) for build. Do not use --with-make-np,
1510 ;; whose value is dumped to $out/lib/petsc/conf/petscvariables.
1511 (list (format #f "MAKE_NP=~a" (parallel-job-count)))
b9100e2f 1512 #:phases
64dcc289
EB
1513 (modify-phases %standard-phases
1514 (replace 'configure
1515 ;; PETSc's configure script is actually a python script, so we can't
1516 ;; run it with bash.
1517 (lambda* (#:key outputs (configure-flags '())
1518 #:allow-other-keys)
1519 (let* ((prefix (assoc-ref outputs "out"))
1520 (flags `(,(string-append "--prefix=" prefix)
1521 ,@configure-flags)))
1522 (format #t "build directory: ~s~%" (getcwd))
1523 (format #t "configure flags: ~s~%" flags)
1524 (zero? (apply system* "./configure" flags)))))
1525 (add-after 'configure 'clean-local-references
9731c412 1526 (lambda* (#:key outputs #:allow-other-keys)
64dcc289
EB
1527 (let ((out (assoc-ref outputs "out")))
1528 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
b730b437
EB
1529 ;; Prevent build directory from leaking into compiled code
1530 (((getcwd)) out)
1531 ;; Scrub timestamp for reproducibility
fafd623e 1532 ((".*Libraries compiled on.*") ""))
9731c412
EB
1533 (substitute* (find-files "." "petscvariables")
1534 ;; Do not expose build machine characteristics, set to defaults.
1535 (("MAKE_NP = [:digit:]+") "MAKE_NP = 2")
1536 (("NPMAX = [:digit:]+") "NPMAX = 2"))
fafd623e 1537 #t)))
64dcc289 1538 (add-after 'install 'clean-install
10b11968
EB
1539 ;; Try to keep installed files from leaking build directory names.
1540 (lambda* (#:key inputs outputs #:allow-other-keys)
64dcc289 1541 (let ((out (assoc-ref outputs "out")))
10b11968 1542 (substitute* (map (lambda (file)
9a899cce 1543 (string-append out "/lib/petsc/conf/" file))
fafd623e 1544 '("petscvariables"))
10b11968
EB
1545 (((getcwd)) out))
1546 ;; Make compiler references point to the store
9a899cce 1547 (substitute* (string-append out "/lib/petsc/conf/petscvariables")
dfdf5716
EB
1548 (("= (gcc|g\\+\\+|gfortran)" _ compiler)
1549 (string-append "= " (which compiler))))
10b11968
EB
1550 ;; PETSc installs some build logs, which aren't necessary.
1551 (for-each (lambda (file)
9a899cce 1552 (let ((f (string-append out "/lib/petsc/conf/" file)))
10b11968
EB
1553 (when (file-exists? f)
1554 (delete-file f))))
9a899cce
EB
1555 '("configure.log" "make.log" "gmake.log"
1556 "test.log" "error.log" "RDict.db"
fafd623e 1557 "PETScBuildInternal.cmake"
10b11968 1558 ;; Once installed, should uninstall with Guix
fafd623e
EB
1559 "uninstall.py"))
1560 #t))))))
b9100e2f 1561 (home-page "http://www.mcs.anl.gov/petsc")
16ecf3ff 1562 (synopsis "Library to solve PDEs")
b9100e2f
EB
1563 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
1564data structures and routines for the scalable (parallel) solution of
1565scientific applications modeled by partial differential equations.")
166191b3 1566 (license (license:non-copyleft
b9100e2f
EB
1567 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
1568
1569(define-public petsc-complex
1570 (package (inherit petsc)
1571 (name "petsc-complex")
1572 (arguments
1573 (substitute-keyword-arguments (package-arguments petsc)
1574 ((#:configure-flags cf)
1575 `(cons "--with-scalar-type=complex" ,cf))))
16ecf3ff 1576 (synopsis "Library to solve PDEs (with complex scalars)")))
183e44ae 1577
d8c7eeb9
EB
1578(define-public petsc-openmpi
1579 (package (inherit petsc)
1580 (name "petsc-openmpi")
1581 (inputs
1582 `(("openmpi" ,openmpi)
1583 ,@(package-inputs petsc)))
1584 (arguments
1585 (substitute-keyword-arguments (package-arguments petsc)
1586 ((#:configure-flags cf)
1587 ``("--with-mpiexec=mpirun"
1588 ,(string-append "--with-mpi-dir="
1589 (assoc-ref %build-inputs "openmpi"))
1590 ,@(delete "--with-mpi=0" ,cf)))))
16ecf3ff 1591 (synopsis "Library to solve PDEs (with MPI support)")))
d8c7eeb9
EB
1592
1593(define-public petsc-complex-openmpi
1594 (package (inherit petsc-complex)
1595 (name "petsc-complex-openmpi")
1596 (inputs
1597 `(("openmpi" ,openmpi)
1598 ,@(package-inputs petsc-complex)))
1599 (arguments
1600 (substitute-keyword-arguments (package-arguments petsc-complex)
1601 ((#:configure-flags cf)
1602 ``("--with-mpiexec=mpirun"
1603 ,(string-append "--with-mpi-dir="
1604 (assoc-ref %build-inputs "openmpi"))
1605 ,@(delete "--with-mpi=0" ,cf)))))
16ecf3ff 1606 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
d8c7eeb9 1607
a7f01414
EB
1608(define-public slepc
1609 (package
1610 (name "slepc")
958b5a1c 1611 (version "3.8.0")
a7f01414
EB
1612 (source
1613 (origin
1614 (method url-fetch)
baeaf882
EB
1615 (uri (string-append "http://slepc.upv.es/download/distrib/slepc-"
1616 version ".tar.gz"))
a7f01414
EB
1617 (sha256
1618 (base32
958b5a1c 1619 "0qyrsdndfdw2g0jmj9iskxj3j20zlkplhv26288s079dhm7cr365"))))
a7f01414
EB
1620 (build-system gnu-build-system)
1621 (native-inputs
1622 `(("python" ,python-2)))
1623 (inputs
1624 `(("arpack" ,arpack-ng)
1625 ("gfortran" ,gfortran)))
1626 (propagated-inputs
1627 `(("petsc" ,petsc)))
1628 (arguments
1629 `(#:parallel-build? #f ;build is parallel by default
1630 #:configure-flags
1631 `(,(string-append "--with-arpack-dir="
9cf52454 1632 (assoc-ref %build-inputs "arpack") "/lib"))
9731c412
EB
1633 #:make-flags ;honor (parallel-job-count)
1634 `(,(format #f "MAKE_NP=~a" (parallel-job-count)))
a7f01414
EB
1635 #:phases
1636 (modify-phases %standard-phases
8787c555 1637 (replace 'configure
a7f01414
EB
1638 ;; configure is a python script, so we can't run it with bash.
1639 (lambda* (#:key inputs outputs (configure-flags '())
1640 #:allow-other-keys)
1641 (let* ((prefix (assoc-ref outputs "out"))
1642 (flags `(,(string-append "--prefix=" prefix)
1643 ,@configure-flags)))
1644 (format #t "build directory: ~s~%" (getcwd))
1645 (format #t "configure flags: ~s~%" flags)
1646 (setenv "SLEPC_DIR" (getcwd))
9cf52454 1647 (setenv "PETSC_DIR" (assoc-ref inputs "petsc"))
a7f01414 1648 (zero? (apply system* "./configure" flags)))))
8787c555 1649 (add-after 'install 'delete-doc
a7f01414
EB
1650 ;; TODO: SLEPc installs HTML documentation alongside headers in
1651 ;; $out/include. We'd like to move them to share/doc, but delete
1652 ;; them for now, as they are incomplete and installing the complete
1653 ;; documentation is difficult.
1654 (lambda* (#:key outputs #:allow-other-keys)
1655 (let* ((out (assoc-ref outputs "out")))
1656 (for-each delete-file (find-files out "\\.html$")))))
8787c555 1657 (add-after 'install 'clean-install
a7f01414
EB
1658 ;; Clean up unnecessary build logs from installation.
1659 (lambda* (#:key outputs #:allow-other-keys)
1660 (let ((out (assoc-ref outputs "out")))
1661 (for-each (lambda (file)
1662 (let ((f (string-append out "/lib/slepc/conf/" file)))
1663 (when (file-exists? f)
1664 (delete-file f))))
1665 '("configure.log" "make.log" "gmake.log"
1666 "test.log" "error.log" "RDict.db"
1667 "uninstall.py"))))))))
1668 (home-page "http://slepc.upv.es")
1669 (synopsis "Scalable library for eigenproblems")
1670 (description "SLEPc is a software library for the solution of large sparse
1671eigenproblems on parallel computers. It can be used for the solution of
1672linear eigenvalue problems formulated in either standard or generalized form,
1673as well as other related problems such as the singular value decomposition.
1674The emphasis of the software is on methods and techniques appropriate for
1675problems in which the associated matrices are sparse, for example, those
1676arising after the discretization of partial differential equations.")
1677 (license license:lgpl3)))
1678
1679(define-public slepc-complex
1680 (package (inherit slepc)
1681 (name "slepc-complex")
1682 (propagated-inputs
1683 `(("petsc" ,petsc-complex)
1684 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
1685 (synopsis "Scalable library for eigenproblems (with complex scalars)")))
1686
1687(define-public slepc-openmpi
1688 (package (inherit slepc)
1689 (name "slepc-openmpi")
1690 (inputs
1691 `(("mpi" ,openmpi)
1692 ("arpack" ,arpack-ng-openmpi)
1693 ,@(alist-delete "arpack" (package-inputs slepc))))
1694 (propagated-inputs
1695 `(("petsc" ,petsc-openmpi)
1696 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
1697 (synopsis "Scalable library for eigenproblems (with MPI support)")))
1698
1699(define-public slepc-complex-openmpi
1700 (package (inherit slepc-openmpi)
1701 (name "slepc-complex-openmpi")
1702 (propagated-inputs
1703 `(("petsc" ,petsc-complex-openmpi)
1704 ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
1705 (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
1706
cec86422
EB
1707(define-public mumps
1708 (package
1709 (name "mumps")
fba78d18 1710 (version "5.0.2")
cec86422
EB
1711 (source
1712 (origin
1713 (method url-fetch)
1714 (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
1715 version ".tar.gz"))
1716 (sha256
1717 (base32
fba78d18 1718 "0igyc1pfzxdhpbad3v3lb86ixkdbqa1a8gbs15b04r2294h2nabp"))
fc1adab1 1719 (patches (search-patches "mumps-build-parallelism.patch"))))
cec86422
EB
1720 (build-system gnu-build-system)
1721 (inputs
1722 `(("fortran" ,gfortran)
1723 ;; These are required for linking against mumps, but we let the user
1724 ;; declare the dependency.
1725 ("blas" ,openblas)
1726 ("metis" ,metis)
1727 ("scotch" ,scotch)))
1728 (arguments
1729 `(#:modules ((ice-9 match)
1730 (ice-9 popen)
1731 (srfi srfi-1)
1732 ,@%gnu-build-system-modules)
1733 #:phases
1734 (modify-phases %standard-phases
fba78d18 1735 (replace 'configure
cec86422
EB
1736 (lambda* (#:key inputs #:allow-other-keys)
1737 (call-with-output-file "Makefile.inc"
1738 (lambda (port)
1739 (format port "
1740PLAT =
1741LIBEXT = .a
1742OUTC = -o
1743OUTF = -o
1744RM = rm -f~:[
1745CC = gcc
1746FC = gfortran
1747FL = gfortran
1748INCSEQ = -I$(topdir)/libseq
1749LIBSEQ = -L$(topdir)/libseq -lmpiseq
1750LIBSEQNEEDED = libseqneeded~;
1751CC = mpicc
1752FC = mpifort
1753FL = mpifort~]
1754AR = ar vr # rules require trailing space, ugh...
1755RANLIB = ranlib
1756LIBBLAS = -L~a -lopenblas~@[
1757SCALAP = -L~a -lscalapack~]
1758LIBOTHERS = -pthread
1759CDEFS = -DAdd_
1760PIC = -fPIC
1761OPTF = -O2 -DALLOW_NON_INIT $(PIC)
1762OPTL = -O2 $(PIC)
1763OPTC = -O2 $(PIC)
1764INCS = $(INCSEQ)
1765LIBS = $(SCALAP) $(LIBSEQ)
1766LPORDDIR = $(topdir)/PORD/lib
1767IPORD = -I$(topdir)/PORD/include
1768LPORD = -L$(LPORDDIR) -lpord
1769ORDERINGSF = -Dpord~@[
1770METISDIR = ~a
1771IMETIS = -I$(METISDIR)/include
1772LMETIS = -L$(METISDIR)/lib -lmetis
1773ORDERINGSF += -Dmetis~]~@[~:{
1774SCOTCHDIR = ~a
1775ISCOTCH = -I$(SCOTCHDIR)/include
1776LSCOTCH = -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
1777ORDERINGSF += ~a~}~]
1778ORDERINGSC = $(ORDERINGSF)
1779LORDERINGS = $(LPORD) $(LMETIS) $(LSCOTCH)
1780IORDERINGSF = $(ISCOTCH)
1781IORDERINGSC = $(IPORD) $(IMETIS) $(ISCOTCH)"
1782 (assoc-ref inputs "mpi")
1783 (assoc-ref inputs "blas")
1784 (assoc-ref inputs "scalapack")
1785 (assoc-ref inputs "metis")
1786 (match (list (assoc-ref inputs "pt-scotch")
1787 (assoc-ref inputs "scotch"))
1788 ((#f #f)
1789 #f)
1790 ((#f scotch)
1791 `((,scotch "" "-Dscotch")))
1792 ((ptscotch _)
1793 `((,ptscotch
1794 "-lptesmumps -lptscotch -lptscotcherr "
1795 "-Dptscotch")))))))))
fba78d18 1796 (replace 'build
cec86422
EB
1797 ;; By default only the d-precision library is built. Make with "all"
1798 ;; target so that all precision libraries and examples are built.
1799 (lambda _
1800 (zero? (system* "make" "all"
1801 (format #f "-j~a" (parallel-job-count))))))
fba78d18 1802 (replace 'check
cec86422
EB
1803 ;; Run the simple test drivers, which read test input from stdin:
1804 ;; from the "real" input for the single- and double-precision
1805 ;; testers, and from the "cmplx" input for complex-precision
1806 ;; testers. The EXEC-PREFIX key is used by the mumps-openmpi
1807 ;; package to prefix execution with "mpirun".
1808 (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
1809 (with-directory-excursion "examples"
1810 (every
1811 (lambda (prec type)
1812 (let ((tester (apply open-pipe*
1813 `(,OPEN_WRITE
1814 ,@exec-prefix
1815 ,(string-append "./" prec
1816 "simpletest"))))
1817 (input (open-input-file
1818 (string-append "input_simpletest_" type))))
1819 (begin
1820 (dump-port input tester)
1821 (close-port input)
1822 (zero? (close-pipe tester)))))
1823 '("s" "d" "c" "z")
1824 '("real" "real" "cmplx" "cmplx")))))
fba78d18
EB
1825 (replace 'install
1826 (lambda* (#:key outputs #:allow-other-keys)
1827 (let* ((out (assoc-ref outputs "out"))
1828 (libdir (string-append out "/lib")))
1829 (copy-recursively "lib" libdir)
1830 (copy-recursively "include" (string-append out "/include"))
1831 (when (file-exists? "libseq/libmpiseq.a")
1832 (install-file "libseq/libmpiseq.a" libdir))
1833 #t))))))
cec86422
EB
1834 (home-page "http://mumps.enseeiht.fr")
1835 (synopsis "Multifrontal sparse direct solver")
1836 (description
1837 "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
1838sparse system of linear equations A x = b using Guassian elimination.")
1839 (license license:cecill-c)))
1840
1841(define-public mumps-metis
1842 (package (inherit mumps)
1843 (name "mumps-metis")
1844 (inputs
1845 (alist-delete "scotch" (package-inputs mumps)))))
1846
1847(define-public mumps-openmpi
1848 (package (inherit mumps)
1849 (name "mumps-openmpi")
1850 (inputs
1851 `(("mpi" ,openmpi)
1852 ("scalapack" ,scalapack)
1853 ("pt-scotch" ,pt-scotch)
1854 ,@(alist-delete "scotch" (package-inputs mumps))))
1855 (arguments
1856 (substitute-keyword-arguments (package-arguments mumps)
1857 ((#:phases phases)
1858 `(modify-phases ,phases
1859 (replace
1860 'check
1861 (lambda _
1862 ((assoc-ref ,phases 'check)
1863 #:exec-prefix '("mpirun" "-n" "2"))))))))
1864 (synopsis "Multifrontal sparse direct solver (with MPI)")))
1865
1866(define-public mumps-metis-openmpi
1867 (package (inherit mumps-openmpi)
1868 (name "mumps-metis-openmpi")
1869 (inputs
1870 (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
1871
2d047896
RW
1872(define-public r-quadprog
1873 (package
1874 (name "r-quadprog")
1875 (version "1.5-5")
1876 (source
1877 (origin
1878 (method url-fetch)
1879 (uri (cran-uri "quadprog" version))
1880 (sha256
1881 (base32
1882 "0jg3r6abmhp8r9vkbhpx9ldjfw6vyl1m4c5vwlyjhk1mi03656fr"))))
1883 (build-system r-build-system)
1884 (native-inputs
1885 `(("gfortran" ,gfortran)))
1886 (home-page "http://cran.r-project.org/web/packages/quadprog")
1887 (synopsis "Functions to solve quadratic programming problems")
1888 (description
1889 "This package contains routines and documentation for solving quadratic
1890programming problems.")
1891 (license license:gpl3+)))
1892
ec8c7e47
RJ
1893(define-public r-pracma
1894 (package
1895 (name "r-pracma")
0f2eee0d 1896 (version "2.0.7")
ec8c7e47
RJ
1897 (source (origin
1898 (method url-fetch)
1899 (uri (cran-uri "pracma" version))
1900 (sha256
0f2eee0d 1901 (base32 "0hxa0rbbp54j0c05qj7vfwhqfdmiz5ax8vhqxd09g33x7c0hqbc5"))))
ec8c7e47 1902 (build-system r-build-system)
ccd9b151
RW
1903 (propagated-inputs
1904 `(("r-quadprog" ,r-quadprog)))
ec8c7e47
RJ
1905 (home-page "http://cran.r-project.org/web/packages/pracma")
1906 (synopsis "Practical numerical math functions")
1907 (description "This package provides functions for numerical analysis and
1908linear algebra, numerical optimization, differential equations, plus some
1909special functions. It uses Matlab function names where appropriate to simplify
1910porting.")
1911 (license license:gpl3+)))
1912
183e44ae
EB
1913(define-public superlu
1914 (package
1915 (name "superlu")
995a09e0 1916 (version "5.2.1")
183e44ae
EB
1917 (source
1918 (origin
1919 (method url-fetch)
1920 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
1921 "superlu_" version ".tar.gz"))
1922 (sha256
995a09e0
EB
1923 (base32 "0qzlb7cd608q62kyppd0a8c65l03vrwqql6gsm465rky23b6dyr8"))
1924 (modules '((guix build utils)))
1925 (snippet
1926 ;; Replace the non-free implementation of MC64 with a stub adapted
1927 ;; from Debian
1928 '(begin
1929 (use-modules (ice-9 regex)
1930 (ice-9 rdelim))
1931 (call-with-output-file "SRC/mc64ad.c"
1932 (lambda (port)
1933 (display "
1934#include <stdio.h>
1935#include <stdlib.h>
1936void mc64id_(int *a) {
1937 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
1938 abort ();
1939}
1940void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
1941 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
1942 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
1943 abort ();
1944}\n" port)))
1945 ;; Remove the corresponding license verbiage. MC64 license follows
1946 ;; a "------" line separator.
1947 (with-atomic-file-replacement "License.txt"
1948 (let ((rx (make-regexp "-{8}")))
1949 (lambda (in out)
1950 (let loop ()
1951 (let ((line (read-line in 'concat)))
1952 (unless (regexp-exec rx line)
1953 (display line out)
1954 (loop)))))))))))
1955 (build-system cmake-build-system)
183e44ae
EB
1956 (native-inputs
1957 `(("tcsh" ,tcsh)))
1958 (inputs
995a09e0 1959 `(("blas" ,openblas)
19afbea1 1960 ("gfortran" ,gfortran)))
183e44ae 1961 (arguments
995a09e0
EB
1962 `(#:configure-flags '("-Denable_blaslib:BOOL=NO" ;do not use internal cblas
1963 "-DTPL_BLAS_LIBRARIES=openblas"
1964 "-DBUILD_SHARED_LIBS:BOOL=YES"
1965 "-DCMAKE_INSTALL_LIBDIR=lib")))
183e44ae
EB
1966 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
1967 (synopsis "Supernodal direct solver for sparse linear systems")
1968 (description
1969 "SuperLU is a general purpose library for the direct solution of large,
1970sparse, nonsymmetric systems of linear equations on high performance machines.
1971The library is written in C and is callable from either C or Fortran. The
1972library routines perform an LU decomposition with partial pivoting and
1973triangular system solves through forward and back substitution. The library
1974also provides threshold-based ILU factorization preconditioners.")
995a09e0
EB
1975 (license (list license:bsd-3
1976 license:gpl2+ ;EXAMPLE/*fgmr.c
1977 (license:fsf-free "file://SRC/colamd.h")))))
f8ed036a 1978
a54aefea
EB
1979(define-public superlu-dist
1980 (package
1981 (name "superlu-dist")
1982 (version "3.3")
1983 (source
1984 (origin
1985 (method url-fetch)
1986 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
1987 "superlu_dist_" version ".tar.gz"))
1988 (sha256
1989 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
29080870
EB
1990 (modules '((guix build utils)))
1991 (snippet
1992 ;; Replace the non-free implementation of MC64 with a stub
1993 '(begin
1994 (use-modules (ice-9 regex)
1995 (ice-9 rdelim))
1996 (call-with-output-file "SRC/mc64ad.c"
1997 (lambda (port)
1998 (display "
1999#include <stdio.h>
2000#include <stdlib.h>
2001void mc64id_(int *a) {
2002 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
2003 abort ();
2004}
2005void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
2006 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
2007 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
2008 abort ();
2009}\n" port)))
2010 (delete-file "SRC/mc64ad.f.bak")
2011 (substitute* "SRC/util.c" ;adjust default algorithm
2012 (("RowPerm[[:blank:]]*=[[:blank:]]*LargeDiag")
2013 "RowPerm = NOROWPERM"))))
fc1adab1 2014 (patches (search-patches "superlu-dist-scotchmetis.patch"))))
a54aefea
EB
2015 (build-system gnu-build-system)
2016 (native-inputs
2017 `(("tcsh" ,tcsh)))
2018 (inputs
19afbea1 2019 `(("gfortran" ,gfortran)))
a54aefea
EB
2020 (propagated-inputs
2021 `(("openmpi" ,openmpi) ;headers include MPI heades
2022 ("lapack" ,lapack) ;required to link with output library
2023 ("pt-scotch" ,pt-scotch))) ;same
2024 (arguments
2025 `(#:parallel-build? #f ;race conditions using ar
2026 #:phases
dc1d3cde
KK
2027 (modify-phases %standard-phases
2028 (replace 'configure
2029 (lambda* (#:key inputs outputs #:allow-other-keys)
2030 (call-with-output-file "make.inc"
2031 (lambda (port)
2032 (format port "
a54aefea
EB
2033PLAT =
2034DSuperLUroot = ~a
2035DSUPERLULIB = ~a/lib/libsuperlu_dist.a
2036BLASDEF = -DUSE_VENDOR_BLAS
2037BLASLIB = -L~a/lib -lblas
2038PARMETISLIB = -L~a/lib \
2039 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
2040 -lscotch -lscotcherr -lscotcherrexit
2041METISLIB = -L~:*~a/lib \
2042 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
2043LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
2044ARCH = ar
2045ARCHFLAGS = cr
2046RANLIB = ranlib
2047CC = mpicc
2048PIC = -fPIC
2049CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
2050NOOPTS = -O0 -g $(PIC)
2051FORTRAN = mpifort
2052FFLAGS = -O2 -g $(PIC)
2053LOADER = $(CC)
2054CDEFS = -DAdd_"
dc1d3cde
KK
2055 (getcwd)
2056 (assoc-ref outputs "out")
2057 (assoc-ref inputs "lapack")
2058 (assoc-ref inputs "pt-scotch"))))
2059 #t))
2060 (add-after 'unpack 'remove-broken-symlinks
2061 (lambda _
2062 (for-each delete-file
2063 (find-files "MAKE_INC" "\\.#make\\..*"))
2064 #t))
2065 (add-before 'build 'create-install-directories
2066 (lambda* (#:key outputs #:allow-other-keys)
2067 (for-each
2068 (lambda (dir)
2069 (mkdir-p (string-append (assoc-ref outputs "out")
2070 "/" dir)))
2071 '("lib" "include"))
2072 #t))
2073 (replace 'check
a54aefea
EB
2074 (lambda _
2075 (with-directory-excursion "EXAMPLE"
2076 (and
2077 (zero? (system* "mpirun" "-n" "2"
2078 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
2079 (zero? (system* "mpirun" "-n" "2"
dc1d3cde
KK
2080 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua"))))))
2081 (replace 'install
2082 (lambda* (#:key outputs #:allow-other-keys)
2083 ;; Library is placed in lib during the build phase. Copy over
2084 ;; headers to include.
2085 (let* ((out (assoc-ref outputs "out"))
2086 (incdir (string-append out "/include")))
2087 (for-each (lambda (file)
2088 (let ((base (basename file)))
2089 (format #t "installing `~a' to `~a'~%"
2090 base incdir)
2091 (copy-file file
2092 (string-append incdir "/" base))))
2093 (find-files "SRC" ".*\\.h$")))
2094 #t)))))
a54aefea
EB
2095 (home-page (package-home-page superlu))
2096 (synopsis "Parallel supernodal direct solver")
2097 (description
2098 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
2099It is targeted for distributed memory parallel machines. SuperLU_DIST is
2100implemented in ANSI C, and MPI for communications.")
2101 (license license:bsd-3)))
2102
f8ed036a
EB
2103(define-public scotch
2104 (package
2105 (name "scotch")
6c798540 2106 (version "6.0.4")
f8ed036a
EB
2107 (source
2108 (origin
2109 (method url-fetch)
6c798540 2110 (uri (string-append "https://gforge.inria.fr/frs/download.php/34618/"
f8ed036a
EB
2111 "scotch_" version ".tar.gz"))
2112 (sha256
6c798540 2113 (base32 "1ir088mvrqggyqdkx9qfynmiaffqbyih5qfl5mga2nrlm1qlsgzm"))
fc1adab1
AK
2114 (patches (search-patches "scotch-test-threading.patch"
2115 "pt-scotch-build-parallelism.patch"))))
f8ed036a
EB
2116 (build-system gnu-build-system)
2117 (inputs
2118 `(("zlib" ,zlib)
5e54f4ad 2119 ("flex" ,flex)
f8ed036a
EB
2120 ("bison" ,bison)))
2121 (arguments
2122 `(#:phases
d6602ee9
EB
2123 (modify-phases %standard-phases
2124 (add-after
2125 'unpack 'chdir-to-src
2126 (lambda _ (chdir "src")))
2127 (replace
2128 'configure
2129 (lambda _
2130 (call-with-output-file "Makefile.inc"
2131 (lambda (port)
2132 (format port "
f8ed036a
EB
2133EXE =
2134LIB = .a
2135OBJ = .o
2136MAKE = make
2137AR = ar
2138ARFLAGS = -ruv
cf0ec6c4 2139CAT = cat
f8ed036a
EB
2140CCS = gcc
2141CCP = mpicc
2142CCD = gcc
2143CPPFLAGS =~{ -D~a~}
6c798540 2144CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
f8ed036a
EB
2145LDFLAGS = -lz -lm -lrt -lpthread
2146CP = cp
2147LEX = flex -Pscotchyy -olex.yy.c
2148LN = ln
2149MKDIR = mkdir
2150MV = mv
2151RANLIB = ranlib
2152YACC = bison -pscotchyy -y -b y
2153"
d6602ee9
EB
2154 '("COMMON_FILE_COMPRESS_GZ"
2155 "COMMON_PTHREAD"
2156 "COMMON_RANDOM_FIXED_SEED"
26599d69 2157 "INTSIZE64" ;use 'long' instead of 'int'
cf0ec6c4
EB
2158 ;; Prevents symbolc clashes with libesmumps
2159 "SCOTCH_RENAME"
d6602ee9
EB
2160 ;; XXX: Causes invalid frees in superlu-dist tests
2161 ;; "SCOTCH_PTHREAD"
2162 ;; "SCOTCH_PTHREAD_NUMBER=2"
2163 "restrict=__restrict"))))))
cf0ec6c4
EB
2164 (add-after
2165 'build 'build-esmumps
2166 (lambda _
2167 (zero? (system* "make"
2168 (format #f "-j~a" (parallel-job-count))
2169 "esmumps"))))
d6602ee9 2170 (replace
f8ed036a
EB
2171 'install
2172 (lambda* (#:key outputs #:allow-other-keys)
2173 (let ((out (assoc-ref outputs "out")))
2174 (mkdir out)
2175 (zero? (system* "make"
2176 (string-append "prefix=" out)
cf0ec6c4
EB
2177 "install"))
2178 ;; esmumps files are not installed with the above
2179 (for-each (lambda (f)
2180 (copy-file f (string-append out "/include/" f)))
2181 (find-files "../include" ".*esmumps.h$"))
2182 (for-each (lambda (f)
2183 (copy-file f (string-append out "/lib/" f)))
2184 (find-files "../lib" "^lib.*esmumps.*"))))))))
f8ed036a
EB
2185 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
2186 (synopsis "Programs and libraries for graph algorithms")
2187 (description "SCOTCH is a set of programs and libraries which implement
2188the static mapping and sparse matrix reordering algorithms developed within
2189the SCOTCH project. Its purpose is to apply graph theory, with a divide and
2190conquer approach, to scientific computing problems such as graph and mesh
2191partitioning, static mapping, and sparse matrix ordering, in application
2192domains ranging from structural mechanics to operating systems or
2193bio-chemistry.")
2194 ;; See LICENSE_en.txt
2195 (license license:cecill-c)))
6acb4adb 2196
1c39f3b8
PG
2197(define-public scotch32
2198 ;; This is the 'INTSIZE32' variant, which uses 32-bit integers, as needed by
2199 ;; some applications.
2200 (package (inherit scotch)
2201 (name "scotch32")
2202 (arguments
2203 (substitute-keyword-arguments (package-arguments scotch)
2204 ((#:phases scotch-phases)
2205 `(modify-phases ,scotch-phases
2206 (replace
2207 'configure
2208 (lambda _
2209 (call-with-output-file "Makefile.inc"
2210 (lambda (port)
2211 (format port "
2212EXE =
2213LIB = .a
2214OBJ = .o
2215MAKE = make
2216AR = ar
2217ARFLAGS = -ruv
2218CAT = cat
2219CCS = gcc
2220CCP = mpicc
2221CCD = gcc
2222CPPFLAGS =~{ -D~a~}
2223CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
2224LDFLAGS = -lz -lm -lrt -lpthread
2225CP = cp
2226LEX = flex -Pscotchyy -olex.yy.c
2227LN = ln
2228MKDIR = mkdir
2229MV = mv
2230RANLIB = ranlib
2231YACC = bison -pscotchyy -y -b y
2232"
2233 '("COMMON_FILE_COMPRESS_GZ"
2234 "COMMON_PTHREAD"
2235 "COMMON_RANDOM_FIXED_SEED"
2236 "INTSIZE32" ;use 32-bit integers. See INSTALL.txt
2237 ;; Prevents symbolc clashes with libesmumps
2238 "SCOTCH_RENAME"
2239 ;; XXX: Causes invalid frees in superlu-dist tests
2240 ;; "SCOTCH_PTHREAD"
2241 ;; "SCOTCH_PTHREAD_NUMBER=2"
2242 "restrict=__restrict"))))))))))
2243 (synopsis
2244 "Programs and libraries for graph algorithms (32-bit integers)")))
2245
6acb4adb
EB
2246(define-public pt-scotch
2247 (package (inherit scotch)
2248 (name "pt-scotch")
2249 (propagated-inputs
2250 `(("openmpi" ,openmpi))) ;Headers include MPI headers
2251 (arguments
2252 (substitute-keyword-arguments (package-arguments scotch)
2253 ((#:phases scotch-phases)
d6602ee9
EB
2254 `(modify-phases ,scotch-phases
2255 (replace
2256 'build
d6602ee9
EB
2257 (lambda _
2258 (and
cf0ec6c4
EB
2259 (zero? (system* "make"
2260 (format #f "-j~a" (parallel-job-count))
2261 "ptscotch" "ptesmumps"))
d6602ee9
EB
2262 ;; Install the serial metis compatibility library
2263 (zero? (system* "make" "-C" "libscotchmetis" "install")))))
2264 (replace
2265 'check
2266 (lambda _ (zero? (system* "make" "ptcheck"))))))))
6acb4adb 2267 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
5698b8b8 2268
1c25a52c
PG
2269(define-public pt-scotch32
2270 (package (inherit scotch32)
2271 (name "pt-scotch32")
2272 (propagated-inputs
2273 `(("openmpi" ,openmpi))) ;headers include MPI headers
2274 (arguments
c4d4a779
PG
2275 (substitute-keyword-arguments (package-arguments scotch32)
2276 ((#:phases scotch32-phases)
2277 `(modify-phases ,scotch32-phases
1c25a52c
PG
2278 (replace 'build
2279 (lambda _
2280 (and
2281 (zero? (system* "make"
2282 (format #f "-j~a" (parallel-job-count))
2283 "ptscotch" "ptesmumps"))
2284 ;; Install the serial metis compatibility library
2285 (zero? (system* "make" "-C" "libscotchmetis" "install")))))
2286 (replace 'check
2287 (lambda _
2288 (zero? (system* "make" "ptcheck"))))))))
2289 (synopsis
2290 "Programs and libraries for graph algorithms (with MPI and 32-bit integers)")))
2291
aa75ad00
EB
2292(define-public metis
2293 (package
2294 (name "metis")
2295 (version "5.1.0")
2296 (source
2297 (origin
2298 (method url-fetch)
2299 (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
2300 "metis-" version ".tar.gz"))
2301 (sha256
2302 (base32
2303 "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
2304 (build-system cmake-build-system)
2305 (inputs
2306 `(("blas" ,openblas)))
2307 (arguments
2308 `(#:tests? #f ;no tests
2309 #:configure-flags `("-DSHARED=ON"
2310 ,(string-append "-DGKLIB_PATH=" (getcwd)
2311 "/metis-" ,version "/GKlib"))))
2312 (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
2313 (synopsis "Graph partitioning and fill-reducing matrix ordering library")
2314 (description
2315 "METIS is a set of serial programs for partitioning graphs, partitioning
2316finite element meshes, and producing fill-reducing orderings for sparse
2317matrices. The algorithms implemented in METIS are based on the multilevel
2318recursive-bisection, multilevel k-way, and multi-constraint partitioning
2319schemes.")
2320 (license license:asl2.0))) ;As of version 5.0.3
2321
700ff222
EB
2322(define-public p4est
2323 (package
2324 (name "p4est")
4150da63 2325 (version "2.0")
700ff222
EB
2326 (source
2327 (origin
2328 (method url-fetch)
2329 (uri (string-append "http://p4est.github.io/release/p4est-"
2330 version ".tar.gz"))
2331 (sha256
2332 (base32
4150da63 2333 "16h267z256kxcxfjs390qqzv19hr58vrj4x8lndb7alnk2vca8n5"))))
700ff222
EB
2334 (build-system gnu-build-system)
2335 (inputs
2336 `(("fortran" ,gfortran)
2337 ("blas" ,openblas)
2338 ("lapack" ,lapack)
2339 ("zlib" ,zlib)))
2340 (arguments
2341 `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
2342 (assoc-ref %build-inputs "blas")
2343 " -lopenblas")
2344 ,(string-append "LAPACK_LIBS=-L"
2345 (assoc-ref %build-inputs "lapack")
2346 " -llapack"))))
2347 (home-page "http://www.p4est.org")
2348 (synopsis "Adaptive mesh refinement on forests of octrees")
2349 (description
2350 "The p4est software library enables the dynamic management of a
2351collection of adaptive octrees, conveniently called a forest of octrees.
2352p4est is designed to work in parallel and scales to hundreds of thousands of
2353processor cores.")
2354 (license license:gpl2+)))
2355
2356(define-public p4est-openmpi
2357 (package (inherit p4est)
2358 (name "p4est-openmpi")
2359 (inputs
2360 `(("mpi" ,openmpi)
2361 ,@(package-inputs p4est)))
2362 (arguments
2363 (substitute-keyword-arguments (package-arguments p4est)
2364 ((#:configure-flags cf)
2365 ``("--enable-mpi" ,@,cf))))
2366 (synopsis "Parallel adaptive mesh refinement on forests of octrees")))
2367
5698b8b8
JD
2368(define-public gsegrafix
2369 (package
2370 (name "gsegrafix")
2371 (version "1.0.6")
2372 (source
2373 (origin
2374 (method url-fetch)
2375 (uri (string-append "mirror://gnu/" name "/" name "-"
2376 version ".tar.gz"))
2377 (sha256
2378 (base32
2379 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
2380 (build-system gnu-build-system)
2381 (arguments
2382 `(#:configure-flags '("LDFLAGS=-lm")))
2383 (inputs
2384 `(("libgnomecanvas" ,libgnomecanvas)
2385 ("libbonoboui" ,libbonoboui)
2386 ("libgnomeui" ,libgnomeui)
2387 ("libgnomeprintui" ,libgnomeprintui)
2388 ("popt" ,popt)))
2389 (native-inputs
2390 `(("pkg-config" ,pkg-config)))
6fd52309 2391 (home-page "https://www.gnu.org/software/gsegrafix/")
5698b8b8
JD
2392 (synopsis "GNOME application to create scientific and engineering plots")
2393 (description "GSEGrafix is an application which produces high-quality graphical
2394plots for science and engineering. Plots are specified via simple ASCII
2395parameter files and data files and are presented in an anti-aliased GNOME
2396canvas. The program supports rectangular two-dimensional plots, histograms,
2397polar-axis plots and three-dimensional plots. Plots can be printed or saved
2398to BMP, JPEG or PNG image formats.")
2399 (license license:gpl3+)))
8731e527
JD
2400
2401(define-public maxima
2402 (package
2403 (name "maxima")
b3b2efc8 2404 (version "5.41.0")
8731e527
JD
2405 (source
2406 (origin
2407 (method url-fetch)
2408 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
2409 version "-source/" name "-" version ".tar.gz"))
2410 (sha256
2411 (base32
b3b2efc8 2412 "0x0n81z0s4pl8nwpf7ivlsbvsdphm9w42250g7qdkizl0132by6s"))
fc1adab1 2413 (patches (search-patches "maxima-defsystem-mkdir.patch"))))
8731e527 2414 (build-system gnu-build-system)
df354a77 2415 (inputs
6b2eafaa 2416 `(("gcl" ,gcl)
df354a77 2417 ("gnuplot" ,gnuplot) ;for plots
f36afe4d 2418 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
df354a77
FB
2419 (native-inputs
2420 `(("texinfo" ,texinfo)
ccbc5758
KK
2421 ("perl" ,perl)
2422 ("python" ,python)))
8731e527 2423 (arguments
df354a77
FB
2424 `(#:configure-flags
2425 (list "--enable-gcl"
2426 (string-append "--with-posix-shell="
2427 (assoc-ref %build-inputs "bash")
2428 "/bin/sh")
2429 (string-append "--with-wish="
2430 (assoc-ref %build-inputs "tk")
2431 "/bin/wish"
2432 (let ((v ,(package-version tk)))
2433 (string-take v (string-index-right v #\.)))))
df354a77 2434 ;; By default Maxima attempts to write temporary files to
77af7b24
MW
2435 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
2436 ;; Work around that.
df354a77 2437 #:make-flags (list "TMPDIR=/tmp")
0093b126
KK
2438 #:phases
2439 (modify-phases %standard-phases
2440 (add-before 'check 'pre-check
2441 (lambda _
2442 (chmod "src/maxima" #o555)
2443 #t))
2444 ;; Make sure the doc and emacs files are found in the
2445 ;; standard location. Also configure maxima to find gnuplot
2446 ;; without having it on the PATH.
2447 (add-after 'install 'post-install
2448 (lambda* (#:key outputs inputs #:allow-other-keys)
2449 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
2450 (out (assoc-ref outputs "out"))
2451 (datadir (string-append out "/share/maxima/" ,version))
2452 (binutils (string-append (assoc-ref inputs "binutils")
2453 "/bin")))
2454 (with-directory-excursion out
2455 (mkdir-p "share/emacs")
2456 (mkdir-p "share/doc")
2457 (symlink
2458 (string-append datadir "/emacs/")
2459 (string-append out "/share/emacs/site-lisp"))
2460 (symlink
2461 (string-append datadir "/doc/")
2462 (string-append out "/share/doc/maxima"))
2463 (with-atomic-file-replacement
2464 (string-append datadir "/share/maxima-init.lisp")
2465 (lambda (in out)
2466 (format out "~a ~s~a~%"
2467 "(setf $gnuplot_command "
2468 (string-append gnuplot "/bin/gnuplot") ")")
2469 (dump-port in out))))
2470 ;; Ensure that Maxima will have access to the GNU binutils
2471 ;; components at runtime.
2472 (wrap-program (string-append out "/bin/maxima")
2473 `("PATH" prefix (,binutils))))
2474 #t)))))
8731e527
JD
2475 (home-page "http://maxima.sourceforge.net")
2476 (synopsis "Numeric and symbolic expression manipulation")
2477 (description "Maxima is a system for the manipulation of symbolic and
2478numerical expressions. It yields high precision numeric results by using
2479exact fractions, arbitrary precision integers, and variable precision floating
e881752c 2480point numbers.")
8731e527
JD
2481 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
2482 ;; Others simply say "GNU General Public License" without stating a
2483 ;; version (which implicitly means gpl1+).
2484 ;; At least one file (src/maxima.asd) says "version 2."
2485 ;; GPLv2 only is therefore the smallest subset.
f36afe4d 2486 (license license:gpl2)))
ec322be2 2487
9aafbc0c
MW
2488(define-public wxmaxima
2489 (package
2490 (name "wxmaxima")
ac2ddcc6 2491 (version "17.05.1")
9aafbc0c
MW
2492 (source
2493 (origin
2494 (method url-fetch)
5143517c
KK
2495 (uri (string-append "https://github.com/andrejv/" name "/archive"
2496 "/Version-" version ".tar.gz"))
2497 (file-name (string-append name "-" version ".tar.gz"))
9aafbc0c
MW
2498 (sha256
2499 (base32
ac2ddcc6 2500 "0dv0cy0cf46v0cbw32izscpkdmpxg1qhwq1f4cz46kkqd8k4yfbj"))))
9aafbc0c 2501 (build-system gnu-build-system)
5143517c
KK
2502 (native-inputs
2503 `(("autoconf" ,autoconf)
2504 ("automake" ,automake)
2505 ("gettext" ,gettext-minimal)))
9aafbc0c
MW
2506 (inputs
2507 `(("wxwidgets" ,wxwidgets)
de477809
SB
2508 ("maxima" ,maxima)
2509 ;; Runtime support.
2510 ("adwaita-icon-theme" ,adwaita-icon-theme)
2511 ("gtk+" ,gtk+)
2512 ("shared-mime-info" ,shared-mime-info)))
9aafbc0c 2513 (arguments
ac2ddcc6
KK
2514 `(#:phases
2515 (modify-phases %standard-phases
2516 (add-after 'unpack 'autoconf
2517 (lambda _
2518 (zero? (system* "sh" "bootstrap"))))
2519 (add-after 'install 'wrap-program
2520 (lambda* (#:key inputs outputs #:allow-other-keys)
2521 (wrap-program (string-append (assoc-ref outputs "out")
2522 "/bin/wxmaxima")
2523 `("PATH" ":" prefix
2524 (,(string-append (assoc-ref inputs "maxima")
2525 "/bin")))
2526 ;; For GtkFileChooserDialog.
2527 `("GSETTINGS_SCHEMA_DIR" =
2528 (,(string-append (assoc-ref inputs "gtk+")
2529 "/share/glib-2.0/schemas")))
2530 `("XDG_DATA_DIRS" ":" prefix
2531 (;; Needed by gdk-pixbuf to know supported icon formats.
2532 ,(string-append
2533 (assoc-ref inputs "shared-mime-info") "/share")
2534 ;; The default icon theme of GTK+.
2535 ,(string-append
2536 (assoc-ref inputs "adwaita-icon-theme") "/share"))))
2537 #t)))))
9aafbc0c
MW
2538 (home-page "https://andrejv.github.io/wxmaxima/")
2539 (synopsis "Graphical user interface for the Maxima computer algebra system")
2540 (description
2541 "wxMaxima is a graphical user interface for the Maxima computer algebra
2542system. It eases the use of Maxima by making most of its commands available
2543through a menu system and by providing input dialogs for commands that require
2544more than one argument. It also implements its own display engine that
2545outputs mathematical symbols directly instead of depicting them with ASCII
2546characters.
2547
2548wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
2549text and mathematical calculations to create documents, exporting of input and
2550output to TeX, and a browser for Maxima's manual including command index and
2551full text searching.")
2552 (license license:gpl2+)))
2553
b15e47f9
RW
2554(define-public armadillo
2555 (package
2556 (name "armadillo")
133cba8c 2557 (version "7.800.2")
b15e47f9
RW
2558 (source (origin
2559 (method url-fetch)
2560 (uri (string-append "mirror://sourceforge/arma/armadillo-"
7397cd9e 2561 version ".tar.xz"))
b15e47f9
RW
2562 (sha256
2563 (base32
133cba8c 2564 "1qqzy7dp891j9v7062mv1599hdwr97vqzrd3j2fl8c3gmc00dmzg"))))
b15e47f9
RW
2565 (build-system cmake-build-system)
2566 (arguments `(#:tests? #f)) ;no test target
2567 (inputs
2568 `(("openblas" ,openblas)
2569 ("lapack" ,lapack)
2570 ("arpack" ,arpack-ng)))
2571 (home-page "http://arma.sourceforge.net/")
2572 (synopsis "C++ linear algebra library")
2573 (description
2574 "Armadillo is a C++ linear algebra library, aiming towards a good balance
2575between speed and ease of use. It is useful for algorithm development
2576directly in C++, or quick conversion of research code into production
2577environments. It can be used for machine learning, pattern recognition,
2578signal processing, bioinformatics, statistics, econometrics, etc. The library
2579provides efficient classes for vectors, matrices and cubes, as well as 150+
2580associated functions (eg. contiguous and non-contiguous submatrix views).")
fe418cc5 2581 (license license:asl2.0)))
b15e47f9 2582
279663ef 2583(define-public muparser
d7cff656
LF
2584 ;; When switching download sites, muparser re-issued a 2.2.5 release with a
2585 ;; different hash. In order to make `guix package --upgrade` work correctly,
2586 ;; we set a Guix packaging revision.
2587 ;; When the next version of muparser is released, we can remove
2588 ;; UPSTREAM-VERSION and REVISION and use the plain VERSION.
2589 (let ((upstream-version "2.2.5")
2590 (revision "2"))
2591 (package
2592 (name "muparser")
2593 (version (string-append upstream-version "-" revision))
2594 (source
2595 (origin
2596 (method url-fetch)
2597 (uri (string-append "https://github.com/beltoforion/muparser/archive/v"
2598 upstream-version ".tar.gz"))
2599 (file-name (string-append name "-" version ".tar.gz"))
2600 (sha256
2601 (base32
2602 "0277qsi5l23jsck1vhn383bmvc2n9l4a1dl5r9bf7hvjv9ayyrh6"))))
2603 (build-system gnu-build-system)
2604 (arguments
2605 `(#:configure-flags '("--enable-samples=no")
2606 #:tests? #f)) ;no "check" target
2607 (home-page "http://muparser.beltoforion.de/")
2608 (synopsis "Fast parser library for mathematical expressions")
2609 (description
2610 "muParser is an extensible high performance math parser library. It is
2611based on transforming an expression into a bytecode and precalculating constant
2612parts of it.")
2613 (license license:expat))))
279663ef 2614
e73b49fb
RW
2615(define-public openblas
2616 (package
2617 (name "openblas")
883d0a7d 2618 (version "0.2.19")
e73b49fb
RW
2619 (source
2620 (origin
2621 (method url-fetch)
2622 (uri (string-append "https://github.com/xianyi/OpenBLAS/tarball/v"
2623 version))
2624 (file-name (string-append name "-" version ".tar.gz"))
2625 (sha256
2626 (base32
883d0a7d 2627 "071zqnmnxhh0c9phzyn3f198yxa0hjxda7016azdbq2056sm70w7"))))
e73b49fb
RW
2628 (build-system gnu-build-system)
2629 (arguments
5b5ea159 2630 `(#:tests? #f ;no "check" target
bd0b4379
RW
2631 ;; DYNAMIC_ARCH is only supported on x86. When it is disabled and no
2632 ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
2633 ;; we need to disable substitutions.
71923a91
AE
2634 #:substitutable?
2635 ,(let ((system (or (%current-target-system) (%current-system))))
2636 (or (string-prefix? "x86_64" system)
bd0b4379 2637 (string-prefix? "i686" system)
83a34647
EF
2638 (string-prefix? "mips" system)
2639 (string-prefix? "aarch64" system)))
e73b49fb
RW
2640 #:make-flags
2641 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
2642 "SHELL=bash"
af5b817e
RW
2643 "NO_LAPACK=1"
2644 ;; Build the library for all supported CPUs. This allows
2645 ;; switching CPU targets at runtime with the environment variable
2646 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
71923a91
AE
2647 ;; Unfortunately, this is not supported on non-x86 architectures,
2648 ;; where it leads to failed builds.
2649 ,@(let ((system (or (%current-target-system) (%current-system))))
8a637e79
RW
2650 (cond
2651 ((or (string-prefix? "x86_64" system)
71923a91 2652 (string-prefix? "i686" system))
8a637e79
RW
2653 '("DYNAMIC_ARCH=1"))
2654 ;; On MIPS we force the "SICORTEX" TARGET, as for the other
2655 ;; two available MIPS targets special extended instructions
2656 ;; for Loongson cores are used.
2657 ((string-prefix? "mips" system)
2658 '("TARGET=SICORTEX"))
83a34647
EF
2659 ;; On aarch64 force the generic 'armv8-a' target
2660 ((string-prefix? "aarch64" system)
2661 '("TARGET=ARMV8"))
8a637e79 2662 (else '()))))
e73b49fb
RW
2663 ;; no configure script
2664 #:phases (alist-delete 'configure %standard-phases)))
2665 (inputs
19afbea1 2666 `(("fortran" ,gfortran)))
e73b49fb
RW
2667 (native-inputs
2668 `(("cunit" ,cunit)
2669 ("perl" ,perl)))
2670 (home-page "http://www.openblas.net/")
2671 (synopsis "Optimized BLAS library based on GotoBLAS")
2672 (description
2673 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
2674 (license license:bsd-3)))
2675
5a7deb11
LC
2676(define* (make-blis implementation #:optional substitutable?)
2677 "Return a BLIS package with the given IMPLEMENTATION (see config/ in the
2678source tree for a list of implementations.)
2679
2680SUBSTITUTABLE? determines whether the package is made available as a
2681substitute.
2682
2683Currently the specialization must be selected at configure-time, but work is
2684underway to allow BLIS to select the right optimized kernels at run time:
2685<https://github.com/flame/blis/issues/129>."
2686 (package
2687 (name (if (string=? implementation "reference")
2688 "blis"
2689 (string-append "blis-" implementation)))
2690 (version "0.2.2")
2691 (home-page "https://github.com/flame/blis")
2692 (source (origin
2693 (method git-fetch)
2694 (uri (git-reference (url home-page) (commit version)))
2695 (sha256
2696 (base32
2697 "1wr79a50nm4abhw8w3sn96nmwp5mrzifcigk7khw9qcgyyyqayfh"))
2698 (file-name (git-file-name "blis" version))))
2699 (build-system gnu-build-system)
2700 (arguments
2701 `(#:test-target "test"
2702
2703 #:substitutable? ,substitutable?
2704
2705 #:phases (modify-phases %standard-phases
2706 (replace 'configure
2707 (lambda* (#:key outputs #:allow-other-keys)
2708 ;; This is a home-made 'configure' script.
2709 (let ((out (assoc-ref outputs "out")))
2710 (zero? (system* "./configure" "-p" out
2711 "-d" "opt"
2712 "--disable-static"
2713 "--enable-shared"
2714 "--enable-threading=openmp"
2715
2716 ,implementation)))))
2717 (add-before 'check 'show-test-output
2718 (lambda _
2719 ;; By default "make check" is silent. Make it verbose.
2720 (system "tail -F output.testsuite &")
2721 #t)))))
2722 (synopsis "High-performance basic linear algebra (BLAS) routines")
2723 (description
2724 "BLIS is a portable software framework for instantiating high-performance
2725BLAS-like dense linear algebra libraries. The framework was designed to
2726isolate essential kernels of computation that, when optimized, immediately
2727enable optimized implementations of most of its commonly used and
2728computationally intensive operations. While BLIS exports a new BLAS-like API,
2729it also includes a BLAS compatibility layer which gives application developers
2730access to BLIS implementations via traditional BLAS routine calls.")
2731 (license license:bsd-3)))
2732
2733(define-public blis
2734 ;; This is the "reference" implementation, which is the non-optimized but
2735 ;; portable variant (no assembly).
2736 (make-blis "reference" #t))
2737
2738(define ignorance blis)
2739
2740(define-syntax-rule (blis/x86_64 processor)
2741 "Expand to a package specialized for PROCESSOR."
2742 (package
2743 (inherit (make-blis processor))
2744 (supported-systems '("x86_64-linux"))))
2745
2746(define-public blis-sandybridge
2747 ;; BLIS specialized for Sandy Bridge processors (launched 2011):
2748 ;; <http://ark.intel.com/products/codename/29900/Sandy-Bridge>.
2749 (blis/x86_64 "sandybridge"))
2750
2751(define-public blis-haswell
2752 ;; BLIS specialized for Haswell processors (launched 2013):
2753 ;; <http://ark.intel.com/products/codename/42174/Haswell>.
2754 (blis/x86_64 "haswell"))
2755
2756(define-public blis-knl
2757 ;; BLIS specialized for Knights Landing processor (launched 2016):
2758 ;; <http://ark.intel.com/products/series/92650/Intel-Xeon-Phi-x200-Product-Family>.
2759 (blis/x86_64 "knl"))
2760
2761
e1605e36
RW
2762(define-public openlibm
2763 (package
2764 (name "openlibm")
26f6e565 2765 (version "0.5.1")
e1605e36
RW
2766 (source
2767 (origin
2768 (method url-fetch)
2769 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
2770 version ".tar.gz"))
2771 (file-name (string-append name "-" version ".tar.gz"))
2772 (sha256
2773 (base32
26f6e565 2774 "11czx2z7nh6dfpz45s3xl7v38hw36jxzxfvny454bk3if14pfakq"))))
e1605e36
RW
2775 (build-system gnu-build-system)
2776 (arguments
2777 `(#:make-flags
2778 (list (string-append "prefix=" (assoc-ref %outputs "out")))
2779 #:phases
2780 ;; no configure script
dc1d3cde 2781 (modify-phases %standard-phases (delete 'configure))
e1605e36
RW
2782 #:tests? #f)) ;the tests are part of the default target
2783 (home-page "http://openlibm.org/")
2784 (synopsis "Portable C mathematical library (libm)")
2785 (description
2786 "OpenLibm is an effort to have a high quality, portable, standalone C
2787mathematical library (libm). It can be used standalone in applications and
2788programming language implementations. The project was born out of a need to
e881752c 2789have a good libm for the Julia programming language that worked consistently
e1605e36
RW
2790across compilers and operating systems, and in 32-bit and 64-bit
2791environments.")
538c0e3b
EF
2792 ;; Each architecture has its own make target, and there is none for mips.
2793 (supported-systems (delete "mips64el-linux" %supported-systems))
e1605e36
RW
2794 ;; See LICENSE.md for details.
2795 (license (list license:expat
2796 license:isc
2797 license:bsd-2
2798 license:public-domain
2799 license:lgpl2.1+))))
2800
e62be58f
RW
2801(define-public openspecfun
2802 (package
2803 (name "openspecfun")
49f54a74 2804 (version "0.5.2")
e62be58f
RW
2805 (source
2806 (origin
2807 (method url-fetch)
2808 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
2809 version ".tar.gz"))
2810 (file-name (string-append name "-" version ".tar.gz"))
2811 (sha256
2812 (base32
49f54a74 2813 "1y5b2h6f2k72536kym3vzy3li3bhpd23x463g7hdmjdi3cncavz1"))))
e62be58f
RW
2814 (build-system gnu-build-system)
2815 (arguments
2816 '(#:tests? #f ;no "check" target
2817 #:make-flags
2818 (list (string-append "prefix=" (assoc-ref %outputs "out")))
2819 ;; no configure script
dc1d3cde 2820 #:phases (modify-phases %standard-phases (delete 'configure))))
e62be58f 2821 (inputs
19afbea1 2822 `(("fortran" ,gfortran)))
e62be58f
RW
2823 (home-page "https://github.com/JuliaLang/openspecfun")
2824 (synopsis "Collection of special mathematical functions")
2825 (description
2826 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
2827portable package for Bessel Functions of a Complex Argument and Nonnegative
2828Order; it contains subroutines for computing Bessel functions and Airy
2829functions. Faddeeva allows computing the various error functions of arbitrary
2830complex arguments (Faddeeva function, error function, complementary error
2831function, scaled complementary error function, imaginary error function, and
2832Dawson function); given these, one can also easily compute Voigt functions,
2833Fresnel integrals, and similar related functions as well.")
2834 ;; Faddeeva is released under the Expat license; AMOS is included as
2835 ;; public domain software.
2836 (license (list license:expat license:public-domain))))
2837
2742f87e
RW
2838(define-public suitesparse
2839 (package
2840 (name "suitesparse")
bd5b5ac0 2841 (version "4.5.5")
2742f87e
RW
2842 (source
2843 (origin
2844 (method url-fetch)
2845 (uri (string-append
2846 "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-"
2847 version ".tar.gz"))
2848 (sha256
2849 (base32
bd5b5ac0
EB
2850 "1dnr6pmjzc2qmbkmb4shigx1l74ilf6abn7svyd6brxgvph8vadr"))
2851 (modules '((guix build utils)))
2852 (snippet
2853 ;; Remove bundled metis source
2854 '(delete-file-recursively "metis-5.1.0"))))
2742f87e
RW
2855 (build-system gnu-build-system)
2856 (arguments
bd5b5ac0 2857 '(#:tests? #f ;no "check" target
2742f87e
RW
2858 #:make-flags
2859 (list "CC=gcc"
2860 "BLAS=-lblas"
2861 "TBB=-ltbb"
bd5b5ac0 2862 "MY_METIS_LIB=-lmetis"
2742f87e
RW
2863 (string-append "INSTALL_LIB="
2864 (assoc-ref %outputs "out") "/lib")
2865 (string-append "INSTALL_INCLUDE="
bd5b5ac0
EB
2866 (assoc-ref %outputs "out") "/include")
2867 "library")
2742f87e 2868 #:phases
2509522c 2869 (modify-phases %standard-phases
bd5b5ac0 2870 (delete 'configure)))) ;no configure script
2742f87e
RW
2871 (inputs
2872 `(("tbb" ,tbb)
bd5b5ac0
EB
2873 ("lapack" ,lapack)
2874 ("metis" ,metis)))
2742f87e
RW
2875 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
2876 (synopsis "Suite of sparse matrix software")
2877 (description
2878 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
2879multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
2880multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
2881simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
2882CXSparse, a concise sparse Cholesky factorization package; and many other
2883packages.")
2884 ;; LGPLv2.1+:
2885 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
2886 ;; GPLv2+:
2887 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
2888 (license (list license:gpl2+ license:lgpl2.1+))))
2889
ec322be2
FB
2890(define-public atlas
2891 (package
2892 (name "atlas")
3c98ac02 2893 (version "3.10.3")
ec322be2
FB
2894 (source (origin
2895 (method url-fetch)
de67e922
LF
2896 (uri (string-append "mirror://sourceforge/math-atlas/Stable/"
2897 version "/atlas" version ".tar.bz2"))
ec322be2
FB
2898 (sha256
2899 (base32
3c98ac02 2900 "1dyjlq3fiparvm8ypwk6rsmjzmnwk81l88gkishphpvc79ryp216"))))
ec322be2
FB
2901 (build-system gnu-build-system)
2902 (home-page "http://math-atlas.sourceforge.net/")
19afbea1 2903 (inputs `(("gfortran" ,gfortran)
ec322be2
FB
2904 ("lapack-tar" ,(package-source lapack))))
2905 (outputs '("out" "doc"))
01480b9e
FB
2906 ;; For the moment we drop support for MIPS at it fails to compile. See
2907 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
2908 (supported-systems (delete "mips64el-linux" %supported-systems))
ec322be2
FB
2909 (arguments
2910 `(#:parallel-build? #f
2911 #:parallel-tests? #f
f15615b1
LC
2912
2913 ;; ATLAS tunes itself for the machine it is built on, as explained at
2914 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
2915 ;; For this reason, we want users to build it locally instead of using
2916 ;; substitutes.
2917 #:substitutable? #f
2918
ec322be2
FB
2919 #:modules ((srfi srfi-26)
2920 (srfi srfi-1)
2921 (guix build gnu-build-system)
2922 (guix build utils))
40029cbe 2923 #:configure-flags
ec322be2
FB
2924 `(;; Generate position independent code suitable for dynamic libraries
2925 ;; and use WALL timer to get more accurate timing.
2926 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
2927 ;; Set word width.
2928 "-b"
2929 ,,(if (string-match "64" (%current-system))
2930 "64"
2931 "32")
2932 ;; Disable parallel build as it gives errors: atlas_pthread.h is
2933 ;; needed to compile C files before it is generated.
2934 "-Ss" "pmake" "make -j 1"
af89a667
FB
2935 ;; Probe is failing for MIPS. We therefore define the system
2936 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
2937 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
2938 ,,@(if (string-prefix? "mips" (%current-system))
2939 (list "-A" "49" "-V" "1")
2940 (list))
ec322be2
FB
2941 ;; Generate shared libraries.
2942 "--shared"
2943 ;; Build a full LAPACK library.
2944 ,(string-append "--with-netlib-lapack-tarfile="
2945 (assoc-ref %build-inputs "lapack-tar")))
2946 #:phases
e5b4b96b
EF
2947 (modify-phases %standard-phases
2948 (add-after 'install 'install-doc
2949 (lambda* (#:key outputs inputs #:allow-other-keys)
2950 (let ((doc (string-append (assoc-ref outputs "doc")
2951 "/share/doc/atlas")))
2952 (mkdir-p doc)
2953 (fold (lambda (file previous)
2954 (and previous (zero? (system* "cp" file doc))))
2955 #t (find-files "../ATLAS/doc" ".*")))))
2956 (add-after 'check 'check-pt
2957 (lambda _ (zero? (system* "make" "ptcheck"))))
2958 ;; Fix files required to run configure.
2959 (add-before 'configure 'fix-/bin/sh
ec322be2
FB
2960 (lambda _
2961 ;; Use `sh', not `/bin/sh'.
2962 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
2963 (("/bin/sh")
e5b4b96b
EF
2964 "sh"))))
2965 ;; Fix /bin/sh in generated make files.
2966 (add-after 'configure 'fix-/bin/sh-in-generated-files
2967 (lambda _
2968 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
2969 (("/bin/sh")
2970 "sh"))))
2971 ;; ATLAS configure program does not accepts the default flags
2972 ;; passed by the 'gnu-build-system'.
2973 (replace 'configure
2974 (lambda* (#:key native-inputs inputs outputs
2975 (configure-flags '())
2976 #:allow-other-keys #:rest args)
2977 (let* ((prefix (assoc-ref outputs "out"))
2978 (bash (or (and=> (assoc-ref
2979 (or native-inputs inputs) "bash")
2980 (cut string-append <> "/bin/bash"))
2981 "/bin/sh"))
2982 (flags `(,(string-append "--prefix=" prefix)
2983 ,@configure-flags))
2984 (abs-srcdir (getcwd))
2985 (srcdir (string-append "../" (basename abs-srcdir))))
2986 (format #t "source directory: ~s (relative from build: ~s)~%"
2987 abs-srcdir srcdir)
2988 (mkdir "../build")
2989 (chdir "../build")
2990 (format #t "build directory: ~s~%" (getcwd))
2991 (format #t "configure flags: ~s~%" flags)
2992 (zero? (apply system* bash
2993 (string-append srcdir "/configure")
2994 flags))))))))
ec322be2
FB
2995 (synopsis "Automatically Tuned Linear Algebra Software")
2996 (description
2997 "ATLAS is an automatically tuned linear algebra software library
2998providing C and Fortran77 interfaces to a portably efficient BLAS
2999implementation, as well as a few routines from LAPACK.
3000
f15615b1
LC
3001Optimization occurs at build time. For this reason, the library is built on
3002the machine where it is installed, without resorting to pre-built substitutes.
ec322be2 3003
f15615b1 3004Before building the library, CPU throttling should be disabled. This can be
d97c429a 3005done in the BIOS, or, on GNU/Linux, with the following command:
ec322be2 3006
8e9ba611 3007@example
d97c429a 3008# cpupower --governor performance
8e9ba611 3009@end example
ec322be2 3010
d97c429a 3011Failure to do so will result in a library with poor performance.")
ec322be2 3012 (license license:bsd-3)))
c12efc72
AE
3013
3014(define-public glm
3015 (package
3016 (name "glm")
3017 (version "0.9.6.3")
3018 (source
3019 (origin
3020 (method url-fetch)
de67e922
LF
3021 (uri (string-append "mirror://sourceforge/ogl-math/glm-" version
3022 "/glm-" version ".zip"))
c12efc72
AE
3023 (sha256
3024 (base32
3025 "1cnjmi033a16a95v6xfkr1bvfmkd26hzdjka8j1819hgn5b1nr8l"))))
3026 (build-system cmake-build-system)
3027 (native-inputs
3028 `(("unzip" ,unzip)))
3029 (home-page "http://glm.g-truc.net")
3030 (synopsis "OpenGL Mathematics library")
3031 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
3032library for graphics software based on the OpenGL Shading Language (GLSL)
3033specifications.")
3034 (license license:expat)))
7f18257b
AE
3035
3036(define-public lpsolve
3037 (package
3038 (name "lpsolve")
3039 (version "5.5.2.0")
3040 (source
3041 (origin
3042 (method url-fetch)
3043 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
3044 "/lp_solve_" version "_source.tar.gz"))
3045 (sha256
3046 (base32
3047 "176c7f023mb6b8bfmv4rfqnrlw88lsg422ca74zjh19i2h5s69sq"))
3048 (modules '((guix build utils)))
3049 (snippet
3050 '(substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
3051 (("^c=cc") "c=gcc")
3052 ;; Pretend to be on a 64 bit platform to obtain a common directory
3053 ;; name for the build results on all architectures; nothing else
3054 ;; seems to depend on it.
5dbfbef7
LC
3055 (("^PLATFORM=.*$") "PLATFORM=ux64\n")
3056
3057 ;; The check for 'isnan' as it is written fails with
3058 ;; "non-floating-point argument in call to function
3059 ;; ‘__builtin_isnan’", which leads to the 'NOISNAN' cpp macro
3060 ;; definition, which in turn leads to bad things. Fix the feature
3061 ;; test.
3062 (("isnan\\(0\\)") "isnan(0.)")))))
7f18257b
AE
3063 (build-system gnu-build-system)
3064 (arguments
3065 `(#:tests? #f ; no check target
3066 #:phases
3067 (modify-phases %standard-phases
3068 (delete 'configure)
3069 (replace 'build
3070 (lambda _
6689d094
LC
3071 (and (with-directory-excursion "lpsolve55"
3072 (zero? (system* "bash" "ccc")))
3073 (with-directory-excursion "lp_solve"
3074 (zero? (system* "bash" "ccc"))))))
7f18257b
AE
3075 (replace 'install
3076 (lambda* (#:key outputs #:allow-other-keys)
3077 (let* ((out (assoc-ref outputs "out"))
3078 (bin (string-append out "/bin"))
3079 (lib (string-append out "/lib"))
3080 ;; This is where LibreOffice expects to find the header
3081 ;; files, and where they are installed by Debian.
3082 (include (string-append out "/include/lpsolve")))
3083 (mkdir-p lib)
3084 (copy-file "lpsolve55/bin/ux64/liblpsolve55.a"
3085 (string-append lib "/liblpsolve55.a"))
3086 (copy-file "lpsolve55/bin/ux64/liblpsolve55.so"
3087 (string-append lib "/liblpsolve55.so"))
96c46210
LC
3088 (install-file "lp_solve/bin/ux64/lp_solve" bin)
3089
7f18257b
AE
3090 ;; Install a subset of the header files as on Debian
3091 ;; (plus lp_bit.h, which matches the regular expression).
96c46210
LC
3092 (for-each (lambda (name)
3093 (install-file name include))
3094 (find-files "." "lp_[HMSa-z].*\\.h$"))
7f18257b 3095 (with-directory-excursion "shared"
96c46210
LC
3096 (for-each (lambda (name)
3097 (install-file name include))
3098 (find-files "." "\\.h$")))
7f18257b
AE
3099 #t))))))
3100 (home-page "http://lpsolve.sourceforge.net/")
3101 (synopsis "Mixed integer linear programming (MILP) solver")
3102 (description
3103 "lp_solve is a mixed integer linear programming solver based on the
3104revised simplex and the branch-and-bound methods.")
3105 (license license:lgpl2.1+)))
a17d4564
EB
3106
3107(define-public dealii
3108 (package
3109 (name "dealii")
24404eaf 3110 (version "8.5.1")
a17d4564
EB
3111 (source
3112 (origin
3113 (method url-fetch)
3114 (uri (string-append "https://github.com/dealii/dealii/releases/"
3115 "download/v" version "/dealii-" version ".tar.gz"))
3116 (sha256
3117 (base32
24404eaf 3118 "1bh9rsmkrg0zi70n27b11djmac9lximghsiy7mg7w7x544n82gnk"))
a17d4564
EB
3119 (modules '((guix build utils)))
3120 (snippet
3121 ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
3122 '(delete-file-recursively "bundled"))))
3123 (build-system cmake-build-system)
3124 (inputs
3125 `(("tbb" ,tbb)
3126 ("zlib" ,zlib)
3127 ("boost" ,boost)
3128 ("p4est" ,p4est)
3129 ("blas" ,openblas)
3130 ("lapack" ,lapack)
3131 ("arpack" ,arpack-ng)
3132 ("muparser" ,muparser)
3133 ("gfortran" ,gfortran)
3134 ("suitesparse" ,suitesparse))) ;for UMFPACK
3135 (arguments
3136 `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease
d84b09e9
EB
3137 #:configure-flags
3138 ;; Work around a bug in libsuitesparseconfig linking
3139 ;; see https://github.com/dealii/dealii/issues/4745
3140 '("-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON")))
a17d4564
EB
3141 (home-page "https://www.dealii.org")
3142 (synopsis "Finite element library")
3143 (description
3144 "Deal.II is a C++ program library targeted at the computational solution
3145of partial differential equations using adaptive finite elements. The main
3146aim of deal.II is to enable rapid development of modern finite element codes,
3147using among other aspects adaptive meshes and a wide array of tools often used
3148in finite element programs.")
3149 (license license:lgpl2.1+)))
3150
3151(define-public dealii-openmpi
3152 (package (inherit dealii)
3153 (name "dealii-openmpi")
3154 (inputs
3155 `(("mpi" ,openmpi)
3156 ;;Supported only with MPI:
3157 ("p4est" ,p4est-openmpi)
3158 ("petsc" ,petsc-openmpi)
3159 ("slepc" ,slepc-openmpi)
3160 ("metis" ,metis) ;for MUMPS
3161 ("scalapack" ,scalapack) ;for MUMPS
3162 ("mumps" ,mumps-metis-openmpi) ;configure supports only metis orderings
3163 ("arpack" ,arpack-ng-openmpi)
3164 ,@(fold alist-delete (package-inputs dealii)
3165 '("p4est" "arpack"))))
3166 (arguments
3167 (substitute-keyword-arguments (package-arguments dealii)
3168 ((#:configure-flags cf)
3169 ``("-DMPI_C_COMPILER=mpicc"
3170 "-DMPI_CXX_COMPILER=mpicxx"
3171 "-DMPI_Fortran_COMPILER=mpifort"
3172 ,@,cf))))
3173 (synopsis "Finite element library (with MPI support)")))
194c7f95
AE
3174
3175(define-public flann
3176 (package
3177 (name "flann")
3178 (version "1.8.4")
3179 (source
3180 (origin
3181 (method url-fetch)
3182 (uri
3183 (string-append
3184 "http://www.cs.ubc.ca/research/flann/uploads/FLANN/flann-"
3185 version "-src.zip"))
3186 (sha256
3187 (base32
3188 "022w8hph7bli5zbpnk3z1qh1c2sl5hm8fw2ccim651ynn0hr7fyz"))))
3189 (build-system cmake-build-system)
6b6aca9b
LC
3190 (outputs '("out"
3191 "octave")) ;46 MiB .mex file that pulls Octave
194c7f95
AE
3192 (native-inputs
3193 `(("unzip" ,unzip)))
3194 (inputs
3195 `(("hdf5" ,hdf5)
3196 ("octave" ,octave)
3197 ("python" ,python-2) ; print syntax
3198 ;; ("python2-numpy" ,python2-numpy) ; only required for the tests
3199 ("zlib" ,zlib)))
3200 (arguments
39b30337
LC
3201 `(;; The 'share/flann/octave' contains a .mex file, which is an ELF file
3202 ;; taken 46 MiB unstripped, and 6 MiB stripped.
3203 #:strip-directories '("lib" "lib64" "libexec"
3204 "bin" "sbin" "share/flann/octave")
3205
9684e30b
LC
3206 ;; Save 12 MiB by not installing .a files. Passing
3207 ;; '-DBUILD_STATIC_LIBS=OFF' has no effect.
3208 #:phases (modify-phases %standard-phases
6b6aca9b
LC
3209 (add-before 'configure 'set-octave-directory
3210 (lambda* (#:key outputs #:allow-other-keys)
3211 ;; Install the .mex file in the "octave" output.
3212 (let ((out (assoc-ref outputs "octave")))
3213 (substitute* "src/matlab/CMakeLists.txt"
3214 (("share/flann/octave")
3215 (string-append out "/share/flann/octave")))
3216 #t)))
9684e30b
LC
3217 (add-after 'install 'remove-static-libraries
3218 (lambda* (#:key outputs #:allow-other-keys)
3219 (let* ((out (assoc-ref outputs "out"))
3220 (lib (string-append out "/lib")))
3221 (for-each delete-file
3222 (find-files lib "\\.a$"))
3223 #t))))
3224
39b30337 3225 #:tests? #f)) ; The test data are downloaded from the Internet.
194c7f95
AE
3226 (home-page "http://www.cs.ubc.ca/research/flann/")
3227 (synopsis "Library for approximate nearest neighbors computation")
3228 (description "FLANN is a library for performing fast approximate
3229nearest neighbor searches in high dimensional spaces. It implements a
3230collection of algorithms and a system for automatically choosing the best
3231algorithm and optimum parameters depending on the dataset.
3232
3233FLANN is written in C++ and contains bindings for C, Octave and Python.")
3234 (license (license:non-copyleft "file://COPYING"
3235 "See COPYING in the distribution."))))
d8c97beb
EF
3236
3237(define-public wcalc
3238 (package
3239 (name "wcalc")
3240 (version "2.5")
3241 (source
3242 (origin
3243 (method url-fetch)
de67e922
LF
3244 (uri (string-append "mirror://sourceforge/w-calc/Wcalc/" version "/"
3245 "wcalc-" version ".tar.bz2"))
d8c97beb
EF
3246 (sha256
3247 (base32
3248 "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
3249 (build-system gnu-build-system)
3250 (inputs
3251 `(("mpfr" ,mpfr)
3252 ("readline" ,readline)))
3253 (home-page "http://w-calc.sourceforge.net/index.php")
3254 (synopsis "Flexible command-line scientific calculator")
3255 (description "Wcalc is a very capable calculator. It has standard functions
3256(sin, asin, and sinh for example, in either radians or degrees), many
3257pre-defined constants (pi, e, c, etc.), support for using variables, \"active\"
3258variables, a command history, hex/octal/binary input and output, unit
3259conversions, embedded comments, and an expandable expression entry field. It
3260evaluates expressions using the standard order of operations.")
3261 (license license:gpl2+)))
45147b0c
FH
3262
3263(define-public xaos
3264 (package
3265 (name "xaos")
3266 (version "3.6")
3267 (source (origin
3268 (method url-fetch)
de67e922
LF
3269 (uri (string-append "mirror://sourceforge/xaos/XaoS/" version
3270 "/xaos-" version ".tar.gz"))
45147b0c
FH
3271 (sha256
3272 (base32
3273 "15cd1cx1dyygw6g2nhjqq3bsfdj8sj8m4va9n75i0f3ryww3x7wq"))))
3274 (build-system gnu-build-system)
b94a6ca0 3275 (native-inputs `(("gettext" ,gettext-minimal)))
45147b0c
FH
3276 (inputs `(("libx11" ,libx11)
3277 ("zlib" ,zlib)
3278 ("libpng" ,libpng)
3279 ("gsl" ,gsl)))
3280 (arguments
3281 `(#:tests? #f ;no "check" target
3282 #:make-flags '("LOCALEDIR=$DATAROOTDIR/locale")))
3283 (synopsis "Real-time fractal zoomer")
3284 (description "GNU XaoS is a graphical program that generates fractal
3285patterns and allows you to zoom in and out of them infinitely in a fluid,
3286continuous manner. It also includes tutorials that help to explain how fractals
3287are built. It can generate many different fractal types such as the Mandelbrot
3288set.")
6fd52309 3289 (home-page "https://www.gnu.org/software/xaos/")
45147b0c 3290 (license license:gpl2+)))
528bb464
EB
3291
3292(define-public hypre
3293 (package
3294 (name "hypre")
3295 (version "2.11.0")
3296 (source (origin
3297 (method url-fetch)
3298 (uri (string-append "https://github.com/LLNL/hypre/archive/"
3299 "v" version ".tar.gz"))
3300 (file-name (string-append name "-" version ".tar.gz"))
3301 (sha256
3302 (base32
3303 "0q69ia0jivzcr8p049dn3mg8yjpn6nwq4sw9iqac8vr63vi54l6m"))
3304 (modules '((guix build utils)))
3305 (snippet
3306 '(begin
3307 ;; Remove use of __DATE__ and __TIME__ for reproducibility;
3308 ;; substitute the tarball creation time.
3309 (substitute* "src/utilities/HYPRE_utilities.h"
3310 (("Date Compiled: .*$")
3311 "Date Compiled: Mar 28 2016 20:19:59 +0000\"\n"))
3312 #t))))
3313 (build-system gnu-build-system)
3314 (outputs '("out" ;6.1 MiB of headers and libraries
3315 "doc")) ;4.8 MiB of documentation
3316 (native-inputs
3317 `(("doc++" ,doc++)
3318 ("netpbm" ,netpbm)
3319 ("texlive" ,texlive) ;full package required for fonts
3320 ("ghostscript" ,ghostscript)))
3321 (inputs
3322 `(("blas" ,openblas)
3323 ("lapack" ,lapack)))
3324 (arguments
3325 `(#:modules ((srfi srfi-1)
3326 ,@%gnu-build-system-modules)
3327 #:configure-flags '("--enable-shared"
3328 "--disable-fortran"
3329 "--without-MPI"
3330 "--with-openmp"
3331 "--with-fei"
3332 "--with-lapack"
3333 "--with-blas")
3334 #:phases
3335 (modify-phases %standard-phases
3336 (add-before 'configure 'chdir-src
3337 (lambda _ (chdir "src")))
3338 (replace 'configure
3339 (lambda* (#:key build target configure-flags
3340 #:allow-other-keys #:rest args)
3341 (let* ((configure (assoc-ref %standard-phases 'configure)))
3342 (apply configure
3343 (append args
3344 (list #:configure-flags
3345 (cons (string-append
3346 "--host=" (or target build))
3347 configure-flags)))))))
3348 (add-after 'build 'build-docs
3349 (lambda _
3350 (zero? (system* "make" "-Cdocs" "pdf" "html"))))
3351 (replace 'check
3352 (lambda _
3353 (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/hypre/lib"))
3354 (setenv "PATH" (string-append "." ":" (getenv "PATH")))
3355 (and (system* "make" "check" "CHECKRUN=")
3356 (fold (lambda (filename result)
3357 (and result
3358 (let ((size (stat:size (stat filename))))
3359 (when (not (zero? size))
3360 (format #t "~a size ~d; error indication~%"
3361 filename size))
3362 (zero? size))))
3363 #t
3364 (find-files "test" ".*\\.err$")))))
3365 (add-after 'install 'install-docs
3366 (lambda* (#:key outputs #:allow-other-keys)
3367 ;; Custom install because docs/Makefile doesn't honor ${docdir}.
3368 (let* ((doc (assoc-ref outputs "doc"))
3369 (docdir (string-append doc "/share/doc/hypre-" ,version)))
528bb464
EB
3370 (with-directory-excursion "docs"
3371 (for-each (lambda (base)
3372 (install-file (string-append base ".pdf") docdir)
3373 (copy-recursively base docdir)) ;html docs
3374 '("HYPRE_usr_manual"
3375 "HYPRE_ref_manual")))
3376 #t))))))
3377 (home-page "http://www.llnl.gov/casc/hypre/")
3378 (synopsis "Library of solvers and preconditioners for linear equations")
3379 (description
3380 "HYPRE is a software library of high performance preconditioners and
3381solvers for the solution of large, sparse linear systems of equations. It
3382features multigrid solvers for both structured and unstructured grid
3383problems.")
3384 (license license:lgpl2.1)))
3385
3386(define-public hypre-openmpi
3387 (package (inherit hypre)
3388 (name "hypre-openmpi")
3389 (inputs
3390 `(("mpi" ,openmpi)
3391 ,@(package-inputs hypre)))
3392 (arguments
3393 (substitute-keyword-arguments (package-arguments hypre)
3394 ((#:configure-flags flags)
3395 ``("--with-MPI"
3396 ,@(delete "--without-MPI" ,flags)))))
3397 (synopsis "Parallel solvers and preconditioners for linear equations")
3398 (description
3399 "HYPRE is a software library of high performance preconditioners and
3400solvers for the solution of large, sparse linear systems of equations on
3401parallel computers. It features parallel multigrid solvers for both
3402structured and unstructured grid problems.")))
6c90e183
EB
3403
3404(define-public matio
3405 (package
3406 (name "matio")
3407 (version "1.5.6")
3408 (source
3409 (origin
3410 (method url-fetch)
de67e922 3411 (uri (string-append "mirror://sourceforge/matio/matio/" version "/"
6c90e183
EB
3412 "matio-" version ".tar.gz"))
3413 (sha256
3414 (base32
3415 "0y2qymgxank8wdiwc68ap8bxdzrhvyw86i29yh3xgn4z1njfd9ir"))))
3416 (build-system gnu-build-system)
3417 (inputs
3418 `(("zlib" ,zlib)
3419 ("hdf5" ,hdf5)))
3420 (home-page "http://matio.sourceforge.net/")
3421 (synopsis "Library for reading and writing MAT files")
3422 (description "Matio is a library for reading and writing MAT files. It
3423supports compressed MAT files, as well as newer (version 7.3) MAT files.")
3424 (license license:bsd-2)))
d721c83a 3425
517318ad
LF
3426(define-public vc
3427 (package
3428 (name "vc")
3429 (version "1.2.0")
3430 (source
3431 (origin (method url-fetch)
3432 (uri (string-append "https://github.com/VcDevel/Vc/releases/"
3433 "download/" version "/Vc-" version ".tar.gz"))
3434 (sha256
3435 (base32
3436 "1rh6dhqar3y07n4xqyml0sa0v48qv3ch9dc3yc2in855hlh4vnqi"))))
3437 (build-system cmake-build-system)
3438 (arguments
3439 '(#:configure-flags
3440 '("-DBUILD_TESTING=ON")))
3441 (synopsis "SIMD vector classes for C++")
3442 (description "Vc provides portable, zero-overhead C++ types for explicitly
3443data-parallel programming. It is a library designed to ease explicit
3444vectorization of C++ code. Its types enable explicitly stating data-parallel
3445operations on multiple values. The parallelism is therefore added via the type
3446system. Vc has an intuitive API and provides portability between different
3447compilers and compiler versions as well as portability between different vector
3448instruction sets. Thus, an application written with Vc can be compiled for:
3449@enumerate
3450@item AVX and AVX2
d1e4ad1b 3451@item SSE2 up to SSE4.2 or SSE4a
517318ad
LF
3452@item Scalar
3453@item MIC
3454@item NEON (in development)
3455@item NVIDIA GPUs / CUDA (in development)
3456@end enumerate\n")
3457 (home-page "https://github.com/VcDevel/Vc")
a8ead6f9
EF
3458 ;; "No support_???.cpp file exists for this architecture."
3459 (supported-systems '("x86_64-linux" "i686-linux"))
517318ad 3460 (license license:bsd-3)))
54052a54 3461
3462(define-public reducelcs
3463 ;; This is the last commit which is available upstream, no
3464 ;; release happened since 2010.
3465 (let ((commit "474f88deb968061abe8cf11c959e02319b8ae5c0")
3466 (revision "1"))
3467 (package
3468 (name "reducelcs")
3469 (version (string-append "1.0-" revision "." (string-take commit 7)))
3470 (source
3471 (origin
3472 (method git-fetch)
3473 (uri (git-reference
3474 (url "https://github.com/gdv/Reduce-Expand-for-LCS")
3475 (commit commit)))
3476 (file-name (string-append name "-" version "-checkout"))
3477 (sha256
3478 (base32
3479 "1rllzcfwc042c336mhq262a8ha90x6afq30kvk60r7i4761j4yjm"))))
3480 (build-system gnu-build-system)
3481 (inputs
3482 `(("openlibm" ,openlibm)))
3483 (arguments
3484 `(#:tests? #f ; no tests
3485 #:phases
3486 (modify-phases %standard-phases
3487 (delete 'configure) ; No configure script exists.
3488 (replace 'install ; No install phase exists.
3489 (lambda* (#:key outputs #:allow-other-keys)
3490 (let* ((out (assoc-ref outputs "out"))
3491 (bin (string-append out "/bin")))
3492 (install-file "Approximation" bin)
3493 (install-file "CollectResults" bin)
3494 (install-file "GenerateInstances" bin)
3495 #t))))))
3496 (synopsis "Approximate Longest Commons Subsequence computation tool")
3497 (description
3498 "@code{reduceLCS} is an implementation of the Reduce-Expand
3499algorithm for LCS. It is a fast program to compute the approximate
3500Longest Commons Subsequence of a set of strings.")
3501 (home-page "https://github.com/gdv/Reduce-Expand-for-LCS")
c000b6b1 3502 (license license:gpl3+))))
479c4273
JD
3503
3504(define-public jacal
3505 (package
3506 (name "jacal")
3507 (version "1c4")
3508 (source (origin
3509 (method url-fetch)
3510 (uri (string-append
3511 "http://groups.csail.mit.edu/mac/ftpdir/scm/jacal-"
3512 version ".zip"))
3513 (sha256 (base32
3514 "055zrn12a1dmy0dqkwrkq3fklbhg3yir6vn0lacp4mvbg8573a3q"))
3515 (patches (search-patches "jacal-fix-texinfo.patch"))))
3516 (build-system gnu-build-system)
3517 (arguments
3518 `(#:phases
3519 (modify-phases %standard-phases
3520 (add-before 'build 'pre-build
3521 ;; Don't use upstream's script - it really doesn't fit into
3522 ;; Guix's functional paradigm.
3523 (lambda* (#:key inputs outputs #:allow-other-keys)
3524 (substitute* "Makefile"
3525 (("^install: install-script") "install: "))))
3526 (add-after 'install 'post-install
3527 ;; Instead, we provide our own simplified script.
3528 (lambda* (#:key inputs outputs #:allow-other-keys)
3529 (let ((wrapper (string-append (assoc-ref outputs "out")
3530 "/bin/jacal")))
3531 (format (open wrapper (logior O_WRONLY O_CREAT))
3532 (string-append "#!~a\nexec ~a/bin/scm -ip1 "
3533 "-e '(slib:load \"~a/lib/jacal/math\") "
3534 "(math)' \"$@\"\n")
3535 (which "bash")
3536 (assoc-ref inputs "scm")
3537 (assoc-ref outputs "out"))
3538 (chmod wrapper #o555))))
3539 (replace 'configure
3540 (lambda* (#:key inputs outputs #:allow-other-keys)
3541 (zero? (system* "./configure"
3542 (string-append "--prefix="
3543 (assoc-ref outputs "out")))))))))
3544 (inputs `(("scm" ,scm)))
3545 (native-inputs `(("unzip" ,unzip)
3546 ("texinfo" ,texinfo)))
3547 (synopsis "Symbolic mathematics system")
3548 (description "GNU JACAL is an interactive symbolic mathematics program based on
3549Scheme. It manipulate and simplify a range of mathematical expressions such
3550as equations, scalars, vectors, and matrices.")
6fd52309 3551 (home-page "https://www.gnu.org/software/jacal/")
479c4273
JD
3552 (license license:gpl3+)))
3553
313844d9
TF
3554(define-public z3
3555 (package
3556 (name "z3")
3557 (version "4.5.0")
3558 (source (origin
3559 (method url-fetch)
3560 (uri (string-append
3561 "https://github.com/Z3Prover/z3/archive/z3-"
3562 version ".tar.gz"))
3563 (sha256
3564 (base32
3565 "032a5lvji2liwmc25jv52bdrhimqflvqbpg77ccaq1jykhiivbmf"))))
cf684d87 3566 (build-system cmake-build-system)
313844d9 3567 (arguments
cf684d87
TF
3568 `(#:configure-flags
3569 (list "-DBUILD_PYTHON_BINDINGS=true"
3570 "-DINSTALL_PYTHON_BINDINGS=true"
3571 (string-append "-DCMAKE_INSTALL_PYTHON_PKG_DIR="
3572 %output
3573 "/lib/python2.7/site-packages")
3574 (string-append "-DCMAKE_INSTALL_LIBDIR="
3575 %output
3576 "/lib"))
3577
313844d9
TF
3578 #:phases
3579 (modify-phases %standard-phases
cf684d87
TF
3580 (add-before 'configure 'bootstrap
3581 (lambda _
313844d9 3582 (zero?
cf684d87
TF
3583 (system* "python" "contrib/cmake/bootstrap.py" "create"))))
3584 (add-before 'check 'make-test-z3
313844d9 3585 (lambda _
cf684d87
TF
3586 ;; Build the test suite executable.
3587 (zero? (system* "make" "test-z3" "-j"
3588 (number->string (parallel-job-count))))))
3589 (replace 'check
3590 (lambda _
3591 ;; Run all the tests that don't require arguments.
3592 (zero? (system* "./test-z3" "/a")))))))
313844d9
TF
3593 (native-inputs
3594 `(("python" ,python-2)))
3595 (synopsis "Theorem prover")
3596 (description "Z3 is a theorem prover and @dfn{satisfiability modulo
cf684d87 3597theories} (SMT) solver. It provides a C/C++ API, as well as Python bindings.")
313844d9
TF
3598 (home-page "https://github.com/Z3Prover/z3")
3599 (license license:expat)))
3d5d87a3
JL
3600
3601(define-public cubicle
3602 (package
3603 (name "cubicle")
3604 (version "1.1.1")
3605 (source (origin
3606 (method url-fetch)
3607 (uri (string-append "http://cubicle.lri.fr/cubicle-"
3608 version ".tar.gz"))
3609 (sha256
3610 (base32
3611 "1sny9c4fm14k014pk62ibpwbrjjirkx8xmhs9jg7q1hk7y7x3q2h"))))
3612 (build-system gnu-build-system)
3613 (native-inputs
3614 `(("ocaml" ,ocaml)
83fef82b 3615 ("which" ,(@@ (gnu packages base) which))))
3d5d87a3
JL
3616 (propagated-inputs
3617 `(("z3" ,z3)))
3618 (arguments
3619 `(#:configure-flags (list "--with-z3")
3620 #:tests? #f
3621 #:phases
3622 (modify-phases %standard-phases
3623 (add-before 'configure 'configure-for-release
3624 (lambda _
3625 (substitute* "Makefile.in"
3626 (("SVNREV=") "#SVNREV="))))
3627 (add-before 'configure 'fix-/bin/sh
3628 (lambda _
3629 (substitute* "configure"
3630 (("/bin/sh") (which "sh")))))
3631 (add-before 'configure 'fix-smt-z3wrapper.ml
3632 (lambda _
3633 (substitute* "Makefile.in"
3634 (("\\\\n") "")))))))
3635 (home-page "http://cubicle.lri.fr/")
3636 (synopsis "Model checker for array-based systems")
5a80c15c
RW
3637 (description "Cubicle is a model checker for verifying safety properties
3638of array-based systems. This is a syntactically restricted class of
3639parametrized transition systems with states represented as arrays indexed by
3640an arbitrary number of processes. Cache coherence protocols and mutual
3641exclusion algorithms are typical examples of such systems.")
3d5d87a3 3642 (license license:asl2.0)))