gnu: hdf5: Have configure honor SOURCE_DATE_EPOCH.
[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>
8f8b2451
AE
14;;;
15;;; This file is part of GNU Guix.
16;;;
17;;; GNU Guix is free software; you can redistribute it and/or modify it
18;;; under the terms of the GNU General Public License as published by
19;;; the Free Software Foundation; either version 3 of the License, or (at
20;;; your option) any later version.
21;;;
22;;; GNU Guix is distributed in the hope that it will be useful, but
23;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25;;; GNU General Public License for more details.
26;;;
27;;; You should have received a copy of the GNU General Public License
28;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
29
30(define-module (gnu packages maths)
ec322be2 31 #:use-module (ice-9 regex)
8f8b2451 32 #:use-module (gnu packages)
b5b73a82 33 #:use-module ((guix licenses) #:prefix license:)
8f8b2451
AE
34 #:use-module (guix packages)
35 #:use-module (guix download)
279663ef 36 #:use-module (guix svn-download)
0e2672ae 37 #:use-module (guix utils)
cec86422 38 #:use-module (guix build utils)
da95c817 39 #:use-module (guix build-system cmake)
c9dfa3c7 40 #:use-module (guix build-system gnu)
ec8c7e47 41 #:use-module (guix build-system r)
3de01d3f
EB
42 #:use-module (gnu packages algebra)
43 #:use-module (gnu packages bison)
a17d4564 44 #:use-module (gnu packages boost)
e73b49fb 45 #:use-module (gnu packages check)
3de01d3f 46 #:use-module (gnu packages cmake)
c9dfa3c7 47 #:use-module (gnu packages compression)
668c06ac 48 #:use-module (gnu packages curl)
528bb464 49 #:use-module (gnu packages documentation)
57e544e8 50 #:use-module (gnu packages elf)
3de01d3f 51 #:use-module (gnu packages flex)
668c06ac 52 #:use-module (gnu packages fltk)
f3929800 53 #:use-module (gnu packages fontutils)
1dba6407 54 #:use-module (gnu packages gettext)
da95c817 55 #:use-module (gnu packages gcc)
73fed4f8 56 #:use-module (gnu packages gd)
668c06ac 57 #:use-module (gnu packages ghostscript)
f3929800 58 #:use-module (gnu packages gtk)
45147b0c 59 #:use-module (gnu packages image)
668c06ac 60 #:use-module (gnu packages less)
8731e527 61 #:use-module (gnu packages lisp)
5698b8b8 62 #:use-module (gnu packages gnome)
1b39a196 63 #:use-module (gnu packages guile)
668c06ac
JD
64 #:use-module (gnu packages xorg)
65 #:use-module (gnu packages gl)
8731e527 66 #:use-module (gnu packages m4)
d8c7eeb9 67 #:use-module (gnu packages mpi)
b92eee75 68 #:use-module (gnu packages multiprecision)
528bb464 69 #:use-module (gnu packages netpbm)
668c06ac 70 #:use-module (gnu packages pcre)
5698b8b8 71 #:use-module (gnu packages popt)
c9dfa3c7
AE
72 #:use-module (gnu packages perl)
73 #:use-module (gnu packages pkg-config)
da95c817 74 #:use-module (gnu packages python)
c9dfa3c7 75 #:use-module (gnu packages readline)
2742f87e 76 #:use-module (gnu packages tbb)
183e44ae 77 #:use-module (gnu packages tcsh)
df354a77 78 #:use-module (gnu packages tcl)
668c06ac 79 #:use-module (gnu packages texinfo)
73fed4f8 80 #:use-module (gnu packages texlive)
9aafbc0c 81 #:use-module (gnu packages wxwidgets)
c12efc72 82 #:use-module (gnu packages xml)
a17d4564
EB
83 #:use-module (gnu packages zip)
84 #:use-module (srfi srfi-1))
8f8b2451 85
9c45c519
JD
86(define-public c-graph
87 (package
88 (name "c-graph")
89 (version "2.0")
90 (source (origin
91 (method url-fetch)
92 (uri (string-append "mirror://gnu/c-graph/c-graph-" version
93 ".tar.gz"))
94 (sha256 (base32
95 "1hlvpzrh7hzzf533diyfiabzskddi8zx92av9hwkjw3l46z7qv01"))))
96 (build-system gnu-build-system)
97 (inputs
98 `(("fortran" ,gfortran)))
99 (synopsis "Visualize and analyze convolution operations")
100 (description
101 "GNU C-Graph demonstrates the theory of convolution underlying
102engineering systems and signal analysis.")
103 (license license:gpl3+)
104 (home-page "http://www.gnu.org/software/c-graph/")))
105
8f8b2451
AE
106(define-public units
107 (package
108 (name "units")
cbe95057 109 (version "2.12")
8f8b2451
AE
110 (source (origin
111 (method url-fetch)
112 (uri (string-append "mirror://gnu/units/units-" version
113 ".tar.gz"))
114 (sha256 (base32
cbe95057 115 "1jxvjknz2jhq773jrwx9gc1df3gfy73yqmkjkygqxzpi318yls3q"))))
8f8b2451
AE
116 (build-system gnu-build-system)
117 (synopsis "Conversion between thousands of scales")
118 (description
574e86f9 119 "GNU Units converts numeric quantities between units of measure. It
7c125ce0
AK
120can handle scale changes through adaptive usage of standard scale
121prefixes (micro-, kilo-, etc.). It can also handle nonlinear
122conversions such as Fahrenheit to Celsius. Its interpreter is powerful
123enough to be used effectively as a scientific calculator.")
8f8b2451
AE
124 (license license:gpl3+)
125 (home-page "http://www.gnu.org/software/units/")))
c9dfa3c7 126
61a529b4
RW
127(define-public double-conversion
128 (package
129 (name "double-conversion")
130 (version "1.1.5")
131 (source (origin
132 (method url-fetch)
133 (uri (string-append
134 "https://github.com/floitsch/double-conversion/archive/v"
135 version ".tar.gz"))
136 (file-name (string-append name "-" version ".tar.gz"))
137 (sha256
138 (base32
139 "0cnr8xhyjfxijay8ymkqcph3672wp2lj23qhdmr3m4kia5kpdf83"))))
140 (build-system cmake-build-system)
141 (arguments
142 '(#:test-target "test"
143 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
144 "-DBUILD_TESTING=ON")))
145 (home-page "https://github.com/floitsch/double-conversion")
146 (synopsis "Conversion routines for IEEE doubles")
147 (description
148 "The double-conversion library provides binary-decimal and decimal-binary
149routines for IEEE doubles. The library consists of efficient conversion
150routines that have been extracted from the V8 JavaScript engine.")
151 (license license:bsd-3)))
152
182d6311
ML
153(define-public dionysus
154 (package
155 (name "dionysus")
156 (version "1.3.0")
157 (source (origin
158 (method url-fetch)
159 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
160 ".tar.gz"))
161 (sha256
162 (base32
163 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
164 (build-system gnu-build-system)
165 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
166 (synopsis "Local search for universal constants and scientific values")
167 (description
168 "GNU Dionysus is a convenient system for quickly retrieving the values of
169mathematical constants used in science and engineering. Values can be
170searched using a simple command-line tool, choosing from three databases:
171universal constants, atomic numbers, and constants related to
172semiconductors.")
173 (license license:gpl3+)
174 (home-page "http://www.gnu.org/software/dionysus/")))
175
88bd1804
AE
176(define-public gsl
177 (package
178 (name "gsl")
0534dd93 179 (version "2.1")
88bd1804
AE
180 (source
181 (origin
182 (method url-fetch)
183 (uri (string-append "mirror://gnu/gsl/gsl-"
184 version ".tar.gz"))
185 (sha256
186 (base32
0534dd93 187 "0rhcia9jhr3p1f1wybwyllwqfs9bggz99i3mi5lpyqcpff1hdbar"))))
88bd1804 188 (build-system gnu-build-system)
71e0f288 189 (arguments
5adbe65f 190 `(#:parallel-tests? #f))
88bd1804
AE
191 (home-page "http://www.gnu.org/software/gsl/")
192 (synopsis "Numerical library for C and C++")
193 (description
a22dc0c4
LC
194 "The GNU Scientific Library is a library for numerical analysis in C
195and C++. It includes a wide range of mathematical routines, with over 1000
196functions in total. Subject areas covered by the library include:
197differential equations, linear algebra, Fast Fourier Transforms and random
198numbers.")
88bd1804
AE
199 (license license:gpl3+)))
200
b92eee75
AE
201(define-public glpk
202 (package
203 (name "glpk")
f0443377 204 (version "4.60")
b92eee75
AE
205 (source
206 (origin
207 (method url-fetch)
208 (uri (string-append "mirror://gnu/glpk/glpk-"
209 version ".tar.gz"))
210 (sha256
211 (base32
f0443377 212 "15z2ymzqhxwss6wgdj5f7vkyqlqdsjgrvm0x871kmlx0n0664mhk"))))
b92eee75
AE
213 (build-system gnu-build-system)
214 (inputs
215 `(("gmp" ,gmp)))
216 (arguments
217 `(#:configure-flags '("--with-gmp")))
218 (home-page "http://www.gnu.org/software/glpk/")
79c311b8 219 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
b92eee75
AE
220 (description
221 "GLPK is a C library for solving large-scale linear programming (LP),
222mixed integer programming (MIP), and other related problems. It supports the
223GNU MathProg modeling language, a subset of the AMPL language, and features a
224translator for the language. In addition to the C library, a stand-alone
225LP/MIP solver is included in the package.")
226 (license license:gpl3+)))
227
b146763a
AE
228(define-public 4ti2
229 (package
230 (name "4ti2")
231 (version "1.6.7")
232 (source
233 (origin
234 (method url-fetch)
235 (uri (string-append "http://www.4ti2.de/version_" version
236 "/4ti2-" version ".tar.gz"))
237 (sha256
238 (base32
239 "1frix3rnm9ffr93alqzw4cavxbfpf524l8rfbmcpyhwd3n1km0yl"))))
240 (build-system gnu-build-system)
241 (native-inputs
242 `(("which" ,(@ (gnu packages base) which)))) ; for the tests
243 (inputs
244 `(("glpk" ,glpk)
245 ("gmp" ,gmp)))
246 (home-page "http://www.4ti2.de/")
247 (synopsis "Mathematical tool suite for problems on linear spaces")
248 (description
249 "4ti2 implements algorithms for solving algebraic, geometric and
250combinatorial problems on linear spaces. Among others, it solves systems
251of linear equations, computes extreme rays of polyhedral cones, solves
252integer programming problems and computes Markov bases for statistics.")
253 (license license:gpl2+)))
254
53696f10
AE
255(define-public cddlib
256 (package
257 (name "cddlib")
258 (version "0.94h")
259 (source
260 (origin
261 (method url-fetch)
262 (uri (string-append "ftp://ftp.ifor.math.ethz.ch/pub/fukuda/cdd/cddlib-"
263 (string-delete #\. version) ".tar.gz"))
264 (sha256
265 (base32
266 "1dasasscwfg793q8fwzgwf64xwj7w62yfvszpr8x8g38jka08vgy"))))
267 (build-system gnu-build-system)
268 (inputs
269 `(("gmp" ,gmp)))
270 (home-page "https://www.inf.ethz.ch/personal/fukudak/cdd_home/index.html")
271 (synopsis "Library for convex hulls and extreme rays of polyhedra")
272 (description
273 "The C-library cddlib implements the Double Description Method of
274Motzkin et al. for generating all vertices (i.e. extreme points) and extreme
275rays of a general convex polyhedron given by a system of linear inequalities
276in arbitrary dimension. It can also be used for the converse operation of
277computing convex hulls.")
278 (license license:gpl2+)))
279
865a69dd
RW
280(define-public arpack-ng
281 (package
282 (name "arpack-ng")
283 (version "3.2.0")
284 (source
285 (origin
286 (method url-fetch)
287 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
288 version ".tar.gz"))
f586c877 289 (file-name (string-append name "-" version ".tar.gz"))
865a69dd
RW
290 (sha256
291 (base32
292 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
293 (build-system gnu-build-system)
294 (home-page "https://github.com/opencollab/arpack-ng")
295 (inputs
296 `(("lapack" ,lapack)
19afbea1 297 ("fortran" ,gfortran)))
865a69dd
RW
298 (synopsis "Fortran subroutines for solving eigenvalue problems")
299 (description
300 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
301large scale eigenvalue problems.")
166191b3 302 (license (license:non-copyleft "file://COPYING"
865a69dd
RW
303 "See COPYING in the distribution."))))
304
8c94c886
EB
305(define-public arpack-ng-openmpi
306 (package (inherit arpack-ng)
307 (name "arpack-ng-openmpi")
308 (inputs
309 `(("mpi" ,openmpi)
310 ,@(package-inputs arpack-ng)))
311 (arguments `(#:configure-flags '("--enable-mpi")))
312 (synopsis "Fortran subroutines for solving eigenvalue problems with MPI")))
313
da95c817
NK
314(define-public lapack
315 (package
316 (name "lapack")
566146ab 317 (version "3.5.0")
da95c817
NK
318 (source
319 (origin
320 (method url-fetch)
321 (uri (string-append "http://www.netlib.org/lapack/lapack-"
322 version ".tgz"))
323 (sha256
324 (base32
566146ab 325 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
da95c817
NK
326 (build-system cmake-build-system)
327 (home-page "http://www.netlib.org/lapack/")
19afbea1 328 (inputs `(("fortran" ,gfortran)
da95c817
NK
329 ("python" ,python-2)))
330 (arguments
06ed5982 331 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
da95c817 332 #:phases (alist-cons-before
6a995754
LC
333 'check 'patch-python
334 (lambda* (#:key inputs #:allow-other-keys)
335 (let ((python (assoc-ref inputs "python")))
336 (substitute* "lapack_testing.py"
337 (("/usr/bin/env python") python))))
06ed5982 338 %standard-phases)))
da95c817
NK
339 (synopsis "Library for numerical linear algebra")
340 (description
341 "LAPACK is a Fortran 90 library for solving the most commonly occurring
342problems in numerical linear algebra.")
166191b3 343 (license (license:non-copyleft "file://LICENSE"
da95c817 344 "See LICENSE in the distribution."))))
73fed4f8 345
e1ff597a
EB
346(define-public scalapack
347 (package
348 (name "scalapack")
349 (version "2.0.2")
350 (source
351 (origin
352 (method url-fetch)
353 (uri (string-append "http://www.netlib.org/scalapack/scalapack-"
354 version ".tgz"))
355 (sha256
356 (base32
357 "0p1r61ss1fq0bs8ynnx7xq4wwsdvs32ljvwjnx6yxr8gd6pawx0c"))))
358 (build-system cmake-build-system)
359 (inputs
360 `(("mpi" ,openmpi)
361 ("fortran" ,gfortran)
362 ("lapack" ,lapack))) ;for testing only
363 (arguments
364 `(#:configure-flags `("-DBUILD_SHARED_LIBS:BOOL=YES")))
365 (home-page "http://www.netlib.org/scalapack/")
366 (synopsis "Library for scalable numerical linear algebra")
367 (description
368 "ScaLAPACK is a Fortran 90 library of high-performance linear algebra
369routines on parallel distributed memory machines. ScaLAPACK solves dense and
370banded linear systems, least squares problems, eigenvalue problems, and
371singular value problems.")
372 (license (license:bsd-style "file://LICENSE"
373 "See LICENSE in the distribution."))))
374
73fed4f8
JD
375(define-public gnuplot
376 (package
377 (name "gnuplot")
ec4130b7 378 (version "5.0.2")
73fed4f8
JD
379 (source
380 (origin
381 (method url-fetch)
382 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
97003b5c 383 version "/gnuplot-" version ".tar.gz"))
73fed4f8
JD
384 (sha256
385 (base32
ec4130b7 386 "146qn414z96c7cc42a1kb9a4kpjc2q2hfdwk44kjjvgmfp9k2ass"))))
73fed4f8
JD
387 (build-system gnu-build-system)
388 (inputs `(("readline" ,readline)
389 ("cairo" ,cairo)
390 ("pango" ,pango)
391 ("gd" ,gd)))
97003b5c 392 (native-inputs `(("pkg-config" ,pkg-config)
289adba7 393 ("texlive" ,texlive-minimal)))
73fed4f8
JD
394 (home-page "http://www.gnuplot.info")
395 (synopsis "Command-line driven graphing utility")
396 (description "Gnuplot is a portable command-line driven graphing
35b9e423 397utility. It was originally created to allow scientists and students to
73fed4f8 398visualize mathematical functions and data interactively, but has grown to
35b9e423 399support many non-interactive uses such as web scripting. It is also used as a
73fed4f8
JD
400plotting engine by third-party applications like Octave.")
401 ;; X11 Style with the additional restriction that derived works may only be
402 ;; distributed as patches to the original.
403 (license (license:fsf-free
a124bbd2 404 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
668c06ac 405
7ee3f1a2
JD
406(define-public hdf5
407 (package
408 (name "hdf5")
04b7a7cd 409 (version "1.8.17")
7ee3f1a2
JD
410 (source
411 (origin
412 (method url-fetch)
93c3de92
AE
413 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-"
414 version "/src/hdf5-"
7ee3f1a2
JD
415 version ".tar.bz2"))
416 (sha256
b8d9c93b
EB
417 (base32 "0sj8x0gfs5fb28gipnynb9wpkz113h8wq9sva9mxx66kv27xsdgw"))
418 (patches (list (search-patch "hdf5-config-date.patch")))))
7ee3f1a2 419 (build-system gnu-build-system)
12ed1216
AE
420 (inputs
421 `(("zlib" ,zlib)))
7ee3f1a2
JD
422 (arguments
423 `(#:phases
f622e212
EB
424 (modify-phases %standard-phases
425 (add-before 'configure 'patch-configure
426 (lambda _
427 (substitute* "configure"
b8d9c93b
EB
428 (("/bin/mv") "mv"))
429 #t))
f622e212
EB
430 (add-after 'install 'patch-references
431 (lambda* (#:key inputs outputs #:allow-other-keys)
432 (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
433 (zlib (assoc-ref inputs "zlib")))
434 (substitute* (find-files bin "h5p?cc")
435 (("-lz" lib)
436 (string-append "-L" zlib "/lib " lib)))
437 #t))))))
7ee3f1a2 438 (home-page "http://www.hdfgroup.org")
516e93f8 439 (synopsis "Management suite for extremely large and complex data")
7ee3f1a2
JD
440 (description "HDF5 is a suite that makes possible the management of
441extremely large and complex data collections.")
d4bf49b1
EB
442 (license (license:x11-style
443 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
7ee3f1a2 444
1b39a196
RJ
445(define-public nlopt
446 (package
447 (name "nlopt")
448 (version "2.4.2")
449 (source (origin
450 (method url-fetch)
451 (uri (string-append "http://ab-initio.mit.edu/nlopt/nlopt-"
452 version ".tar.gz"))
453 (sha256
454 (base32 "12cfkkhcdf4zmb6h7y6qvvdvqjs2xf9sjpa3rl3bq76px4yn76c0"))))
455 (build-system gnu-build-system)
456 (arguments
457 `(;; Shared libraries are not built by default. They are required to
458 ;; build the Guile, Octave, and Python bindings.
459 #:configure-flags '("--enable-shared")
460
461 #:phases
462 (modify-phases %standard-phases
463 (add-before 'configure 'set-libnlopt-file-name
464 (lambda* (#:key outputs #:allow-other-keys)
465 ;; Make sure the Scheme module refers to the library by its
466 ;; absolute file name (we cannot do that from a snippet
467 ;; because the expansion of @libdir@ contains
468 ;; ${exec_prefix}.)
469 (let ((out (assoc-ref outputs "out")))
470 (substitute* "swig/nlopt.scm.in"
471 (("libnlopt")
472 (string-append out "/lib/libnlopt")))
473 #t))))))
474 (inputs `(("guile" ,guile-2.0)))
475 (native-inputs `(("pkg-config" ,pkg-config)))
476 (home-page "http://ab-initio.mit.edu/wiki/")
477 (synopsis "Library for nonlinear optimization")
478 (description "NLopt is a library for nonlinear optimization, providing a
479common interface for a number of different free optimization routines available
480online as well as original implementations of various other algorithms.")
481 (license license:lgpl2.1+)))
482
7ee3f1a2 483
668c06ac
JD
484;; For a fully featured Octave, users are strongly recommended also to install
485;; the following packages: texinfo, less, ghostscript, gnuplot.
486(define-public octave
487 (package
488 (name "octave")
19659acc 489 (version "4.0.0")
668c06ac
JD
490 (source
491 (origin
492 (method url-fetch)
493 (uri (string-append "mirror://gnu/octave/octave-"
a124bbd2 494 version ".tar.gz"))
668c06ac
JD
495 (sha256
496 (base32
a124bbd2 497 "101jr9yck798586jz4vkjcgk36zksmxf1pxrzvipgn2xgyay0zjc"))))
668c06ac
JD
498 (build-system gnu-build-system)
499 (inputs
500 `(("lapack" ,lapack)
501 ("readline" ,readline)
502 ("glpk" ,glpk)
1ec78e9d
EB
503 ("fftw" ,fftw)
504 ("fftwf" ,fftwf)
505 ("arpack" ,arpack-ng)
668c06ac
JD
506 ("curl" ,curl)
507 ("pcre" ,pcre)
508 ("fltk" ,fltk)
509 ("fontconfig" ,fontconfig)
510 ("freetype" ,freetype)
40029cbe 511 ("hdf5" ,hdf5)
668c06ac
JD
512 ("libxft" ,libxft)
513 ("mesa" ,mesa)
1ec78e9d 514 ("glu" ,glu)
668c06ac
JD
515 ("zlib" ,zlib)))
516 (native-inputs
19afbea1 517 `(("gfortran" ,gfortran)
668c06ac
JD
518 ("pkg-config" ,pkg-config)
519 ("perl" ,perl)
1ec78e9d
EB
520 ;; The following inputs are not actually used in the build process.
521 ;; However, the ./configure gratuitously tests for their existence and
522 ;; assumes that programs not present at build time are also not, and
523 ;; can never be, available at run time! If these inputs are therefore
524 ;; not present, support for them will be built out. However, Octave
525 ;; will still run without them, albeit without the features they
668c06ac
JD
526 ;; provide.
527 ("less" ,less)
528 ("texinfo" ,texinfo)
529 ("ghostscript" ,ghostscript)
530 ("gnuplot" ,gnuplot)))
531 (arguments
532 `(#:configure-flags (list (string-append "--with-shell="
533 (assoc-ref %build-inputs "bash")
534 "/bin/sh"))))
535 (home-page "http://www.gnu.org/software/octave/")
536 (synopsis "High-level language for numerical computation")
1ec78e9d
EB
537 (description "GNU Octave is a high-level interpreted language that is
538specialized for numerical computations. It can be used for both linear and
539non-linear applications and it provides great support for visualizing results.
540Work may be performed both at the interactive command-line as well as via
541script files.")
668c06ac 542 (license license:gpl3+)))
3de01d3f
EB
543
544(define-public gmsh
545 (package
546 (name "gmsh")
c7b08410 547 (version "2.11.0")
3de01d3f
EB
548 (source
549 (origin
550 (method url-fetch)
551 (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
552 version "-source.tgz"))
553 (sha256
c7b08410 554 (base32 "1ilplibvjgf7a905grpnclrvkmqy9fgrpl7xyp3w4yl1qc682v9b"))
3de01d3f
EB
555 (modules '((guix build utils)))
556 (snippet
557 ;; Remove non-free METIS code
558 '(delete-file-recursively "contrib/Metis"))))
559 (build-system cmake-build-system)
3de01d3f
EB
560 (propagated-inputs
561 `(("fltk" ,fltk)
19afbea1 562 ("gfortran" ,gfortran)
3de01d3f 563 ("gmp" ,gmp)
40029cbe 564 ("hdf5" ,hdf5)
3de01d3f
EB
565 ("lapack" ,lapack)
566 ("mesa" ,mesa)
85f41902 567 ("glu" ,glu)
3de01d3f
EB
568 ("libx11" ,libx11)
569 ("libxext" ,libxext)))
570 (arguments
571 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
572 "-DENABLE_BUILD_SHARED:BOOL=ON"
c7b08410
EB
573 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")
574 #:phases (modify-phases %standard-phases
575 (replace
576 'check
577 (lambda _
578 (zero? (system* "make" "test"
579 ;; Disable this test. See
580 ;; https://geuz.org/trac/gmsh/ticket/271
581 "ARGS=-E component8_in_a_box")))))))
3de01d3f
EB
582 (home-page "http://www.geuz.org/gmsh/")
583 (synopsis "3D finite element grid generator")
edf684ef
EB
584 (description "Gmsh is a 3D finite element grid generator with a built-in
585CAD engine and post-processor. Its design goal is to provide a fast, light
586and user-friendly meshing tool with parametric input and advanced
587visualization capabilities. Gmsh is built around four modules: geometry,
588mesh, solver and post-processing. The specification of any input to these
589modules is done either interactively using the graphical user interface or in
590ASCII text files using Gmsh's own scripting language.")
3de01d3f 591 (license license:gpl2+)))
b9100e2f
EB
592
593(define-public petsc
594 (package
595 (name "petsc")
32187d99 596 (version "3.6.2")
b9100e2f
EB
597 (source
598 (origin
599 (method url-fetch)
600 ;; The *-lite-* tarball does not contain the *large* documentation
601 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
602 "petsc-lite-" version ".tar.gz"))
603 (sha256
32187d99 604 (base32 "13h0m5f9xsdpps4lsp59iz2m7zkapwavq2zfkfvs3ab6sndla0l9"))))
b9100e2f
EB
605 (build-system gnu-build-system)
606 (native-inputs
607 `(("python" ,python-2)
608 ("perl" ,perl)))
609 (inputs
19afbea1 610 `(("gfortran" ,gfortran)
b9100e2f 611 ("lapack" ,lapack)
f258212d 612 ("superlu" ,superlu)
b9100e2f
EB
613 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
614 ;; leaving out opengl, as configuration seems to only be for mac
615 ))
616 (arguments
617 `(#:test-target "test"
9a899cce 618 #:parallel-build? #f ;build is parallel by default
b9100e2f
EB
619 #:configure-flags
620 `("--with-mpi=0"
f258212d
EB
621 "--with-openmp=1"
622 "--with-superlu=1"
623 ,(string-append "--with-superlu-include="
624 (assoc-ref %build-inputs "superlu") "/include")
625 ,(string-append "--with-superlu-lib="
626 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
b9100e2f
EB
627 #:phases
628 (alist-replace
629 'configure
630 ;; PETSc's configure script is actually a python script, so we can't
631 ;; run it with bash.
632 (lambda* (#:key outputs (configure-flags '())
633 #:allow-other-keys)
634 (let* ((prefix (assoc-ref outputs "out"))
635 (flags `(,(string-append "--prefix=" prefix)
636 ,@configure-flags)))
637 (format #t "build directory: ~s~%" (getcwd))
638 (format #t "configure flags: ~s~%" flags)
639 (zero? (apply system* "./configure" flags))))
640 (alist-cons-after
10b11968
EB
641 'configure 'clean-local-references
642 ;; Try to keep build directory names from leaking into compiled code
b9100e2f 643 (lambda* (#:key inputs outputs #:allow-other-keys)
10b11968
EB
644 (let ((out (assoc-ref outputs "out")))
645 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
646 (((getcwd)) out))))
647 (alist-cons-after
648 'install 'clean-install
649 ;; Try to keep installed files from leaking build directory names.
650 (lambda* (#:key inputs outputs #:allow-other-keys)
dfdf5716 651 (let ((out (assoc-ref outputs "out")))
10b11968 652 (substitute* (map (lambda (file)
9a899cce
EB
653 (string-append out "/lib/petsc/conf/" file))
654 '("petscvariables" "PETScConfig.cmake"))
10b11968
EB
655 (((getcwd)) out))
656 ;; Make compiler references point to the store
9a899cce 657 (substitute* (string-append out "/lib/petsc/conf/petscvariables")
dfdf5716
EB
658 (("= (gcc|g\\+\\+|gfortran)" _ compiler)
659 (string-append "= " (which compiler))))
10b11968
EB
660 ;; PETSc installs some build logs, which aren't necessary.
661 (for-each (lambda (file)
9a899cce 662 (let ((f (string-append out "/lib/petsc/conf/" file)))
10b11968
EB
663 (when (file-exists? f)
664 (delete-file f))))
9a899cce
EB
665 '("configure.log" "make.log" "gmake.log"
666 "test.log" "error.log" "RDict.db"
10b11968 667 ;; Once installed, should uninstall with Guix
9a899cce 668 "uninstall.py"))))
10b11968 669 %standard-phases)))))
b9100e2f 670 (home-page "http://www.mcs.anl.gov/petsc")
16ecf3ff 671 (synopsis "Library to solve PDEs")
b9100e2f
EB
672 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
673data structures and routines for the scalable (parallel) solution of
674scientific applications modeled by partial differential equations.")
166191b3 675 (license (license:non-copyleft
b9100e2f
EB
676 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
677
678(define-public petsc-complex
679 (package (inherit petsc)
680 (name "petsc-complex")
681 (arguments
682 (substitute-keyword-arguments (package-arguments petsc)
683 ((#:configure-flags cf)
684 `(cons "--with-scalar-type=complex" ,cf))))
16ecf3ff 685 (synopsis "Library to solve PDEs (with complex scalars)")))
183e44ae 686
d8c7eeb9
EB
687(define-public petsc-openmpi
688 (package (inherit petsc)
689 (name "petsc-openmpi")
690 (inputs
691 `(("openmpi" ,openmpi)
692 ,@(package-inputs petsc)))
693 (arguments
694 (substitute-keyword-arguments (package-arguments petsc)
695 ((#:configure-flags cf)
696 ``("--with-mpiexec=mpirun"
697 ,(string-append "--with-mpi-dir="
698 (assoc-ref %build-inputs "openmpi"))
699 ,@(delete "--with-mpi=0" ,cf)))))
16ecf3ff 700 (synopsis "Library to solve PDEs (with MPI support)")))
d8c7eeb9
EB
701
702(define-public petsc-complex-openmpi
703 (package (inherit petsc-complex)
704 (name "petsc-complex-openmpi")
705 (inputs
706 `(("openmpi" ,openmpi)
707 ,@(package-inputs petsc-complex)))
708 (arguments
709 (substitute-keyword-arguments (package-arguments petsc-complex)
710 ((#:configure-flags cf)
711 ``("--with-mpiexec=mpirun"
712 ,(string-append "--with-mpi-dir="
713 (assoc-ref %build-inputs "openmpi"))
714 ,@(delete "--with-mpi=0" ,cf)))))
16ecf3ff 715 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
d8c7eeb9 716
a7f01414
EB
717(define-public slepc
718 (package
719 (name "slepc")
9cf52454 720 (version "3.6.2")
a7f01414
EB
721 (source
722 (origin
723 (method url-fetch)
724 (uri (string-append "http://slepc.upv.es/download/download.php?"
725 "filename=slepc-" version ".tar.gz"))
d588422e 726 (file-name (string-append name "-" version ".tar.gz"))
a7f01414
EB
727 (sha256
728 (base32
9cf52454 729 "1pv5iqz2kc8sj49zsabyz4arnfpana8mjrhq31vzgk16xldk3d1a"))))
a7f01414
EB
730 (build-system gnu-build-system)
731 (native-inputs
732 `(("python" ,python-2)))
733 (inputs
734 `(("arpack" ,arpack-ng)
735 ("gfortran" ,gfortran)))
736 (propagated-inputs
737 `(("petsc" ,petsc)))
738 (arguments
739 `(#:parallel-build? #f ;build is parallel by default
740 #:configure-flags
741 `(,(string-append "--with-arpack-dir="
9cf52454 742 (assoc-ref %build-inputs "arpack") "/lib"))
a7f01414
EB
743 #:phases
744 (modify-phases %standard-phases
745 (replace
746 'configure
747 ;; configure is a python script, so we can't run it with bash.
748 (lambda* (#:key inputs outputs (configure-flags '())
749 #:allow-other-keys)
750 (let* ((prefix (assoc-ref outputs "out"))
751 (flags `(,(string-append "--prefix=" prefix)
752 ,@configure-flags)))
753 (format #t "build directory: ~s~%" (getcwd))
754 (format #t "configure flags: ~s~%" flags)
755 (setenv "SLEPC_DIR" (getcwd))
9cf52454 756 (setenv "PETSC_DIR" (assoc-ref inputs "petsc"))
a7f01414
EB
757 (zero? (apply system* "./configure" flags)))))
758 (add-after
759 'install 'delete-doc
760 ;; TODO: SLEPc installs HTML documentation alongside headers in
761 ;; $out/include. We'd like to move them to share/doc, but delete
762 ;; them for now, as they are incomplete and installing the complete
763 ;; documentation is difficult.
764 (lambda* (#:key outputs #:allow-other-keys)
765 (let* ((out (assoc-ref outputs "out")))
766 (for-each delete-file (find-files out "\\.html$")))))
767 (add-after
768 'install 'clean-install
769 ;; Clean up unnecessary build logs from installation.
770 (lambda* (#:key outputs #:allow-other-keys)
771 (let ((out (assoc-ref outputs "out")))
772 (for-each (lambda (file)
773 (let ((f (string-append out "/lib/slepc/conf/" file)))
774 (when (file-exists? f)
775 (delete-file f))))
776 '("configure.log" "make.log" "gmake.log"
777 "test.log" "error.log" "RDict.db"
778 "uninstall.py"))))))))
779 (home-page "http://slepc.upv.es")
780 (synopsis "Scalable library for eigenproblems")
781 (description "SLEPc is a software library for the solution of large sparse
782eigenproblems on parallel computers. It can be used for the solution of
783linear eigenvalue problems formulated in either standard or generalized form,
784as well as other related problems such as the singular value decomposition.
785The emphasis of the software is on methods and techniques appropriate for
786problems in which the associated matrices are sparse, for example, those
787arising after the discretization of partial differential equations.")
788 (license license:lgpl3)))
789
790(define-public slepc-complex
791 (package (inherit slepc)
792 (name "slepc-complex")
793 (propagated-inputs
794 `(("petsc" ,petsc-complex)
795 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
796 (synopsis "Scalable library for eigenproblems (with complex scalars)")))
797
798(define-public slepc-openmpi
799 (package (inherit slepc)
800 (name "slepc-openmpi")
801 (inputs
802 `(("mpi" ,openmpi)
803 ("arpack" ,arpack-ng-openmpi)
804 ,@(alist-delete "arpack" (package-inputs slepc))))
805 (propagated-inputs
806 `(("petsc" ,petsc-openmpi)
807 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
808 (synopsis "Scalable library for eigenproblems (with MPI support)")))
809
810(define-public slepc-complex-openmpi
811 (package (inherit slepc-openmpi)
812 (name "slepc-complex-openmpi")
813 (propagated-inputs
814 `(("petsc" ,petsc-complex-openmpi)
815 ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
816 (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
817
cec86422
EB
818(define-public mumps
819 (package
820 (name "mumps")
c69fa438 821 (version "5.0.1")
cec86422
EB
822 (source
823 (origin
824 (method url-fetch)
825 (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
826 version ".tar.gz"))
827 (sha256
828 (base32
c69fa438 829 "1820jfp3mbl7n85765v5mp6p0gzqpgr4d2lrnhwj4gl7cwp5ndah"))
fc1adab1 830 (patches (search-patches "mumps-build-parallelism.patch"))))
cec86422
EB
831 (build-system gnu-build-system)
832 (inputs
833 `(("fortran" ,gfortran)
834 ;; These are required for linking against mumps, but we let the user
835 ;; declare the dependency.
836 ("blas" ,openblas)
837 ("metis" ,metis)
838 ("scotch" ,scotch)))
839 (arguments
840 `(#:modules ((ice-9 match)
841 (ice-9 popen)
842 (srfi srfi-1)
843 ,@%gnu-build-system-modules)
844 #:phases
845 (modify-phases %standard-phases
846 (replace
847 'configure
848 (lambda* (#:key inputs #:allow-other-keys)
849 (call-with-output-file "Makefile.inc"
850 (lambda (port)
851 (format port "
852PLAT =
853LIBEXT = .a
854OUTC = -o
855OUTF = -o
856RM = rm -f~:[
857CC = gcc
858FC = gfortran
859FL = gfortran
860INCSEQ = -I$(topdir)/libseq
861LIBSEQ = -L$(topdir)/libseq -lmpiseq
862LIBSEQNEEDED = libseqneeded~;
863CC = mpicc
864FC = mpifort
865FL = mpifort~]
866AR = ar vr # rules require trailing space, ugh...
867RANLIB = ranlib
868LIBBLAS = -L~a -lopenblas~@[
869SCALAP = -L~a -lscalapack~]
870LIBOTHERS = -pthread
871CDEFS = -DAdd_
872PIC = -fPIC
873OPTF = -O2 -DALLOW_NON_INIT $(PIC)
874OPTL = -O2 $(PIC)
875OPTC = -O2 $(PIC)
876INCS = $(INCSEQ)
877LIBS = $(SCALAP) $(LIBSEQ)
878LPORDDIR = $(topdir)/PORD/lib
879IPORD = -I$(topdir)/PORD/include
880LPORD = -L$(LPORDDIR) -lpord
881ORDERINGSF = -Dpord~@[
882METISDIR = ~a
883IMETIS = -I$(METISDIR)/include
884LMETIS = -L$(METISDIR)/lib -lmetis
885ORDERINGSF += -Dmetis~]~@[~:{
886SCOTCHDIR = ~a
887ISCOTCH = -I$(SCOTCHDIR)/include
888LSCOTCH = -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
889ORDERINGSF += ~a~}~]
890ORDERINGSC = $(ORDERINGSF)
891LORDERINGS = $(LPORD) $(LMETIS) $(LSCOTCH)
892IORDERINGSF = $(ISCOTCH)
893IORDERINGSC = $(IPORD) $(IMETIS) $(ISCOTCH)"
894 (assoc-ref inputs "mpi")
895 (assoc-ref inputs "blas")
896 (assoc-ref inputs "scalapack")
897 (assoc-ref inputs "metis")
898 (match (list (assoc-ref inputs "pt-scotch")
899 (assoc-ref inputs "scotch"))
900 ((#f #f)
901 #f)
902 ((#f scotch)
903 `((,scotch "" "-Dscotch")))
904 ((ptscotch _)
905 `((,ptscotch
906 "-lptesmumps -lptscotch -lptscotcherr "
907 "-Dptscotch")))))))))
908 (replace
909 'build
910 ;; By default only the d-precision library is built. Make with "all"
911 ;; target so that all precision libraries and examples are built.
912 (lambda _
913 (zero? (system* "make" "all"
914 (format #f "-j~a" (parallel-job-count))))))
915 (replace
916 'check
917 ;; Run the simple test drivers, which read test input from stdin:
918 ;; from the "real" input for the single- and double-precision
919 ;; testers, and from the "cmplx" input for complex-precision
920 ;; testers. The EXEC-PREFIX key is used by the mumps-openmpi
921 ;; package to prefix execution with "mpirun".
922 (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
923 (with-directory-excursion "examples"
924 (every
925 (lambda (prec type)
926 (let ((tester (apply open-pipe*
927 `(,OPEN_WRITE
928 ,@exec-prefix
929 ,(string-append "./" prec
930 "simpletest"))))
931 (input (open-input-file
932 (string-append "input_simpletest_" type))))
933 (begin
934 (dump-port input tester)
935 (close-port input)
936 (zero? (close-pipe tester)))))
937 '("s" "d" "c" "z")
938 '("real" "real" "cmplx" "cmplx")))))
939 (replace
940 'install
941 (lambda* (#:key outputs #:allow-other-keys)
942 (let ((out (assoc-ref outputs "out")))
943 (copy-recursively "lib" (string-append out "/lib"))
944 (copy-recursively "include" (string-append out "/include"))
945 (when (file-exists? "libseq/libmpiseq.a")
946 (copy-file "libseq/libmpiseq.a"
947 (string-append out "/lib/libmpiseq.a")))))))))
948 (home-page "http://mumps.enseeiht.fr")
949 (synopsis "Multifrontal sparse direct solver")
950 (description
951 "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
952sparse system of linear equations A x = b using Guassian elimination.")
953 (license license:cecill-c)))
954
955(define-public mumps-metis
956 (package (inherit mumps)
957 (name "mumps-metis")
958 (inputs
959 (alist-delete "scotch" (package-inputs mumps)))))
960
961(define-public mumps-openmpi
962 (package (inherit mumps)
963 (name "mumps-openmpi")
964 (inputs
965 `(("mpi" ,openmpi)
966 ("scalapack" ,scalapack)
967 ("pt-scotch" ,pt-scotch)
968 ,@(alist-delete "scotch" (package-inputs mumps))))
969 (arguments
970 (substitute-keyword-arguments (package-arguments mumps)
971 ((#:phases phases)
972 `(modify-phases ,phases
973 (replace
974 'check
975 (lambda _
976 ((assoc-ref ,phases 'check)
977 #:exec-prefix '("mpirun" "-n" "2"))))))))
978 (synopsis "Multifrontal sparse direct solver (with MPI)")))
979
980(define-public mumps-metis-openmpi
981 (package (inherit mumps-openmpi)
982 (name "mumps-metis-openmpi")
983 (inputs
984 (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
985
ec8c7e47
RJ
986(define-public r-pracma
987 (package
988 (name "r-pracma")
989 (version "1.8.8")
990 (source (origin
991 (method url-fetch)
992 (uri (cran-uri "pracma" version))
993 (sha256
994 (base32 "0ans9l5rrb7a38gyi4qx4258sd5r5668vyrk02yzjpg9k3h8l165"))))
995 (build-system r-build-system)
996 (home-page "http://cran.r-project.org/web/packages/pracma")
997 (synopsis "Practical numerical math functions")
998 (description "This package provides functions for numerical analysis and
999linear algebra, numerical optimization, differential equations, plus some
1000special functions. It uses Matlab function names where appropriate to simplify
1001porting.")
1002 (license license:gpl3+)))
1003
183e44ae
EB
1004(define-public superlu
1005 (package
1006 (name "superlu")
1007 (version "4.3")
1008 (source
1009 (origin
1010 (method url-fetch)
1011 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
1012 "superlu_" version ".tar.gz"))
1013 (sha256
1014 (base32 "10b785s9s4x0m9q7ihap09275pq4km3k2hk76jiwdfdr5qr2168n"))))
1015 (build-system gnu-build-system)
1016 (native-inputs
1017 `(("tcsh" ,tcsh)))
1018 (inputs
1019 `(("lapack" ,lapack)
19afbea1 1020 ("gfortran" ,gfortran)))
183e44ae
EB
1021 (arguments
1022 `(#:parallel-build? #f
1023 #:tests? #f ;tests are run as part of `make all`
1024 #:phases
1025 (alist-replace
1026 'configure
1027 (lambda* (#:key inputs outputs #:allow-other-keys)
1028 (call-with-output-file "make.inc"
1029 (lambda (port)
1030 (format port "
1031PLAT =
1032SuperLUroot = ~a
1033SUPERLULIB = ~a/lib/libsuperlu.a
1034TMGLIB = libtmglib.a
1035BLASDEF = -DUSE_VENDOR_BLAS
1036BLASLIB = -L~a/lib -lblas
1037LIBS = $(SUPERLULIB) $(BLASLIB)
1038ARCH = ar
1039ARCHFLAGS = cr
1040RANLIB = ranlib
1041CC = gcc
1042PIC = -fPIC
1043CFLAGS = -O3 -DPRNTlevel=0 $(PIC)
1044NOOPTS = -O0 $(PIC)
1045FORTRAN = gfortran
1046FFLAGS = -O2 $(PIC)
1047LOADER = $(CC)
1048CDEFS = -DAdd_"
1049 (getcwd)
1050 (assoc-ref outputs "out")
1051 (assoc-ref inputs "lapack")))))
1052 (alist-cons-before
1053 'build 'create-install-directories
1054 (lambda* (#:key outputs #:allow-other-keys)
1055 (for-each
1056 (lambda (dir)
1057 (mkdir-p (string-append (assoc-ref outputs "out")
1058 "/" dir)))
1059 '("lib" "include")))
1060 (alist-replace
1061 'install
1062 (lambda* (#:key outputs #:allow-other-keys)
1063 ;; Library is placed in lib during the build phase. Copy over
1064 ;; headers to include.
1065 (let* ((out (assoc-ref outputs "out"))
1066 (incdir (string-append out "/include")))
1067 (for-each (lambda (file)
1068 (let ((base (basename file)))
1069 (format #t "installing `~a' to `~a'~%"
1070 base incdir)
1071 (copy-file file
1072 (string-append incdir "/" base))))
1073 (find-files "SRC" ".*\\.h$"))))
1074 %standard-phases)))))
1075 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
1076 (synopsis "Supernodal direct solver for sparse linear systems")
1077 (description
1078 "SuperLU is a general purpose library for the direct solution of large,
1079sparse, nonsymmetric systems of linear equations on high performance machines.
1080The library is written in C and is callable from either C or Fortran. The
1081library routines perform an LU decomposition with partial pivoting and
1082triangular system solves through forward and back substitution. The library
1083also provides threshold-based ILU factorization preconditioners.")
1084 (license license:bsd-3)))
f8ed036a 1085
a54aefea
EB
1086(define-public superlu-dist
1087 (package
1088 (name "superlu-dist")
1089 (version "3.3")
1090 (source
1091 (origin
1092 (method url-fetch)
1093 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
1094 "superlu_dist_" version ".tar.gz"))
1095 (sha256
1096 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
fc1adab1 1097 (patches (search-patches "superlu-dist-scotchmetis.patch"))))
a54aefea
EB
1098 (build-system gnu-build-system)
1099 (native-inputs
1100 `(("tcsh" ,tcsh)))
1101 (inputs
19afbea1 1102 `(("gfortran" ,gfortran)))
a54aefea
EB
1103 (propagated-inputs
1104 `(("openmpi" ,openmpi) ;headers include MPI heades
1105 ("lapack" ,lapack) ;required to link with output library
1106 ("pt-scotch" ,pt-scotch))) ;same
1107 (arguments
1108 `(#:parallel-build? #f ;race conditions using ar
1109 #:phases
1110 (alist-replace
1111 'configure
1112 (lambda* (#:key inputs outputs #:allow-other-keys)
1113 (call-with-output-file "make.inc"
1114 (lambda (port)
1115 (format port "
1116PLAT =
1117DSuperLUroot = ~a
1118DSUPERLULIB = ~a/lib/libsuperlu_dist.a
1119BLASDEF = -DUSE_VENDOR_BLAS
1120BLASLIB = -L~a/lib -lblas
1121PARMETISLIB = -L~a/lib \
1122 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
1123 -lscotch -lscotcherr -lscotcherrexit
1124METISLIB = -L~:*~a/lib \
1125 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
1126LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
1127ARCH = ar
1128ARCHFLAGS = cr
1129RANLIB = ranlib
1130CC = mpicc
1131PIC = -fPIC
1132CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
1133NOOPTS = -O0 -g $(PIC)
1134FORTRAN = mpifort
1135FFLAGS = -O2 -g $(PIC)
1136LOADER = $(CC)
1137CDEFS = -DAdd_"
1138 (getcwd)
1139 (assoc-ref outputs "out")
1140 (assoc-ref inputs "lapack")
1141 (assoc-ref inputs "pt-scotch")))))
1142 (alist-cons-after
1143 'unpack 'remove-broken-symlinks
1144 (lambda _
1145 (for-each delete-file
1146 (find-files "MAKE_INC" "\\.#make\\..*")))
1147 (alist-cons-before
1148 'build 'create-install-directories
1149 (lambda* (#:key outputs #:allow-other-keys)
1150 (for-each
1151 (lambda (dir)
1152 (mkdir-p (string-append (assoc-ref outputs "out")
1153 "/" dir)))
1154 '("lib" "include")))
1155 (alist-replace
1156 'check
1157 (lambda _
1158 (with-directory-excursion "EXAMPLE"
1159 (and
1160 (zero? (system* "mpirun" "-n" "2"
1161 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
1162 (zero? (system* "mpirun" "-n" "2"
1163 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
1164 (alist-replace
1165 'install
1166 (lambda* (#:key outputs #:allow-other-keys)
1167 ;; Library is placed in lib during the build phase. Copy over
1168 ;; headers to include.
1169 (let* ((out (assoc-ref outputs "out"))
1170 (incdir (string-append out "/include")))
1171 (for-each (lambda (file)
1172 (let ((base (basename file)))
1173 (format #t "installing `~a' to `~a'~%"
1174 base incdir)
1175 (copy-file file
1176 (string-append incdir "/" base))))
1177 (find-files "SRC" ".*\\.h$"))))
1178 %standard-phases)))))))
1179 (home-page (package-home-page superlu))
1180 (synopsis "Parallel supernodal direct solver")
1181 (description
1182 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
1183It is targeted for distributed memory parallel machines. SuperLU_DIST is
1184implemented in ANSI C, and MPI for communications.")
1185 (license license:bsd-3)))
1186
f8ed036a
EB
1187(define-public scotch
1188 (package
1189 (name "scotch")
6c798540 1190 (version "6.0.4")
f8ed036a
EB
1191 (source
1192 (origin
1193 (method url-fetch)
6c798540 1194 (uri (string-append "https://gforge.inria.fr/frs/download.php/34618/"
f8ed036a
EB
1195 "scotch_" version ".tar.gz"))
1196 (sha256
6c798540 1197 (base32 "1ir088mvrqggyqdkx9qfynmiaffqbyih5qfl5mga2nrlm1qlsgzm"))
fc1adab1
AK
1198 (patches (search-patches "scotch-test-threading.patch"
1199 "pt-scotch-build-parallelism.patch"))))
f8ed036a
EB
1200 (build-system gnu-build-system)
1201 (inputs
1202 `(("zlib" ,zlib)
1203 ("flex" ,flex)
1204 ("bison" ,bison)))
1205 (arguments
1206 `(#:phases
d6602ee9
EB
1207 (modify-phases %standard-phases
1208 (add-after
1209 'unpack 'chdir-to-src
1210 (lambda _ (chdir "src")))
1211 (replace
1212 'configure
1213 (lambda _
1214 (call-with-output-file "Makefile.inc"
1215 (lambda (port)
1216 (format port "
f8ed036a
EB
1217EXE =
1218LIB = .a
1219OBJ = .o
1220MAKE = make
1221AR = ar
1222ARFLAGS = -ruv
cf0ec6c4 1223CAT = cat
f8ed036a
EB
1224CCS = gcc
1225CCP = mpicc
1226CCD = gcc
1227CPPFLAGS =~{ -D~a~}
6c798540 1228CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
f8ed036a
EB
1229LDFLAGS = -lz -lm -lrt -lpthread
1230CP = cp
1231LEX = flex -Pscotchyy -olex.yy.c
1232LN = ln
1233MKDIR = mkdir
1234MV = mv
1235RANLIB = ranlib
1236YACC = bison -pscotchyy -y -b y
1237"
d6602ee9
EB
1238 '("COMMON_FILE_COMPRESS_GZ"
1239 "COMMON_PTHREAD"
1240 "COMMON_RANDOM_FIXED_SEED"
cf0ec6c4
EB
1241 ;; Prevents symbolc clashes with libesmumps
1242 "SCOTCH_RENAME"
d6602ee9
EB
1243 ;; XXX: Causes invalid frees in superlu-dist tests
1244 ;; "SCOTCH_PTHREAD"
1245 ;; "SCOTCH_PTHREAD_NUMBER=2"
1246 "restrict=__restrict"))))))
cf0ec6c4
EB
1247 (add-after
1248 'build 'build-esmumps
1249 (lambda _
1250 (zero? (system* "make"
1251 (format #f "-j~a" (parallel-job-count))
1252 "esmumps"))))
d6602ee9 1253 (replace
f8ed036a
EB
1254 'install
1255 (lambda* (#:key outputs #:allow-other-keys)
1256 (let ((out (assoc-ref outputs "out")))
1257 (mkdir out)
1258 (zero? (system* "make"
1259 (string-append "prefix=" out)
cf0ec6c4
EB
1260 "install"))
1261 ;; esmumps files are not installed with the above
1262 (for-each (lambda (f)
1263 (copy-file f (string-append out "/include/" f)))
1264 (find-files "../include" ".*esmumps.h$"))
1265 (for-each (lambda (f)
1266 (copy-file f (string-append out "/lib/" f)))
1267 (find-files "../lib" "^lib.*esmumps.*"))))))))
f8ed036a
EB
1268 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
1269 (synopsis "Programs and libraries for graph algorithms")
1270 (description "SCOTCH is a set of programs and libraries which implement
1271the static mapping and sparse matrix reordering algorithms developed within
1272the SCOTCH project. Its purpose is to apply graph theory, with a divide and
1273conquer approach, to scientific computing problems such as graph and mesh
1274partitioning, static mapping, and sparse matrix ordering, in application
1275domains ranging from structural mechanics to operating systems or
1276bio-chemistry.")
1277 ;; See LICENSE_en.txt
1278 (license license:cecill-c)))
6acb4adb
EB
1279
1280(define-public pt-scotch
1281 (package (inherit scotch)
1282 (name "pt-scotch")
1283 (propagated-inputs
1284 `(("openmpi" ,openmpi))) ;Headers include MPI headers
1285 (arguments
1286 (substitute-keyword-arguments (package-arguments scotch)
1287 ((#:phases scotch-phases)
d6602ee9
EB
1288 `(modify-phases ,scotch-phases
1289 (replace
1290 'build
d6602ee9
EB
1291 (lambda _
1292 (and
cf0ec6c4
EB
1293 (zero? (system* "make"
1294 (format #f "-j~a" (parallel-job-count))
1295 "ptscotch" "ptesmumps"))
d6602ee9
EB
1296 ;; Install the serial metis compatibility library
1297 (zero? (system* "make" "-C" "libscotchmetis" "install")))))
1298 (replace
1299 'check
1300 (lambda _ (zero? (system* "make" "ptcheck"))))))))
6acb4adb 1301 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
5698b8b8 1302
aa75ad00
EB
1303(define-public metis
1304 (package
1305 (name "metis")
1306 (version "5.1.0")
1307 (source
1308 (origin
1309 (method url-fetch)
1310 (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
1311 "metis-" version ".tar.gz"))
1312 (sha256
1313 (base32
1314 "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
1315 (build-system cmake-build-system)
1316 (inputs
1317 `(("blas" ,openblas)))
1318 (arguments
1319 `(#:tests? #f ;no tests
1320 #:configure-flags `("-DSHARED=ON"
1321 ,(string-append "-DGKLIB_PATH=" (getcwd)
1322 "/metis-" ,version "/GKlib"))))
1323 (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
1324 (synopsis "Graph partitioning and fill-reducing matrix ordering library")
1325 (description
1326 "METIS is a set of serial programs for partitioning graphs, partitioning
1327finite element meshes, and producing fill-reducing orderings for sparse
1328matrices. The algorithms implemented in METIS are based on the multilevel
1329recursive-bisection, multilevel k-way, and multi-constraint partitioning
1330schemes.")
1331 (license license:asl2.0))) ;As of version 5.0.3
1332
700ff222
EB
1333(define-public p4est
1334 (package
1335 (name "p4est")
1336 (version "1.1")
1337 (source
1338 (origin
1339 (method url-fetch)
1340 (uri (string-append "http://p4est.github.io/release/p4est-"
1341 version ".tar.gz"))
1342 (sha256
1343 (base32
1344 "0faina2h5qsx3m2izbzaj9bbakma1krbbjmq43wrp1hcbyijflqb"))))
1345 (build-system gnu-build-system)
1346 (inputs
1347 `(("fortran" ,gfortran)
1348 ("blas" ,openblas)
1349 ("lapack" ,lapack)
1350 ("zlib" ,zlib)))
1351 (arguments
1352 `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
1353 (assoc-ref %build-inputs "blas")
1354 " -lopenblas")
1355 ,(string-append "LAPACK_LIBS=-L"
1356 (assoc-ref %build-inputs "lapack")
1357 " -llapack"))))
1358 (home-page "http://www.p4est.org")
1359 (synopsis "Adaptive mesh refinement on forests of octrees")
1360 (description
1361 "The p4est software library enables the dynamic management of a
1362collection of adaptive octrees, conveniently called a forest of octrees.
1363p4est is designed to work in parallel and scales to hundreds of thousands of
1364processor cores.")
1365 (license license:gpl2+)))
1366
1367(define-public p4est-openmpi
1368 (package (inherit p4est)
1369 (name "p4est-openmpi")
1370 (inputs
1371 `(("mpi" ,openmpi)
1372 ,@(package-inputs p4est)))
1373 (arguments
1374 (substitute-keyword-arguments (package-arguments p4est)
1375 ((#:configure-flags cf)
1376 ``("--enable-mpi" ,@,cf))))
1377 (synopsis "Parallel adaptive mesh refinement on forests of octrees")))
1378
5698b8b8
JD
1379(define-public gsegrafix
1380 (package
1381 (name "gsegrafix")
1382 (version "1.0.6")
1383 (source
1384 (origin
1385 (method url-fetch)
1386 (uri (string-append "mirror://gnu/" name "/" name "-"
1387 version ".tar.gz"))
1388 (sha256
1389 (base32
1390 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
1391 (build-system gnu-build-system)
1392 (arguments
1393 `(#:configure-flags '("LDFLAGS=-lm")))
1394 (inputs
1395 `(("libgnomecanvas" ,libgnomecanvas)
1396 ("libbonoboui" ,libbonoboui)
1397 ("libgnomeui" ,libgnomeui)
1398 ("libgnomeprintui" ,libgnomeprintui)
1399 ("popt" ,popt)))
1400 (native-inputs
1401 `(("pkg-config" ,pkg-config)))
1402 (home-page "http://www.gnu.org/software/gsegrafix/")
1403 (synopsis "GNOME application to create scientific and engineering plots")
1404 (description "GSEGrafix is an application which produces high-quality graphical
1405plots for science and engineering. Plots are specified via simple ASCII
1406parameter files and data files and are presented in an anti-aliased GNOME
1407canvas. The program supports rectangular two-dimensional plots, histograms,
1408polar-axis plots and three-dimensional plots. Plots can be printed or saved
1409to BMP, JPEG or PNG image formats.")
1410 (license license:gpl3+)))
8731e527
JD
1411
1412(define-public maxima
1413 (package
1414 (name "maxima")
77af7b24 1415 (version "5.36.1")
8731e527
JD
1416 (source
1417 (origin
1418 (method url-fetch)
1419 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
1420 version "-source/" name "-" version ".tar.gz"))
1421 (sha256
1422 (base32
77af7b24 1423 "0x1rk659sn3cq0n5c90848ilzr1gb1wf0072fl6jhkdq00qgh2s0"))
fc1adab1 1424 (patches (search-patches "maxima-defsystem-mkdir.patch"))))
8731e527 1425 (build-system gnu-build-system)
df354a77
FB
1426 (inputs
1427 `(("gcl" ,gcl)
1428 ("gnuplot" ,gnuplot) ;for plots
f36afe4d 1429 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
df354a77
FB
1430 (native-inputs
1431 `(("texinfo" ,texinfo)
1432 ("perl" ,perl)))
8731e527 1433 (arguments
df354a77
FB
1434 `(#:configure-flags
1435 (list "--enable-gcl"
1436 (string-append "--with-posix-shell="
1437 (assoc-ref %build-inputs "bash")
1438 "/bin/sh")
1439 (string-append "--with-wish="
1440 (assoc-ref %build-inputs "tk")
1441 "/bin/wish"
1442 (let ((v ,(package-version tk)))
1443 (string-take v (string-index-right v #\.)))))
df354a77 1444 ;; By default Maxima attempts to write temporary files to
77af7b24
MW
1445 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
1446 ;; Work around that.
df354a77 1447 #:make-flags (list "TMPDIR=/tmp")
df354a77 1448 #:phases (alist-cons-before
8731e527 1449 'check 'pre-check
df354a77 1450 (lambda _
8731e527 1451 (chmod "src/maxima" #o555))
f36afe4d
FB
1452 ;; Make sure the doc and emacs files are found in the
1453 ;; standard location. Also configure maxima to find gnuplot
1454 ;; without having it on the PATH.
1455 (alist-cons-after
1456 'install 'post-install
1457 (lambda* (#:key outputs inputs #:allow-other-keys)
1458 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
1459 (out (assoc-ref outputs "out"))
1460 (datadir (string-append out "/share/maxima/" ,version)))
1461 (with-directory-excursion out
1462 (mkdir-p "share/emacs")
1463 (mkdir-p "share/doc")
1464 (symlink
1465 (string-append datadir "/emacs/")
1466 (string-append out "/share/emacs/site-lisp"))
1467 (symlink
1468 (string-append datadir "/doc/")
1469 (string-append out "/share/doc/maxima"))
1470 (with-atomic-file-replacement
1471 (string-append datadir "/share/maxima-init.lisp")
1472 (lambda (in out)
1473 (format out "~a ~s~a~%"
1474 "(setf $gnuplot_command "
1475 (string-append gnuplot "/bin/gnuplot") ")")
1476 (dump-port in out))))))
1477 %standard-phases))))
8731e527
JD
1478 (home-page "http://maxima.sourceforge.net")
1479 (synopsis "Numeric and symbolic expression manipulation")
1480 (description "Maxima is a system for the manipulation of symbolic and
1481numerical expressions. It yields high precision numeric results by using
1482exact fractions, arbitrary precision integers, and variable precision floating
e881752c 1483point numbers.")
8731e527
JD
1484 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
1485 ;; Others simply say "GNU General Public License" without stating a
1486 ;; version (which implicitly means gpl1+).
1487 ;; At least one file (src/maxima.asd) says "version 2."
1488 ;; GPLv2 only is therefore the smallest subset.
f36afe4d 1489 (license license:gpl2)))
ec322be2 1490
9aafbc0c
MW
1491(define-public wxmaxima
1492 (package
1493 (name "wxmaxima")
1494 (version "15.04.0")
1495 (source
1496 (origin
1497 (method url-fetch)
1498 (uri (string-append "mirror://sourceforge/wxmaxima/wxMaxima/"
1499 version "/" name "-" version ".tar.gz"))
1500 (sha256
1501 (base32
1502 "1fm47ah4aw5qdjqhkz67w5fwhy8yfffa5z896crp0d3hk2bh4180"))))
1503 (build-system gnu-build-system)
1504 (inputs
1505 `(("wxwidgets" ,wxwidgets)
1506 ("maxima" ,maxima)))
1507 (arguments
1508 `(#:phases (modify-phases %standard-phases
1509 (add-after
1510 'install 'wrap-program
1511 (lambda* (#:key inputs outputs #:allow-other-keys)
1512 (wrap-program (string-append (assoc-ref outputs "out")
1513 "/bin/wxmaxima")
1514 `("PATH" ":" prefix
1515 (,(string-append (assoc-ref inputs "maxima")
1516 "/bin"))))
1517 #t)))))
1518 (home-page "https://andrejv.github.io/wxmaxima/")
1519 (synopsis "Graphical user interface for the Maxima computer algebra system")
1520 (description
1521 "wxMaxima is a graphical user interface for the Maxima computer algebra
1522system. It eases the use of Maxima by making most of its commands available
1523through a menu system and by providing input dialogs for commands that require
1524more than one argument. It also implements its own display engine that
1525outputs mathematical symbols directly instead of depicting them with ASCII
1526characters.
1527
1528wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
1529text and mathematical calculations to create documents, exporting of input and
1530output to TeX, and a browser for Maxima's manual including command index and
1531full text searching.")
1532 (license license:gpl2+)))
1533
b15e47f9
RW
1534(define-public armadillo
1535 (package
1536 (name "armadillo")
458b47e3 1537 (version "6.700.4")
b15e47f9
RW
1538 (source (origin
1539 (method url-fetch)
1540 (uri (string-append "mirror://sourceforge/arma/armadillo-"
1541 version ".tar.gz"))
1542 (sha256
1543 (base32
458b47e3 1544 "0dsdjcps5l2nhg0455rrc708inffarzj7n435vj4sm9lxwf21wg9"))))
b15e47f9
RW
1545 (build-system cmake-build-system)
1546 (arguments `(#:tests? #f)) ;no test target
1547 (inputs
1548 `(("openblas" ,openblas)
1549 ("lapack" ,lapack)
1550 ("arpack" ,arpack-ng)))
1551 (home-page "http://arma.sourceforge.net/")
1552 (synopsis "C++ linear algebra library")
1553 (description
1554 "Armadillo is a C++ linear algebra library, aiming towards a good balance
1555between speed and ease of use. It is useful for algorithm development
1556directly in C++, or quick conversion of research code into production
1557environments. It can be used for machine learning, pattern recognition,
1558signal processing, bioinformatics, statistics, econometrics, etc. The library
1559provides efficient classes for vectors, matrices and cubes, as well as 150+
1560associated functions (eg. contiguous and non-contiguous submatrix views).")
1561 (license license:mpl2.0)))
1562
e22d4ca4
RW
1563(define-public armadillo-for-rcpparmadillo
1564 (package (inherit armadillo)
c5ad883b 1565 (version "6.700.3")
e22d4ca4
RW
1566 (source (origin
1567 (method url-fetch)
1568 (uri (string-append "mirror://sourceforge/arma/armadillo-"
1569 version ".tar.gz"))
1570 (sha256
1571 (base32
c5ad883b 1572 "1vnhifa7d0aij3kv5bxf6m91d99h3y2fyj48jrx7jcvwyb1q5wwq"))))))
e22d4ca4 1573
279663ef
RW
1574(define-public muparser
1575 (package
1576 (name "muparser")
1577 (version "2.2.5")
1578 (source
1579 (origin
1580 (method svn-fetch)
1581 (uri (svn-reference
1582 (url "http://muparser.googlecode.com/svn/trunk/")
1583 (revision 34)))
1584 (sha256
1585 (base32
1586 "1d6bdbhx9zj3srwj3m7c9hvr18gnx1fx43h6d25my7q85gicpcwn"))))
1587 (build-system gnu-build-system)
1588 (arguments
1589 `(#:configure-flags '("--enable-samples=no")
1590 #:tests? #f)) ;no "check" target
1591 (home-page "http://muparser.beltoforion.de/")
1592 (synopsis "Fast parser library for mathematical expressions")
1593 (description
1594 "muParser is an extensible high performance math parser library. It is
1595based on transforming an expression into a bytecode and precalculating
1596constant parts of it.")
1597 (license license:expat)))
1598
e73b49fb
RW
1599(define-public openblas
1600 (package
1601 (name "openblas")
69851c59 1602 (version "0.2.15")
e73b49fb
RW
1603 (source
1604 (origin
1605 (method url-fetch)
1606 (uri (string-append "https://github.com/xianyi/OpenBLAS/tarball/v"
1607 version))
1608 (file-name (string-append name "-" version ".tar.gz"))
1609 (sha256
1610 (base32
69851c59 1611 "1k5f6vjlk54qlplk5m7xkbaw6g2y7dl50lwwdv6xsbcsgsbxfcpy"))))
e73b49fb
RW
1612 (build-system gnu-build-system)
1613 (arguments
5b5ea159 1614 `(#:tests? #f ;no "check" target
bd0b4379
RW
1615 ;; DYNAMIC_ARCH is only supported on x86. When it is disabled and no
1616 ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
1617 ;; we need to disable substitutions.
71923a91
AE
1618 #:substitutable?
1619 ,(let ((system (or (%current-target-system) (%current-system))))
1620 (or (string-prefix? "x86_64" system)
bd0b4379
RW
1621 (string-prefix? "i686" system)
1622 (string-prefix? "mips" system)))
e73b49fb
RW
1623 #:make-flags
1624 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1625 "SHELL=bash"
af5b817e
RW
1626 "NO_LAPACK=1"
1627 ;; Build the library for all supported CPUs. This allows
1628 ;; switching CPU targets at runtime with the environment variable
1629 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
71923a91
AE
1630 ;; Unfortunately, this is not supported on non-x86 architectures,
1631 ;; where it leads to failed builds.
1632 ,@(let ((system (or (%current-target-system) (%current-system))))
8a637e79
RW
1633 (cond
1634 ((or (string-prefix? "x86_64" system)
71923a91 1635 (string-prefix? "i686" system))
8a637e79
RW
1636 '("DYNAMIC_ARCH=1"))
1637 ;; On MIPS we force the "SICORTEX" TARGET, as for the other
1638 ;; two available MIPS targets special extended instructions
1639 ;; for Loongson cores are used.
1640 ((string-prefix? "mips" system)
1641 '("TARGET=SICORTEX"))
1642 (else '()))))
e73b49fb
RW
1643 ;; no configure script
1644 #:phases (alist-delete 'configure %standard-phases)))
1645 (inputs
19afbea1 1646 `(("fortran" ,gfortran)))
e73b49fb
RW
1647 (native-inputs
1648 `(("cunit" ,cunit)
1649 ("perl" ,perl)))
1650 (home-page "http://www.openblas.net/")
1651 (synopsis "Optimized BLAS library based on GotoBLAS")
1652 (description
1653 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
1654 (license license:bsd-3)))
1655
e1605e36
RW
1656(define-public openlibm
1657 (package
1658 (name "openlibm")
1659 (version "0.4.1")
1660 (source
1661 (origin
1662 (method url-fetch)
1663 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
1664 version ".tar.gz"))
1665 (file-name (string-append name "-" version ".tar.gz"))
1666 (sha256
1667 (base32
1668 "0cwqqqlblj3kzp9aq1wnpfs1fl0qd1wp1xzm5shb09w06i4rh9nn"))))
1669 (build-system gnu-build-system)
1670 (arguments
1671 `(#:make-flags
1672 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1673 #:phases
1674 ;; no configure script
1675 (alist-delete 'configure %standard-phases)
1676 #:tests? #f)) ;the tests are part of the default target
1677 (home-page "http://openlibm.org/")
1678 (synopsis "Portable C mathematical library (libm)")
1679 (description
1680 "OpenLibm is an effort to have a high quality, portable, standalone C
1681mathematical library (libm). It can be used standalone in applications and
1682programming language implementations. The project was born out of a need to
e881752c 1683have a good libm for the Julia programming language that worked consistently
e1605e36
RW
1684across compilers and operating systems, and in 32-bit and 64-bit
1685environments.")
1686 ;; See LICENSE.md for details.
1687 (license (list license:expat
1688 license:isc
1689 license:bsd-2
1690 license:public-domain
1691 license:lgpl2.1+))))
1692
e62be58f
RW
1693(define-public openspecfun
1694 (package
1695 (name "openspecfun")
1696 (version "0.4")
1697 (source
1698 (origin
1699 (method url-fetch)
1700 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
1701 version ".tar.gz"))
1702 (file-name (string-append name "-" version ".tar.gz"))
1703 (sha256
1704 (base32
1705 "0nsa3jjmlhcqkw5ba5ypbn3n0c8b6lc22zzlxnmxkxi9shhdx65z"))))
1706 (build-system gnu-build-system)
1707 (arguments
1708 '(#:tests? #f ;no "check" target
1709 #:make-flags
1710 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1711 ;; no configure script
1712 #:phases (alist-delete 'configure %standard-phases)))
1713 (inputs
19afbea1 1714 `(("fortran" ,gfortran)))
e62be58f
RW
1715 (home-page "https://github.com/JuliaLang/openspecfun")
1716 (synopsis "Collection of special mathematical functions")
1717 (description
1718 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
1719portable package for Bessel Functions of a Complex Argument and Nonnegative
1720Order; it contains subroutines for computing Bessel functions and Airy
1721functions. Faddeeva allows computing the various error functions of arbitrary
1722complex arguments (Faddeeva function, error function, complementary error
1723function, scaled complementary error function, imaginary error function, and
1724Dawson function); given these, one can also easily compute Voigt functions,
1725Fresnel integrals, and similar related functions as well.")
1726 ;; Faddeeva is released under the Expat license; AMOS is included as
1727 ;; public domain software.
1728 (license (list license:expat license:public-domain))))
1729
2742f87e
RW
1730(define-public suitesparse
1731 (package
1732 (name "suitesparse")
1733 (version "4.4.3")
1734 (source
1735 (origin
1736 (method url-fetch)
1737 (uri (string-append
1738 "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-"
1739 version ".tar.gz"))
1740 (sha256
1741 (base32
1742 "100hdzr0mf4mzlwnqpmwpfw4pymgsf9n3g0ywb1yps2nk1zbkdy5"))))
1743 (build-system gnu-build-system)
1744 (arguments
1745 '(#:parallel-build? #f ;cholmod build fails otherwise
1746 #:tests? #f ;no "check" target
1747 #:make-flags
1748 (list "CC=gcc"
1749 "BLAS=-lblas"
1750 "TBB=-ltbb"
1751 "CHOLMOD_CONFIG=-DNPARTITION" ;required when METIS is not used
1752 (string-append "INSTALL_LIB="
1753 (assoc-ref %outputs "out") "/lib")
1754 (string-append "INSTALL_INCLUDE="
1755 (assoc-ref %outputs "out") "/include"))
1756 #:phases
1757 (alist-cons-before
1758 'install 'prepare-out
1759 ;; README.txt states that the target directories must exist prior to
1760 ;; running "make install".
1761 (lambda _
1762 (mkdir-p (string-append (assoc-ref %outputs "out") "/lib"))
1763 (mkdir-p (string-append (assoc-ref %outputs "out") "/include")))
1764 ;; no configure script
1765 (alist-delete 'configure %standard-phases))))
1766 (inputs
1767 `(("tbb" ,tbb)
1768 ("lapack" ,lapack)))
1769 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
1770 (synopsis "Suite of sparse matrix software")
1771 (description
1772 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
1773multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
1774multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
1775simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
1776CXSparse, a concise sparse Cholesky factorization package; and many other
1777packages.")
1778 ;; LGPLv2.1+:
1779 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
1780 ;; GPLv2+:
1781 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
1782 (license (list license:gpl2+ license:lgpl2.1+))))
1783
ec322be2
FB
1784(define-public atlas
1785 (package
1786 (name "atlas")
1787 (version "3.10.2")
1788 (source (origin
1789 (method url-fetch)
1790 (uri (string-append "mirror://sourceforge/math-atlas/atlas"
1791 version ".tar.bz2"))
1792 (sha256
1793 (base32
1794 "0bqh4bdnjdyww4mcpg6kn0x7338mfqbdgysn97dzrwwb26di7ars"))))
1795 (build-system gnu-build-system)
1796 (home-page "http://math-atlas.sourceforge.net/")
19afbea1 1797 (inputs `(("gfortran" ,gfortran)
ec322be2
FB
1798 ("lapack-tar" ,(package-source lapack))))
1799 (outputs '("out" "doc"))
01480b9e
FB
1800 ;; For the moment we drop support for MIPS at it fails to compile. See
1801 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
1802 (supported-systems (delete "mips64el-linux" %supported-systems))
ec322be2
FB
1803 (arguments
1804 `(#:parallel-build? #f
1805 #:parallel-tests? #f
f15615b1
LC
1806
1807 ;; ATLAS tunes itself for the machine it is built on, as explained at
1808 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
1809 ;; For this reason, we want users to build it locally instead of using
1810 ;; substitutes.
1811 #:substitutable? #f
1812
ec322be2
FB
1813 #:modules ((srfi srfi-26)
1814 (srfi srfi-1)
1815 (guix build gnu-build-system)
1816 (guix build utils))
40029cbe 1817 #:configure-flags
ec322be2
FB
1818 `(;; Generate position independent code suitable for dynamic libraries
1819 ;; and use WALL timer to get more accurate timing.
1820 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
1821 ;; Set word width.
1822 "-b"
1823 ,,(if (string-match "64" (%current-system))
1824 "64"
1825 "32")
1826 ;; Disable parallel build as it gives errors: atlas_pthread.h is
1827 ;; needed to compile C files before it is generated.
1828 "-Ss" "pmake" "make -j 1"
af89a667
FB
1829 ;; Probe is failing for MIPS. We therefore define the system
1830 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
1831 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
1832 ,,@(if (string-prefix? "mips" (%current-system))
1833 (list "-A" "49" "-V" "1")
1834 (list))
ec322be2
FB
1835 ;; Generate shared libraries.
1836 "--shared"
1837 ;; Build a full LAPACK library.
1838 ,(string-append "--with-netlib-lapack-tarfile="
1839 (assoc-ref %build-inputs "lapack-tar")))
1840 #:phases
1841 (alist-cons-after
1842 'install 'install-doc
1843 (lambda* (#:key outputs inputs #:allow-other-keys)
40029cbe 1844 (let ((doc (string-append (assoc-ref outputs "doc")
ec322be2
FB
1845 "/share/doc/atlas")))
1846 (mkdir-p doc)
40029cbe 1847 (fold (lambda (file previous)
ec322be2
FB
1848 (and previous (zero? (system* "cp" file doc))))
1849 #t (find-files "../ATLAS/doc" ".*"))))
1850 (alist-cons-after
1851 'check 'check-pt
1852 (lambda _ (zero? (system* "make" "ptcheck")))
1853 ;; Fix files required to run configure.
1854 (alist-cons-before
1855 'configure 'fix-/bin/sh
1856 (lambda _
1857 ;; Use `sh', not `/bin/sh'.
1858 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
1859 (("/bin/sh")
1860 "sh")))
1861 ;; Fix /bin/sh in generated make files.
1862 (alist-cons-after
1863 'configure 'fix-/bin/sh-in-generated-files
1864 (lambda _
1865 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
1866 (("/bin/sh")
1867 "sh")))
1868 ;; ATLAS configure program does not accepts the default flags
1869 ;; passed by the 'gnu-build-system'.
1870 (alist-replace
1871 'configure
1872 (lambda* (#:key native-inputs inputs outputs
1873 (configure-flags '())
1874 #:allow-other-keys #:rest args)
1875 (let* ((prefix (assoc-ref outputs "out"))
1876 (bash (or (and=> (assoc-ref
1877 (or native-inputs inputs) "bash")
1878 (cut string-append <> "/bin/bash"))
1879 "/bin/sh"))
1880 (flags `(,(string-append "--prefix=" prefix)
1881 ,@configure-flags))
1882 (abs-srcdir (getcwd))
1883 (srcdir (string-append "../" (basename abs-srcdir))))
1884 (format #t "source directory: ~s (relative from build: ~s)~%"
1885 abs-srcdir srcdir)
1886 (mkdir "../build")
1887 (chdir "../build")
1888 (format #t "build directory: ~s~%" (getcwd))
1889 (format #t "configure flags: ~s~%" flags)
1890 (zero? (apply system* bash
1891 (string-append srcdir "/configure")
1892 flags))))
1893 %standard-phases)))))))
1894 (synopsis "Automatically Tuned Linear Algebra Software")
1895 (description
1896 "ATLAS is an automatically tuned linear algebra software library
1897providing C and Fortran77 interfaces to a portably efficient BLAS
1898implementation, as well as a few routines from LAPACK.
1899
f15615b1
LC
1900Optimization occurs at build time. For this reason, the library is built on
1901the machine where it is installed, without resorting to pre-built substitutes.
ec322be2 1902
f15615b1
LC
1903Before building the library, CPU throttling should be disabled. This can be
1904done in the BIOS, or, on GNU/Linux, with the following commands:
ec322be2
FB
1905
1906cpufreq-selector -g performance -c 0
1907...
1908cpufreq-selector -g performance -c N-1
1909
1910where N is the number of cores of your CPU. Failure to do so will result in a
1911library with poor performance.")
1912 (license license:bsd-3)))
c12efc72
AE
1913
1914(define-public glm
1915 (package
1916 (name "glm")
1917 (version "0.9.6.3")
1918 (source
1919 (origin
1920 (method url-fetch)
1921 (uri (string-append "mirror://sourceforge/ogl-math/glm-"
1922 version ".zip"))
1923 (sha256
1924 (base32
1925 "1cnjmi033a16a95v6xfkr1bvfmkd26hzdjka8j1819hgn5b1nr8l"))))
1926 (build-system cmake-build-system)
1927 (native-inputs
1928 `(("unzip" ,unzip)))
1929 (home-page "http://glm.g-truc.net")
1930 (synopsis "OpenGL Mathematics library")
1931 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
1932library for graphics software based on the OpenGL Shading Language (GLSL)
1933specifications.")
1934 (license license:expat)))
7f18257b
AE
1935
1936(define-public lpsolve
1937 (package
1938 (name "lpsolve")
1939 (version "5.5.2.0")
1940 (source
1941 (origin
1942 (method url-fetch)
1943 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
1944 "/lp_solve_" version "_source.tar.gz"))
1945 (sha256
1946 (base32
1947 "176c7f023mb6b8bfmv4rfqnrlw88lsg422ca74zjh19i2h5s69sq"))
1948 (modules '((guix build utils)))
1949 (snippet
1950 '(substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
1951 (("^c=cc") "c=gcc")
1952 ;; Pretend to be on a 64 bit platform to obtain a common directory
1953 ;; name for the build results on all architectures; nothing else
1954 ;; seems to depend on it.
1955 (("^PLATFORM=.*$") "PLATFORM=ux64\n")))))
1956 (build-system gnu-build-system)
1957 (arguments
1958 `(#:tests? #f ; no check target
1959 #:phases
1960 (modify-phases %standard-phases
1961 (delete 'configure)
1962 (replace 'build
1963 (lambda _
1964 (with-directory-excursion "lpsolve55"
1965 (system* "bash" "ccc"))
1966 (with-directory-excursion "lp_solve"
1967 (system* "bash" "ccc"))
1968 #t))
1969 (replace 'install
1970 (lambda* (#:key outputs #:allow-other-keys)
1971 (let* ((out (assoc-ref outputs "out"))
1972 (bin (string-append out "/bin"))
1973 (lib (string-append out "/lib"))
1974 ;; This is where LibreOffice expects to find the header
1975 ;; files, and where they are installed by Debian.
1976 (include (string-append out "/include/lpsolve")))
1977 (mkdir-p lib)
1978 (copy-file "lpsolve55/bin/ux64/liblpsolve55.a"
1979 (string-append lib "/liblpsolve55.a"))
1980 (copy-file "lpsolve55/bin/ux64/liblpsolve55.so"
1981 (string-append lib "/liblpsolve55.so"))
96c46210
LC
1982 (install-file "lp_solve/bin/ux64/lp_solve" bin)
1983
7f18257b
AE
1984 ;; Install a subset of the header files as on Debian
1985 ;; (plus lp_bit.h, which matches the regular expression).
96c46210
LC
1986 (for-each (lambda (name)
1987 (install-file name include))
1988 (find-files "." "lp_[HMSa-z].*\\.h$"))
7f18257b 1989 (with-directory-excursion "shared"
96c46210
LC
1990 (for-each (lambda (name)
1991 (install-file name include))
1992 (find-files "." "\\.h$")))
7f18257b
AE
1993 #t))))))
1994 (home-page "http://lpsolve.sourceforge.net/")
1995 (synopsis "Mixed integer linear programming (MILP) solver")
1996 (description
1997 "lp_solve is a mixed integer linear programming solver based on the
1998revised simplex and the branch-and-bound methods.")
1999 (license license:lgpl2.1+)))
a17d4564
EB
2000
2001(define-public dealii
2002 (package
2003 (name "dealii")
2004 (version "8.2.1")
2005 (source
2006 (origin
2007 (method url-fetch)
2008 (uri (string-append "https://github.com/dealii/dealii/releases/"
2009 "download/v" version "/dealii-" version ".tar.gz"))
2010 (sha256
2011 (base32
2012 "185jych0gdnpkjwxni7pd0dda149492zwq2457xdjg76bzj78mnp"))
fc1adab1 2013 (patches (search-patches "dealii-p4est-interface.patch"))
a17d4564
EB
2014 (modules '((guix build utils)))
2015 (snippet
2016 ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
2017 '(delete-file-recursively "bundled"))))
2018 (build-system cmake-build-system)
2019 (inputs
2020 `(("tbb" ,tbb)
2021 ("zlib" ,zlib)
2022 ("boost" ,boost)
2023 ("p4est" ,p4est)
2024 ("blas" ,openblas)
2025 ("lapack" ,lapack)
2026 ("arpack" ,arpack-ng)
2027 ("muparser" ,muparser)
2028 ("gfortran" ,gfortran)
2029 ("suitesparse" ,suitesparse))) ;for UMFPACK
2030 (arguments
2031 `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease
2032 #:configure-flags '("-DCOMPAT_FILES=OFF") ;Follow new directory structure
2033 #:phases (modify-phases %standard-phases
2034 (add-after
2035 'install 'hint-example-prefix
2036 ;; Set Cmake hints in examples so that they can find this
2037 ;; deal.II when configuring.
2038 (lambda* (#:key outputs #:allow-other-keys)
2039 (let* ((out (assoc-ref %outputs "out"))
2040 (exmpl (string-append out "/share/doc"
2041 "/dealii/examples")))
2042 (substitute* (find-files exmpl "CMakeLists.txt")
2043 (("([[:space:]]*HINTS.*)\n" _ line)
2044 (string-append line " $ENV{HOME}/.guix-profile "
2045 out "\n")))
2046 #t))))))
2047 (home-page "https://www.dealii.org")
2048 (synopsis "Finite element library")
2049 (description
2050 "Deal.II is a C++ program library targeted at the computational solution
2051of partial differential equations using adaptive finite elements. The main
2052aim of deal.II is to enable rapid development of modern finite element codes,
2053using among other aspects adaptive meshes and a wide array of tools often used
2054in finite element programs.")
2055 (license license:lgpl2.1+)))
2056
2057(define-public dealii-openmpi
2058 (package (inherit dealii)
2059 (name "dealii-openmpi")
2060 (inputs
2061 `(("mpi" ,openmpi)
2062 ;;Supported only with MPI:
2063 ("p4est" ,p4est-openmpi)
2064 ("petsc" ,petsc-openmpi)
2065 ("slepc" ,slepc-openmpi)
2066 ("metis" ,metis) ;for MUMPS
2067 ("scalapack" ,scalapack) ;for MUMPS
2068 ("mumps" ,mumps-metis-openmpi) ;configure supports only metis orderings
2069 ("arpack" ,arpack-ng-openmpi)
2070 ,@(fold alist-delete (package-inputs dealii)
2071 '("p4est" "arpack"))))
2072 (arguments
2073 (substitute-keyword-arguments (package-arguments dealii)
2074 ((#:configure-flags cf)
2075 ``("-DMPI_C_COMPILER=mpicc"
2076 "-DMPI_CXX_COMPILER=mpicxx"
2077 "-DMPI_Fortran_COMPILER=mpifort"
2078 ,@,cf))))
2079 (synopsis "Finite element library (with MPI support)")))
194c7f95
AE
2080
2081(define-public flann
2082 (package
2083 (name "flann")
2084 (version "1.8.4")
2085 (source
2086 (origin
2087 (method url-fetch)
2088 (uri
2089 (string-append
2090 "http://www.cs.ubc.ca/research/flann/uploads/FLANN/flann-"
2091 version "-src.zip"))
2092 (sha256
2093 (base32
2094 "022w8hph7bli5zbpnk3z1qh1c2sl5hm8fw2ccim651ynn0hr7fyz"))))
2095 (build-system cmake-build-system)
2096 (native-inputs
2097 `(("unzip" ,unzip)))
2098 (inputs
2099 `(("hdf5" ,hdf5)
2100 ("octave" ,octave)
2101 ("python" ,python-2) ; print syntax
2102 ;; ("python2-numpy" ,python2-numpy) ; only required for the tests
2103 ("zlib" ,zlib)))
2104 (arguments
2105 `(#:tests? #f)) ; The test data are downloaded from the Internet.
2106 (home-page "http://www.cs.ubc.ca/research/flann/")
2107 (synopsis "Library for approximate nearest neighbors computation")
2108 (description "FLANN is a library for performing fast approximate
2109nearest neighbor searches in high dimensional spaces. It implements a
2110collection of algorithms and a system for automatically choosing the best
2111algorithm and optimum parameters depending on the dataset.
2112
2113FLANN is written in C++ and contains bindings for C, Octave and Python.")
2114 (license (license:non-copyleft "file://COPYING"
2115 "See COPYING in the distribution."))))
d8c97beb
EF
2116
2117(define-public wcalc
2118 (package
2119 (name "wcalc")
2120 (version "2.5")
2121 (source
2122 (origin
2123 (method url-fetch)
2124 (uri
2125 (string-append
2126 "mirror://sourceforge/w-calc/wcalc-" version ".tar.bz2"))
2127 (sha256
2128 (base32
2129 "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
2130 (build-system gnu-build-system)
2131 (inputs
2132 `(("mpfr" ,mpfr)
2133 ("readline" ,readline)))
2134 (home-page "http://w-calc.sourceforge.net/index.php")
2135 (synopsis "Flexible command-line scientific calculator")
2136 (description "Wcalc is a very capable calculator. It has standard functions
2137(sin, asin, and sinh for example, in either radians or degrees), many
2138pre-defined constants (pi, e, c, etc.), support for using variables, \"active\"
2139variables, a command history, hex/octal/binary input and output, unit
2140conversions, embedded comments, and an expandable expression entry field. It
2141evaluates expressions using the standard order of operations.")
2142 (license license:gpl2+)))
45147b0c
FH
2143
2144(define-public xaos
2145 (package
2146 (name "xaos")
2147 (version "3.6")
2148 (source (origin
2149 (method url-fetch)
2150 (uri (string-append "mirror://sourceforge/xaos/xaos-"
2151 version ".tar.gz"))
2152 (sha256
2153 (base32
2154 "15cd1cx1dyygw6g2nhjqq3bsfdj8sj8m4va9n75i0f3ryww3x7wq"))))
2155 (build-system gnu-build-system)
2156 (native-inputs `(("gettext" ,gnu-gettext)))
2157 (inputs `(("libx11" ,libx11)
2158 ("zlib" ,zlib)
2159 ("libpng" ,libpng)
2160 ("gsl" ,gsl)))
2161 (arguments
2162 `(#:tests? #f ;no "check" target
2163 #:make-flags '("LOCALEDIR=$DATAROOTDIR/locale")))
2164 (synopsis "Real-time fractal zoomer")
2165 (description "GNU XaoS is a graphical program that generates fractal
2166patterns and allows you to zoom in and out of them infinitely in a fluid,
2167continuous manner. It also includes tutorials that help to explain how fractals
2168are built. It can generate many different fractal types such as the Mandelbrot
2169set.")
2170 (home-page "http://www.gnu.org/software/xaos/")
2171 (license license:gpl2+)))
528bb464
EB
2172
2173(define-public hypre
2174 (package
2175 (name "hypre")
2176 (version "2.11.0")
2177 (source (origin
2178 (method url-fetch)
2179 (uri (string-append "https://github.com/LLNL/hypre/archive/"
2180 "v" version ".tar.gz"))
2181 (file-name (string-append name "-" version ".tar.gz"))
2182 (sha256
2183 (base32
2184 "0q69ia0jivzcr8p049dn3mg8yjpn6nwq4sw9iqac8vr63vi54l6m"))
2185 (modules '((guix build utils)))
2186 (snippet
2187 '(begin
2188 ;; Remove use of __DATE__ and __TIME__ for reproducibility;
2189 ;; substitute the tarball creation time.
2190 (substitute* "src/utilities/HYPRE_utilities.h"
2191 (("Date Compiled: .*$")
2192 "Date Compiled: Mar 28 2016 20:19:59 +0000\"\n"))
2193 #t))))
2194 (build-system gnu-build-system)
2195 (outputs '("out" ;6.1 MiB of headers and libraries
2196 "doc")) ;4.8 MiB of documentation
2197 (native-inputs
2198 `(("doc++" ,doc++)
2199 ("netpbm" ,netpbm)
2200 ("texlive" ,texlive) ;full package required for fonts
2201 ("ghostscript" ,ghostscript)))
2202 (inputs
2203 `(("blas" ,openblas)
2204 ("lapack" ,lapack)))
2205 (arguments
2206 `(#:modules ((srfi srfi-1)
2207 ,@%gnu-build-system-modules)
2208 #:configure-flags '("--enable-shared"
2209 "--disable-fortran"
2210 "--without-MPI"
2211 "--with-openmp"
2212 "--with-fei"
2213 "--with-lapack"
2214 "--with-blas")
2215 #:phases
2216 (modify-phases %standard-phases
2217 (add-before 'configure 'chdir-src
2218 (lambda _ (chdir "src")))
2219 (replace 'configure
2220 (lambda* (#:key build target configure-flags
2221 #:allow-other-keys #:rest args)
2222 (let* ((configure (assoc-ref %standard-phases 'configure)))
2223 (apply configure
2224 (append args
2225 (list #:configure-flags
2226 (cons (string-append
2227 "--host=" (or target build))
2228 configure-flags)))))))
2229 (add-after 'build 'build-docs
2230 (lambda _
2231 (zero? (system* "make" "-Cdocs" "pdf" "html"))))
2232 (replace 'check
2233 (lambda _
2234 (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/hypre/lib"))
2235 (setenv "PATH" (string-append "." ":" (getenv "PATH")))
2236 (and (system* "make" "check" "CHECKRUN=")
2237 (fold (lambda (filename result)
2238 (and result
2239 (let ((size (stat:size (stat filename))))
2240 (when (not (zero? size))
2241 (format #t "~a size ~d; error indication~%"
2242 filename size))
2243 (zero? size))))
2244 #t
2245 (find-files "test" ".*\\.err$")))))
2246 (add-after 'install 'install-docs
2247 (lambda* (#:key outputs #:allow-other-keys)
2248 ;; Custom install because docs/Makefile doesn't honor ${docdir}.
2249 (let* ((doc (assoc-ref outputs "doc"))
2250 (docdir (string-append doc "/share/doc/hypre-" ,version)))
2251 (mkdir-p docdir)
2252 (with-directory-excursion "docs"
2253 (for-each (lambda (base)
2254 (install-file (string-append base ".pdf") docdir)
2255 (copy-recursively base docdir)) ;html docs
2256 '("HYPRE_usr_manual"
2257 "HYPRE_ref_manual")))
2258 #t))))))
2259 (home-page "http://www.llnl.gov/casc/hypre/")
2260 (synopsis "Library of solvers and preconditioners for linear equations")
2261 (description
2262 "HYPRE is a software library of high performance preconditioners and
2263solvers for the solution of large, sparse linear systems of equations. It
2264features multigrid solvers for both structured and unstructured grid
2265problems.")
2266 (license license:lgpl2.1)))
2267
2268(define-public hypre-openmpi
2269 (package (inherit hypre)
2270 (name "hypre-openmpi")
2271 (inputs
2272 `(("mpi" ,openmpi)
2273 ,@(package-inputs hypre)))
2274 (arguments
2275 (substitute-keyword-arguments (package-arguments hypre)
2276 ((#:configure-flags flags)
2277 ``("--with-MPI"
2278 ,@(delete "--without-MPI" ,flags)))))
2279 (synopsis "Parallel solvers and preconditioners for linear equations")
2280 (description
2281 "HYPRE is a software library of high performance preconditioners and
2282solvers for the solution of large, sparse linear systems of equations on
2283parallel computers. It features parallel multigrid solvers for both
2284structured and unstructured grid problems.")))