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