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