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