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