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