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