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