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