gnu: gegl: Disable tests.
[jackhill/guix/guix.git] / gnu / packages / maths.scm
CommitLineData
8f8b2451 1;;; GNU Guix --- Functional package management for GNU
06ed5982 2;;; Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr>
da95c817 3;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
668c06ac 4;;; Copyright © 2014 John Darrington <jmd@gnu.org>
f5d5a346 5;;; Copyright © 2014 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>
8f8b2451
AE
8;;;
9;;; This file is part of GNU Guix.
10;;;
11;;; GNU Guix is free software; you can redistribute it and/or modify it
12;;; under the terms of the GNU General Public License as published by
13;;; the Free Software Foundation; either version 3 of the License, or (at
14;;; your option) any later version.
15;;;
16;;; GNU Guix is distributed in the hope that it will be useful, but
17;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;;; GNU General Public License for more details.
20;;;
21;;; You should have received a copy of the GNU General Public License
22;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24(define-module (gnu packages maths)
ec322be2 25 #:use-module (ice-9 regex)
8f8b2451 26 #:use-module (gnu packages)
b5b73a82 27 #:use-module ((guix licenses) #:prefix license:)
8f8b2451
AE
28 #:use-module (guix packages)
29 #:use-module (guix download)
0e2672ae 30 #:use-module (guix utils)
da95c817 31 #:use-module (guix build-system cmake)
c9dfa3c7 32 #:use-module (guix build-system gnu)
3de01d3f
EB
33 #:use-module (gnu packages algebra)
34 #:use-module (gnu packages bison)
35 #:use-module (gnu packages cmake)
c9dfa3c7 36 #:use-module (gnu packages compression)
668c06ac 37 #:use-module (gnu packages curl)
57e544e8 38 #:use-module (gnu packages elf)
3de01d3f 39 #:use-module (gnu packages flex)
668c06ac 40 #:use-module (gnu packages fltk)
f3929800 41 #:use-module (gnu packages fontutils)
1dba6407 42 #:use-module (gnu packages gettext)
da95c817 43 #:use-module (gnu packages gcc)
73fed4f8 44 #:use-module (gnu packages gd)
668c06ac 45 #:use-module (gnu packages ghostscript)
221ed17a 46 #:use-module (gnu packages glib)
f3929800 47 #:use-module (gnu packages gtk)
668c06ac 48 #:use-module (gnu packages less)
8731e527 49 #:use-module (gnu packages lisp)
5698b8b8 50 #:use-module (gnu packages gnome)
668c06ac
JD
51 #:use-module (gnu packages xorg)
52 #:use-module (gnu packages gl)
8731e527 53 #:use-module (gnu packages m4)
d8c7eeb9 54 #:use-module (gnu packages mpi)
b92eee75 55 #:use-module (gnu packages multiprecision)
668c06ac 56 #:use-module (gnu packages pcre)
5698b8b8 57 #:use-module (gnu packages popt)
c9dfa3c7
AE
58 #:use-module (gnu packages perl)
59 #:use-module (gnu packages pkg-config)
da95c817 60 #:use-module (gnu packages python)
c9dfa3c7 61 #:use-module (gnu packages readline)
183e44ae 62 #:use-module (gnu packages tcsh)
df354a77 63 #:use-module (gnu packages tcl)
668c06ac 64 #:use-module (gnu packages texinfo)
73fed4f8 65 #:use-module (gnu packages texlive)
c9dfa3c7 66 #:use-module (gnu packages xml))
8f8b2451
AE
67
68(define-public units
69 (package
70 (name "units")
983815c8 71 (version "2.11")
8f8b2451
AE
72 (source (origin
73 (method url-fetch)
74 (uri (string-append "mirror://gnu/units/units-" version
75 ".tar.gz"))
76 (sha256 (base32
983815c8 77 "1gjs3wc212aaiq4r76hx9nl1h3fa39n0ljwl9420d6ixl3rdmdjk"))))
8f8b2451
AE
78 (build-system gnu-build-system)
79 (synopsis "Conversion between thousands of scales")
80 (description
574e86f9
LC
81 "GNU Units converts numeric quantities between units of measure. It
82can handle scale changes through adaptive usage of standard scale prefixes
83(micro-, kilo-, etc.). It can also handle nonlinear conversions such as
84Fahrenheit to Celsius. Its interpreter is powerful enough to be used
85effectively as a scientific calculator.")
8f8b2451
AE
86 (license license:gpl3+)
87 (home-page "http://www.gnu.org/software/units/")))
c9dfa3c7 88
182d6311
ML
89(define-public dionysus
90 (package
91 (name "dionysus")
92 (version "1.3.0")
93 (source (origin
94 (method url-fetch)
95 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
96 ".tar.gz"))
97 (sha256
98 (base32
99 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
100 (build-system gnu-build-system)
101 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
102 (synopsis "Local search for universal constants and scientific values")
103 (description
104 "GNU Dionysus is a convenient system for quickly retrieving the values of
105mathematical constants used in science and engineering. Values can be
106searched using a simple command-line tool, choosing from three databases:
107universal constants, atomic numbers, and constants related to
108semiconductors.")
109 (license license:gpl3+)
110 (home-page "http://www.gnu.org/software/dionysus/")))
111
88bd1804
AE
112(define-public gsl
113 (package
114 (name "gsl")
487da565 115 (version "1.16")
88bd1804
AE
116 (source
117 (origin
118 (method url-fetch)
119 (uri (string-append "mirror://gnu/gsl/gsl-"
120 version ".tar.gz"))
121 (sha256
122 (base32
487da565 123 "0lrgipi0z6559jqh82yx8n4xgnxkhzj46v96dl77hahdp58jzg3k"))))
88bd1804 124 (build-system gnu-build-system)
71e0f288 125 (arguments
487da565
AE
126 `(#:parallel-tests? #f
127 #:phases
71e0f288
AE
128 (alist-replace
129 'configure
130 (lambda* (#:key target system outputs #:allow-other-keys #:rest args)
131 (let ((configure (assoc-ref %standard-phases 'configure)))
132 ;; disable numerically unstable test on i686, see thread at
133 ;; http://lists.gnu.org/archive/html/bug-gsl/2011-11/msg00019.html
134 (if (string=? (or target system) "i686-linux")
135 (substitute* "ode-initval2/Makefile.in"
136 (("TESTS = \\$\\(check_PROGRAMS\\)") "TESTS =")))
137 (apply configure args)))
138 %standard-phases)))
88bd1804
AE
139 (home-page "http://www.gnu.org/software/gsl/")
140 (synopsis "Numerical library for C and C++")
141 (description
a22dc0c4
LC
142 "The GNU Scientific Library is a library for numerical analysis in C
143and C++. It includes a wide range of mathematical routines, with over 1000
144functions in total. Subject areas covered by the library include:
145differential equations, linear algebra, Fast Fourier Transforms and random
146numbers.")
88bd1804
AE
147 (license license:gpl3+)))
148
b92eee75
AE
149(define-public glpk
150 (package
151 (name "glpk")
66fdf545 152 (version "4.55")
b92eee75
AE
153 (source
154 (origin
155 (method url-fetch)
156 (uri (string-append "mirror://gnu/glpk/glpk-"
157 version ".tar.gz"))
158 (sha256
159 (base32
66fdf545 160 "1rqx5fzj1mhkifilip5mkxybpj2wkniq5qcn8h1w2vkr2rzhs29p"))))
b92eee75
AE
161 (build-system gnu-build-system)
162 (inputs
163 `(("gmp" ,gmp)))
164 (arguments
165 `(#:configure-flags '("--with-gmp")))
166 (home-page "http://www.gnu.org/software/glpk/")
79c311b8 167 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
b92eee75
AE
168 (description
169 "GLPK is a C library for solving large-scale linear programming (LP),
170mixed integer programming (MIP), and other related problems. It supports the
171GNU MathProg modeling language, a subset of the AMPL language, and features a
172translator for the language. In addition to the C library, a stand-alone
173LP/MIP solver is included in the package.")
174 (license license:gpl3+)))
175
c9dfa3c7
AE
176(define-public pspp
177 (package
178 (name "pspp")
3dcd7810 179 (version "0.8.4")
c9dfa3c7
AE
180 (source
181 (origin
182 (method url-fetch)
183 (uri (string-append "mirror://gnu/pspp/pspp-"
184 version ".tar.gz"))
185 (sha256
186 (base32
3dcd7810 187 "0b65q45x05ps95pph6glbg7ymdr638nfb0rk9x5x9qm5k073pk5z"))))
c9dfa3c7
AE
188 (build-system gnu-build-system)
189 (inputs
f3929800
AE
190 `(("cairo" ,cairo)
191 ("fontconfig" ,fontconfig)
1dba6407 192 ("gettext" ,gnu-gettext)
c9dfa3c7
AE
193 ("gsl" ,gsl)
194 ("libxml2" ,libxml2)
f3929800 195 ("pango" ,pango)
c9dfa3c7 196 ("readline" ,readline)
e6a5ce8e
JD
197 ("gtk" ,gtk+-2)
198 ("gtksourceview" ,gtksourceview)
c9dfa3c7
AE
199 ("zlib" ,zlib)))
200 (native-inputs
221ed17a
EB
201 `(("glib" ,glib "bin") ;for glib-genmarshal
202 ("perl" ,perl)
c9dfa3c7 203 ("pkg-config" ,pkg-config)))
c9dfa3c7
AE
204 (home-page "http://www.gnu.org/software/pspp/")
205 (synopsis "Statistical analysis")
206 (description
79c311b8 207 "GNU PSPP is a statistical analysis program. It can perform
c5779c93
LC
208descriptive statistics, T-tests, linear regression and non-parametric tests.
209It features both a graphical interface as well as command-line input. PSPP
210is designed to interoperate with Gnumeric, LibreOffice and OpenOffice. Data
211can be imported from spreadsheets, text files and database sources and it can
212be output in text, PostScript, PDF or HTML.")
c9dfa3c7 213 (license license:gpl3+)))
da95c817
NK
214
215(define-public lapack
216 (package
217 (name "lapack")
566146ab 218 (version "3.5.0")
da95c817
NK
219 (source
220 (origin
221 (method url-fetch)
222 (uri (string-append "http://www.netlib.org/lapack/lapack-"
223 version ".tgz"))
224 (sha256
225 (base32
566146ab 226 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
da95c817
NK
227 (build-system cmake-build-system)
228 (home-page "http://www.netlib.org/lapack/")
57e544e8 229 (native-inputs `(("patchelf" ,patchelf))) ;for augment-rpath
da95c817
NK
230 (inputs `(("fortran" ,gfortran-4.8)
231 ("python" ,python-2)))
232 (arguments
06ed5982 233 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
da95c817 234 #:phases (alist-cons-before
6a995754
LC
235 'check 'patch-python
236 (lambda* (#:key inputs #:allow-other-keys)
237 (let ((python (assoc-ref inputs "python")))
238 (substitute* "lapack_testing.py"
239 (("/usr/bin/env python") python))))
06ed5982 240 %standard-phases)))
da95c817
NK
241 (synopsis "Library for numerical linear algebra")
242 (description
243 "LAPACK is a Fortran 90 library for solving the most commonly occurring
244problems in numerical linear algebra.")
245 (license (license:bsd-style "file://LICENSE"
246 "See LICENSE in the distribution."))))
73fed4f8
JD
247
248(define-public gnuplot
249 (package
250 (name "gnuplot")
251 (version "4.6.3")
252 (source
253 (origin
254 (method url-fetch)
255 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
256 version "/gnuplot-" version ".tar.gz"))
257 (sha256
258 (base32
259 "1xd7gqdhlk7k1p9yyqf9vkk811nadc7m4si0q3nb6cpv4pxglpyz"))))
260 (build-system gnu-build-system)
261 (inputs `(("readline" ,readline)
262 ("cairo" ,cairo)
263 ("pango" ,pango)
264 ("gd" ,gd)))
265 (native-inputs `(("texlive" ,texlive)
266 ("pkg-config" ,pkg-config)))
267 (home-page "http://www.gnuplot.info")
268 (synopsis "Command-line driven graphing utility")
269 (description "Gnuplot is a portable command-line driven graphing
35b9e423 270utility. It was originally created to allow scientists and students to
73fed4f8 271visualize mathematical functions and data interactively, but has grown to
35b9e423 272support many non-interactive uses such as web scripting. It is also used as a
73fed4f8
JD
273plotting engine by third-party applications like Octave.")
274 ;; X11 Style with the additional restriction that derived works may only be
275 ;; distributed as patches to the original.
276 (license (license:fsf-free
668c06ac
JD
277 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
278
7ee3f1a2
JD
279(define-public hdf5
280 (package
281 (name "hdf5")
282 (version "1.8.12")
283 (source
284 (origin
285 (method url-fetch)
93c3de92
AE
286 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-"
287 version "/src/hdf5-"
7ee3f1a2
JD
288 version ".tar.bz2"))
289 (sha256
290 (base32 "0f9n0v3p3lwc7564791a39c6cn1d3dbrn7d1j3ikqsi27a8hy23d"))))
291 (build-system gnu-build-system)
292 (arguments
293 `(#:phases
d4bf49b1
EB
294 (alist-cons-before
295 'configure 'patch-configure
296 (lambda _
297 (substitute* "configure"
298 (("/bin/mv") "mv")))
7ee3f1a2
JD
299 %standard-phases)))
300 (outputs '("out" "bin" "lib" "include"))
301 (home-page "http://www.hdfgroup.org")
516e93f8 302 (synopsis "Management suite for extremely large and complex data")
7ee3f1a2
JD
303 (description "HDF5 is a suite that makes possible the management of
304extremely large and complex data collections.")
d4bf49b1
EB
305 (license (license:x11-style
306 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
7ee3f1a2
JD
307
308
668c06ac
JD
309;; For a fully featured Octave, users are strongly recommended also to install
310;; the following packages: texinfo, less, ghostscript, gnuplot.
311(define-public octave
312 (package
313 (name "octave")
314 (version "3.8.0")
315 (source
316 (origin
317 (method url-fetch)
318 (uri (string-append "mirror://gnu/octave/octave-"
319 version ".tar.gz"))
320 (sha256
321 (base32
322 "0ks9pr154syw0vb3jn6xsnrkkrbvf9y7i7gaxa28rz6ngxbxvq9l"))))
323 (build-system gnu-build-system)
324 (inputs
325 `(("lapack" ,lapack)
326 ("readline" ,readline)
327 ("glpk" ,glpk)
328 ("curl" ,curl)
329 ("pcre" ,pcre)
330 ("fltk" ,fltk)
331 ("fontconfig" ,fontconfig)
332 ("freetype" ,freetype)
7ee3f1a2
JD
333 ("hdf5-lib" ,hdf5 "lib")
334 ("hdf5-include" ,hdf5 "include")
668c06ac
JD
335 ("libxft" ,libxft)
336 ("mesa" ,mesa)
337 ("zlib" ,zlib)))
338 (native-inputs
339 `(("gfortran" ,gfortran-4.8)
340 ("pkg-config" ,pkg-config)
341 ("perl" ,perl)
342 ;; The following inputs are not actually used in the build process. However, the
343 ;; ./configure gratuitously tests for their existence and assumes that programs not
344 ;; present at build time are also not, and can never be, available at run time!
345 ;; If these inputs are therefore not present, support for them will be built out.
346 ;; However, Octave will still run without them, albeit without the features they
347 ;; provide.
348 ("less" ,less)
349 ("texinfo" ,texinfo)
350 ("ghostscript" ,ghostscript)
351 ("gnuplot" ,gnuplot)))
352 (arguments
353 `(#:configure-flags (list (string-append "--with-shell="
354 (assoc-ref %build-inputs "bash")
355 "/bin/sh"))))
356 (home-page "http://www.gnu.org/software/octave/")
357 (synopsis "High-level language for numerical computation")
358 (description "GNU Octave is a high-level interpreted language that is specialized
359for numerical computations. It can be used for both linear and non-linear
360applications and it provides great support for visualizing results. Work may
361be performed both at the interactive command-line as well as via script
362files.")
363 (license license:gpl3+)))
3de01d3f
EB
364
365(define-public gmsh
366 (package
367 (name "gmsh")
368 (version "2.8.4")
369 (source
370 (origin
371 (method url-fetch)
372 (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
373 version "-source.tgz"))
374 (sha256
375 (base32 "0jv2yvk28w86rx5mvjkb0w12ff2jxih7axnpvznpd295lg5jg7hr"))
376 (modules '((guix build utils)))
377 (snippet
378 ;; Remove non-free METIS code
379 '(delete-file-recursively "contrib/Metis"))))
380 (build-system cmake-build-system)
381 (native-inputs `(("patchelf" ,patchelf))) ;for augment-rpath
382 (propagated-inputs
383 `(("fltk" ,fltk)
384 ("gfortran" ,gfortran-4.8)
385 ("gmp" ,gmp)
386 ("hdf5-lib" ,hdf5 "lib")
387 ("hdf5-include" ,hdf5 "include")
388 ("lapack" ,lapack)
389 ("mesa" ,mesa)
390 ("libx11" ,libx11)
391 ("libxext" ,libxext)))
392 (arguments
393 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
394 "-DENABLE_BUILD_SHARED:BOOL=ON"
395 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")))
396 (home-page "http://www.geuz.org/gmsh/")
397 (synopsis "3D finite element grid generator")
edf684ef
EB
398 (description "Gmsh is a 3D finite element grid generator with a built-in
399CAD engine and post-processor. Its design goal is to provide a fast, light
400and user-friendly meshing tool with parametric input and advanced
401visualization capabilities. Gmsh is built around four modules: geometry,
402mesh, solver and post-processing. The specification of any input to these
403modules is done either interactively using the graphical user interface or in
404ASCII text files using Gmsh's own scripting language.")
3de01d3f 405 (license license:gpl2+)))
b9100e2f
EB
406
407(define-public petsc
408 (package
409 (name "petsc")
410 (version "3.4.4")
411 (source
412 (origin
413 (method url-fetch)
414 ;; The *-lite-* tarball does not contain the *large* documentation
415 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
416 "petsc-lite-" version ".tar.gz"))
417 (sha256
418 (base32 "0v5dg6dhdjpi5ianvd4mm6hsvxzv1bsxwnh9f9myag0a0d9xk9iv"))
419 (patches
420 (list (search-patch "petsc-fix-threadcomm.patch")))))
421 (build-system gnu-build-system)
422 (native-inputs
423 `(("python" ,python-2)
424 ("perl" ,perl)))
425 (inputs
426 `(("gfortran" ,gfortran-4.8)
427 ("lapack" ,lapack)
f258212d 428 ("superlu" ,superlu)
b9100e2f
EB
429 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
430 ;; leaving out opengl, as configuration seems to only be for mac
431 ))
432 (arguments
433 `(#:test-target "test"
434 #:parallel-build? #f
435 #:configure-flags
436 `("--with-mpi=0"
f258212d
EB
437 "--with-openmp=1"
438 "--with-superlu=1"
439 ,(string-append "--with-superlu-include="
440 (assoc-ref %build-inputs "superlu") "/include")
441 ,(string-append "--with-superlu-lib="
442 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
b9100e2f
EB
443 #:phases
444 (alist-replace
445 'configure
446 ;; PETSc's configure script is actually a python script, so we can't
447 ;; run it with bash.
448 (lambda* (#:key outputs (configure-flags '())
449 #:allow-other-keys)
450 (let* ((prefix (assoc-ref outputs "out"))
451 (flags `(,(string-append "--prefix=" prefix)
452 ,@configure-flags)))
453 (format #t "build directory: ~s~%" (getcwd))
454 (format #t "configure flags: ~s~%" flags)
455 (zero? (apply system* "./configure" flags))))
456 (alist-cons-after
10b11968
EB
457 'configure 'clean-local-references
458 ;; Try to keep build directory names from leaking into compiled code
b9100e2f 459 (lambda* (#:key inputs outputs #:allow-other-keys)
10b11968
EB
460 (let ((out (assoc-ref outputs "out")))
461 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
462 (((getcwd)) out))))
463 (alist-cons-after
464 'install 'clean-install
465 ;; Try to keep installed files from leaking build directory names.
466 (lambda* (#:key inputs outputs #:allow-other-keys)
467 (let ((out (assoc-ref outputs "out"))
468 (fortran (assoc-ref inputs "gfortran")))
469 (substitute* (map (lambda (file)
470 (string-append out "/" file))
471 '("conf/petscvariables"
472 "conf/PETScConfig.cmake"))
473 (((getcwd)) out))
474 ;; Make compiler references point to the store
475 (substitute* (string-append out "/conf/petscvariables")
476 (("= g(cc|\\+\\+|fortran)" _ suffix)
477 (string-append "= " fortran "/bin/g" suffix)))
478 ;; PETSc installs some build logs, which aren't necessary.
479 (for-each (lambda (file)
480 (let ((f (string-append out "/" file)))
481 (when (file-exists? f)
482 (delete-file f))))
483 '("conf/configure.log"
484 "conf/make.log"
485 "conf/test.log"
486 "conf/error.log"
487 "conf/RDict.db"
488 ;; Once installed, should uninstall with Guix
489 "conf/uninstall.py"))))
490 %standard-phases)))))
b9100e2f 491 (home-page "http://www.mcs.anl.gov/petsc")
16ecf3ff 492 (synopsis "Library to solve PDEs")
b9100e2f
EB
493 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
494data structures and routines for the scalable (parallel) solution of
495scientific applications modeled by partial differential equations.")
496 (license (license:bsd-style
497 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
498
499(define-public petsc-complex
500 (package (inherit petsc)
9e771e3b 501 (location (source-properties->location (current-source-location)))
b9100e2f
EB
502 (name "petsc-complex")
503 (arguments
504 (substitute-keyword-arguments (package-arguments petsc)
505 ((#:configure-flags cf)
506 `(cons "--with-scalar-type=complex" ,cf))))
16ecf3ff 507 (synopsis "Library to solve PDEs (with complex scalars)")))
183e44ae 508
d8c7eeb9
EB
509(define-public petsc-openmpi
510 (package (inherit petsc)
511 (name "petsc-openmpi")
512 (inputs
513 `(("openmpi" ,openmpi)
514 ,@(package-inputs petsc)))
515 (arguments
516 (substitute-keyword-arguments (package-arguments petsc)
517 ((#:configure-flags cf)
518 ``("--with-mpiexec=mpirun"
519 ,(string-append "--with-mpi-dir="
520 (assoc-ref %build-inputs "openmpi"))
521 ,@(delete "--with-mpi=0" ,cf)))))
16ecf3ff 522 (synopsis "Library to solve PDEs (with MPI support)")))
d8c7eeb9
EB
523
524(define-public petsc-complex-openmpi
525 (package (inherit petsc-complex)
526 (name "petsc-complex-openmpi")
527 (inputs
528 `(("openmpi" ,openmpi)
529 ,@(package-inputs petsc-complex)))
530 (arguments
531 (substitute-keyword-arguments (package-arguments petsc-complex)
532 ((#:configure-flags cf)
533 ``("--with-mpiexec=mpirun"
534 ,(string-append "--with-mpi-dir="
535 (assoc-ref %build-inputs "openmpi"))
536 ,@(delete "--with-mpi=0" ,cf)))))
16ecf3ff 537 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
d8c7eeb9 538
183e44ae
EB
539(define-public superlu
540 (package
541 (name "superlu")
542 (version "4.3")
543 (source
544 (origin
545 (method url-fetch)
546 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
547 "superlu_" version ".tar.gz"))
548 (sha256
549 (base32 "10b785s9s4x0m9q7ihap09275pq4km3k2hk76jiwdfdr5qr2168n"))))
550 (build-system gnu-build-system)
551 (native-inputs
552 `(("tcsh" ,tcsh)))
553 (inputs
554 `(("lapack" ,lapack)
555 ("gfortran" ,gfortran-4.8)))
556 (arguments
557 `(#:parallel-build? #f
558 #:tests? #f ;tests are run as part of `make all`
559 #:phases
560 (alist-replace
561 'configure
562 (lambda* (#:key inputs outputs #:allow-other-keys)
563 (call-with-output-file "make.inc"
564 (lambda (port)
565 (format port "
566PLAT =
567SuperLUroot = ~a
568SUPERLULIB = ~a/lib/libsuperlu.a
569TMGLIB = libtmglib.a
570BLASDEF = -DUSE_VENDOR_BLAS
571BLASLIB = -L~a/lib -lblas
572LIBS = $(SUPERLULIB) $(BLASLIB)
573ARCH = ar
574ARCHFLAGS = cr
575RANLIB = ranlib
576CC = gcc
577PIC = -fPIC
578CFLAGS = -O3 -DPRNTlevel=0 $(PIC)
579NOOPTS = -O0 $(PIC)
580FORTRAN = gfortran
581FFLAGS = -O2 $(PIC)
582LOADER = $(CC)
583CDEFS = -DAdd_"
584 (getcwd)
585 (assoc-ref outputs "out")
586 (assoc-ref inputs "lapack")))))
587 (alist-cons-before
588 'build 'create-install-directories
589 (lambda* (#:key outputs #:allow-other-keys)
590 (for-each
591 (lambda (dir)
592 (mkdir-p (string-append (assoc-ref outputs "out")
593 "/" dir)))
594 '("lib" "include")))
595 (alist-replace
596 'install
597 (lambda* (#:key outputs #:allow-other-keys)
598 ;; Library is placed in lib during the build phase. Copy over
599 ;; headers to include.
600 (let* ((out (assoc-ref outputs "out"))
601 (incdir (string-append out "/include")))
602 (for-each (lambda (file)
603 (let ((base (basename file)))
604 (format #t "installing `~a' to `~a'~%"
605 base incdir)
606 (copy-file file
607 (string-append incdir "/" base))))
608 (find-files "SRC" ".*\\.h$"))))
609 %standard-phases)))))
610 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
611 (synopsis "Supernodal direct solver for sparse linear systems")
612 (description
613 "SuperLU is a general purpose library for the direct solution of large,
614sparse, nonsymmetric systems of linear equations on high performance machines.
615The library is written in C and is callable from either C or Fortran. The
616library routines perform an LU decomposition with partial pivoting and
617triangular system solves through forward and back substitution. The library
618also provides threshold-based ILU factorization preconditioners.")
619 (license license:bsd-3)))
f8ed036a 620
a54aefea
EB
621(define-public superlu-dist
622 (package
623 (name "superlu-dist")
624 (version "3.3")
625 (source
626 (origin
627 (method url-fetch)
628 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
629 "superlu_dist_" version ".tar.gz"))
630 (sha256
631 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
632 (patches (list (search-patch "superlu-dist-scotchmetis.patch")))))
633 (build-system gnu-build-system)
634 (native-inputs
635 `(("tcsh" ,tcsh)))
636 (inputs
637 `(("gfortran" ,gfortran-4.8)))
638 (propagated-inputs
639 `(("openmpi" ,openmpi) ;headers include MPI heades
640 ("lapack" ,lapack) ;required to link with output library
641 ("pt-scotch" ,pt-scotch))) ;same
642 (arguments
643 `(#:parallel-build? #f ;race conditions using ar
644 #:phases
645 (alist-replace
646 'configure
647 (lambda* (#:key inputs outputs #:allow-other-keys)
648 (call-with-output-file "make.inc"
649 (lambda (port)
650 (format port "
651PLAT =
652DSuperLUroot = ~a
653DSUPERLULIB = ~a/lib/libsuperlu_dist.a
654BLASDEF = -DUSE_VENDOR_BLAS
655BLASLIB = -L~a/lib -lblas
656PARMETISLIB = -L~a/lib \
657 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
658 -lscotch -lscotcherr -lscotcherrexit
659METISLIB = -L~:*~a/lib \
660 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
661LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
662ARCH = ar
663ARCHFLAGS = cr
664RANLIB = ranlib
665CC = mpicc
666PIC = -fPIC
667CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
668NOOPTS = -O0 -g $(PIC)
669FORTRAN = mpifort
670FFLAGS = -O2 -g $(PIC)
671LOADER = $(CC)
672CDEFS = -DAdd_"
673 (getcwd)
674 (assoc-ref outputs "out")
675 (assoc-ref inputs "lapack")
676 (assoc-ref inputs "pt-scotch")))))
677 (alist-cons-after
678 'unpack 'remove-broken-symlinks
679 (lambda _
680 (for-each delete-file
681 (find-files "MAKE_INC" "\\.#make\\..*")))
682 (alist-cons-before
683 'build 'create-install-directories
684 (lambda* (#:key outputs #:allow-other-keys)
685 (for-each
686 (lambda (dir)
687 (mkdir-p (string-append (assoc-ref outputs "out")
688 "/" dir)))
689 '("lib" "include")))
690 (alist-replace
691 'check
692 (lambda _
693 (with-directory-excursion "EXAMPLE"
694 (and
695 (zero? (system* "mpirun" "-n" "2"
696 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
697 (zero? (system* "mpirun" "-n" "2"
698 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
699 (alist-replace
700 'install
701 (lambda* (#:key outputs #:allow-other-keys)
702 ;; Library is placed in lib during the build phase. Copy over
703 ;; headers to include.
704 (let* ((out (assoc-ref outputs "out"))
705 (incdir (string-append out "/include")))
706 (for-each (lambda (file)
707 (let ((base (basename file)))
708 (format #t "installing `~a' to `~a'~%"
709 base incdir)
710 (copy-file file
711 (string-append incdir "/" base))))
712 (find-files "SRC" ".*\\.h$"))))
713 %standard-phases)))))))
714 (home-page (package-home-page superlu))
715 (synopsis "Parallel supernodal direct solver")
716 (description
717 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
718It is targeted for distributed memory parallel machines. SuperLU_DIST is
719implemented in ANSI C, and MPI for communications.")
720 (license license:bsd-3)))
721
f8ed036a
EB
722(define-public scotch
723 (package
724 (name "scotch")
725 (version "6.0.0")
726 (source
727 (origin
728 (method url-fetch)
729 (uri (string-append "https://gforge.inria.fr/frs/download.php/31831/"
730 "scotch_" version ".tar.gz"))
731 (sha256
732 (base32 "0yfqf9lk7chb3h42777x42x4adx0v3n0b41q0cdqrdmscp4iczp5"))
733 (patches (list (search-patch "scotch-test-threading.patch")))))
734 (build-system gnu-build-system)
735 (inputs
736 `(("zlib" ,zlib)
737 ("flex" ,flex)
738 ("bison" ,bison)))
739 (arguments
740 `(#:phases
741 (alist-cons-after
742 'unpack 'chdir-to-src
743 (lambda _ (chdir "src"))
744 (alist-replace
745 'configure
746 (lambda _
747 (call-with-output-file "Makefile.inc"
748 (lambda (port)
749 (format port "
750EXE =
751LIB = .a
752OBJ = .o
753MAKE = make
754AR = ar
755ARFLAGS = -ruv
756CCS = gcc
757CCP = mpicc
758CCD = gcc
759CPPFLAGS =~{ -D~a~}
760CFLAGS = -O2 -g $(CPPFLAGS)
761LDFLAGS = -lz -lm -lrt -lpthread
762CP = cp
763LEX = flex -Pscotchyy -olex.yy.c
764LN = ln
765MKDIR = mkdir
766MV = mv
767RANLIB = ranlib
768YACC = bison -pscotchyy -y -b y
769"
770 '("COMMON_FILE_COMPRESS_GZ"
771 "COMMON_PTHREAD"
772 "COMMON_RANDOM_FIXED_SEED"
773 ;; TODO: Define once our MPI supports
774 ;; MPI_THREAD_MULTIPLE
775 ;; "SCOTCH_PTHREAD"
776 ;; "SCOTCH_PTHREAD_NUMBER=2"
777 "restrict=__restrict")))))
778 (alist-replace
779 'install
780 (lambda* (#:key outputs #:allow-other-keys)
781 (let ((out (assoc-ref outputs "out")))
782 (mkdir out)
783 (zero? (system* "make"
784 (string-append "prefix=" out)
785 "install"))))
786 %standard-phases)))))
787 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
788 (synopsis "Programs and libraries for graph algorithms")
789 (description "SCOTCH is a set of programs and libraries which implement
790the static mapping and sparse matrix reordering algorithms developed within
791the SCOTCH project. Its purpose is to apply graph theory, with a divide and
792conquer approach, to scientific computing problems such as graph and mesh
793partitioning, static mapping, and sparse matrix ordering, in application
794domains ranging from structural mechanics to operating systems or
795bio-chemistry.")
796 ;; See LICENSE_en.txt
797 (license license:cecill-c)))
6acb4adb
EB
798
799(define-public pt-scotch
800 (package (inherit scotch)
801 (name "pt-scotch")
802 (propagated-inputs
803 `(("openmpi" ,openmpi))) ;Headers include MPI headers
804 (arguments
805 (substitute-keyword-arguments (package-arguments scotch)
806 ((#:phases scotch-phases)
807 `(alist-replace
808 'build
809 ;; TODO: Would like to add parallelism here
810 (lambda _
811 (and
812 (zero? (system* "make" "ptscotch"))
813 ;; Install the serial metis compatibility library
814 (zero? (system* "make" "-C" "libscotchmetis" "install"))))
815 (alist-replace
816 'check
817 (lambda _ (zero? (system* "make" "ptcheck")))
818 (alist-replace
819 'install
820 (lambda* (#:key outputs #:allow-other-keys)
821 (let ((out (assoc-ref outputs "out")))
822 (mkdir out)
823 (zero? (system* "make"
824 (string-append "prefix=" out)
825 "install"))))
826 ,scotch-phases))))))
827 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
5698b8b8
JD
828
829(define-public gsegrafix
830 (package
831 (name "gsegrafix")
832 (version "1.0.6")
833 (source
834 (origin
835 (method url-fetch)
836 (uri (string-append "mirror://gnu/" name "/" name "-"
837 version ".tar.gz"))
838 (sha256
839 (base32
840 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
841 (build-system gnu-build-system)
842 (arguments
843 `(#:configure-flags '("LDFLAGS=-lm")))
844 (inputs
845 `(("libgnomecanvas" ,libgnomecanvas)
846 ("libbonoboui" ,libbonoboui)
847 ("libgnomeui" ,libgnomeui)
848 ("libgnomeprintui" ,libgnomeprintui)
849 ("popt" ,popt)))
850 (native-inputs
851 `(("pkg-config" ,pkg-config)))
852 (home-page "http://www.gnu.org/software/gsegrafix/")
853 (synopsis "GNOME application to create scientific and engineering plots")
854 (description "GSEGrafix is an application which produces high-quality graphical
855plots for science and engineering. Plots are specified via simple ASCII
856parameter files and data files and are presented in an anti-aliased GNOME
857canvas. The program supports rectangular two-dimensional plots, histograms,
858polar-axis plots and three-dimensional plots. Plots can be printed or saved
859to BMP, JPEG or PNG image formats.")
860 (license license:gpl3+)))
8731e527
JD
861
862(define-public maxima
863 (package
864 (name "maxima")
df354a77 865 (version "5.34.1")
8731e527
JD
866 (source
867 (origin
868 (method url-fetch)
869 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
870 version "-source/" name "-" version ".tar.gz"))
871 (sha256
872 (base32
df354a77 873 "1dw9vfzldpj7lv303xbw0wpyn6ra6i2yzwlrjbcx7j0jm5n43ji0"))))
8731e527 874 (build-system gnu-build-system)
df354a77
FB
875 (inputs
876 `(("gcl" ,gcl)
877 ("gnuplot" ,gnuplot) ;for plots
f36afe4d 878 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
df354a77
FB
879 (native-inputs
880 `(("texinfo" ,texinfo)
881 ("perl" ,perl)))
8731e527 882 (arguments
df354a77
FB
883 `(#:configure-flags
884 (list "--enable-gcl"
885 (string-append "--with-posix-shell="
886 (assoc-ref %build-inputs "bash")
887 "/bin/sh")
888 (string-append "--with-wish="
889 (assoc-ref %build-inputs "tk")
890 "/bin/wish"
891 (let ((v ,(package-version tk)))
892 (string-take v (string-index-right v #\.)))))
df354a77
FB
893 ;; By default Maxima attempts to write temporary files to
894 ;; '/tmp/nix-build-maxima-5.34.1', which doesn't exist. Work around
895 ;; that.
896 #:make-flags (list "TMPDIR=/tmp")
df354a77 897 #:phases (alist-cons-before
8731e527 898 'check 'pre-check
df354a77 899 (lambda _
8731e527 900 (chmod "src/maxima" #o555))
f36afe4d
FB
901 ;; Make sure the doc and emacs files are found in the
902 ;; standard location. Also configure maxima to find gnuplot
903 ;; without having it on the PATH.
904 (alist-cons-after
905 'install 'post-install
906 (lambda* (#:key outputs inputs #:allow-other-keys)
907 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
908 (out (assoc-ref outputs "out"))
909 (datadir (string-append out "/share/maxima/" ,version)))
910 (with-directory-excursion out
911 (mkdir-p "share/emacs")
912 (mkdir-p "share/doc")
913 (symlink
914 (string-append datadir "/emacs/")
915 (string-append out "/share/emacs/site-lisp"))
916 (symlink
917 (string-append datadir "/doc/")
918 (string-append out "/share/doc/maxima"))
919 (with-atomic-file-replacement
920 (string-append datadir "/share/maxima-init.lisp")
921 (lambda (in out)
922 (format out "~a ~s~a~%"
923 "(setf $gnuplot_command "
924 (string-append gnuplot "/bin/gnuplot") ")")
925 (dump-port in out))))))
926 %standard-phases))))
8731e527
JD
927 (home-page "http://maxima.sourceforge.net")
928 (synopsis "Numeric and symbolic expression manipulation")
929 (description "Maxima is a system for the manipulation of symbolic and
930numerical expressions. It yields high precision numeric results by using
931exact fractions, arbitrary precision integers, and variable precision floating
932point numbers")
933 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
934 ;; Others simply say "GNU General Public License" without stating a
935 ;; version (which implicitly means gpl1+).
936 ;; At least one file (src/maxima.asd) says "version 2."
937 ;; GPLv2 only is therefore the smallest subset.
f36afe4d 938 (license license:gpl2)))
ec322be2
FB
939
940(define-public atlas
941 (package
942 (name "atlas")
943 (version "3.10.2")
944 (source (origin
945 (method url-fetch)
946 (uri (string-append "mirror://sourceforge/math-atlas/atlas"
947 version ".tar.bz2"))
948 (sha256
949 (base32
950 "0bqh4bdnjdyww4mcpg6kn0x7338mfqbdgysn97dzrwwb26di7ars"))))
951 (build-system gnu-build-system)
952 (home-page "http://math-atlas.sourceforge.net/")
953 (inputs `(("gfortran" ,gfortran-4.8)
954 ("lapack-tar" ,(package-source lapack))))
955 (outputs '("out" "doc"))
956 (arguments
957 `(#:parallel-build? #f
958 #:parallel-tests? #f
f15615b1
LC
959
960 ;; ATLAS tunes itself for the machine it is built on, as explained at
961 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
962 ;; For this reason, we want users to build it locally instead of using
963 ;; substitutes.
964 #:substitutable? #f
965
ec322be2
FB
966 #:modules ((srfi srfi-26)
967 (srfi srfi-1)
968 (guix build gnu-build-system)
969 (guix build utils))
970 #:configure-flags
971 `(;; Generate position independent code suitable for dynamic libraries
972 ;; and use WALL timer to get more accurate timing.
973 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
974 ;; Set word width.
975 "-b"
976 ,,(if (string-match "64" (%current-system))
977 "64"
978 "32")
979 ;; Disable parallel build as it gives errors: atlas_pthread.h is
980 ;; needed to compile C files before it is generated.
981 "-Ss" "pmake" "make -j 1"
982 ;; Generate shared libraries.
983 "--shared"
984 ;; Build a full LAPACK library.
985 ,(string-append "--with-netlib-lapack-tarfile="
986 (assoc-ref %build-inputs "lapack-tar")))
987 #:phases
988 (alist-cons-after
989 'install 'install-doc
990 (lambda* (#:key outputs inputs #:allow-other-keys)
991 (let ((doc (string-append (assoc-ref outputs "doc")
992 "/share/doc/atlas")))
993 (mkdir-p doc)
994 (fold (lambda (file previous)
995 (and previous (zero? (system* "cp" file doc))))
996 #t (find-files "../ATLAS/doc" ".*"))))
997 (alist-cons-after
998 'check 'check-pt
999 (lambda _ (zero? (system* "make" "ptcheck")))
1000 ;; Fix files required to run configure.
1001 (alist-cons-before
1002 'configure 'fix-/bin/sh
1003 (lambda _
1004 ;; Use `sh', not `/bin/sh'.
1005 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
1006 (("/bin/sh")
1007 "sh")))
1008 ;; Fix /bin/sh in generated make files.
1009 (alist-cons-after
1010 'configure 'fix-/bin/sh-in-generated-files
1011 (lambda _
1012 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
1013 (("/bin/sh")
1014 "sh")))
1015 ;; ATLAS configure program does not accepts the default flags
1016 ;; passed by the 'gnu-build-system'.
1017 (alist-replace
1018 'configure
1019 (lambda* (#:key native-inputs inputs outputs
1020 (configure-flags '())
1021 #:allow-other-keys #:rest args)
1022 (let* ((prefix (assoc-ref outputs "out"))
1023 (bash (or (and=> (assoc-ref
1024 (or native-inputs inputs) "bash")
1025 (cut string-append <> "/bin/bash"))
1026 "/bin/sh"))
1027 (flags `(,(string-append "--prefix=" prefix)
1028 ,@configure-flags))
1029 (abs-srcdir (getcwd))
1030 (srcdir (string-append "../" (basename abs-srcdir))))
1031 (format #t "source directory: ~s (relative from build: ~s)~%"
1032 abs-srcdir srcdir)
1033 (mkdir "../build")
1034 (chdir "../build")
1035 (format #t "build directory: ~s~%" (getcwd))
1036 (format #t "configure flags: ~s~%" flags)
1037 (zero? (apply system* bash
1038 (string-append srcdir "/configure")
1039 flags))))
1040 %standard-phases)))))))
1041 (synopsis "Automatically Tuned Linear Algebra Software")
1042 (description
1043 "ATLAS is an automatically tuned linear algebra software library
1044providing C and Fortran77 interfaces to a portably efficient BLAS
1045implementation, as well as a few routines from LAPACK.
1046
f15615b1
LC
1047Optimization occurs at build time. For this reason, the library is built on
1048the machine where it is installed, without resorting to pre-built substitutes.
ec322be2 1049
f15615b1
LC
1050Before building the library, CPU throttling should be disabled. This can be
1051done in the BIOS, or, on GNU/Linux, with the following commands:
ec322be2
FB
1052
1053cpufreq-selector -g performance -c 0
1054...
1055cpufreq-selector -g performance -c N-1
1056
1057where N is the number of cores of your CPU. Failure to do so will result in a
1058library with poor performance.")
1059 (license license:bsd-3)))