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