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