gnu: global: Update to 6.3.2.
[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>
8f8b2451
AE
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)
0e2672ae 28 #:use-module (guix utils)
da95c817 29 #:use-module (guix build-system cmake)
c9dfa3c7 30 #:use-module (guix build-system gnu)
3de01d3f
EB
31 #:use-module (gnu packages algebra)
32 #:use-module (gnu packages bison)
33 #:use-module (gnu packages cmake)
c9dfa3c7 34 #:use-module (gnu packages compression)
668c06ac 35 #:use-module (gnu packages curl)
57e544e8 36 #:use-module (gnu packages elf)
3de01d3f 37 #:use-module (gnu packages flex)
668c06ac 38 #:use-module (gnu packages fltk)
f3929800 39 #:use-module (gnu packages fontutils)
1dba6407 40 #:use-module (gnu packages gettext)
da95c817 41 #:use-module (gnu packages gcc)
73fed4f8 42 #:use-module (gnu packages gd)
668c06ac 43 #:use-module (gnu packages ghostscript)
221ed17a 44 #:use-module (gnu packages glib)
f3929800 45 #:use-module (gnu packages gtk)
668c06ac 46 #:use-module (gnu packages less)
8731e527 47 #:use-module (gnu packages lisp)
5698b8b8 48 #:use-module (gnu packages gnome)
668c06ac
JD
49 #:use-module (gnu packages xorg)
50 #:use-module (gnu packages gl)
8731e527 51 #:use-module (gnu packages m4)
d8c7eeb9 52 #:use-module (gnu packages mpi)
b92eee75 53 #:use-module (gnu packages multiprecision)
668c06ac 54 #:use-module (gnu packages pcre)
5698b8b8 55 #:use-module (gnu packages popt)
c9dfa3c7
AE
56 #:use-module (gnu packages perl)
57 #:use-module (gnu packages pkg-config)
da95c817 58 #:use-module (gnu packages python)
c9dfa3c7 59 #:use-module (gnu packages readline)
183e44ae 60 #:use-module (gnu packages tcsh)
668c06ac 61 #:use-module (gnu packages texinfo)
73fed4f8 62 #:use-module (gnu packages texlive)
c9dfa3c7 63 #:use-module (gnu packages xml))
8f8b2451
AE
64
65(define-public units
66 (package
67 (name "units")
983815c8 68 (version "2.11")
8f8b2451
AE
69 (source (origin
70 (method url-fetch)
71 (uri (string-append "mirror://gnu/units/units-" version
72 ".tar.gz"))
73 (sha256 (base32
983815c8 74 "1gjs3wc212aaiq4r76hx9nl1h3fa39n0ljwl9420d6ixl3rdmdjk"))))
8f8b2451
AE
75 (build-system gnu-build-system)
76 (synopsis "Conversion between thousands of scales")
77 (description
574e86f9
LC
78 "GNU Units converts numeric quantities between units of measure. It
79can handle scale changes through adaptive usage of standard scale prefixes
80(micro-, kilo-, etc.). It can also handle nonlinear conversions such as
81Fahrenheit to Celsius. Its interpreter is powerful enough to be used
82effectively as a scientific calculator.")
8f8b2451
AE
83 (license license:gpl3+)
84 (home-page "http://www.gnu.org/software/units/")))
c9dfa3c7 85
88bd1804
AE
86(define-public gsl
87 (package
88 (name "gsl")
487da565 89 (version "1.16")
88bd1804
AE
90 (source
91 (origin
92 (method url-fetch)
93 (uri (string-append "mirror://gnu/gsl/gsl-"
94 version ".tar.gz"))
95 (sha256
96 (base32
487da565 97 "0lrgipi0z6559jqh82yx8n4xgnxkhzj46v96dl77hahdp58jzg3k"))))
88bd1804 98 (build-system gnu-build-system)
71e0f288 99 (arguments
487da565
AE
100 `(#:parallel-tests? #f
101 #:phases
71e0f288
AE
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)))
88bd1804
AE
113 (home-page "http://www.gnu.org/software/gsl/")
114 (synopsis "Numerical library for C and C++")
115 (description
a22dc0c4
LC
116 "The GNU Scientific Library is a library for numerical analysis in C
117and C++. It includes a wide range of mathematical routines, with over 1000
118functions in total. Subject areas covered by the library include:
119differential equations, linear algebra, Fast Fourier Transforms and random
120numbers.")
88bd1804
AE
121 (license license:gpl3+)))
122
b92eee75
AE
123(define-public glpk
124 (package
125 (name "glpk")
1f1c0aff 126 (version "4.54")
b92eee75
AE
127 (source
128 (origin
129 (method url-fetch)
130 (uri (string-append "mirror://gnu/glpk/glpk-"
131 version ".tar.gz"))
132 (sha256
133 (base32
1f1c0aff 134 "18gr2anv8gyps6j9f22k7li6w07glvww666sdqblvlq2hh3whwmb"))))
b92eee75
AE
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/")
79c311b8 141 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
b92eee75
AE
142 (description
143 "GLPK is a C library for solving large-scale linear programming (LP),
144mixed integer programming (MIP), and other related problems. It supports the
145GNU MathProg modeling language, a subset of the AMPL language, and features a
146translator for the language. In addition to the C library, a stand-alone
147LP/MIP solver is included in the package.")
148 (license license:gpl3+)))
149
c9dfa3c7
AE
150(define-public pspp
151 (package
152 (name "pspp")
7e0c23fb 153 (version "0.8.3")
c9dfa3c7
AE
154 (source
155 (origin
156 (method url-fetch)
157 (uri (string-append "mirror://gnu/pspp/pspp-"
158 version ".tar.gz"))
159 (sha256
160 (base32
7e0c23fb 161 "0vri2pzvmm38qaihfvwlry30f40lcnps4blg59ixic4q20ldxf5d"))))
c9dfa3c7
AE
162 (build-system gnu-build-system)
163 (inputs
f3929800
AE
164 `(("cairo" ,cairo)
165 ("fontconfig" ,fontconfig)
1dba6407 166 ("gettext" ,gnu-gettext)
c9dfa3c7
AE
167 ("gsl" ,gsl)
168 ("libxml2" ,libxml2)
f3929800 169 ("pango" ,pango)
c9dfa3c7 170 ("readline" ,readline)
e6a5ce8e
JD
171 ("gtk" ,gtk+-2)
172 ("gtksourceview" ,gtksourceview)
c9dfa3c7
AE
173 ("zlib" ,zlib)))
174 (native-inputs
221ed17a
EB
175 `(("glib" ,glib "bin") ;for glib-genmarshal
176 ("perl" ,perl)
c9dfa3c7 177 ("pkg-config" ,pkg-config)))
c9dfa3c7
AE
178 (home-page "http://www.gnu.org/software/pspp/")
179 (synopsis "Statistical analysis")
180 (description
79c311b8
LC
181 "GNU PSPP is a statistical analysis program. It can perform
182descriptive statistics, T-tests, linear regression and non-parametric tests.
183It features both a graphical interface as well as command-line input. PSPP is
184designed to interoperate with Gnumeric, LibreOffice and OpenOffice. Data can
185be imported from spreadsheets, text files and database sources and it can be
186output in text, PostScript, PDF or HTML.")
c9dfa3c7 187 (license license:gpl3+)))
da95c817
NK
188
189(define-public lapack
190 (package
191 (name "lapack")
566146ab 192 (version "3.5.0")
da95c817
NK
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
566146ab 200 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
da95c817
NK
201 (build-system cmake-build-system)
202 (home-page "http://www.netlib.org/lapack/")
57e544e8 203 (native-inputs `(("patchelf" ,patchelf))) ;for augment-rpath
da95c817
NK
204 (inputs `(("fortran" ,gfortran-4.8)
205 ("python" ,python-2)))
206 (arguments
06ed5982 207 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
da95c817 208 #:phases (alist-cons-before
6a995754
LC
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))))
06ed5982 214 %standard-phases)))
da95c817
NK
215 (synopsis "Library for numerical linear algebra")
216 (description
217 "LAPACK is a Fortran 90 library for solving the most commonly occurring
218problems in numerical linear algebra.")
219 (license (license:bsd-style "file://LICENSE"
220 "See LICENSE in the distribution."))))
73fed4f8
JD
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
244utility. It was originally created to allow scientists and students to
245visualize mathematical functions and data interactively, but has grown to
246support many non-interactive uses such as web scripting. It is also used as a
247plotting 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
668c06ac
JD
251 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
252
7ee3f1a2
JD
253(define-public hdf5
254 (package
255 (name "hdf5")
256 (version "1.8.12")
257 (source
258 (origin
259 (method url-fetch)
93c3de92
AE
260 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-"
261 version "/src/hdf5-"
7ee3f1a2
JD
262 version ".tar.bz2"))
263 (sha256
264 (base32 "0f9n0v3p3lwc7564791a39c6cn1d3dbrn7d1j3ikqsi27a8hy23d"))))
265 (build-system gnu-build-system)
266 (arguments
267 `(#:phases
d4bf49b1
EB
268 (alist-cons-before
269 'configure 'patch-configure
270 (lambda _
271 (substitute* "configure"
272 (("/bin/mv") "mv")))
7ee3f1a2
JD
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
278extremely large and complex data collections.")
d4bf49b1
EB
279 (license (license:x11-style
280 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
7ee3f1a2
JD
281
282
668c06ac
JD
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)
7ee3f1a2
JD
307 ("hdf5-lib" ,hdf5 "lib")
308 ("hdf5-include" ,hdf5 "include")
668c06ac
JD
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
333for numerical computations. It can be used for both linear and non-linear
334applications and it provides great support for visualizing results. Work may
335be performed both at the interactive command-line as well as via script
336files.")
337 (license license:gpl3+)))
3de01d3f
EB
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")
edf684ef
EB
372 (description "Gmsh is a 3D finite element grid generator with a built-in
373CAD engine and post-processor. Its design goal is to provide a fast, light
374and user-friendly meshing tool with parametric input and advanced
375visualization capabilities. Gmsh is built around four modules: geometry,
376mesh, solver and post-processing. The specification of any input to these
377modules is done either interactively using the graphical user interface or in
378ASCII text files using Gmsh's own scripting language.")
3de01d3f 379 (license license:gpl2+)))
b9100e2f
EB
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)
f258212d 402 ("superlu" ,superlu)
b9100e2f
EB
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"
f258212d
EB
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"))
b9100e2f
EB
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
10b11968
EB
431 'configure 'clean-local-references
432 ;; Try to keep build directory names from leaking into compiled code
b9100e2f 433 (lambda* (#:key inputs outputs #:allow-other-keys)
10b11968
EB
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)))))
b9100e2f 465 (home-page "http://www.mcs.anl.gov/petsc")
16ecf3ff 466 (synopsis "Library to solve PDEs")
b9100e2f
EB
467 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
468data structures and routines for the scalable (parallel) solution of
469scientific 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))))
16ecf3ff 480 (synopsis "Library to solve PDEs (with complex scalars)")))
183e44ae 481
d8c7eeb9
EB
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)))))
16ecf3ff 495 (synopsis "Library to solve PDEs (with MPI support)")))
d8c7eeb9
EB
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)))))
16ecf3ff 510 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
d8c7eeb9 511
183e44ae
EB
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 "
539PLAT =
540SuperLUroot = ~a
541SUPERLULIB = ~a/lib/libsuperlu.a
542TMGLIB = libtmglib.a
543BLASDEF = -DUSE_VENDOR_BLAS
544BLASLIB = -L~a/lib -lblas
545LIBS = $(SUPERLULIB) $(BLASLIB)
546ARCH = ar
547ARCHFLAGS = cr
548RANLIB = ranlib
549CC = gcc
550PIC = -fPIC
551CFLAGS = -O3 -DPRNTlevel=0 $(PIC)
552NOOPTS = -O0 $(PIC)
553FORTRAN = gfortran
554FFLAGS = -O2 $(PIC)
555LOADER = $(CC)
556CDEFS = -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,
587sparse, nonsymmetric systems of linear equations on high performance machines.
588The library is written in C and is callable from either C or Fortran. The
589library routines perform an LU decomposition with partial pivoting and
590triangular system solves through forward and back substitution. The library
591also provides threshold-based ILU factorization preconditioners.")
592 (license license:bsd-3)))
f8ed036a 593
a54aefea
EB
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 "
624PLAT =
625DSuperLUroot = ~a
626DSUPERLULIB = ~a/lib/libsuperlu_dist.a
627BLASDEF = -DUSE_VENDOR_BLAS
628BLASLIB = -L~a/lib -lblas
629PARMETISLIB = -L~a/lib \
630 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
631 -lscotch -lscotcherr -lscotcherrexit
632METISLIB = -L~:*~a/lib \
633 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
634LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
635ARCH = ar
636ARCHFLAGS = cr
637RANLIB = ranlib
638CC = mpicc
639PIC = -fPIC
640CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
641NOOPTS = -O0 -g $(PIC)
642FORTRAN = mpifort
643FFLAGS = -O2 -g $(PIC)
644LOADER = $(CC)
645CDEFS = -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.
691It is targeted for distributed memory parallel machines. SuperLU_DIST is
692implemented in ANSI C, and MPI for communications.")
693 (license license:bsd-3)))
694
f8ed036a
EB
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 "
723EXE =
724LIB = .a
725OBJ = .o
726MAKE = make
727AR = ar
728ARFLAGS = -ruv
729CCS = gcc
730CCP = mpicc
731CCD = gcc
732CPPFLAGS =~{ -D~a~}
733CFLAGS = -O2 -g $(CPPFLAGS)
734LDFLAGS = -lz -lm -lrt -lpthread
735CP = cp
736LEX = flex -Pscotchyy -olex.yy.c
737LN = ln
738MKDIR = mkdir
739MV = mv
740RANLIB = ranlib
741YACC = 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
763the static mapping and sparse matrix reordering algorithms developed within
764the SCOTCH project. Its purpose is to apply graph theory, with a divide and
765conquer approach, to scientific computing problems such as graph and mesh
766partitioning, static mapping, and sparse matrix ordering, in application
767domains ranging from structural mechanics to operating systems or
768bio-chemistry.")
769 ;; See LICENSE_en.txt
770 (license license:cecill-c)))
6acb4adb
EB
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)")))
5698b8b8
JD
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
828plots for science and engineering. Plots are specified via simple ASCII
829parameter files and data files and are presented in an anti-aliased GNOME
830canvas. The program supports rectangular two-dimensional plots, histograms,
831polar-axis plots and three-dimensional plots. Plots can be printed or saved
832to BMP, JPEG or PNG image formats.")
833 (license license:gpl3+)))
8731e527
JD
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
862numerical expressions. It yields high precision numeric results by using
863exact fractions, arbitrary precision integers, and variable precision floating
864point 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)))