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