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