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