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