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