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