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