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