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