guix hash: Interpret '-' as standard input.
[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 John Darrington <jmd@gnu.org>
5 ;;; Copyright © 2014, 2015, 2016 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 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 Efraim Flashner <efraim@flashner.co.il>
12 ;;; Copyright © 2015 Fabian Harfert <fhmgufs@web.de>
13 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
14 ;;; Copyright © 2016 Kei Kebreau <kei@openmailbox.org>
15 ;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
16 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
17 ;;; Copyright © 2016 Thomas Danckaert <post@thomasdanckaert.be>
18 ;;;
19 ;;; This file is part of GNU Guix.
20 ;;;
21 ;;; GNU Guix is free software; you can redistribute it and/or modify it
22 ;;; under the terms of the GNU General Public License as published by
23 ;;; the Free Software Foundation; either version 3 of the License, or (at
24 ;;; your option) any later version.
25 ;;;
26 ;;; GNU Guix is distributed in the hope that it will be useful, but
27 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
28 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 ;;; GNU General Public License for more details.
30 ;;;
31 ;;; You should have received a copy of the GNU General Public License
32 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
33
34 (define-module (gnu packages maths)
35 #:use-module (ice-9 regex)
36 #:use-module (gnu packages)
37 #:use-module ((guix licenses) #:prefix license:)
38 #:use-module (guix packages)
39 #:use-module (guix download)
40 #:use-module (guix utils)
41 #:use-module (guix build utils)
42 #:use-module (guix build-system cmake)
43 #:use-module (guix build-system gnu)
44 #:use-module (guix build-system r)
45 #:use-module (gnu packages algebra)
46 #:use-module (gnu packages bison)
47 #:use-module (gnu packages boost)
48 #:use-module (gnu packages check)
49 #:use-module (gnu packages cmake)
50 #:use-module (gnu packages compression)
51 #:use-module (gnu packages curl)
52 #:use-module (gnu packages cyrus-sasl)
53 #:use-module (gnu packages documentation)
54 #:use-module (gnu packages elf)
55 #:use-module (gnu packages flex)
56 #:use-module (gnu packages fltk)
57 #:use-module (gnu packages fontutils)
58 #:use-module (gnu packages gettext)
59 #:use-module (gnu packages gcc)
60 #:use-module (gnu packages gd)
61 #:use-module (gnu packages ghostscript)
62 #:use-module (gnu packages graphviz)
63 #:use-module (gnu packages gtk)
64 #:use-module (gnu packages image)
65 #:use-module (gnu packages less)
66 #:use-module (gnu packages lisp)
67 #:use-module (gnu packages logging)
68 #:use-module (gnu packages gnome)
69 #:use-module (gnu packages guile)
70 #:use-module (gnu packages xorg)
71 #:use-module (gnu packages gl)
72 #:use-module (gnu packages m4)
73 #:use-module (gnu packages mpi)
74 #:use-module (gnu packages multiprecision)
75 #:use-module (gnu packages netpbm)
76 #:use-module (gnu packages pcre)
77 #:use-module (gnu packages popt)
78 #:use-module (gnu packages perl)
79 #:use-module (gnu packages pkg-config)
80 #:use-module (gnu packages python)
81 #:use-module (gnu packages readline)
82 #:use-module (gnu packages tbb)
83 #:use-module (gnu packages shells)
84 #:use-module (gnu packages tcl)
85 #:use-module (gnu packages texinfo)
86 #:use-module (gnu packages tex)
87 #:use-module (gnu packages tls)
88 #:use-module (gnu packages wxwidgets)
89 #:use-module (gnu packages xml)
90 #:use-module (gnu packages zip)
91 #:use-module (srfi srfi-1))
92
93 (define-public c-graph
94 (package
95 (name "c-graph")
96 (version "2.0")
97 (source (origin
98 (method url-fetch)
99 (uri (string-append "mirror://gnu/c-graph/c-graph-" version
100 ".tar.gz"))
101 (sha256 (base32
102 "1hlvpzrh7hzzf533diyfiabzskddi8zx92av9hwkjw3l46z7qv01"))))
103 (build-system gnu-build-system)
104 (inputs
105 `(("fortran" ,gfortran)))
106 (synopsis "Visualizing and demonstrating convolution")
107 (description
108 "GNU C-Graph is a tool for demonstrating the theory of convolution.
109 Thus, it can serve as an excellent aid to students of signal and systems
110 theory in visualizing the convolution process. Rather than forcing the
111 student to write code, the program offers an intuitive interface with
112 interactive dialogs to guide them.")
113 (license license:gpl3+)
114 (home-page "http://www.gnu.org/software/c-graph/")))
115
116 (define-public coda
117 (package
118 (name "coda")
119 (version "2.17.3")
120 (source
121 (origin
122 (method url-fetch)
123 (uri (string-append "https://github.com/stcorp/coda/releases/download/"
124 version "/coda-" version ".tar.gz"))
125 (sha256
126 (base32 "04b9l3wzcix0mnfq77mwnil6cbr8h2mki8myvy0lzn236qcwaq1h"))
127 (patches (search-patches "coda-use-system-libs.patch"))
128 (modules '((guix build utils)))
129 (snippet
130 ;; Make sure we don't use the bundled software.
131 '(for-each (lambda (d)
132 (delete-file-recursively (string-append "libcoda/" d)))
133 '("zlib" "pcre" "expat")))))
134 (native-inputs
135 `(("fortran" ,gfortran)
136 ("python" ,python)
137 ("python-numpy" ,python-numpy)))
138 (inputs
139 `(("zlib" ,zlib)
140 ("pcre" ,pcre)
141 ("expat" ,expat)
142 ("hdf4" ,hdf4-alt)
143 ("hdf5" ,hdf5)))
144 (build-system gnu-build-system)
145 (arguments
146 '(#:configure-flags '("--with-hdf4" "--with-hdf5" "--enable-python"
147 "LIBS= -lz -lpcre -lexpat")))
148 (synopsis "A common interface to various earth observation data formats")
149 (description
150 "The Common Data Access toolbox (CODA) provides a set of interfaces for
151 reading remote sensing data from earth observation data files. It consists of
152 command line applications and interfaces to the C, Fortran, Python, and Java
153 programming languages.")
154 (home-page "https://stcorp.nl/coda")
155 (license license:gpl2+)))
156
157 (define-public units
158 (package
159 (name "units")
160 (version "2.13")
161 (source (origin
162 (method url-fetch)
163 (uri (string-append "mirror://gnu/units/units-" version
164 ".tar.gz"))
165 (sha256 (base32
166 "1awhjw9zjlfb8s5g3yyx63f7ddfcr1sanlbxpqifmrgq24ql198b"))))
167 (build-system gnu-build-system)
168 (synopsis "Conversion between thousands of scales")
169 (description
170 "GNU Units converts numeric quantities between units of measure. It
171 can handle scale changes through adaptive usage of standard scale
172 prefixes (micro-, kilo-, etc.). It can also handle nonlinear
173 conversions such as Fahrenheit to Celsius. Its interpreter is powerful
174 enough to be used effectively as a scientific calculator.")
175 (license license:gpl3+)
176 (home-page "http://www.gnu.org/software/units/")))
177
178 (define-public double-conversion
179 (package
180 (name "double-conversion")
181 (version "1.1.5")
182 (source (origin
183 (method url-fetch)
184 (uri (string-append
185 "https://github.com/floitsch/double-conversion/archive/v"
186 version ".tar.gz"))
187 (file-name (string-append name "-" version ".tar.gz"))
188 (sha256
189 (base32
190 "0cnr8xhyjfxijay8ymkqcph3672wp2lj23qhdmr3m4kia5kpdf83"))))
191 (build-system cmake-build-system)
192 (arguments
193 '(#:test-target "test"
194 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
195 "-DBUILD_TESTING=ON")))
196 (home-page "https://github.com/floitsch/double-conversion")
197 (synopsis "Conversion routines for IEEE doubles")
198 (description
199 "The double-conversion library provides binary-decimal and decimal-binary
200 routines for IEEE doubles. The library consists of efficient conversion
201 routines that have been extracted from the V8 JavaScript engine.")
202 (license license:bsd-3)))
203
204 (define-public dionysus
205 (package
206 (name "dionysus")
207 (version "1.3.0")
208 (source (origin
209 (method url-fetch)
210 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
211 ".tar.gz"))
212 (sha256
213 (base32
214 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
215 (build-system gnu-build-system)
216 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
217 (synopsis "Local search for universal constants and scientific values")
218 (description
219 "GNU Dionysus is a convenient system for quickly retrieving the values of
220 mathematical constants used in science and engineering. Values can be
221 searched using a simple command-line tool, choosing from three databases:
222 universal constants, atomic numbers, and constants related to
223 semiconductors.")
224 (license license:gpl3+)
225 (home-page "http://www.gnu.org/software/dionysus/")))
226
227 (define-public gsl
228 (package
229 (name "gsl")
230 (version "2.2.1")
231 (source (origin
232 (method url-fetch)
233 (uri (string-append "mirror://gnu/gsl/gsl-"
234 version ".tar.gz"))
235 (sha256
236 (base32
237 "095hp01d8lkqdvv0p1k25kvbisgfdmvx1rzpyc2i8kl2n33kvlhk"))
238 (patches (search-patches "gsl-test-i686.patch"))))
239 (build-system gnu-build-system)
240 (arguments
241 `(#:parallel-tests? #f))
242 (home-page "http://www.gnu.org/software/gsl/")
243 (synopsis "Numerical library for C and C++")
244 (description
245 "The GNU Scientific Library is a library for numerical analysis in C
246 and C++. It includes a wide range of mathematical routines, with over 1000
247 functions in total. Subject areas covered by the library include:
248 differential equations, linear algebra, Fast Fourier Transforms and random
249 numbers.")
250 (license license:gpl3+)))
251
252 (define-public glpk
253 (package
254 (name "glpk")
255 (version "4.60")
256 (source
257 (origin
258 (method url-fetch)
259 (uri (string-append "mirror://gnu/glpk/glpk-"
260 version ".tar.gz"))
261 (sha256
262 (base32
263 "15z2ymzqhxwss6wgdj5f7vkyqlqdsjgrvm0x871kmlx0n0664mhk"))))
264 (build-system gnu-build-system)
265 (inputs
266 `(("gmp" ,gmp)))
267 (arguments
268 `(#:configure-flags '("--with-gmp")))
269 (home-page "http://www.gnu.org/software/glpk/")
270 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
271 (description
272 "GLPK is a C library for solving large-scale linear programming (LP),
273 mixed integer programming (MIP), and other related problems. It supports the
274 GNU MathProg modeling language, a subset of the AMPL language, and features a
275 translator for the language. In addition to the C library, a stand-alone
276 LP/MIP solver is included in the package.")
277 (license license:gpl3+)))
278
279 (define-public 4ti2
280 (package
281 (name "4ti2")
282 (version "1.6.7")
283 (source
284 (origin
285 (method url-fetch)
286 (uri (string-append "http://www.4ti2.de/version_" version
287 "/4ti2-" version ".tar.gz"))
288 (sha256
289 (base32
290 "1frix3rnm9ffr93alqzw4cavxbfpf524l8rfbmcpyhwd3n1km0yl"))))
291 (build-system gnu-build-system)
292 (native-inputs
293 `(("which" ,(@ (gnu packages base) which)))) ; for the tests
294 (inputs
295 `(("glpk" ,glpk)
296 ("gmp" ,gmp)))
297 (home-page "http://www.4ti2.de/")
298 (synopsis "Mathematical tool suite for problems on linear spaces")
299 (description
300 "4ti2 implements algorithms for solving algebraic, geometric and
301 combinatorial problems on linear spaces. Among others, it solves systems
302 of linear equations, computes extreme rays of polyhedral cones, solves
303 integer programming problems and computes Markov bases for statistics.")
304 (license license:gpl2+)))
305
306 (define-public cddlib
307 (package
308 (name "cddlib")
309 (version "0.94h")
310 (source
311 (origin
312 (method url-fetch)
313 (uri (string-append "ftp://ftp.ifor.math.ethz.ch/pub/fukuda/cdd/cddlib-"
314 (string-delete #\. version) ".tar.gz"))
315 (sha256
316 (base32
317 "1dasasscwfg793q8fwzgwf64xwj7w62yfvszpr8x8g38jka08vgy"))))
318 (build-system gnu-build-system)
319 (inputs
320 `(("gmp" ,gmp)))
321 (home-page "https://www.inf.ethz.ch/personal/fukudak/cdd_home/index.html")
322 (synopsis "Library for convex hulls and extreme rays of polyhedra")
323 (description
324 "The C-library cddlib implements the Double Description Method of
325 Motzkin et al. for generating all vertices (i.e. extreme points) and extreme
326 rays of a general convex polyhedron given by a system of linear inequalities
327 in arbitrary dimension. It can also be used for the converse operation of
328 computing convex hulls.")
329 (license license:gpl2+)))
330
331 (define-public arpack-ng
332 (package
333 (name "arpack-ng")
334 (version "3.2.0")
335 (source
336 (origin
337 (method url-fetch)
338 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
339 version ".tar.gz"))
340 (file-name (string-append name "-" version ".tar.gz"))
341 (sha256
342 (base32
343 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
344 (build-system gnu-build-system)
345 (home-page "https://github.com/opencollab/arpack-ng")
346 (inputs
347 `(("lapack" ,lapack)
348 ("fortran" ,gfortran)))
349 (synopsis "Fortran subroutines for solving eigenvalue problems")
350 (description
351 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
352 large scale eigenvalue problems.")
353 (license (license:non-copyleft "file://COPYING"
354 "See COPYING in the distribution."))))
355
356 (define-public arpack-ng-openmpi
357 (package (inherit arpack-ng)
358 (name "arpack-ng-openmpi")
359 (inputs
360 `(("mpi" ,openmpi)
361 ,@(package-inputs arpack-ng)))
362 (arguments `(#:configure-flags '("--enable-mpi")))
363 (synopsis "Fortran subroutines for solving eigenvalue problems with MPI")))
364
365 (define-public lapack
366 (package
367 (name "lapack")
368 (version "3.5.0")
369 (source
370 (origin
371 (method url-fetch)
372 (uri (string-append "http://www.netlib.org/lapack/lapack-"
373 version ".tgz"))
374 (sha256
375 (base32
376 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
377 (build-system cmake-build-system)
378 (home-page "http://www.netlib.org/lapack/")
379 (inputs `(("fortran" ,gfortran)
380 ("python" ,python-2)))
381 (arguments
382 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES"
383 "-DLAPACKE=ON")
384 #:phases (alist-cons-before
385 'check 'patch-python
386 (lambda* (#:key inputs #:allow-other-keys)
387 (let ((python (assoc-ref inputs "python")))
388 (substitute* "lapack_testing.py"
389 (("/usr/bin/env python") python))))
390 %standard-phases)))
391 (synopsis "Library for numerical linear algebra")
392 (description
393 "LAPACK is a Fortran 90 library for solving the most commonly occurring
394 problems in numerical linear algebra.")
395 (license (license:non-copyleft "file://LICENSE"
396 "See LICENSE in the distribution."))))
397
398 (define-public scalapack
399 (package
400 (name "scalapack")
401 (version "2.0.2")
402 (source
403 (origin
404 (method url-fetch)
405 (uri (string-append "http://www.netlib.org/scalapack/scalapack-"
406 version ".tgz"))
407 (sha256
408 (base32
409 "0p1r61ss1fq0bs8ynnx7xq4wwsdvs32ljvwjnx6yxr8gd6pawx0c"))))
410 (build-system cmake-build-system)
411 (inputs
412 `(("mpi" ,openmpi)
413 ("fortran" ,gfortran)
414 ("lapack" ,lapack))) ;for testing only
415 (arguments
416 `(#:configure-flags `("-DBUILD_SHARED_LIBS:BOOL=YES")))
417 (home-page "http://www.netlib.org/scalapack/")
418 (synopsis "Library for scalable numerical linear algebra")
419 (description
420 "ScaLAPACK is a Fortran 90 library of high-performance linear algebra
421 routines on parallel distributed memory machines. ScaLAPACK solves dense and
422 banded linear systems, least squares problems, eigenvalue problems, and
423 singular value problems.")
424 (license (license:bsd-style "file://LICENSE"
425 "See LICENSE in the distribution."))))
426
427 (define-public gnuplot
428 ;; Gnuplot version 5.0.4 was updated in-place, resulting in a hash mismatch.
429 ;; This can be removed at the next version update.
430 (let ((upstream-version "5.0.4")
431 (guix-revision "1"))
432 (package
433 (name "gnuplot")
434 (version (string-append upstream-version "-" guix-revision))
435 (source
436 (origin
437 (method url-fetch)
438 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
439 upstream-version "/gnuplot-"
440 upstream-version ".tar.gz"))
441 (sha256
442 (base32
443 "07n3w12dkcxjnhsvsliaqnkhajhi818v6q8mkpmpbplbf92vh70m"))))
444 (build-system gnu-build-system)
445 (inputs `(("readline" ,readline)
446 ("cairo" ,cairo)
447 ("pango" ,pango)
448 ("gd" ,gd)))
449 (native-inputs `(("pkg-config" ,pkg-config)
450 ("texlive" ,texlive-minimal)))
451 (home-page "http://www.gnuplot.info")
452 (synopsis "Command-line driven graphing utility")
453 (description "Gnuplot is a portable command-line driven graphing
454 utility. It was originally created to allow scientists and students to
455 visualize mathematical functions and data interactively, but has grown to
456 support many non-interactive uses such as web scripting. It is also used as a
457 plotting engine by third-party applications like Octave.")
458 ;; X11 Style with the additional restriction that derived works may only be
459 ;; distributed as patches to the original.
460 (license (license:fsf-free
461 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright")))))
462
463 (define-public gctp
464 (package
465 (name "gctp")
466 (version "2.0.0")
467 (source
468 (origin
469 (method url-fetch)
470 (uri (string-append "https://github.com/OkoSanto/GCTP/archive/v"
471 version ".tar.gz"))
472 (file-name (string-append name "-" version ".tar.gz"))
473 (sha256
474 (base32
475 "0l9aqnqynh9laicn5dxf3rsb1n14xiks79wbyqccirzmjqd1c1x4"))))
476 (native-inputs
477 `(("fortran" ,gfortran)))
478 (build-system gnu-build-system)
479 (synopsis "General Cartographic Transformation Package (GCTP)")
480 (description
481 "The General Cartographic Transformation Package (GCTP) is a system of
482 software routines designed to permit the transformation of coordinate pairs
483 from one map projection to another. The GCTP is the standard computer
484 software used by the National Mapping Division for map projection
485 computations.")
486 (home-page "https://github.com/OkoSanto/GCTP")
487 (license license:public-domain))) ;https://www2.usgs.gov/laws/info_policies.html
488
489 (define-public hdf4
490 (package
491 (name "hdf4")
492 (version "4.2.11")
493 (source
494 (origin
495 (method url-fetch)
496 (uri (string-append "https://support.hdfgroup.org/ftp/HDF/releases/HDF"
497 version "/src/hdf-" version ".tar.bz2"))
498 (sha256
499 (base32 "16yr50j845zlfx20skmw3y75ww77akk9gg0affjqkg66ih5r03mv"))
500 (patches (search-patches "hdf4-architectures.patch"
501 "hdf4-reproducibility.patch"
502 "hdf4-shared-fortran.patch"))))
503
504 (build-system gnu-build-system)
505 (native-inputs
506 `(("gfortran" ,gfortran)
507 ("bison" ,bison)
508 ("flex" ,flex)))
509 (inputs
510 `(("zlib" ,zlib)
511 ("libjpeg" ,libjpeg)))
512 (arguments
513 `(#:parallel-tests? #f
514 #:configure-flags '("--enable-shared")
515 #:phases
516 (modify-phases %standard-phases
517 (add-before 'configure 'patchbuild
518 (lambda _
519 (substitute*
520 '("mfhdf/hdfimport/testutil.sh.in" "hdf/util/testutil.sh.in")
521 (("/bin/rm") "rm")
522 (("/bin/mkdir") "mkdir"))
523 (substitute* (find-files "." "^Makefile\\.in$")
524 (("@HDF_BUILD_XDR_TRUE@XDR_ADD = \
525 -R\\$\\(abs_top_builddir\\)/mfhdf/xdr/\\.libs") "")
526 (("@HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = \
527 -R\\$\\(abs_top_builddir\\)/mfhdf/libsrc/\\.libs \
528 -R\\$\\(abs_top_builddir\\)/hdf/src/\\.libs \\$\\(XDR_ADD\\)") "")))))))
529 (home-page "https://www.hdfgroup.org/products/hdf4/")
530 (synopsis
531 "Library and multi-object file format for storing and managing data")
532 (description "HDF4 is a library and multi-object file format for storing
533 and managing data between machines. HDF4 is an older hierarchical data format,
534 incompatible with HDF5.")
535 (license
536 (license:non-copyleft
537 "https://www.hdfgroup.org/ftp/HDF/HDF_Current/src/unpacked/COPYING"))))
538
539 (define-public hdf4-alt
540 (package
541 (inherit hdf4)
542 (name "hdf4-alt")
543 (arguments
544 (substitute-keyword-arguments (package-arguments hdf4)
545 ((#:configure-flags flags) `(cons* "--disable-netcdf" ,flags))))
546 (synopsis
547 "HDF4 without netCDF API, can be combined with the regular netCDF library")))
548
549 (define-public hdf5
550 (package
551 (name "hdf5")
552 (version "1.8.17")
553 (source
554 (origin
555 (method url-fetch)
556 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-"
557 version "/src/hdf5-"
558 version ".tar.bz2"))
559 (sha256
560 (base32 "0sj8x0gfs5fb28gipnynb9wpkz113h8wq9sva9mxx66kv27xsdgw"))
561 (patches (list (search-patch "hdf5-config-date.patch")))))
562 (build-system gnu-build-system)
563 (inputs
564 `(("zlib" ,zlib)))
565 (arguments
566 `(#:phases
567 (modify-phases %standard-phases
568 (add-before 'configure 'patch-configure
569 (lambda _
570 (substitute* "configure"
571 (("/bin/mv") "mv"))
572 #t))
573 (add-after 'install 'patch-references
574 (lambda* (#:key inputs outputs #:allow-other-keys)
575 (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
576 (zlib (assoc-ref inputs "zlib")))
577 (substitute* (find-files bin "h5p?cc")
578 (("-lz" lib)
579 (string-append "-L" zlib "/lib " lib)))
580 #t))))))
581 (home-page "http://www.hdfgroup.org")
582 (synopsis "Management suite for extremely large and complex data")
583 (description "HDF5 is a suite that makes possible the management of
584 extremely large and complex data collections.")
585 (license (license:x11-style
586 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
587
588 (define-public hdf-eos2
589 (package
590 (name "hdf-eos2")
591 (version "19.1.0")
592 (source
593 (origin
594 (method url-fetch)
595 (uri "ftp://edhs1.gsfc.nasa.gov\
596 /edhs/hdfeos/latest_release/HDF-EOS2.19v1.00.tar.Z")
597 (sha256
598 (base32 "0c9fcz25s292ldap12wxmlrvnyz99z24p63d8fwx51bf8s0s1zrz"))
599 (patches (search-patches "hdf-eos2-remove-gctp.patch"
600 "hdf-eos2-build-shared.patch"
601 "hdf-eos2-fortrantests.patch"))))
602 (build-system gnu-build-system)
603 (native-inputs
604 `(("gfortran" ,gfortran)))
605 (inputs
606 `(("hdf4" ,hdf4-alt) ; assume most HDF-EOS2 users won't use the HDF4 netCDF API
607 ("zlib" ,zlib)
608 ("libjpeg" ,libjpeg)
609 ("gctp" ,gctp)))
610 (arguments
611 `( #:configure-flags '("--enable-install-include" "--enable-shared"
612 "CC=h4cc -Df2cFortran" "LIBS=-lgctp")
613 #:parallel-tests? #f))
614 (home-page "http://hdfeos.org/software/library.php#HDF-EOS2")
615 (synopsis "HDF4-based data format for NASA's Earth Observing System")
616 (description "HDF-EOS2 is a software library built on HDF4 which supports
617 the construction of data structures used in NASA's Earth Observing
618 System (Grid, Point and Swath).")
619
620 ;; Source files carry a permissive license header.
621 (license (license:non-copyleft home-page))))
622
623 (define-public hdf-eos5
624 (package
625 (name "hdf-eos5")
626 (version "1.15")
627 (source (origin
628 (method url-fetch)
629 (uri (string-append "ftp://edhs1.gsfc.nasa.gov\
630 /edhs/hdfeos5/latest_release/HDF-EOS5." version ".tar.Z"))
631 (sha256
632 (base32
633 "1p83333nzzy8rn5chxlm0hrkjjnhh2w1ji8ac0f9q4xzg838i58i"))
634 (patches (search-patches "hdf-eos5-build-shared.patch"
635 "hdf-eos5-remove-gctp.patch"
636 "hdf-eos5-fix-szip.patch"
637 "hdf-eos5-fortrantests.patch"))))
638 (native-inputs
639 `(("gfortran" ,gfortran)))
640 (build-system gnu-build-system)
641 (inputs
642 `(("hdf5" ,hdf5)
643 ("zlib" ,zlib)
644 ("gctp" ,gctp)))
645 (arguments
646 `(#:configure-flags '("--enable-install-include" "--enable-shared"
647 "CC=h5cc -Df2cFortran" "LIBS=-lgctp")
648 #:parallel-tests? #f))
649 (synopsis "HDF5-based data format for NASA's Earth Observing System")
650 (description
651 "HDF-EOS5 is a software library built on HDF5 to support the construction
652 of data structures used in NASA's Earth Observing System (Grid, Point and
653 Swath).")
654 (home-page "http://www.hdfeos.org/software/library.php#HDF-EOS5")
655
656 ;; Source files carry a permissive license header.
657 (license (license:non-copyleft home-page))))
658
659 (define-public hdf5-parallel-openmpi
660 (package (inherit hdf5)
661 (name "hdf5-parallel-openmpi")
662 (inputs
663 `(("mpi" ,openmpi)
664 ,@(package-inputs hdf5)))
665 (arguments
666 (substitute-keyword-arguments `(#:configure-flags '("--enable-parallel")
667 ,@(package-arguments hdf5))
668 ((#:phases phases)
669 `(modify-phases ,phases
670 (add-before 'check 'patch-tests
671 (lambda _
672 ;; OpenMPI's mpirun will exit with non-zero status if it
673 ;; detects an "abnormal termination", i.e. any process not
674 ;; calling MPI_Finalize(). Since the test is explicitely
675 ;; avoiding MPI_Finalize so as not to have at_exit and thus
676 ;; H5C_flush_cache from being called, mpirun will always
677 ;; complain, so turn this test off.
678 (substitute* "testpar/Makefile"
679 (("(^TEST_PROG_PARA.*)t_pflush1(.*)" front back)
680 (string-append front back "\n")))
681 (substitute* "tools/h5diff/testph5diff.sh"
682 (("/bin/sh") (which "sh")))
683 #t))))))
684 (synopsis "Management suite for data with parallel IO support")))
685
686 (define-public h5check
687 (package
688 (name "h5check")
689 (version "2.0.1")
690 (source
691 (origin
692 (method url-fetch)
693 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/tools/"
694 "h5check/src/h5check-" version ".tar.gz"))
695 (sha256
696 (base32
697 "1gm76jbwhz9adbxgn14zx8cj33dmjdr2g5xcy0m9c2gakp8w59kj"))))
698 (build-system gnu-build-system)
699 (inputs `(("hdf5" ,hdf5))) ;h5cc for tests
700 (home-page "https://www.hdfgroup.org/products/hdf5_tools/h5check.html")
701 (synopsis "HDF5 format checker")
702 (description "@code{h5check} is a validation tool for verifying that an
703 HDF5 file is encoded according to the HDF File Format Specification.")
704 (license (license:x11-style "file://COPYING"))))
705
706 (define-public netcdf
707 (package
708 (name "netcdf")
709 (version "4.4.0")
710 (source
711 (origin
712 (method url-fetch)
713 (uri (string-append "ftp://ftp.unidata.ucar.edu/pub/netcdf/"
714 "netcdf-" version ".tar.gz"))
715 (sha256
716 (base32
717 "0y6gdcplarwqqnrav2xg1xd6ih732rzzbmdw78v3rl5b8mwcnh0d"))
718 (patches (list (search-patch "netcdf-config-date.patch")))))
719 (build-system gnu-build-system)
720 (native-inputs
721 `(("m4" ,m4)
722 ("doxygen" ,doxygen)
723 ("graphviz" ,graphviz)))
724 (inputs
725 `(("hdf5" ,hdf5)
726 ("zlib" ,zlib)))
727 (arguments
728 `(#:configure-flags '("--enable-doxygen" "--enable-dot")
729 #:parallel-tests? #f)) ;various race conditions
730 (home-page "http://www.unidata.ucar.edu/software/netcdf/")
731 (synopsis "Library for scientific data")
732 (description "NetCDF is an interface for scientific data access and a
733 software library that provides an implementation of the interface. The netCDF
734 library defines a machine-independent format for representing scientific data.
735 Together, the interface, library, and format support the creation, access, and
736 sharing of scientific data.")
737 (license (license:x11-style "file://COPYRIGHT"))))
738
739 (define-public netcdf-parallel-openmpi
740 (package (inherit netcdf)
741 (name "netcdf-parallel-openmpi")
742 (inputs
743 `(("mpi" ,openmpi)
744 ,@(alist-replace "hdf5" (list hdf5-parallel-openmpi)
745 (package-inputs netcdf))))
746 ;; TODO: Replace pkg-config references in nc-config with absolute references
747 (arguments
748 (substitute-keyword-arguments (package-arguments netcdf)
749 ((#:configure-flags flags)
750 `(cons* "CC=mpicc" "CXX=mpicxx"
751 "--enable-parallel-tests"
752 ;; Shared libraries not supported with parallel IO.
753 "--disable-shared" "--with-pic"
754 ,flags))))))
755
756 (define-public nlopt
757 (package
758 (name "nlopt")
759 (version "2.4.2")
760 (source (origin
761 (method url-fetch)
762 (uri (string-append "http://ab-initio.mit.edu/nlopt/nlopt-"
763 version ".tar.gz"))
764 (sha256
765 (base32 "12cfkkhcdf4zmb6h7y6qvvdvqjs2xf9sjpa3rl3bq76px4yn76c0"))))
766 (build-system gnu-build-system)
767 (arguments
768 `(;; Shared libraries are not built by default. They are required to
769 ;; build the Guile, Octave, and Python bindings.
770 #:configure-flags '("--enable-shared")
771
772 #:phases
773 (modify-phases %standard-phases
774 (add-before 'configure 'set-libnlopt-file-name
775 (lambda* (#:key outputs #:allow-other-keys)
776 ;; Make sure the Scheme module refers to the library by its
777 ;; absolute file name (we cannot do that from a snippet
778 ;; because the expansion of @libdir@ contains
779 ;; ${exec_prefix}.)
780 (let ((out (assoc-ref outputs "out")))
781 (substitute* "swig/nlopt.scm.in"
782 (("libnlopt")
783 (string-append out "/lib/libnlopt")))
784 #t))))))
785 (inputs `(("guile" ,guile-2.0)))
786 (native-inputs `(("pkg-config" ,pkg-config)))
787 (home-page "http://ab-initio.mit.edu/wiki/")
788 (synopsis "Library for nonlinear optimization")
789 (description "NLopt is a library for nonlinear optimization, providing a
790 common interface for a number of different free optimization routines available
791 online as well as original implementations of various other algorithms.")
792 (license license:lgpl2.1+)))
793
794 (define-public ipopt
795 (package
796 (name "ipopt")
797 (version "3.12.5")
798 (source (origin
799 (method url-fetch)
800 (uri (string-append
801 "http://www.coin-or.org/download/source/Ipopt/Ipopt-"
802 version".tgz"))
803 (sha256
804 (base32
805 "09bk2hqy2vgi4yi76xng9zxakddwqy3wij9nx7wf2vfbxxpazrsk"))
806 (modules '((guix build utils)))
807 (snippet
808 ;; Make sure we don't use the bundled software.
809 '(delete-file-recursively "ThirdParty"))))
810 (build-system gnu-build-system)
811 (arguments
812 '(#:phases (modify-phases %standard-phases
813 (add-after 'install 'add--L-flags-in-ipopt.pc
814 (lambda* (#:key inputs outputs #:allow-other-keys)
815 ;; The '.pc' file lists '-llapack -lblas' in "Libs";
816 ;; move it to "Libs.private" where it belongs, and add a
817 ;; '-L' flag for LAPACK.
818 (let ((out (assoc-ref outputs "out"))
819 (lapack (assoc-ref inputs "lapack")))
820 (substitute* (string-append out "/lib/pkgconfig/"
821 "ipopt.pc")
822 (("Libs: (.*)-llapack -lblas(.*)$" _ before after)
823 (string-append "Libs: " before " " after "\n"
824 "Libs.private: " before
825 "-L" lapack "/lib -llapack -lblas "
826 after "\n")))
827 #t))))))
828 (native-inputs
829 `(("gfortran" ,gfortran)))
830 (inputs
831 ;; TODO: Maybe add dependency on COIN-MUMPS, ASL, and HSL.
832 `(("lapack" ,lapack))) ;for both libblas and liblapack
833 (home-page "http://www.coin-or.org")
834 (synopsis "Large-scale nonlinear optimizer")
835 (description
836 "The Interior Point Optimizer (IPOPT) is a software package for
837 large-scale nonlinear optimization. It provides C++, C, and Fortran
838 interfaces.")
839 (license license:epl1.0)))
840
841 (define-public ceres
842 (package
843 (name "ceres-solver")
844 (version "1.11.0")
845 (home-page "http://ceres-solver.org/")
846 (source (origin
847 (method url-fetch)
848 (uri (string-append home-page "ceres-solver-"
849 version ".tar.gz"))
850 (sha256
851 (base32
852 "0i7qkbf8g6pd8arxzldppga26ckv93y8zldsfz6wbd4n6b1nqrjd"))))
853 (build-system cmake-build-system)
854 (arguments
855 ;; TODO: Build HTML user documentation and install separately.
856 '(#:configure-flags '("-DBUILD_EXAMPLES=OFF"
857 "-DBUILD_SHARED_LIBS=ON")
858
859 #:phases (modify-phases %standard-phases
860 (add-before 'configure 'set-library-directory
861 (lambda _
862 ;; Install libraries to lib/, not lib64/.
863 (substitute* "internal/ceres/CMakeLists.txt"
864 (("set\\(LIB_SUFFIX \"64\"\\)")
865 "set(LIB_SUFFIX \"\")"))
866 #t)))))
867 (native-inputs
868 `(("pkg-config" ,pkg-config)))
869 (propagated-inputs
870 `(("glog" ,glog))) ;for #include <glog/glog.h>
871 (inputs
872 `(("eigen" ,eigen)
873 ("blas" ,openblas)
874 ("lapack" ,lapack)
875 ("suitesparse" ,suitesparse)
876 ("gflags" ,gflags)))
877 (synopsis "C++ library for solving large optimization problems")
878 (description
879 "Ceres Solver is a C++ library for modeling and solving large,
880 complicated optimization problems. It is a feature rich, mature and
881 performant library which has been used in production since 2010. Ceres Solver
882 can solve two kinds of problems:
883 @enumerate
884 @item non-linear least squares problems with bounds constraints;
885 @item general unconstrained optimization problems.
886 @end enumerate\n")
887 (license license:bsd-3)))
888
889 ;; For a fully featured Octave, users are strongly recommended also to install
890 ;; the following packages: texinfo, less, ghostscript, gnuplot.
891 (define-public octave
892 (package
893 (name "octave")
894 (version "4.0.3")
895 (source
896 (origin
897 (method url-fetch)
898 (uri (string-append "mirror://gnu/octave/octave-"
899 version ".tar.xz"))
900 (sha256
901 (base32
902 "11day29k4yfvxh4101x5yf26ld992x5n6qvmhjjk6mzsd26fqayw"))))
903 (build-system gnu-build-system)
904 (inputs
905 `(("lapack" ,lapack)
906 ("readline" ,readline)
907 ("glpk" ,glpk)
908 ("fftw" ,fftw)
909 ("fftwf" ,fftwf)
910 ("arpack" ,arpack-ng)
911 ("pcre" ,pcre)
912 ("fltk" ,fltk)
913 ("fontconfig" ,fontconfig)
914 ("freetype" ,freetype)
915 ("hdf5" ,hdf5)
916 ("libxft" ,libxft)
917 ("mesa" ,mesa)
918 ("glu" ,glu)
919 ("zlib" ,zlib)))
920 (native-inputs
921 `(("gfortran" ,gfortran)
922 ("pkg-config" ,pkg-config)
923 ("perl" ,perl)
924 ;; The following inputs are not actually used in the build process.
925 ;; However, the ./configure gratuitously tests for their existence and
926 ;; assumes that programs not present at build time are also not, and
927 ;; can never be, available at run time! If these inputs are therefore
928 ;; not present, support for them will be built out. However, Octave
929 ;; will still run without them, albeit without the features they
930 ;; provide.
931 ("less" ,less)
932 ("texinfo" ,texinfo)
933 ("ghostscript" ,ghostscript)
934 ("gnuplot" ,gnuplot)))
935 (arguments
936 `(#:configure-flags
937 (list (string-append "--with-shell="
938 (assoc-ref %build-inputs "bash")
939 "/bin/sh"))))
940 (home-page "http://www.gnu.org/software/octave/")
941 (synopsis "High-level language for numerical computation")
942 (description "GNU Octave is a high-level interpreted language that is
943 specialized for numerical computations. It can be used for both linear and
944 non-linear applications and it provides great support for visualizing results.
945 Work may be performed both at the interactive command-line as well as via
946 script files.")
947 (license license:gpl3+)))
948
949 (define-public gmsh
950 (package
951 (name "gmsh")
952 (version "2.11.0")
953 (source
954 (origin
955 (method url-fetch)
956 (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
957 version "-source.tgz"))
958 (sha256
959 (base32 "1ilplibvjgf7a905grpnclrvkmqy9fgrpl7xyp3w4yl1qc682v9b"))
960 (modules '((guix build utils)))
961 (snippet
962 ;; Remove non-free METIS code
963 '(delete-file-recursively "contrib/Metis"))))
964 (build-system cmake-build-system)
965 (propagated-inputs
966 `(("fltk" ,fltk)
967 ("gfortran" ,gfortran)
968 ("gmp" ,gmp)
969 ("hdf5" ,hdf5)
970 ("lapack" ,lapack)
971 ("mesa" ,mesa)
972 ("glu" ,glu)
973 ("libx11" ,libx11)
974 ("libxext" ,libxext)))
975 (inputs
976 `(("fontconfig" ,fontconfig)
977 ("libxft" ,libxft)))
978 (arguments
979 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
980 "-DENABLE_BUILD_SHARED:BOOL=ON"
981 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")
982 #:phases (modify-phases %standard-phases
983 (replace
984 'check
985 (lambda _
986 (zero? (system* "make" "test"
987 ;; Disable this test. See
988 ;; https://geuz.org/trac/gmsh/ticket/271
989 "ARGS=-E component8_in_a_box")))))))
990 (home-page "http://www.geuz.org/gmsh/")
991 (synopsis "3D finite element grid generator")
992 (description "Gmsh is a 3D finite element grid generator with a built-in
993 CAD engine and post-processor. Its design goal is to provide a fast, light
994 and user-friendly meshing tool with parametric input and advanced
995 visualization capabilities. Gmsh is built around four modules: geometry,
996 mesh, solver and post-processing. The specification of any input to these
997 modules is done either interactively using the graphical user interface or in
998 ASCII text files using Gmsh's own scripting language.")
999 (license license:gpl2+)))
1000
1001 (define-public petsc
1002 (package
1003 (name "petsc")
1004 (version "3.7.2")
1005 (source
1006 (origin
1007 (method url-fetch)
1008 ;; The *-lite-* tarball does not contain the *large* documentation
1009 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
1010 "petsc-lite-" version ".tar.gz"))
1011 (sha256
1012 (base32 "0jfrq6rd4zagw1iimz05m2w91k0jvz3qbik1lk8pqcxw3rvdqk5d"))))
1013 (build-system gnu-build-system)
1014 (native-inputs
1015 `(("python" ,python-2)
1016 ("perl" ,perl)))
1017 (inputs
1018 `(("gfortran" ,gfortran)
1019 ("lapack" ,lapack)
1020 ("superlu" ,superlu)
1021 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
1022 ;; leaving out opengl, as configuration seems to only be for mac
1023 ))
1024 (arguments
1025 `(#:test-target "test"
1026 #:parallel-build? #f ;build is parallel by default
1027 #:configure-flags
1028 `("--with-mpi=0"
1029 "--with-openmp=1"
1030 "--with-superlu=1"
1031 ,(string-append "--with-superlu-include="
1032 (assoc-ref %build-inputs "superlu") "/include")
1033 ,(string-append "--with-superlu-lib="
1034 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
1035 #:phases
1036 (modify-phases %standard-phases
1037 (replace 'configure
1038 ;; PETSc's configure script is actually a python script, so we can't
1039 ;; run it with bash.
1040 (lambda* (#:key outputs (configure-flags '())
1041 #:allow-other-keys)
1042 (let* ((prefix (assoc-ref outputs "out"))
1043 (flags `(,(string-append "--prefix=" prefix)
1044 ,@configure-flags)))
1045 (format #t "build directory: ~s~%" (getcwd))
1046 (format #t "configure flags: ~s~%" flags)
1047 (zero? (apply system* "./configure" flags)))))
1048 (add-after 'configure 'clean-local-references
1049 (lambda* (#:key inputs outputs #:allow-other-keys)
1050 (let ((out (assoc-ref outputs "out")))
1051 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
1052 ;; Prevent build directory from leaking into compiled code
1053 (((getcwd)) out)
1054 ;; Scrub timestamp for reproducibility
1055 ((".*Libraries compiled on.*") ""))
1056 #t)))
1057 (add-after 'install 'clean-install
1058 ;; Try to keep installed files from leaking build directory names.
1059 (lambda* (#:key inputs outputs #:allow-other-keys)
1060 (let ((out (assoc-ref outputs "out")))
1061 (substitute* (map (lambda (file)
1062 (string-append out "/lib/petsc/conf/" file))
1063 '("petscvariables"))
1064 (((getcwd)) out))
1065 ;; Make compiler references point to the store
1066 (substitute* (string-append out "/lib/petsc/conf/petscvariables")
1067 (("= (gcc|g\\+\\+|gfortran)" _ compiler)
1068 (string-append "= " (which compiler))))
1069 ;; PETSc installs some build logs, which aren't necessary.
1070 (for-each (lambda (file)
1071 (let ((f (string-append out "/lib/petsc/conf/" file)))
1072 (when (file-exists? f)
1073 (delete-file f))))
1074 '("configure.log" "make.log" "gmake.log"
1075 "test.log" "error.log" "RDict.db"
1076 "PETScBuildInternal.cmake"
1077 ;; Once installed, should uninstall with Guix
1078 "uninstall.py"))
1079 #t))))))
1080 (home-page "http://www.mcs.anl.gov/petsc")
1081 (synopsis "Library to solve PDEs")
1082 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
1083 data structures and routines for the scalable (parallel) solution of
1084 scientific applications modeled by partial differential equations.")
1085 (license (license:non-copyleft
1086 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
1087
1088 (define-public petsc-complex
1089 (package (inherit petsc)
1090 (name "petsc-complex")
1091 (arguments
1092 (substitute-keyword-arguments (package-arguments petsc)
1093 ((#:configure-flags cf)
1094 `(cons "--with-scalar-type=complex" ,cf))))
1095 (synopsis "Library to solve PDEs (with complex scalars)")))
1096
1097 (define-public petsc-openmpi
1098 (package (inherit petsc)
1099 (name "petsc-openmpi")
1100 (inputs
1101 `(("openmpi" ,openmpi)
1102 ,@(package-inputs petsc)))
1103 (arguments
1104 (substitute-keyword-arguments (package-arguments petsc)
1105 ((#:configure-flags cf)
1106 ``("--with-mpiexec=mpirun"
1107 ,(string-append "--with-mpi-dir="
1108 (assoc-ref %build-inputs "openmpi"))
1109 ,@(delete "--with-mpi=0" ,cf)))))
1110 (synopsis "Library to solve PDEs (with MPI support)")))
1111
1112 (define-public petsc-complex-openmpi
1113 (package (inherit petsc-complex)
1114 (name "petsc-complex-openmpi")
1115 (inputs
1116 `(("openmpi" ,openmpi)
1117 ,@(package-inputs petsc-complex)))
1118 (arguments
1119 (substitute-keyword-arguments (package-arguments petsc-complex)
1120 ((#:configure-flags cf)
1121 ``("--with-mpiexec=mpirun"
1122 ,(string-append "--with-mpi-dir="
1123 (assoc-ref %build-inputs "openmpi"))
1124 ,@(delete "--with-mpi=0" ,cf)))))
1125 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
1126
1127 (define-public slepc
1128 (package
1129 (name "slepc")
1130 (version "3.7.1")
1131 (source
1132 (origin
1133 (method url-fetch)
1134 (uri (string-append "http://slepc.upv.es/download/download.php?"
1135 "filename=slepc-" version ".tar.gz"))
1136 (file-name (string-append name "-" version ".tar.gz"))
1137 (sha256
1138 (base32
1139 "1hijlmrvxvfqslnx8yydzw5xqbsn1yy02g32w0hln1z3cgr1c0k7"))))
1140 (build-system gnu-build-system)
1141 (native-inputs
1142 `(("python" ,python-2)))
1143 (inputs
1144 `(("arpack" ,arpack-ng)
1145 ("gfortran" ,gfortran)))
1146 (propagated-inputs
1147 `(("petsc" ,petsc)))
1148 (arguments
1149 `(#:parallel-build? #f ;build is parallel by default
1150 #:configure-flags
1151 `(,(string-append "--with-arpack-dir="
1152 (assoc-ref %build-inputs "arpack") "/lib"))
1153 #:phases
1154 (modify-phases %standard-phases
1155 (replace 'configure
1156 ;; configure is a python script, so we can't run it with bash.
1157 (lambda* (#:key inputs outputs (configure-flags '())
1158 #:allow-other-keys)
1159 (let* ((prefix (assoc-ref outputs "out"))
1160 (flags `(,(string-append "--prefix=" prefix)
1161 ,@configure-flags)))
1162 (format #t "build directory: ~s~%" (getcwd))
1163 (format #t "configure flags: ~s~%" flags)
1164 (setenv "SLEPC_DIR" (getcwd))
1165 (setenv "PETSC_DIR" (assoc-ref inputs "petsc"))
1166 (zero? (apply system* "./configure" flags)))))
1167 (add-after 'install 'delete-doc
1168 ;; TODO: SLEPc installs HTML documentation alongside headers in
1169 ;; $out/include. We'd like to move them to share/doc, but delete
1170 ;; them for now, as they are incomplete and installing the complete
1171 ;; documentation is difficult.
1172 (lambda* (#:key outputs #:allow-other-keys)
1173 (let* ((out (assoc-ref outputs "out")))
1174 (for-each delete-file (find-files out "\\.html$")))))
1175 (add-after 'install 'clean-install
1176 ;; Clean up unnecessary build logs from installation.
1177 (lambda* (#:key outputs #:allow-other-keys)
1178 (let ((out (assoc-ref outputs "out")))
1179 (for-each (lambda (file)
1180 (let ((f (string-append out "/lib/slepc/conf/" file)))
1181 (when (file-exists? f)
1182 (delete-file f))))
1183 '("configure.log" "make.log" "gmake.log"
1184 "test.log" "error.log" "RDict.db"
1185 "uninstall.py"))))))))
1186 (home-page "http://slepc.upv.es")
1187 (synopsis "Scalable library for eigenproblems")
1188 (description "SLEPc is a software library for the solution of large sparse
1189 eigenproblems on parallel computers. It can be used for the solution of
1190 linear eigenvalue problems formulated in either standard or generalized form,
1191 as well as other related problems such as the singular value decomposition.
1192 The emphasis of the software is on methods and techniques appropriate for
1193 problems in which the associated matrices are sparse, for example, those
1194 arising after the discretization of partial differential equations.")
1195 (license license:lgpl3)))
1196
1197 (define-public slepc-complex
1198 (package (inherit slepc)
1199 (name "slepc-complex")
1200 (propagated-inputs
1201 `(("petsc" ,petsc-complex)
1202 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
1203 (synopsis "Scalable library for eigenproblems (with complex scalars)")))
1204
1205 (define-public slepc-openmpi
1206 (package (inherit slepc)
1207 (name "slepc-openmpi")
1208 (inputs
1209 `(("mpi" ,openmpi)
1210 ("arpack" ,arpack-ng-openmpi)
1211 ,@(alist-delete "arpack" (package-inputs slepc))))
1212 (propagated-inputs
1213 `(("petsc" ,petsc-openmpi)
1214 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
1215 (synopsis "Scalable library for eigenproblems (with MPI support)")))
1216
1217 (define-public slepc-complex-openmpi
1218 (package (inherit slepc-openmpi)
1219 (name "slepc-complex-openmpi")
1220 (propagated-inputs
1221 `(("petsc" ,petsc-complex-openmpi)
1222 ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
1223 (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
1224
1225 (define-public mumps
1226 (package
1227 (name "mumps")
1228 (version "5.0.1")
1229 (source
1230 (origin
1231 (method url-fetch)
1232 (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
1233 version ".tar.gz"))
1234 (sha256
1235 (base32
1236 "1820jfp3mbl7n85765v5mp6p0gzqpgr4d2lrnhwj4gl7cwp5ndah"))
1237 (patches (search-patches "mumps-build-parallelism.patch"))))
1238 (build-system gnu-build-system)
1239 (inputs
1240 `(("fortran" ,gfortran)
1241 ;; These are required for linking against mumps, but we let the user
1242 ;; declare the dependency.
1243 ("blas" ,openblas)
1244 ("metis" ,metis)
1245 ("scotch" ,scotch)))
1246 (arguments
1247 `(#:modules ((ice-9 match)
1248 (ice-9 popen)
1249 (srfi srfi-1)
1250 ,@%gnu-build-system-modules)
1251 #:phases
1252 (modify-phases %standard-phases
1253 (replace
1254 'configure
1255 (lambda* (#:key inputs #:allow-other-keys)
1256 (call-with-output-file "Makefile.inc"
1257 (lambda (port)
1258 (format port "
1259 PLAT =
1260 LIBEXT = .a
1261 OUTC = -o
1262 OUTF = -o
1263 RM = rm -f~:[
1264 CC = gcc
1265 FC = gfortran
1266 FL = gfortran
1267 INCSEQ = -I$(topdir)/libseq
1268 LIBSEQ = -L$(topdir)/libseq -lmpiseq
1269 LIBSEQNEEDED = libseqneeded~;
1270 CC = mpicc
1271 FC = mpifort
1272 FL = mpifort~]
1273 AR = ar vr # rules require trailing space, ugh...
1274 RANLIB = ranlib
1275 LIBBLAS = -L~a -lopenblas~@[
1276 SCALAP = -L~a -lscalapack~]
1277 LIBOTHERS = -pthread
1278 CDEFS = -DAdd_
1279 PIC = -fPIC
1280 OPTF = -O2 -DALLOW_NON_INIT $(PIC)
1281 OPTL = -O2 $(PIC)
1282 OPTC = -O2 $(PIC)
1283 INCS = $(INCSEQ)
1284 LIBS = $(SCALAP) $(LIBSEQ)
1285 LPORDDIR = $(topdir)/PORD/lib
1286 IPORD = -I$(topdir)/PORD/include
1287 LPORD = -L$(LPORDDIR) -lpord
1288 ORDERINGSF = -Dpord~@[
1289 METISDIR = ~a
1290 IMETIS = -I$(METISDIR)/include
1291 LMETIS = -L$(METISDIR)/lib -lmetis
1292 ORDERINGSF += -Dmetis~]~@[~:{
1293 SCOTCHDIR = ~a
1294 ISCOTCH = -I$(SCOTCHDIR)/include
1295 LSCOTCH = -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
1296 ORDERINGSF += ~a~}~]
1297 ORDERINGSC = $(ORDERINGSF)
1298 LORDERINGS = $(LPORD) $(LMETIS) $(LSCOTCH)
1299 IORDERINGSF = $(ISCOTCH)
1300 IORDERINGSC = $(IPORD) $(IMETIS) $(ISCOTCH)"
1301 (assoc-ref inputs "mpi")
1302 (assoc-ref inputs "blas")
1303 (assoc-ref inputs "scalapack")
1304 (assoc-ref inputs "metis")
1305 (match (list (assoc-ref inputs "pt-scotch")
1306 (assoc-ref inputs "scotch"))
1307 ((#f #f)
1308 #f)
1309 ((#f scotch)
1310 `((,scotch "" "-Dscotch")))
1311 ((ptscotch _)
1312 `((,ptscotch
1313 "-lptesmumps -lptscotch -lptscotcherr "
1314 "-Dptscotch")))))))))
1315 (replace
1316 'build
1317 ;; By default only the d-precision library is built. Make with "all"
1318 ;; target so that all precision libraries and examples are built.
1319 (lambda _
1320 (zero? (system* "make" "all"
1321 (format #f "-j~a" (parallel-job-count))))))
1322 (replace
1323 'check
1324 ;; Run the simple test drivers, which read test input from stdin:
1325 ;; from the "real" input for the single- and double-precision
1326 ;; testers, and from the "cmplx" input for complex-precision
1327 ;; testers. The EXEC-PREFIX key is used by the mumps-openmpi
1328 ;; package to prefix execution with "mpirun".
1329 (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
1330 (with-directory-excursion "examples"
1331 (every
1332 (lambda (prec type)
1333 (let ((tester (apply open-pipe*
1334 `(,OPEN_WRITE
1335 ,@exec-prefix
1336 ,(string-append "./" prec
1337 "simpletest"))))
1338 (input (open-input-file
1339 (string-append "input_simpletest_" type))))
1340 (begin
1341 (dump-port input tester)
1342 (close-port input)
1343 (zero? (close-pipe tester)))))
1344 '("s" "d" "c" "z")
1345 '("real" "real" "cmplx" "cmplx")))))
1346 (replace
1347 'install
1348 (lambda* (#:key outputs #:allow-other-keys)
1349 (let ((out (assoc-ref outputs "out")))
1350 (copy-recursively "lib" (string-append out "/lib"))
1351 (copy-recursively "include" (string-append out "/include"))
1352 (when (file-exists? "libseq/libmpiseq.a")
1353 (copy-file "libseq/libmpiseq.a"
1354 (string-append out "/lib/libmpiseq.a")))))))))
1355 (home-page "http://mumps.enseeiht.fr")
1356 (synopsis "Multifrontal sparse direct solver")
1357 (description
1358 "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
1359 sparse system of linear equations A x = b using Guassian elimination.")
1360 (license license:cecill-c)))
1361
1362 (define-public mumps-metis
1363 (package (inherit mumps)
1364 (name "mumps-metis")
1365 (inputs
1366 (alist-delete "scotch" (package-inputs mumps)))))
1367
1368 (define-public mumps-openmpi
1369 (package (inherit mumps)
1370 (name "mumps-openmpi")
1371 (inputs
1372 `(("mpi" ,openmpi)
1373 ("scalapack" ,scalapack)
1374 ("pt-scotch" ,pt-scotch)
1375 ,@(alist-delete "scotch" (package-inputs mumps))))
1376 (arguments
1377 (substitute-keyword-arguments (package-arguments mumps)
1378 ((#:phases phases)
1379 `(modify-phases ,phases
1380 (replace
1381 'check
1382 (lambda _
1383 ((assoc-ref ,phases 'check)
1384 #:exec-prefix '("mpirun" "-n" "2"))))))))
1385 (synopsis "Multifrontal sparse direct solver (with MPI)")))
1386
1387 (define-public mumps-metis-openmpi
1388 (package (inherit mumps-openmpi)
1389 (name "mumps-metis-openmpi")
1390 (inputs
1391 (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
1392
1393 (define-public r-quadprog
1394 (package
1395 (name "r-quadprog")
1396 (version "1.5-5")
1397 (source
1398 (origin
1399 (method url-fetch)
1400 (uri (cran-uri "quadprog" version))
1401 (sha256
1402 (base32
1403 "0jg3r6abmhp8r9vkbhpx9ldjfw6vyl1m4c5vwlyjhk1mi03656fr"))))
1404 (build-system r-build-system)
1405 (native-inputs
1406 `(("gfortran" ,gfortran)))
1407 (home-page "http://cran.r-project.org/web/packages/quadprog")
1408 (synopsis "Functions to solve quadratic programming problems")
1409 (description
1410 "This package contains routines and documentation for solving quadratic
1411 programming problems.")
1412 (license license:gpl3+)))
1413
1414 (define-public r-pracma
1415 (package
1416 (name "r-pracma")
1417 (version "1.9.5")
1418 (source (origin
1419 (method url-fetch)
1420 (uri (cran-uri "pracma" version))
1421 (sha256
1422 (base32 "19nr2jlkbcdgvw3gx5hry12av565lmvqd5q4h7zlch3q13avwwl2"))))
1423 (build-system r-build-system)
1424 (propagated-inputs
1425 `(("r-quadprog" ,r-quadprog)))
1426 (home-page "http://cran.r-project.org/web/packages/pracma")
1427 (synopsis "Practical numerical math functions")
1428 (description "This package provides functions for numerical analysis and
1429 linear algebra, numerical optimization, differential equations, plus some
1430 special functions. It uses Matlab function names where appropriate to simplify
1431 porting.")
1432 (license license:gpl3+)))
1433
1434 (define-public superlu
1435 (package
1436 (name "superlu")
1437 (version "5.2.1")
1438 (source
1439 (origin
1440 (method url-fetch)
1441 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
1442 "superlu_" version ".tar.gz"))
1443 (sha256
1444 (base32 "0qzlb7cd608q62kyppd0a8c65l03vrwqql6gsm465rky23b6dyr8"))
1445 (modules '((guix build utils)))
1446 (snippet
1447 ;; Replace the non-free implementation of MC64 with a stub adapted
1448 ;; from Debian
1449 '(begin
1450 (use-modules (ice-9 regex)
1451 (ice-9 rdelim))
1452 (call-with-output-file "SRC/mc64ad.c"
1453 (lambda (port)
1454 (display "
1455 #include <stdio.h>
1456 #include <stdlib.h>
1457 void mc64id_(int *a) {
1458 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
1459 abort ();
1460 }
1461 void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
1462 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
1463 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
1464 abort ();
1465 }\n" port)))
1466 ;; Remove the corresponding license verbiage. MC64 license follows
1467 ;; a "------" line separator.
1468 (with-atomic-file-replacement "License.txt"
1469 (let ((rx (make-regexp "-{8}")))
1470 (lambda (in out)
1471 (let loop ()
1472 (let ((line (read-line in 'concat)))
1473 (unless (regexp-exec rx line)
1474 (display line out)
1475 (loop)))))))))))
1476 (build-system cmake-build-system)
1477 (native-inputs
1478 `(("tcsh" ,tcsh)))
1479 (inputs
1480 `(("blas" ,openblas)
1481 ("gfortran" ,gfortran)))
1482 (arguments
1483 `(#:configure-flags '("-Denable_blaslib:BOOL=NO" ;do not use internal cblas
1484 "-DTPL_BLAS_LIBRARIES=openblas"
1485 "-DBUILD_SHARED_LIBS:BOOL=YES"
1486 "-DCMAKE_INSTALL_LIBDIR=lib")))
1487 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
1488 (synopsis "Supernodal direct solver for sparse linear systems")
1489 (description
1490 "SuperLU is a general purpose library for the direct solution of large,
1491 sparse, nonsymmetric systems of linear equations on high performance machines.
1492 The library is written in C and is callable from either C or Fortran. The
1493 library routines perform an LU decomposition with partial pivoting and
1494 triangular system solves through forward and back substitution. The library
1495 also provides threshold-based ILU factorization preconditioners.")
1496 (license (list license:bsd-3
1497 license:gpl2+ ;EXAMPLE/*fgmr.c
1498 (license:fsf-free "file://SRC/colamd.h")))))
1499
1500 (define-public superlu-dist
1501 (package
1502 (name "superlu-dist")
1503 (version "3.3")
1504 (source
1505 (origin
1506 (method url-fetch)
1507 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
1508 "superlu_dist_" version ".tar.gz"))
1509 (sha256
1510 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
1511 (modules '((guix build utils)))
1512 (snippet
1513 ;; Replace the non-free implementation of MC64 with a stub
1514 '(begin
1515 (use-modules (ice-9 regex)
1516 (ice-9 rdelim))
1517 (call-with-output-file "SRC/mc64ad.c"
1518 (lambda (port)
1519 (display "
1520 #include <stdio.h>
1521 #include <stdlib.h>
1522 void mc64id_(int *a) {
1523 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
1524 abort ();
1525 }
1526 void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
1527 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
1528 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
1529 abort ();
1530 }\n" port)))
1531 (delete-file "SRC/mc64ad.f.bak")
1532 (substitute* "SRC/util.c" ;adjust default algorithm
1533 (("RowPerm[[:blank:]]*=[[:blank:]]*LargeDiag")
1534 "RowPerm = NOROWPERM"))))
1535 (patches (search-patches "superlu-dist-scotchmetis.patch"))))
1536 (build-system gnu-build-system)
1537 (native-inputs
1538 `(("tcsh" ,tcsh)))
1539 (inputs
1540 `(("gfortran" ,gfortran)))
1541 (propagated-inputs
1542 `(("openmpi" ,openmpi) ;headers include MPI heades
1543 ("lapack" ,lapack) ;required to link with output library
1544 ("pt-scotch" ,pt-scotch))) ;same
1545 (arguments
1546 `(#:parallel-build? #f ;race conditions using ar
1547 #:phases
1548 (alist-replace
1549 'configure
1550 (lambda* (#:key inputs outputs #:allow-other-keys)
1551 (call-with-output-file "make.inc"
1552 (lambda (port)
1553 (format port "
1554 PLAT =
1555 DSuperLUroot = ~a
1556 DSUPERLULIB = ~a/lib/libsuperlu_dist.a
1557 BLASDEF = -DUSE_VENDOR_BLAS
1558 BLASLIB = -L~a/lib -lblas
1559 PARMETISLIB = -L~a/lib \
1560 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
1561 -lscotch -lscotcherr -lscotcherrexit
1562 METISLIB = -L~:*~a/lib \
1563 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
1564 LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
1565 ARCH = ar
1566 ARCHFLAGS = cr
1567 RANLIB = ranlib
1568 CC = mpicc
1569 PIC = -fPIC
1570 CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
1571 NOOPTS = -O0 -g $(PIC)
1572 FORTRAN = mpifort
1573 FFLAGS = -O2 -g $(PIC)
1574 LOADER = $(CC)
1575 CDEFS = -DAdd_"
1576 (getcwd)
1577 (assoc-ref outputs "out")
1578 (assoc-ref inputs "lapack")
1579 (assoc-ref inputs "pt-scotch")))))
1580 (alist-cons-after
1581 'unpack 'remove-broken-symlinks
1582 (lambda _
1583 (for-each delete-file
1584 (find-files "MAKE_INC" "\\.#make\\..*")))
1585 (alist-cons-before
1586 'build 'create-install-directories
1587 (lambda* (#:key outputs #:allow-other-keys)
1588 (for-each
1589 (lambda (dir)
1590 (mkdir-p (string-append (assoc-ref outputs "out")
1591 "/" dir)))
1592 '("lib" "include")))
1593 (alist-replace
1594 'check
1595 (lambda _
1596 (with-directory-excursion "EXAMPLE"
1597 (and
1598 (zero? (system* "mpirun" "-n" "2"
1599 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
1600 (zero? (system* "mpirun" "-n" "2"
1601 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
1602 (alist-replace
1603 'install
1604 (lambda* (#:key outputs #:allow-other-keys)
1605 ;; Library is placed in lib during the build phase. Copy over
1606 ;; headers to include.
1607 (let* ((out (assoc-ref outputs "out"))
1608 (incdir (string-append out "/include")))
1609 (for-each (lambda (file)
1610 (let ((base (basename file)))
1611 (format #t "installing `~a' to `~a'~%"
1612 base incdir)
1613 (copy-file file
1614 (string-append incdir "/" base))))
1615 (find-files "SRC" ".*\\.h$"))))
1616 %standard-phases)))))))
1617 (home-page (package-home-page superlu))
1618 (synopsis "Parallel supernodal direct solver")
1619 (description
1620 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
1621 It is targeted for distributed memory parallel machines. SuperLU_DIST is
1622 implemented in ANSI C, and MPI for communications.")
1623 (license license:bsd-3)))
1624
1625 (define-public scotch
1626 (package
1627 (name "scotch")
1628 (version "6.0.4")
1629 (source
1630 (origin
1631 (method url-fetch)
1632 (uri (string-append "https://gforge.inria.fr/frs/download.php/34618/"
1633 "scotch_" version ".tar.gz"))
1634 (sha256
1635 (base32 "1ir088mvrqggyqdkx9qfynmiaffqbyih5qfl5mga2nrlm1qlsgzm"))
1636 (patches (search-patches "scotch-test-threading.patch"
1637 "pt-scotch-build-parallelism.patch"))))
1638 (build-system gnu-build-system)
1639 (inputs
1640 `(("zlib" ,zlib)
1641 ("flex" ,flex)
1642 ("bison" ,bison)))
1643 (arguments
1644 `(#:phases
1645 (modify-phases %standard-phases
1646 (add-after
1647 'unpack 'chdir-to-src
1648 (lambda _ (chdir "src")))
1649 (replace
1650 'configure
1651 (lambda _
1652 (call-with-output-file "Makefile.inc"
1653 (lambda (port)
1654 (format port "
1655 EXE =
1656 LIB = .a
1657 OBJ = .o
1658 MAKE = make
1659 AR = ar
1660 ARFLAGS = -ruv
1661 CAT = cat
1662 CCS = gcc
1663 CCP = mpicc
1664 CCD = gcc
1665 CPPFLAGS =~{ -D~a~}
1666 CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
1667 LDFLAGS = -lz -lm -lrt -lpthread
1668 CP = cp
1669 LEX = flex -Pscotchyy -olex.yy.c
1670 LN = ln
1671 MKDIR = mkdir
1672 MV = mv
1673 RANLIB = ranlib
1674 YACC = bison -pscotchyy -y -b y
1675 "
1676 '("COMMON_FILE_COMPRESS_GZ"
1677 "COMMON_PTHREAD"
1678 "COMMON_RANDOM_FIXED_SEED"
1679 ;; Prevents symbolc clashes with libesmumps
1680 "SCOTCH_RENAME"
1681 ;; XXX: Causes invalid frees in superlu-dist tests
1682 ;; "SCOTCH_PTHREAD"
1683 ;; "SCOTCH_PTHREAD_NUMBER=2"
1684 "restrict=__restrict"))))))
1685 (add-after
1686 'build 'build-esmumps
1687 (lambda _
1688 (zero? (system* "make"
1689 (format #f "-j~a" (parallel-job-count))
1690 "esmumps"))))
1691 (replace
1692 'install
1693 (lambda* (#:key outputs #:allow-other-keys)
1694 (let ((out (assoc-ref outputs "out")))
1695 (mkdir out)
1696 (zero? (system* "make"
1697 (string-append "prefix=" out)
1698 "install"))
1699 ;; esmumps files are not installed with the above
1700 (for-each (lambda (f)
1701 (copy-file f (string-append out "/include/" f)))
1702 (find-files "../include" ".*esmumps.h$"))
1703 (for-each (lambda (f)
1704 (copy-file f (string-append out "/lib/" f)))
1705 (find-files "../lib" "^lib.*esmumps.*"))))))))
1706 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
1707 (synopsis "Programs and libraries for graph algorithms")
1708 (description "SCOTCH is a set of programs and libraries which implement
1709 the static mapping and sparse matrix reordering algorithms developed within
1710 the SCOTCH project. Its purpose is to apply graph theory, with a divide and
1711 conquer approach, to scientific computing problems such as graph and mesh
1712 partitioning, static mapping, and sparse matrix ordering, in application
1713 domains ranging from structural mechanics to operating systems or
1714 bio-chemistry.")
1715 ;; See LICENSE_en.txt
1716 (license license:cecill-c)))
1717
1718 (define-public pt-scotch
1719 (package (inherit scotch)
1720 (name "pt-scotch")
1721 (propagated-inputs
1722 `(("openmpi" ,openmpi))) ;Headers include MPI headers
1723 (arguments
1724 (substitute-keyword-arguments (package-arguments scotch)
1725 ((#:phases scotch-phases)
1726 `(modify-phases ,scotch-phases
1727 (replace
1728 'build
1729 (lambda _
1730 (and
1731 (zero? (system* "make"
1732 (format #f "-j~a" (parallel-job-count))
1733 "ptscotch" "ptesmumps"))
1734 ;; Install the serial metis compatibility library
1735 (zero? (system* "make" "-C" "libscotchmetis" "install")))))
1736 (replace
1737 'check
1738 (lambda _ (zero? (system* "make" "ptcheck"))))))))
1739 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
1740
1741 (define-public metis
1742 (package
1743 (name "metis")
1744 (version "5.1.0")
1745 (source
1746 (origin
1747 (method url-fetch)
1748 (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
1749 "metis-" version ".tar.gz"))
1750 (sha256
1751 (base32
1752 "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
1753 (build-system cmake-build-system)
1754 (inputs
1755 `(("blas" ,openblas)))
1756 (arguments
1757 `(#:tests? #f ;no tests
1758 #:configure-flags `("-DSHARED=ON"
1759 ,(string-append "-DGKLIB_PATH=" (getcwd)
1760 "/metis-" ,version "/GKlib"))))
1761 (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
1762 (synopsis "Graph partitioning and fill-reducing matrix ordering library")
1763 (description
1764 "METIS is a set of serial programs for partitioning graphs, partitioning
1765 finite element meshes, and producing fill-reducing orderings for sparse
1766 matrices. The algorithms implemented in METIS are based on the multilevel
1767 recursive-bisection, multilevel k-way, and multi-constraint partitioning
1768 schemes.")
1769 (license license:asl2.0))) ;As of version 5.0.3
1770
1771 (define-public p4est
1772 (package
1773 (name "p4est")
1774 (version "1.1")
1775 (source
1776 (origin
1777 (method url-fetch)
1778 (uri (string-append "http://p4est.github.io/release/p4est-"
1779 version ".tar.gz"))
1780 (sha256
1781 (base32
1782 "0faina2h5qsx3m2izbzaj9bbakma1krbbjmq43wrp1hcbyijflqb"))))
1783 (build-system gnu-build-system)
1784 (inputs
1785 `(("fortran" ,gfortran)
1786 ("blas" ,openblas)
1787 ("lapack" ,lapack)
1788 ("zlib" ,zlib)))
1789 (arguments
1790 `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
1791 (assoc-ref %build-inputs "blas")
1792 " -lopenblas")
1793 ,(string-append "LAPACK_LIBS=-L"
1794 (assoc-ref %build-inputs "lapack")
1795 " -llapack"))))
1796 (home-page "http://www.p4est.org")
1797 (synopsis "Adaptive mesh refinement on forests of octrees")
1798 (description
1799 "The p4est software library enables the dynamic management of a
1800 collection of adaptive octrees, conveniently called a forest of octrees.
1801 p4est is designed to work in parallel and scales to hundreds of thousands of
1802 processor cores.")
1803 (license license:gpl2+)))
1804
1805 (define-public p4est-openmpi
1806 (package (inherit p4est)
1807 (name "p4est-openmpi")
1808 (inputs
1809 `(("mpi" ,openmpi)
1810 ,@(package-inputs p4est)))
1811 (arguments
1812 (substitute-keyword-arguments (package-arguments p4est)
1813 ((#:configure-flags cf)
1814 ``("--enable-mpi" ,@,cf))))
1815 (synopsis "Parallel adaptive mesh refinement on forests of octrees")))
1816
1817 (define-public gsegrafix
1818 (package
1819 (name "gsegrafix")
1820 (version "1.0.6")
1821 (source
1822 (origin
1823 (method url-fetch)
1824 (uri (string-append "mirror://gnu/" name "/" name "-"
1825 version ".tar.gz"))
1826 (sha256
1827 (base32
1828 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
1829 (build-system gnu-build-system)
1830 (arguments
1831 `(#:configure-flags '("LDFLAGS=-lm")))
1832 (inputs
1833 `(("libgnomecanvas" ,libgnomecanvas)
1834 ("libbonoboui" ,libbonoboui)
1835 ("libgnomeui" ,libgnomeui)
1836 ("libgnomeprintui" ,libgnomeprintui)
1837 ("popt" ,popt)))
1838 (native-inputs
1839 `(("pkg-config" ,pkg-config)))
1840 (home-page "http://www.gnu.org/software/gsegrafix/")
1841 (synopsis "GNOME application to create scientific and engineering plots")
1842 (description "GSEGrafix is an application which produces high-quality graphical
1843 plots for science and engineering. Plots are specified via simple ASCII
1844 parameter files and data files and are presented in an anti-aliased GNOME
1845 canvas. The program supports rectangular two-dimensional plots, histograms,
1846 polar-axis plots and three-dimensional plots. Plots can be printed or saved
1847 to BMP, JPEG or PNG image formats.")
1848 (license license:gpl3+)))
1849
1850 (define-public maxima
1851 (package
1852 (name "maxima")
1853 (version "5.36.1")
1854 (source
1855 (origin
1856 (method url-fetch)
1857 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
1858 version "-source/" name "-" version ".tar.gz"))
1859 (sha256
1860 (base32
1861 "0x1rk659sn3cq0n5c90848ilzr1gb1wf0072fl6jhkdq00qgh2s0"))
1862 (patches (search-patches "maxima-defsystem-mkdir.patch"))))
1863 (build-system gnu-build-system)
1864 (inputs
1865 `(("gcl" ,gcl)
1866 ("gnuplot" ,gnuplot) ;for plots
1867 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
1868 (native-inputs
1869 `(("texinfo" ,texinfo)
1870 ("perl" ,perl)))
1871 (arguments
1872 `(#:configure-flags
1873 (list "--enable-gcl"
1874 (string-append "--with-posix-shell="
1875 (assoc-ref %build-inputs "bash")
1876 "/bin/sh")
1877 (string-append "--with-wish="
1878 (assoc-ref %build-inputs "tk")
1879 "/bin/wish"
1880 (let ((v ,(package-version tk)))
1881 (string-take v (string-index-right v #\.)))))
1882 ;; By default Maxima attempts to write temporary files to
1883 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
1884 ;; Work around that.
1885 #:make-flags (list "TMPDIR=/tmp")
1886 #:phases (alist-cons-before
1887 'check 'pre-check
1888 (lambda _
1889 (chmod "src/maxima" #o555))
1890 ;; Make sure the doc and emacs files are found in the
1891 ;; standard location. Also configure maxima to find gnuplot
1892 ;; without having it on the PATH.
1893 (alist-cons-after
1894 'install 'post-install
1895 (lambda* (#:key outputs inputs #:allow-other-keys)
1896 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
1897 (out (assoc-ref outputs "out"))
1898 (datadir (string-append out "/share/maxima/" ,version)))
1899 (with-directory-excursion out
1900 (mkdir-p "share/emacs")
1901 (mkdir-p "share/doc")
1902 (symlink
1903 (string-append datadir "/emacs/")
1904 (string-append out "/share/emacs/site-lisp"))
1905 (symlink
1906 (string-append datadir "/doc/")
1907 (string-append out "/share/doc/maxima"))
1908 (with-atomic-file-replacement
1909 (string-append datadir "/share/maxima-init.lisp")
1910 (lambda (in out)
1911 (format out "~a ~s~a~%"
1912 "(setf $gnuplot_command "
1913 (string-append gnuplot "/bin/gnuplot") ")")
1914 (dump-port in out))))))
1915 %standard-phases))))
1916 (home-page "http://maxima.sourceforge.net")
1917 (synopsis "Numeric and symbolic expression manipulation")
1918 (description "Maxima is a system for the manipulation of symbolic and
1919 numerical expressions. It yields high precision numeric results by using
1920 exact fractions, arbitrary precision integers, and variable precision floating
1921 point numbers.")
1922 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
1923 ;; Others simply say "GNU General Public License" without stating a
1924 ;; version (which implicitly means gpl1+).
1925 ;; At least one file (src/maxima.asd) says "version 2."
1926 ;; GPLv2 only is therefore the smallest subset.
1927 (license license:gpl2)))
1928
1929 (define-public wxmaxima
1930 (package
1931 (name "wxmaxima")
1932 (version "16.04.2")
1933 (source
1934 (origin
1935 (method url-fetch)
1936 (uri (string-append "mirror://sourceforge/wxmaxima/wxMaxima/"
1937 version "/" name "-" version ".tar.gz"))
1938 (sha256
1939 (base32
1940 "1fpqzk1921isiqrpgpf433ldq41924qs9sy99fl1zn5661b2l73n"))))
1941 (build-system gnu-build-system)
1942 (inputs
1943 `(("wxwidgets" ,wxwidgets)
1944 ("maxima" ,maxima)
1945 ;; Runtime support.
1946 ("adwaita-icon-theme" ,adwaita-icon-theme)
1947 ("gtk+" ,gtk+)
1948 ("shared-mime-info" ,shared-mime-info)))
1949 (arguments
1950 `(#:phases (modify-phases %standard-phases
1951 (add-after
1952 'install 'wrap-program
1953 (lambda* (#:key inputs outputs #:allow-other-keys)
1954 (wrap-program (string-append (assoc-ref outputs "out")
1955 "/bin/wxmaxima")
1956 `("PATH" ":" prefix
1957 (,(string-append (assoc-ref inputs "maxima")
1958 "/bin")))
1959 ;; For GtkFileChooserDialog.
1960 `("GSETTINGS_SCHEMA_DIR" =
1961 (,(string-append (assoc-ref inputs "gtk+")
1962 "/share/glib-2.0/schemas")))
1963 `("XDG_DATA_DIRS" ":" prefix
1964 (;; Needed by gdk-pixbuf to know supported icon formats.
1965 ,(string-append
1966 (assoc-ref inputs "shared-mime-info") "/share")
1967 ;; The default icon theme of GTK+.
1968 ,(string-append
1969 (assoc-ref inputs "adwaita-icon-theme") "/share"))))
1970 #t)))))
1971 (home-page "https://andrejv.github.io/wxmaxima/")
1972 (synopsis "Graphical user interface for the Maxima computer algebra system")
1973 (description
1974 "wxMaxima is a graphical user interface for the Maxima computer algebra
1975 system. It eases the use of Maxima by making most of its commands available
1976 through a menu system and by providing input dialogs for commands that require
1977 more than one argument. It also implements its own display engine that
1978 outputs mathematical symbols directly instead of depicting them with ASCII
1979 characters.
1980
1981 wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
1982 text and mathematical calculations to create documents, exporting of input and
1983 output to TeX, and a browser for Maxima's manual including command index and
1984 full text searching.")
1985 (license license:gpl2+)))
1986
1987 (define-public armadillo
1988 (package
1989 (name "armadillo")
1990 (version "7.500.0")
1991 (source (origin
1992 (method url-fetch)
1993 (uri (string-append "mirror://sourceforge/arma/armadillo-"
1994 version ".tar.xz"))
1995 (sha256
1996 (base32
1997 "1x98d32cgxbzbbma2ak6c37wnbpq13xxyxyd6jjvflv748mzi9ks"))))
1998 (build-system cmake-build-system)
1999 (arguments `(#:tests? #f)) ;no test target
2000 (inputs
2001 `(("openblas" ,openblas)
2002 ("lapack" ,lapack)
2003 ("arpack" ,arpack-ng)))
2004 (home-page "http://arma.sourceforge.net/")
2005 (synopsis "C++ linear algebra library")
2006 (description
2007 "Armadillo is a C++ linear algebra library, aiming towards a good balance
2008 between speed and ease of use. It is useful for algorithm development
2009 directly in C++, or quick conversion of research code into production
2010 environments. It can be used for machine learning, pattern recognition,
2011 signal processing, bioinformatics, statistics, econometrics, etc. The library
2012 provides efficient classes for vectors, matrices and cubes, as well as 150+
2013 associated functions (eg. contiguous and non-contiguous submatrix views).")
2014 (license license:mpl2.0)))
2015
2016 (define-public armadillo-for-rcpparmadillo
2017 (package (inherit armadillo)
2018 (version "7.500.0")
2019 (source (origin
2020 (method url-fetch)
2021 (uri (string-append "mirror://sourceforge/arma/armadillo-"
2022 version ".tar.xz"))
2023 (sha256
2024 (base32
2025 "1x98d32cgxbzbbma2ak6c37wnbpq13xxyxyd6jjvflv748mzi9ks"))))))
2026
2027 (define-public muparser
2028 ;; When switching download sites, muparser re-issued a 2.2.5 release with a
2029 ;; different hash. In order to make `guix package --upgrade` work correctly,
2030 ;; we set a Guix packaging revision.
2031 ;; When the next version of muparser is released, we can remove
2032 ;; UPSTREAM-VERSION and REVISION and use the plain VERSION.
2033 (let ((upstream-version "2.2.5")
2034 (revision "2"))
2035 (package
2036 (name "muparser")
2037 (version (string-append upstream-version "-" revision))
2038 (source
2039 (origin
2040 (method url-fetch)
2041 (uri (string-append "https://github.com/beltoforion/muparser/archive/v"
2042 upstream-version ".tar.gz"))
2043 (file-name (string-append name "-" version ".tar.gz"))
2044 (sha256
2045 (base32
2046 "0277qsi5l23jsck1vhn383bmvc2n9l4a1dl5r9bf7hvjv9ayyrh6"))))
2047 (build-system gnu-build-system)
2048 (arguments
2049 `(#:configure-flags '("--enable-samples=no")
2050 #:tests? #f)) ;no "check" target
2051 (home-page "http://muparser.beltoforion.de/")
2052 (synopsis "Fast parser library for mathematical expressions")
2053 (description
2054 "muParser is an extensible high performance math parser library. It is
2055 based on transforming an expression into a bytecode and precalculating constant
2056 parts of it.")
2057 (license license:expat))))
2058
2059 (define-public openblas
2060 (package
2061 (name "openblas")
2062 (version "0.2.15")
2063 (source
2064 (origin
2065 (method url-fetch)
2066 (uri (string-append "https://github.com/xianyi/OpenBLAS/tarball/v"
2067 version))
2068 (file-name (string-append name "-" version ".tar.gz"))
2069 (sha256
2070 (base32
2071 "1k5f6vjlk54qlplk5m7xkbaw6g2y7dl50lwwdv6xsbcsgsbxfcpy"))))
2072 (build-system gnu-build-system)
2073 (arguments
2074 `(#:tests? #f ;no "check" target
2075 ;; DYNAMIC_ARCH is only supported on x86. When it is disabled and no
2076 ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
2077 ;; we need to disable substitutions.
2078 #:substitutable?
2079 ,(let ((system (or (%current-target-system) (%current-system))))
2080 (or (string-prefix? "x86_64" system)
2081 (string-prefix? "i686" system)
2082 (string-prefix? "mips" system)))
2083 #:make-flags
2084 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
2085 "SHELL=bash"
2086 "NO_LAPACK=1"
2087 ;; Build the library for all supported CPUs. This allows
2088 ;; switching CPU targets at runtime with the environment variable
2089 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
2090 ;; Unfortunately, this is not supported on non-x86 architectures,
2091 ;; where it leads to failed builds.
2092 ,@(let ((system (or (%current-target-system) (%current-system))))
2093 (cond
2094 ((or (string-prefix? "x86_64" system)
2095 (string-prefix? "i686" system))
2096 '("DYNAMIC_ARCH=1"))
2097 ;; On MIPS we force the "SICORTEX" TARGET, as for the other
2098 ;; two available MIPS targets special extended instructions
2099 ;; for Loongson cores are used.
2100 ((string-prefix? "mips" system)
2101 '("TARGET=SICORTEX"))
2102 (else '()))))
2103 ;; no configure script
2104 #:phases (alist-delete 'configure %standard-phases)))
2105 (inputs
2106 `(("fortran" ,gfortran)))
2107 (native-inputs
2108 `(("cunit" ,cunit)
2109 ("perl" ,perl)))
2110 (home-page "http://www.openblas.net/")
2111 (synopsis "Optimized BLAS library based on GotoBLAS")
2112 (description
2113 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
2114 (license license:bsd-3)))
2115
2116 (define-public openlibm
2117 (package
2118 (name "openlibm")
2119 (version "0.5.1")
2120 (source
2121 (origin
2122 (method url-fetch)
2123 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
2124 version ".tar.gz"))
2125 (file-name (string-append name "-" version ".tar.gz"))
2126 (sha256
2127 (base32
2128 "11czx2z7nh6dfpz45s3xl7v38hw36jxzxfvny454bk3if14pfakq"))))
2129 (build-system gnu-build-system)
2130 (arguments
2131 `(#:make-flags
2132 (list (string-append "prefix=" (assoc-ref %outputs "out")))
2133 #:phases
2134 ;; no configure script
2135 (alist-delete 'configure %standard-phases)
2136 #:tests? #f)) ;the tests are part of the default target
2137 (home-page "http://openlibm.org/")
2138 (synopsis "Portable C mathematical library (libm)")
2139 (description
2140 "OpenLibm is an effort to have a high quality, portable, standalone C
2141 mathematical library (libm). It can be used standalone in applications and
2142 programming language implementations. The project was born out of a need to
2143 have a good libm for the Julia programming language that worked consistently
2144 across compilers and operating systems, and in 32-bit and 64-bit
2145 environments.")
2146 ;; Each architecture has its own make target, and there is none for mips.
2147 (supported-systems (delete "mips64el-linux" %supported-systems))
2148 ;; See LICENSE.md for details.
2149 (license (list license:expat
2150 license:isc
2151 license:bsd-2
2152 license:public-domain
2153 license:lgpl2.1+))))
2154
2155 (define-public openspecfun
2156 (package
2157 (name "openspecfun")
2158 (version "0.5.2")
2159 (source
2160 (origin
2161 (method url-fetch)
2162 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
2163 version ".tar.gz"))
2164 (file-name (string-append name "-" version ".tar.gz"))
2165 (sha256
2166 (base32
2167 "1y5b2h6f2k72536kym3vzy3li3bhpd23x463g7hdmjdi3cncavz1"))))
2168 (build-system gnu-build-system)
2169 (arguments
2170 '(#:tests? #f ;no "check" target
2171 #:make-flags
2172 (list (string-append "prefix=" (assoc-ref %outputs "out")))
2173 ;; no configure script
2174 #:phases (alist-delete 'configure %standard-phases)))
2175 (inputs
2176 `(("fortran" ,gfortran)))
2177 (home-page "https://github.com/JuliaLang/openspecfun")
2178 (synopsis "Collection of special mathematical functions")
2179 (description
2180 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
2181 portable package for Bessel Functions of a Complex Argument and Nonnegative
2182 Order; it contains subroutines for computing Bessel functions and Airy
2183 functions. Faddeeva allows computing the various error functions of arbitrary
2184 complex arguments (Faddeeva function, error function, complementary error
2185 function, scaled complementary error function, imaginary error function, and
2186 Dawson function); given these, one can also easily compute Voigt functions,
2187 Fresnel integrals, and similar related functions as well.")
2188 ;; Faddeeva is released under the Expat license; AMOS is included as
2189 ;; public domain software.
2190 (license (list license:expat license:public-domain))))
2191
2192 (define-public suitesparse
2193 (package
2194 (name "suitesparse")
2195 (version "4.4.3")
2196 (source
2197 (origin
2198 (method url-fetch)
2199 (uri (string-append
2200 "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-"
2201 version ".tar.gz"))
2202 (sha256
2203 (base32
2204 "100hdzr0mf4mzlwnqpmwpfw4pymgsf9n3g0ywb1yps2nk1zbkdy5"))))
2205 (build-system gnu-build-system)
2206 (arguments
2207 '(#:parallel-build? #f ;cholmod build fails otherwise
2208 #:tests? #f ;no "check" target
2209 #:make-flags
2210 (list "CC=gcc"
2211 "BLAS=-lblas"
2212 "TBB=-ltbb"
2213 "CHOLMOD_CONFIG=-DNPARTITION" ;required when METIS is not used
2214 (string-append "INSTALL_LIB="
2215 (assoc-ref %outputs "out") "/lib")
2216 (string-append "INSTALL_INCLUDE="
2217 (assoc-ref %outputs "out") "/include"))
2218 #:phases
2219 (alist-cons-before
2220 'install 'prepare-out
2221 ;; README.txt states that the target directories must exist prior to
2222 ;; running "make install".
2223 (lambda _
2224 (mkdir-p (string-append (assoc-ref %outputs "out") "/lib"))
2225 (mkdir-p (string-append (assoc-ref %outputs "out") "/include")))
2226 ;; no configure script
2227 (alist-delete 'configure %standard-phases))))
2228 (inputs
2229 `(("tbb" ,tbb)
2230 ("lapack" ,lapack)))
2231 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
2232 (synopsis "Suite of sparse matrix software")
2233 (description
2234 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
2235 multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
2236 multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
2237 simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
2238 CXSparse, a concise sparse Cholesky factorization package; and many other
2239 packages.")
2240 ;; LGPLv2.1+:
2241 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
2242 ;; GPLv2+:
2243 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
2244 (license (list license:gpl2+ license:lgpl2.1+))))
2245
2246 (define-public atlas
2247 (package
2248 (name "atlas")
2249 (version "3.10.3")
2250 (source (origin
2251 (method url-fetch)
2252 (uri (string-append "mirror://sourceforge/math-atlas/Stable/"
2253 version "/atlas" version ".tar.bz2"))
2254 (sha256
2255 (base32
2256 "1dyjlq3fiparvm8ypwk6rsmjzmnwk81l88gkishphpvc79ryp216"))))
2257 (build-system gnu-build-system)
2258 (home-page "http://math-atlas.sourceforge.net/")
2259 (inputs `(("gfortran" ,gfortran)
2260 ("lapack-tar" ,(package-source lapack))))
2261 (outputs '("out" "doc"))
2262 ;; For the moment we drop support for MIPS at it fails to compile. See
2263 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
2264 (supported-systems (delete "mips64el-linux" %supported-systems))
2265 (arguments
2266 `(#:parallel-build? #f
2267 #:parallel-tests? #f
2268
2269 ;; ATLAS tunes itself for the machine it is built on, as explained at
2270 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
2271 ;; For this reason, we want users to build it locally instead of using
2272 ;; substitutes.
2273 #:substitutable? #f
2274
2275 #:modules ((srfi srfi-26)
2276 (srfi srfi-1)
2277 (guix build gnu-build-system)
2278 (guix build utils))
2279 #:configure-flags
2280 `(;; Generate position independent code suitable for dynamic libraries
2281 ;; and use WALL timer to get more accurate timing.
2282 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
2283 ;; Set word width.
2284 "-b"
2285 ,,(if (string-match "64" (%current-system))
2286 "64"
2287 "32")
2288 ;; Disable parallel build as it gives errors: atlas_pthread.h is
2289 ;; needed to compile C files before it is generated.
2290 "-Ss" "pmake" "make -j 1"
2291 ;; Probe is failing for MIPS. We therefore define the system
2292 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
2293 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
2294 ,,@(if (string-prefix? "mips" (%current-system))
2295 (list "-A" "49" "-V" "1")
2296 (list))
2297 ;; Generate shared libraries.
2298 "--shared"
2299 ;; Build a full LAPACK library.
2300 ,(string-append "--with-netlib-lapack-tarfile="
2301 (assoc-ref %build-inputs "lapack-tar")))
2302 #:phases
2303 (modify-phases %standard-phases
2304 (add-after 'install 'install-doc
2305 (lambda* (#:key outputs inputs #:allow-other-keys)
2306 (let ((doc (string-append (assoc-ref outputs "doc")
2307 "/share/doc/atlas")))
2308 (mkdir-p doc)
2309 (fold (lambda (file previous)
2310 (and previous (zero? (system* "cp" file doc))))
2311 #t (find-files "../ATLAS/doc" ".*")))))
2312 (add-after 'check 'check-pt
2313 (lambda _ (zero? (system* "make" "ptcheck"))))
2314 ;; Fix files required to run configure.
2315 (add-before 'configure 'fix-/bin/sh
2316 (lambda _
2317 ;; Use `sh', not `/bin/sh'.
2318 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
2319 (("/bin/sh")
2320 "sh"))))
2321 ;; Fix /bin/sh in generated make files.
2322 (add-after 'configure 'fix-/bin/sh-in-generated-files
2323 (lambda _
2324 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
2325 (("/bin/sh")
2326 "sh"))))
2327 ;; ATLAS configure program does not accepts the default flags
2328 ;; passed by the 'gnu-build-system'.
2329 (replace 'configure
2330 (lambda* (#:key native-inputs inputs outputs
2331 (configure-flags '())
2332 #:allow-other-keys #:rest args)
2333 (let* ((prefix (assoc-ref outputs "out"))
2334 (bash (or (and=> (assoc-ref
2335 (or native-inputs inputs) "bash")
2336 (cut string-append <> "/bin/bash"))
2337 "/bin/sh"))
2338 (flags `(,(string-append "--prefix=" prefix)
2339 ,@configure-flags))
2340 (abs-srcdir (getcwd))
2341 (srcdir (string-append "../" (basename abs-srcdir))))
2342 (format #t "source directory: ~s (relative from build: ~s)~%"
2343 abs-srcdir srcdir)
2344 (mkdir "../build")
2345 (chdir "../build")
2346 (format #t "build directory: ~s~%" (getcwd))
2347 (format #t "configure flags: ~s~%" flags)
2348 (zero? (apply system* bash
2349 (string-append srcdir "/configure")
2350 flags))))))))
2351 (synopsis "Automatically Tuned Linear Algebra Software")
2352 (description
2353 "ATLAS is an automatically tuned linear algebra software library
2354 providing C and Fortran77 interfaces to a portably efficient BLAS
2355 implementation, as well as a few routines from LAPACK.
2356
2357 Optimization occurs at build time. For this reason, the library is built on
2358 the machine where it is installed, without resorting to pre-built substitutes.
2359
2360 Before building the library, CPU throttling should be disabled. This can be
2361 done in the BIOS, or, on GNU/Linux, with the following command:
2362
2363 @example
2364 # cpupower --governor performance
2365 @end example
2366
2367 Failure to do so will result in a library with poor performance.")
2368 (license license:bsd-3)))
2369
2370 (define-public glm
2371 (package
2372 (name "glm")
2373 (version "0.9.6.3")
2374 (source
2375 (origin
2376 (method url-fetch)
2377 (uri (string-append "mirror://sourceforge/ogl-math/glm-" version
2378 "/glm-" version ".zip"))
2379 (sha256
2380 (base32
2381 "1cnjmi033a16a95v6xfkr1bvfmkd26hzdjka8j1819hgn5b1nr8l"))))
2382 (build-system cmake-build-system)
2383 (native-inputs
2384 `(("unzip" ,unzip)))
2385 (home-page "http://glm.g-truc.net")
2386 (synopsis "OpenGL Mathematics library")
2387 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
2388 library for graphics software based on the OpenGL Shading Language (GLSL)
2389 specifications.")
2390 (license license:expat)))
2391
2392 (define-public lpsolve
2393 (package
2394 (name "lpsolve")
2395 (version "5.5.2.0")
2396 (source
2397 (origin
2398 (method url-fetch)
2399 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
2400 "/lp_solve_" version "_source.tar.gz"))
2401 (sha256
2402 (base32
2403 "176c7f023mb6b8bfmv4rfqnrlw88lsg422ca74zjh19i2h5s69sq"))
2404 (modules '((guix build utils)))
2405 (snippet
2406 '(substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
2407 (("^c=cc") "c=gcc")
2408 ;; Pretend to be on a 64 bit platform to obtain a common directory
2409 ;; name for the build results on all architectures; nothing else
2410 ;; seems to depend on it.
2411 (("^PLATFORM=.*$") "PLATFORM=ux64\n")
2412
2413 ;; The check for 'isnan' as it is written fails with
2414 ;; "non-floating-point argument in call to function
2415 ;; ‘__builtin_isnan’", which leads to the 'NOISNAN' cpp macro
2416 ;; definition, which in turn leads to bad things. Fix the feature
2417 ;; test.
2418 (("isnan\\(0\\)") "isnan(0.)")))))
2419 (build-system gnu-build-system)
2420 (arguments
2421 `(#:tests? #f ; no check target
2422 #:phases
2423 (modify-phases %standard-phases
2424 (delete 'configure)
2425 (replace 'build
2426 (lambda _
2427 (and (with-directory-excursion "lpsolve55"
2428 (zero? (system* "bash" "ccc")))
2429 (with-directory-excursion "lp_solve"
2430 (zero? (system* "bash" "ccc"))))))
2431 (replace 'install
2432 (lambda* (#:key outputs #:allow-other-keys)
2433 (let* ((out (assoc-ref outputs "out"))
2434 (bin (string-append out "/bin"))
2435 (lib (string-append out "/lib"))
2436 ;; This is where LibreOffice expects to find the header
2437 ;; files, and where they are installed by Debian.
2438 (include (string-append out "/include/lpsolve")))
2439 (mkdir-p lib)
2440 (copy-file "lpsolve55/bin/ux64/liblpsolve55.a"
2441 (string-append lib "/liblpsolve55.a"))
2442 (copy-file "lpsolve55/bin/ux64/liblpsolve55.so"
2443 (string-append lib "/liblpsolve55.so"))
2444 (install-file "lp_solve/bin/ux64/lp_solve" bin)
2445
2446 ;; Install a subset of the header files as on Debian
2447 ;; (plus lp_bit.h, which matches the regular expression).
2448 (for-each (lambda (name)
2449 (install-file name include))
2450 (find-files "." "lp_[HMSa-z].*\\.h$"))
2451 (with-directory-excursion "shared"
2452 (for-each (lambda (name)
2453 (install-file name include))
2454 (find-files "." "\\.h$")))
2455 #t))))))
2456 (home-page "http://lpsolve.sourceforge.net/")
2457 (synopsis "Mixed integer linear programming (MILP) solver")
2458 (description
2459 "lp_solve is a mixed integer linear programming solver based on the
2460 revised simplex and the branch-and-bound methods.")
2461 (license license:lgpl2.1+)))
2462
2463 (define-public dealii
2464 (package
2465 (name "dealii")
2466 (version "8.4.1")
2467 (source
2468 (origin
2469 (method url-fetch)
2470 (uri (string-append "https://github.com/dealii/dealii/releases/"
2471 "download/v" version "/dealii-" version ".tar.gz"))
2472 (sha256
2473 (base32
2474 "1bdksvvyp1rj37df1ndh8j3x9nzpc3sazw8nd0hzvnlw0qnyk800"))
2475 (modules '((guix build utils)))
2476 (snippet
2477 ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
2478 '(delete-file-recursively "bundled"))))
2479 (build-system cmake-build-system)
2480 (inputs
2481 `(("tbb" ,tbb)
2482 ("zlib" ,zlib)
2483 ("boost" ,boost)
2484 ("p4est" ,p4est)
2485 ("blas" ,openblas)
2486 ("lapack" ,lapack)
2487 ("arpack" ,arpack-ng)
2488 ("muparser" ,muparser)
2489 ("gfortran" ,gfortran)
2490 ("suitesparse" ,suitesparse))) ;for UMFPACK
2491 (arguments
2492 `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease
2493 #:configure-flags '("-DCOMPAT_FILES=OFF") ;Follow new directory structure
2494 #:phases (modify-phases %standard-phases
2495 (add-after
2496 'install 'hint-example-prefix
2497 ;; Set Cmake hints in examples so that they can find this
2498 ;; deal.II when configuring.
2499 (lambda* (#:key outputs #:allow-other-keys)
2500 (let* ((out (assoc-ref %outputs "out"))
2501 (exmpl (string-append out "/share/doc"
2502 "/dealii/examples")))
2503 (substitute* (find-files exmpl "CMakeLists.txt")
2504 (("([[:space:]]*HINTS.*)\n" _ line)
2505 (string-append line " $ENV{HOME}/.guix-profile "
2506 out "\n")))
2507 #t))))))
2508 (home-page "https://www.dealii.org")
2509 (synopsis "Finite element library")
2510 (description
2511 "Deal.II is a C++ program library targeted at the computational solution
2512 of partial differential equations using adaptive finite elements. The main
2513 aim of deal.II is to enable rapid development of modern finite element codes,
2514 using among other aspects adaptive meshes and a wide array of tools often used
2515 in finite element programs.")
2516 (license license:lgpl2.1+)))
2517
2518 (define-public dealii-openmpi
2519 (package (inherit dealii)
2520 (name "dealii-openmpi")
2521 (inputs
2522 `(("mpi" ,openmpi)
2523 ;;Supported only with MPI:
2524 ("p4est" ,p4est-openmpi)
2525 ("petsc" ,petsc-openmpi)
2526 ("slepc" ,slepc-openmpi)
2527 ("metis" ,metis) ;for MUMPS
2528 ("scalapack" ,scalapack) ;for MUMPS
2529 ("mumps" ,mumps-metis-openmpi) ;configure supports only metis orderings
2530 ("arpack" ,arpack-ng-openmpi)
2531 ,@(fold alist-delete (package-inputs dealii)
2532 '("p4est" "arpack"))))
2533 (arguments
2534 (substitute-keyword-arguments (package-arguments dealii)
2535 ((#:configure-flags cf)
2536 ``("-DMPI_C_COMPILER=mpicc"
2537 "-DMPI_CXX_COMPILER=mpicxx"
2538 "-DMPI_Fortran_COMPILER=mpifort"
2539 ,@,cf))))
2540 (synopsis "Finite element library (with MPI support)")))
2541
2542 (define-public flann
2543 (package
2544 (name "flann")
2545 (version "1.8.4")
2546 (source
2547 (origin
2548 (method url-fetch)
2549 (uri
2550 (string-append
2551 "http://www.cs.ubc.ca/research/flann/uploads/FLANN/flann-"
2552 version "-src.zip"))
2553 (sha256
2554 (base32
2555 "022w8hph7bli5zbpnk3z1qh1c2sl5hm8fw2ccim651ynn0hr7fyz"))))
2556 (build-system cmake-build-system)
2557 (native-inputs
2558 `(("unzip" ,unzip)))
2559 (inputs
2560 `(("hdf5" ,hdf5)
2561 ("octave" ,octave)
2562 ("python" ,python-2) ; print syntax
2563 ;; ("python2-numpy" ,python2-numpy) ; only required for the tests
2564 ("zlib" ,zlib)))
2565 (arguments
2566 `(;; The 'share/flann/octave' contains a .mex file, which is an ELF file
2567 ;; taken 46 MiB unstripped, and 6 MiB stripped.
2568 #:strip-directories '("lib" "lib64" "libexec"
2569 "bin" "sbin" "share/flann/octave")
2570
2571 ;; Save 12 MiB by not installing .a files. Passing
2572 ;; '-DBUILD_STATIC_LIBS=OFF' has no effect.
2573 #:phases (modify-phases %standard-phases
2574 (add-after 'install 'remove-static-libraries
2575 (lambda* (#:key outputs #:allow-other-keys)
2576 (let* ((out (assoc-ref outputs "out"))
2577 (lib (string-append out "/lib")))
2578 (for-each delete-file
2579 (find-files lib "\\.a$"))
2580 #t))))
2581
2582 #:tests? #f)) ; The test data are downloaded from the Internet.
2583 (home-page "http://www.cs.ubc.ca/research/flann/")
2584 (synopsis "Library for approximate nearest neighbors computation")
2585 (description "FLANN is a library for performing fast approximate
2586 nearest neighbor searches in high dimensional spaces. It implements a
2587 collection of algorithms and a system for automatically choosing the best
2588 algorithm and optimum parameters depending on the dataset.
2589
2590 FLANN is written in C++ and contains bindings for C, Octave and Python.")
2591 (license (license:non-copyleft "file://COPYING"
2592 "See COPYING in the distribution."))))
2593
2594 (define-public wcalc
2595 (package
2596 (name "wcalc")
2597 (version "2.5")
2598 (source
2599 (origin
2600 (method url-fetch)
2601 (uri (string-append "mirror://sourceforge/w-calc/Wcalc/" version "/"
2602 "wcalc-" version ".tar.bz2"))
2603 (sha256
2604 (base32
2605 "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
2606 (build-system gnu-build-system)
2607 (inputs
2608 `(("mpfr" ,mpfr)
2609 ("readline" ,readline)))
2610 (home-page "http://w-calc.sourceforge.net/index.php")
2611 (synopsis "Flexible command-line scientific calculator")
2612 (description "Wcalc is a very capable calculator. It has standard functions
2613 (sin, asin, and sinh for example, in either radians or degrees), many
2614 pre-defined constants (pi, e, c, etc.), support for using variables, \"active\"
2615 variables, a command history, hex/octal/binary input and output, unit
2616 conversions, embedded comments, and an expandable expression entry field. It
2617 evaluates expressions using the standard order of operations.")
2618 (license license:gpl2+)))
2619
2620 (define-public xaos
2621 (package
2622 (name "xaos")
2623 (version "3.6")
2624 (source (origin
2625 (method url-fetch)
2626 (uri (string-append "mirror://sourceforge/xaos/XaoS/" version
2627 "/xaos-" version ".tar.gz"))
2628 (sha256
2629 (base32
2630 "15cd1cx1dyygw6g2nhjqq3bsfdj8sj8m4va9n75i0f3ryww3x7wq"))))
2631 (build-system gnu-build-system)
2632 (native-inputs `(("gettext" ,gnu-gettext)))
2633 (inputs `(("libx11" ,libx11)
2634 ("zlib" ,zlib)
2635 ("libpng" ,libpng)
2636 ("gsl" ,gsl)))
2637 (arguments
2638 `(#:tests? #f ;no "check" target
2639 #:make-flags '("LOCALEDIR=$DATAROOTDIR/locale")))
2640 (synopsis "Real-time fractal zoomer")
2641 (description "GNU XaoS is a graphical program that generates fractal
2642 patterns and allows you to zoom in and out of them infinitely in a fluid,
2643 continuous manner. It also includes tutorials that help to explain how fractals
2644 are built. It can generate many different fractal types such as the Mandelbrot
2645 set.")
2646 (home-page "http://www.gnu.org/software/xaos/")
2647 (license license:gpl2+)))
2648
2649 (define-public hypre
2650 (package
2651 (name "hypre")
2652 (version "2.11.0")
2653 (source (origin
2654 (method url-fetch)
2655 (uri (string-append "https://github.com/LLNL/hypre/archive/"
2656 "v" version ".tar.gz"))
2657 (file-name (string-append name "-" version ".tar.gz"))
2658 (sha256
2659 (base32
2660 "0q69ia0jivzcr8p049dn3mg8yjpn6nwq4sw9iqac8vr63vi54l6m"))
2661 (modules '((guix build utils)))
2662 (snippet
2663 '(begin
2664 ;; Remove use of __DATE__ and __TIME__ for reproducibility;
2665 ;; substitute the tarball creation time.
2666 (substitute* "src/utilities/HYPRE_utilities.h"
2667 (("Date Compiled: .*$")
2668 "Date Compiled: Mar 28 2016 20:19:59 +0000\"\n"))
2669 #t))))
2670 (build-system gnu-build-system)
2671 (outputs '("out" ;6.1 MiB of headers and libraries
2672 "doc")) ;4.8 MiB of documentation
2673 (native-inputs
2674 `(("doc++" ,doc++)
2675 ("netpbm" ,netpbm)
2676 ("texlive" ,texlive) ;full package required for fonts
2677 ("ghostscript" ,ghostscript)))
2678 (inputs
2679 `(("blas" ,openblas)
2680 ("lapack" ,lapack)))
2681 (arguments
2682 `(#:modules ((srfi srfi-1)
2683 ,@%gnu-build-system-modules)
2684 #:configure-flags '("--enable-shared"
2685 "--disable-fortran"
2686 "--without-MPI"
2687 "--with-openmp"
2688 "--with-fei"
2689 "--with-lapack"
2690 "--with-blas")
2691 #:phases
2692 (modify-phases %standard-phases
2693 (add-before 'configure 'chdir-src
2694 (lambda _ (chdir "src")))
2695 (replace 'configure
2696 (lambda* (#:key build target configure-flags
2697 #:allow-other-keys #:rest args)
2698 (let* ((configure (assoc-ref %standard-phases 'configure)))
2699 (apply configure
2700 (append args
2701 (list #:configure-flags
2702 (cons (string-append
2703 "--host=" (or target build))
2704 configure-flags)))))))
2705 (add-after 'build 'build-docs
2706 (lambda _
2707 (zero? (system* "make" "-Cdocs" "pdf" "html"))))
2708 (replace 'check
2709 (lambda _
2710 (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/hypre/lib"))
2711 (setenv "PATH" (string-append "." ":" (getenv "PATH")))
2712 (and (system* "make" "check" "CHECKRUN=")
2713 (fold (lambda (filename result)
2714 (and result
2715 (let ((size (stat:size (stat filename))))
2716 (when (not (zero? size))
2717 (format #t "~a size ~d; error indication~%"
2718 filename size))
2719 (zero? size))))
2720 #t
2721 (find-files "test" ".*\\.err$")))))
2722 (add-after 'install 'install-docs
2723 (lambda* (#:key outputs #:allow-other-keys)
2724 ;; Custom install because docs/Makefile doesn't honor ${docdir}.
2725 (let* ((doc (assoc-ref outputs "doc"))
2726 (docdir (string-append doc "/share/doc/hypre-" ,version)))
2727 (mkdir-p docdir)
2728 (with-directory-excursion "docs"
2729 (for-each (lambda (base)
2730 (install-file (string-append base ".pdf") docdir)
2731 (copy-recursively base docdir)) ;html docs
2732 '("HYPRE_usr_manual"
2733 "HYPRE_ref_manual")))
2734 #t))))))
2735 (home-page "http://www.llnl.gov/casc/hypre/")
2736 (synopsis "Library of solvers and preconditioners for linear equations")
2737 (description
2738 "HYPRE is a software library of high performance preconditioners and
2739 solvers for the solution of large, sparse linear systems of equations. It
2740 features multigrid solvers for both structured and unstructured grid
2741 problems.")
2742 (license license:lgpl2.1)))
2743
2744 (define-public hypre-openmpi
2745 (package (inherit hypre)
2746 (name "hypre-openmpi")
2747 (inputs
2748 `(("mpi" ,openmpi)
2749 ,@(package-inputs hypre)))
2750 (arguments
2751 (substitute-keyword-arguments (package-arguments hypre)
2752 ((#:configure-flags flags)
2753 ``("--with-MPI"
2754 ,@(delete "--without-MPI" ,flags)))))
2755 (synopsis "Parallel solvers and preconditioners for linear equations")
2756 (description
2757 "HYPRE is a software library of high performance preconditioners and
2758 solvers for the solution of large, sparse linear systems of equations on
2759 parallel computers. It features parallel multigrid solvers for both
2760 structured and unstructured grid problems.")))
2761
2762 (define-public matio
2763 (package
2764 (name "matio")
2765 (version "1.5.6")
2766 (source
2767 (origin
2768 (method url-fetch)
2769 (uri (string-append "mirror://sourceforge/matio/matio/" version "/"
2770 "matio-" version ".tar.gz"))
2771 (sha256
2772 (base32
2773 "0y2qymgxank8wdiwc68ap8bxdzrhvyw86i29yh3xgn4z1njfd9ir"))))
2774 (build-system gnu-build-system)
2775 (inputs
2776 `(("zlib" ,zlib)
2777 ("hdf5" ,hdf5)))
2778 (home-page "http://matio.sourceforge.net/")
2779 (synopsis "Library for reading and writing MAT files")
2780 (description "Matio is a library for reading and writing MAT files. It
2781 supports compressed MAT files, as well as newer (version 7.3) MAT files.")
2782 (license license:bsd-2)))
2783
2784 (define-public libhilbert
2785 (package
2786 (name "libhilbert")
2787 (version "0.2-1")
2788 (source
2789 (origin
2790 (method url-fetch)
2791 (uri (string-append "http://web.cs.dal.ca/~chamilto/hilbert/"
2792 "libhilbert-" version ".tar.gz"))
2793 (sha256
2794 (base32
2795 "0v48x8405dj95gjn2saja4bzhw86d6zl6d3dg8h7dzac2qr97s34"))))
2796 (build-system gnu-build-system)
2797 (home-page "http://web.cs.dal.ca/~chamilto/hilbert")
2798 (synopsis "Hilbert indices for multidimensional data")
2799 (description "The libhilbert library can efficiently calculate Hilbert
2800 curves and order-preserving representations of Hilbert curve indices that use
2801 the same amount of space as the original point representation. This is useful
2802 when using the Gilbert curve as a space filling curve through a
2803 high-dimensional space where not all demensions have the same cardinality.")
2804 (license license:lgpl2.1+)))
2805
2806 (define-public vc
2807 (package
2808 (name "vc")
2809 (version "1.2.0")
2810 (source
2811 (origin (method url-fetch)
2812 (uri (string-append "https://github.com/VcDevel/Vc/releases/"
2813 "download/" version "/Vc-" version ".tar.gz"))
2814 (sha256
2815 (base32
2816 "1rh6dhqar3y07n4xqyml0sa0v48qv3ch9dc3yc2in855hlh4vnqi"))))
2817 (build-system cmake-build-system)
2818 (arguments
2819 '(#:configure-flags
2820 '("-DBUILD_TESTING=ON")))
2821 (synopsis "SIMD vector classes for C++")
2822 (description "Vc provides portable, zero-overhead C++ types for explicitly
2823 data-parallel programming. It is a library designed to ease explicit
2824 vectorization of C++ code. Its types enable explicitly stating data-parallel
2825 operations on multiple values. The parallelism is therefore added via the type
2826 system. Vc has an intuitive API and provides portability between different
2827 compilers and compiler versions as well as portability between different vector
2828 instruction sets. Thus, an application written with Vc can be compiled for:
2829 @enumerate
2830 @item AVX and AVX2
2831 @item SSE2 upto SSE4.2 or SSE4a
2832 @item Scalar
2833 @item MIC
2834 @item NEON (in development)
2835 @item NVIDIA GPUs / CUDA (in development)
2836 @end enumerate\n")
2837 (home-page "https://github.com/VcDevel/Vc")
2838 (license license:bsd-3)))