1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 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>
11 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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 check)
39 #:use-module (gnu packages cmake)
40 #:use-module (gnu packages compression)
41 #:use-module (gnu packages curl)
42 #:use-module (gnu packages elf)
43 #:use-module (gnu packages flex)
44 #:use-module (gnu packages fltk)
45 #:use-module (gnu packages fontutils)
46 #:use-module (gnu packages gettext)
47 #:use-module (gnu packages gcc)
48 #:use-module (gnu packages gd)
49 #:use-module (gnu packages ghostscript)
50 #:use-module (gnu packages glib)
51 #:use-module (gnu packages gtk)
52 #:use-module (gnu packages less)
53 #:use-module (gnu packages lisp)
54 #:use-module (gnu packages gnome)
55 #:use-module (gnu packages xorg)
56 #:use-module (gnu packages gl)
57 #:use-module (gnu packages m4)
58 #:use-module (gnu packages mpi)
59 #:use-module (gnu packages multiprecision)
60 #:use-module (gnu packages pcre)
61 #:use-module (gnu packages popt)
62 #:use-module (gnu packages perl)
63 #:use-module (gnu packages pkg-config)
64 #:use-module (gnu packages python)
65 #:use-module (gnu packages readline)
66 #:use-module (gnu packages tbb)
67 #:use-module (gnu packages tcsh)
68 #:use-module (gnu packages tcl)
69 #:use-module (gnu packages texinfo)
70 #:use-module (gnu packages texlive)
71 #:use-module (gnu packages xml)
72 #:use-module (gnu packages zip))
80 (uri (string-append "mirror://gnu/units/units-" version
83 "1gjs3wc212aaiq4r76hx9nl1h3fa39n0ljwl9420d6ixl3rdmdjk"))))
84 (build-system gnu-build-system)
85 (synopsis "Conversion between thousands of scales")
87 "GNU Units converts numeric quantities between units of measure. It
88 can handle scale changes through adaptive usage of standard scale prefixes
89 (micro-, kilo-, etc.). It can also handle nonlinear conversions such as
90 Fahrenheit to Celsius. Its interpreter is powerful enough to be used
91 effectively as a scientific calculator.")
92 (license license:gpl3+)
93 (home-page "http://www.gnu.org/software/units/")))
95 (define-public double-conversion
97 (name "double-conversion")
102 "https://github.com/floitsch/double-conversion/archive/v"
104 (file-name (string-append name "-" version ".tar.gz"))
107 "0cnr8xhyjfxijay8ymkqcph3672wp2lj23qhdmr3m4kia5kpdf83"))))
108 (build-system cmake-build-system)
110 '(#:test-target "test"
111 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
112 "-DBUILD_TESTING=ON")))
113 (home-page "https://github.com/floitsch/double-conversion")
114 (synopsis "Conversion routines for IEEE doubles")
116 "The double-conversion library provides binary-decimal and decimal-binary
117 routines for IEEE doubles. The library consists of efficient conversion
118 routines that have been extracted from the V8 JavaScript engine.")
119 (license license:bsd-3)))
121 (define-public dionysus
127 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
131 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
132 (build-system gnu-build-system)
133 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
134 (synopsis "Local search for universal constants and scientific values")
136 "GNU Dionysus is a convenient system for quickly retrieving the values of
137 mathematical constants used in science and engineering. Values can be
138 searched using a simple command-line tool, choosing from three databases:
139 universal constants, atomic numbers, and constants related to
141 (license license:gpl3+)
142 (home-page "http://www.gnu.org/software/dionysus/")))
151 (uri (string-append "mirror://gnu/gsl/gsl-"
155 "0lrgipi0z6559jqh82yx8n4xgnxkhzj46v96dl77hahdp58jzg3k"))))
156 (build-system gnu-build-system)
158 `(#:parallel-tests? #f
162 (lambda* (#:key target system outputs #:allow-other-keys #:rest args)
163 (let ((configure (assoc-ref %standard-phases 'configure)))
164 ;; disable numerically unstable test on i686, see thread at
165 ;; http://lists.gnu.org/archive/html/bug-gsl/2011-11/msg00019.html
166 (if (string=? (or target system) "i686-linux")
167 (substitute* "ode-initval2/Makefile.in"
168 (("TESTS = \\$\\(check_PROGRAMS\\)") "TESTS =")))
169 (apply configure args)))
171 (home-page "http://www.gnu.org/software/gsl/")
172 (synopsis "Numerical library for C and C++")
174 "The GNU Scientific Library is a library for numerical analysis in C
175 and C++. It includes a wide range of mathematical routines, with over 1000
176 functions in total. Subject areas covered by the library include:
177 differential equations, linear algebra, Fast Fourier Transforms and random
179 (license license:gpl3+)))
188 (uri (string-append "mirror://gnu/glpk/glpk-"
192 "1rqx5fzj1mhkifilip5mkxybpj2wkniq5qcn8h1w2vkr2rzhs29p"))))
193 (build-system gnu-build-system)
197 `(#:configure-flags '("--with-gmp")))
198 (home-page "http://www.gnu.org/software/glpk/")
199 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
201 "GLPK is a C library for solving large-scale linear programming (LP),
202 mixed integer programming (MIP), and other related problems. It supports the
203 GNU MathProg modeling language, a subset of the AMPL language, and features a
204 translator for the language. In addition to the C library, a stand-alone
205 LP/MIP solver is included in the package.")
206 (license license:gpl3+)))
215 (uri (string-append "mirror://gnu/pspp/pspp-"
219 "0b65q45x05ps95pph6glbg7ymdr638nfb0rk9x5x9qm5k073pk5z"))))
220 (build-system gnu-build-system)
223 ("fontconfig" ,fontconfig)
224 ("gettext" ,gnu-gettext)
228 ("readline" ,readline)
230 ("gtksourceview" ,gtksourceview)
233 `(("glib" ,glib "bin") ;for glib-genmarshal
235 ("pkg-config" ,pkg-config)))
236 (home-page "http://www.gnu.org/software/pspp/")
237 (synopsis "Statistical analysis")
239 "GNU PSPP is a statistical analysis program. It can perform
240 descriptive statistics, T-tests, linear regression and non-parametric tests.
241 It features both a graphical interface as well as command-line input. PSPP
242 is designed to interoperate with Gnumeric, LibreOffice and OpenOffice. Data
243 can be imported from spreadsheets, text files and database sources and it can
244 be output in text, PostScript, PDF or HTML.")
245 (license license:gpl3+)))
247 (define-public arpack-ng
254 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
256 (file-name (string-append name "-" version ".tar.gz"))
259 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
260 (build-system gnu-build-system)
261 (home-page "https://github.com/opencollab/arpack-ng")
264 ("fortran" ,gfortran-4.8)))
265 (synopsis "Fortran subroutines for solving eigenvalue problems")
267 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
268 large scale eigenvalue problems.")
269 (license (license:non-copyleft "file://COPYING"
270 "See COPYING in the distribution."))))
272 (define-public lapack
279 (uri (string-append "http://www.netlib.org/lapack/lapack-"
283 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
284 (build-system cmake-build-system)
285 (home-page "http://www.netlib.org/lapack/")
286 (inputs `(("fortran" ,gfortran-4.8)
287 ("python" ,python-2)))
289 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
290 #:phases (alist-cons-before
292 (lambda* (#:key inputs #:allow-other-keys)
293 (let ((python (assoc-ref inputs "python")))
294 (substitute* "lapack_testing.py"
295 (("/usr/bin/env python") python))))
297 (synopsis "Library for numerical linear algebra")
299 "LAPACK is a Fortran 90 library for solving the most commonly occurring
300 problems in numerical linear algebra.")
301 (license (license:non-copyleft "file://LICENSE"
302 "See LICENSE in the distribution."))))
304 (define-public gnuplot
311 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
312 version "/gnuplot-" version ".tar.gz"))
315 "1xd7gqdhlk7k1p9yyqf9vkk811nadc7m4si0q3nb6cpv4pxglpyz"))))
316 (build-system gnu-build-system)
317 (inputs `(("readline" ,readline)
321 (native-inputs `(("texlive" ,texlive)
322 ("pkg-config" ,pkg-config)))
323 (home-page "http://www.gnuplot.info")
324 (synopsis "Command-line driven graphing utility")
325 (description "Gnuplot is a portable command-line driven graphing
326 utility. It was originally created to allow scientists and students to
327 visualize mathematical functions and data interactively, but has grown to
328 support many non-interactive uses such as web scripting. It is also used as a
329 plotting engine by third-party applications like Octave.")
330 ;; X11 Style with the additional restriction that derived works may only be
331 ;; distributed as patches to the original.
332 (license (license:fsf-free
333 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
342 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-"
346 (base32 "0f9n0v3p3lwc7564791a39c6cn1d3dbrn7d1j3ikqsi27a8hy23d"))))
347 (build-system gnu-build-system)
353 'configure 'patch-configure
355 (substitute* "configure"
358 (home-page "http://www.hdfgroup.org")
359 (synopsis "Management suite for extremely large and complex data")
360 (description "HDF5 is a suite that makes possible the management of
361 extremely large and complex data collections.")
362 (license (license:x11-style
363 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
366 ;; For a fully featured Octave, users are strongly recommended also to install
367 ;; the following packages: texinfo, less, ghostscript, gnuplot.
368 (define-public octave
375 (uri (string-append "mirror://gnu/octave/octave-"
379 "05slz8yx8k91fqlnfr1f0vni95iq9qmchz41c7nf4isn3b2fjn7j"))))
380 (build-system gnu-build-system)
383 ("readline" ,readline)
387 ("arpack" ,arpack-ng)
391 ("fontconfig" ,fontconfig)
392 ("freetype" ,freetype)
399 `(("gfortran" ,gfortran-4.8)
400 ("pkg-config" ,pkg-config)
402 ;; The following inputs are not actually used in the build process.
403 ;; However, the ./configure gratuitously tests for their existence and
404 ;; assumes that programs not present at build time are also not, and
405 ;; can never be, available at run time! If these inputs are therefore
406 ;; not present, support for them will be built out. However, Octave
407 ;; will still run without them, albeit without the features they
411 ("ghostscript" ,ghostscript)
412 ("gnuplot" ,gnuplot)))
414 `(#:configure-flags (list (string-append "--with-shell="
415 (assoc-ref %build-inputs "bash")
417 (home-page "http://www.gnu.org/software/octave/")
418 (synopsis "High-level language for numerical computation")
419 (description "GNU Octave is a high-level interpreted language that is
420 specialized for numerical computations. It can be used for both linear and
421 non-linear applications and it provides great support for visualizing results.
422 Work may be performed both at the interactive command-line as well as via
424 (license license:gpl3+)))
433 (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
434 version "-source.tgz"))
436 (base32 "0jv2yvk28w86rx5mvjkb0w12ff2jxih7axnpvznpd295lg5jg7hr"))
437 (modules '((guix build utils)))
439 ;; Remove non-free METIS code
440 '(delete-file-recursively "contrib/Metis"))))
441 (build-system cmake-build-system)
444 ("gfortran" ,gfortran-4.8)
451 ("libxext" ,libxext)))
453 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
454 "-DENABLE_BUILD_SHARED:BOOL=ON"
455 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")))
456 (home-page "http://www.geuz.org/gmsh/")
457 (synopsis "3D finite element grid generator")
458 (description "Gmsh is a 3D finite element grid generator with a built-in
459 CAD engine and post-processor. Its design goal is to provide a fast, light
460 and user-friendly meshing tool with parametric input and advanced
461 visualization capabilities. Gmsh is built around four modules: geometry,
462 mesh, solver and post-processing. The specification of any input to these
463 modules is done either interactively using the graphical user interface or in
464 ASCII text files using Gmsh's own scripting language.")
465 (license license:gpl2+)))
474 ;; The *-lite-* tarball does not contain the *large* documentation
475 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
476 "petsc-lite-" version ".tar.gz"))
478 (base32 "0v5dg6dhdjpi5ianvd4mm6hsvxzv1bsxwnh9f9myag0a0d9xk9iv"))
480 (list (search-patch "petsc-fix-threadcomm.patch")))))
481 (build-system gnu-build-system)
483 `(("python" ,python-2)
486 `(("gfortran" ,gfortran-4.8)
489 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
490 ;; leaving out opengl, as configuration seems to only be for mac
493 `(#:test-target "test"
499 ,(string-append "--with-superlu-include="
500 (assoc-ref %build-inputs "superlu") "/include")
501 ,(string-append "--with-superlu-lib="
502 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
506 ;; PETSc's configure script is actually a python script, so we can't
508 (lambda* (#:key outputs (configure-flags '())
510 (let* ((prefix (assoc-ref outputs "out"))
511 (flags `(,(string-append "--prefix=" prefix)
513 (format #t "build directory: ~s~%" (getcwd))
514 (format #t "configure flags: ~s~%" flags)
515 (zero? (apply system* "./configure" flags))))
517 'configure 'clean-local-references
518 ;; Try to keep build directory names from leaking into compiled code
519 (lambda* (#:key inputs outputs #:allow-other-keys)
520 (let ((out (assoc-ref outputs "out")))
521 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
524 'install 'clean-install
525 ;; Try to keep installed files from leaking build directory names.
526 (lambda* (#:key inputs outputs #:allow-other-keys)
527 (let ((out (assoc-ref outputs "out"))
528 (fortran (assoc-ref inputs "gfortran")))
529 (substitute* (map (lambda (file)
530 (string-append out "/" file))
531 '("conf/petscvariables"
532 "conf/PETScConfig.cmake"))
534 ;; Make compiler references point to the store
535 (substitute* (string-append out "/conf/petscvariables")
536 (("= g(cc|\\+\\+|fortran)" _ suffix)
537 (string-append "= " fortran "/bin/g" suffix)))
538 ;; PETSc installs some build logs, which aren't necessary.
539 (for-each (lambda (file)
540 (let ((f (string-append out "/" file)))
541 (when (file-exists? f)
543 '("conf/configure.log"
548 ;; Once installed, should uninstall with Guix
549 "conf/uninstall.py"))))
550 %standard-phases)))))
551 (home-page "http://www.mcs.anl.gov/petsc")
552 (synopsis "Library to solve PDEs")
553 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
554 data structures and routines for the scalable (parallel) solution of
555 scientific applications modeled by partial differential equations.")
556 (license (license:non-copyleft
557 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
559 (define-public petsc-complex
560 (package (inherit petsc)
561 (location (source-properties->location (current-source-location)))
562 (name "petsc-complex")
564 (substitute-keyword-arguments (package-arguments petsc)
565 ((#:configure-flags cf)
566 `(cons "--with-scalar-type=complex" ,cf))))
567 (synopsis "Library to solve PDEs (with complex scalars)")))
569 (define-public petsc-openmpi
570 (package (inherit petsc)
571 (name "petsc-openmpi")
573 `(("openmpi" ,openmpi)
574 ,@(package-inputs petsc)))
576 (substitute-keyword-arguments (package-arguments petsc)
577 ((#:configure-flags cf)
578 ``("--with-mpiexec=mpirun"
579 ,(string-append "--with-mpi-dir="
580 (assoc-ref %build-inputs "openmpi"))
581 ,@(delete "--with-mpi=0" ,cf)))))
582 (synopsis "Library to solve PDEs (with MPI support)")))
584 (define-public petsc-complex-openmpi
585 (package (inherit petsc-complex)
586 (name "petsc-complex-openmpi")
588 `(("openmpi" ,openmpi)
589 ,@(package-inputs petsc-complex)))
591 (substitute-keyword-arguments (package-arguments petsc-complex)
592 ((#:configure-flags cf)
593 ``("--with-mpiexec=mpirun"
594 ,(string-append "--with-mpi-dir="
595 (assoc-ref %build-inputs "openmpi"))
596 ,@(delete "--with-mpi=0" ,cf)))))
597 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
599 (define-public superlu
606 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
607 "superlu_" version ".tar.gz"))
609 (base32 "10b785s9s4x0m9q7ihap09275pq4km3k2hk76jiwdfdr5qr2168n"))))
610 (build-system gnu-build-system)
615 ("gfortran" ,gfortran-4.8)))
617 `(#:parallel-build? #f
618 #:tests? #f ;tests are run as part of `make all`
622 (lambda* (#:key inputs outputs #:allow-other-keys)
623 (call-with-output-file "make.inc"
628 SUPERLULIB = ~a/lib/libsuperlu.a
630 BLASDEF = -DUSE_VENDOR_BLAS
631 BLASLIB = -L~a/lib -lblas
632 LIBS = $(SUPERLULIB) $(BLASLIB)
638 CFLAGS = -O3 -DPRNTlevel=0 $(PIC)
645 (assoc-ref outputs "out")
646 (assoc-ref inputs "lapack")))))
648 'build 'create-install-directories
649 (lambda* (#:key outputs #:allow-other-keys)
652 (mkdir-p (string-append (assoc-ref outputs "out")
657 (lambda* (#:key outputs #:allow-other-keys)
658 ;; Library is placed in lib during the build phase. Copy over
659 ;; headers to include.
660 (let* ((out (assoc-ref outputs "out"))
661 (incdir (string-append out "/include")))
662 (for-each (lambda (file)
663 (let ((base (basename file)))
664 (format #t "installing `~a' to `~a'~%"
667 (string-append incdir "/" base))))
668 (find-files "SRC" ".*\\.h$"))))
669 %standard-phases)))))
670 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
671 (synopsis "Supernodal direct solver for sparse linear systems")
673 "SuperLU is a general purpose library for the direct solution of large,
674 sparse, nonsymmetric systems of linear equations on high performance machines.
675 The library is written in C and is callable from either C or Fortran. The
676 library routines perform an LU decomposition with partial pivoting and
677 triangular system solves through forward and back substitution. The library
678 also provides threshold-based ILU factorization preconditioners.")
679 (license license:bsd-3)))
681 (define-public superlu-dist
683 (name "superlu-dist")
688 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
689 "superlu_dist_" version ".tar.gz"))
691 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
692 (patches (list (search-patch "superlu-dist-scotchmetis.patch")))))
693 (build-system gnu-build-system)
697 `(("gfortran" ,gfortran-4.8)))
699 `(("openmpi" ,openmpi) ;headers include MPI heades
700 ("lapack" ,lapack) ;required to link with output library
701 ("pt-scotch" ,pt-scotch))) ;same
703 `(#:parallel-build? #f ;race conditions using ar
707 (lambda* (#:key inputs outputs #:allow-other-keys)
708 (call-with-output-file "make.inc"
713 DSUPERLULIB = ~a/lib/libsuperlu_dist.a
714 BLASDEF = -DUSE_VENDOR_BLAS
715 BLASLIB = -L~a/lib -lblas
716 PARMETISLIB = -L~a/lib \
717 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
718 -lscotch -lscotcherr -lscotcherrexit
719 METISLIB = -L~:*~a/lib \
720 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
721 LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
727 CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
728 NOOPTS = -O0 -g $(PIC)
730 FFLAGS = -O2 -g $(PIC)
734 (assoc-ref outputs "out")
735 (assoc-ref inputs "lapack")
736 (assoc-ref inputs "pt-scotch")))))
738 'unpack 'remove-broken-symlinks
740 (for-each delete-file
741 (find-files "MAKE_INC" "\\.#make\\..*")))
743 'build 'create-install-directories
744 (lambda* (#:key outputs #:allow-other-keys)
747 (mkdir-p (string-append (assoc-ref outputs "out")
753 (with-directory-excursion "EXAMPLE"
755 (zero? (system* "mpirun" "-n" "2"
756 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
757 (zero? (system* "mpirun" "-n" "2"
758 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
761 (lambda* (#:key outputs #:allow-other-keys)
762 ;; Library is placed in lib during the build phase. Copy over
763 ;; headers to include.
764 (let* ((out (assoc-ref outputs "out"))
765 (incdir (string-append out "/include")))
766 (for-each (lambda (file)
767 (let ((base (basename file)))
768 (format #t "installing `~a' to `~a'~%"
771 (string-append incdir "/" base))))
772 (find-files "SRC" ".*\\.h$"))))
773 %standard-phases)))))))
774 (home-page (package-home-page superlu))
775 (synopsis "Parallel supernodal direct solver")
777 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
778 It is targeted for distributed memory parallel machines. SuperLU_DIST is
779 implemented in ANSI C, and MPI for communications.")
780 (license license:bsd-3)))
782 (define-public scotch
789 (uri (string-append "https://gforge.inria.fr/frs/download.php/31831/"
790 "scotch_" version ".tar.gz"))
792 (base32 "0yfqf9lk7chb3h42777x42x4adx0v3n0b41q0cdqrdmscp4iczp5"))
793 (patches (list (search-patch "scotch-test-threading.patch")))))
794 (build-system gnu-build-system)
802 'unpack 'chdir-to-src
803 (lambda _ (chdir "src"))
807 (call-with-output-file "Makefile.inc"
820 CFLAGS = -O2 -g $(CPPFLAGS)
821 LDFLAGS = -lz -lm -lrt -lpthread
823 LEX = flex -Pscotchyy -olex.yy.c
828 YACC = bison -pscotchyy -y -b y
830 '("COMMON_FILE_COMPRESS_GZ"
832 "COMMON_RANDOM_FIXED_SEED"
833 ;; TODO: Define once our MPI supports
834 ;; MPI_THREAD_MULTIPLE
836 ;; "SCOTCH_PTHREAD_NUMBER=2"
837 "restrict=__restrict")))))
840 (lambda* (#:key outputs #:allow-other-keys)
841 (let ((out (assoc-ref outputs "out")))
843 (zero? (system* "make"
844 (string-append "prefix=" out)
846 %standard-phases)))))
847 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
848 (synopsis "Programs and libraries for graph algorithms")
849 (description "SCOTCH is a set of programs and libraries which implement
850 the static mapping and sparse matrix reordering algorithms developed within
851 the SCOTCH project. Its purpose is to apply graph theory, with a divide and
852 conquer approach, to scientific computing problems such as graph and mesh
853 partitioning, static mapping, and sparse matrix ordering, in application
854 domains ranging from structural mechanics to operating systems or
856 ;; See LICENSE_en.txt
857 (license license:cecill-c)))
859 (define-public pt-scotch
860 (package (inherit scotch)
863 `(("openmpi" ,openmpi))) ;Headers include MPI headers
865 (substitute-keyword-arguments (package-arguments scotch)
866 ((#:phases scotch-phases)
869 ;; TODO: Would like to add parallelism here
872 (zero? (system* "make" "ptscotch"))
873 ;; Install the serial metis compatibility library
874 (zero? (system* "make" "-C" "libscotchmetis" "install"))))
877 (lambda _ (zero? (system* "make" "ptcheck")))
880 (lambda* (#:key outputs #:allow-other-keys)
881 (let ((out (assoc-ref outputs "out")))
883 (zero? (system* "make"
884 (string-append "prefix=" out)
887 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
889 (define-public gsegrafix
896 (uri (string-append "mirror://gnu/" name "/" name "-"
900 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
901 (build-system gnu-build-system)
903 `(#:configure-flags '("LDFLAGS=-lm")))
905 `(("libgnomecanvas" ,libgnomecanvas)
906 ("libbonoboui" ,libbonoboui)
907 ("libgnomeui" ,libgnomeui)
908 ("libgnomeprintui" ,libgnomeprintui)
911 `(("pkg-config" ,pkg-config)))
912 (home-page "http://www.gnu.org/software/gsegrafix/")
913 (synopsis "GNOME application to create scientific and engineering plots")
914 (description "GSEGrafix is an application which produces high-quality graphical
915 plots for science and engineering. Plots are specified via simple ASCII
916 parameter files and data files and are presented in an anti-aliased GNOME
917 canvas. The program supports rectangular two-dimensional plots, histograms,
918 polar-axis plots and three-dimensional plots. Plots can be printed or saved
919 to BMP, JPEG or PNG image formats.")
920 (license license:gpl3+)))
922 (define-public maxima
929 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
930 version "-source/" name "-" version ".tar.gz"))
933 "1dw9vfzldpj7lv303xbw0wpyn6ra6i2yzwlrjbcx7j0jm5n43ji0"))))
934 (build-system gnu-build-system)
937 ("gnuplot" ,gnuplot) ;for plots
938 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
940 `(("texinfo" ,texinfo)
945 (string-append "--with-posix-shell="
946 (assoc-ref %build-inputs "bash")
948 (string-append "--with-wish="
949 (assoc-ref %build-inputs "tk")
951 (let ((v ,(package-version tk)))
952 (string-take v (string-index-right v #\.)))))
953 ;; By default Maxima attempts to write temporary files to
954 ;; '/tmp/nix-build-maxima-5.34.1', which doesn't exist. Work around
956 #:make-flags (list "TMPDIR=/tmp")
957 #:phases (alist-cons-before
960 (chmod "src/maxima" #o555))
961 ;; Make sure the doc and emacs files are found in the
962 ;; standard location. Also configure maxima to find gnuplot
963 ;; without having it on the PATH.
965 'install 'post-install
966 (lambda* (#:key outputs inputs #:allow-other-keys)
967 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
968 (out (assoc-ref outputs "out"))
969 (datadir (string-append out "/share/maxima/" ,version)))
970 (with-directory-excursion out
971 (mkdir-p "share/emacs")
972 (mkdir-p "share/doc")
974 (string-append datadir "/emacs/")
975 (string-append out "/share/emacs/site-lisp"))
977 (string-append datadir "/doc/")
978 (string-append out "/share/doc/maxima"))
979 (with-atomic-file-replacement
980 (string-append datadir "/share/maxima-init.lisp")
982 (format out "~a ~s~a~%"
983 "(setf $gnuplot_command "
984 (string-append gnuplot "/bin/gnuplot") ")")
985 (dump-port in out))))))
987 (home-page "http://maxima.sourceforge.net")
988 (synopsis "Numeric and symbolic expression manipulation")
989 (description "Maxima is a system for the manipulation of symbolic and
990 numerical expressions. It yields high precision numeric results by using
991 exact fractions, arbitrary precision integers, and variable precision floating
993 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
994 ;; Others simply say "GNU General Public License" without stating a
995 ;; version (which implicitly means gpl1+).
996 ;; At least one file (src/maxima.asd) says "version 2."
997 ;; GPLv2 only is therefore the smallest subset.
998 (license license:gpl2)))
1000 (define-public muparser
1008 (url "http://muparser.googlecode.com/svn/trunk/")
1012 "1d6bdbhx9zj3srwj3m7c9hvr18gnx1fx43h6d25my7q85gicpcwn"))))
1013 (build-system gnu-build-system)
1015 `(#:configure-flags '("--enable-samples=no")
1016 #:tests? #f)) ;no "check" target
1017 (home-page "http://muparser.beltoforion.de/")
1018 (synopsis "Fast parser library for mathematical expressions")
1020 "muParser is an extensible high performance math parser library. It is
1021 based on transforming an expression into a bytecode and precalculating
1022 constant parts of it.")
1023 (license license:expat)))
1025 (define-public openblas
1032 (uri (string-append "https://github.com/xianyi/OpenBLAS/tarball/v"
1034 (file-name (string-append name "-" version ".tar.gz"))
1037 "0av3pd96j8rx5i65f652xv9wqfkaqn0w4ma1gvbyz73i6j2hi9db"))))
1038 (build-system gnu-build-system)
1040 `(#:tests? #f ;no "check" target
1041 ;; DYNAMIC_ARCH is not supported on MIPS. When it is disabled,
1042 ;; OpenBLAS will tune itself to the build host, so we need to disable
1044 #:substitutable? ,(not (string-prefix? "mips" (%current-system)))
1046 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1049 ;; Build the library for all supported CPUs. This allows
1050 ;; switching CPU targets at runtime with the environment variable
1051 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
1052 ;; Unfortunately, this is not supported on MIPS.
1053 ,@(if (string-prefix? "mips" (%current-system))
1055 '("DYNAMIC_ARCH=1")))
1056 ;; no configure script
1057 #:phases (alist-delete 'configure %standard-phases)))
1059 `(("fortran" ,gfortran-4.8)))
1063 (home-page "http://www.openblas.net/")
1064 (synopsis "Optimized BLAS library based on GotoBLAS")
1066 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
1067 (license license:bsd-3)))
1069 (define-public openlibm
1076 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
1078 (file-name (string-append name "-" version ".tar.gz"))
1081 "0cwqqqlblj3kzp9aq1wnpfs1fl0qd1wp1xzm5shb09w06i4rh9nn"))))
1082 (build-system gnu-build-system)
1085 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1087 ;; no configure script
1088 (alist-delete 'configure %standard-phases)
1089 #:tests? #f)) ;the tests are part of the default target
1090 (home-page "http://openlibm.org/")
1091 (synopsis "Portable C mathematical library (libm)")
1093 "OpenLibm is an effort to have a high quality, portable, standalone C
1094 mathematical library (libm). It can be used standalone in applications and
1095 programming language implementations. The project was born out of a need to
1096 have a good libm for the Julia programming langage that worked consistently
1097 across compilers and operating systems, and in 32-bit and 64-bit
1099 ;; See LICENSE.md for details.
1100 (license (list license:expat
1103 license:public-domain
1104 license:lgpl2.1+))))
1106 (define-public openspecfun
1108 (name "openspecfun")
1113 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
1115 (file-name (string-append name "-" version ".tar.gz"))
1118 "0nsa3jjmlhcqkw5ba5ypbn3n0c8b6lc22zzlxnmxkxi9shhdx65z"))))
1119 (build-system gnu-build-system)
1121 '(#:tests? #f ;no "check" target
1123 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1124 ;; no configure script
1125 #:phases (alist-delete 'configure %standard-phases)))
1127 `(("fortran" ,gfortran-4.8)))
1128 (home-page "https://github.com/JuliaLang/openspecfun")
1129 (synopsis "Collection of special mathematical functions")
1131 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
1132 portable package for Bessel Functions of a Complex Argument and Nonnegative
1133 Order; it contains subroutines for computing Bessel functions and Airy
1134 functions. Faddeeva allows computing the various error functions of arbitrary
1135 complex arguments (Faddeeva function, error function, complementary error
1136 function, scaled complementary error function, imaginary error function, and
1137 Dawson function); given these, one can also easily compute Voigt functions,
1138 Fresnel integrals, and similar related functions as well.")
1139 ;; Faddeeva is released under the Expat license; AMOS is included as
1140 ;; public domain software.
1141 (license (list license:expat license:public-domain))))
1143 (define-public suitesparse
1145 (name "suitesparse")
1151 "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-"
1155 "100hdzr0mf4mzlwnqpmwpfw4pymgsf9n3g0ywb1yps2nk1zbkdy5"))))
1156 (build-system gnu-build-system)
1158 '(#:parallel-build? #f ;cholmod build fails otherwise
1159 #:tests? #f ;no "check" target
1164 "CHOLMOD_CONFIG=-DNPARTITION" ;required when METIS is not used
1165 (string-append "INSTALL_LIB="
1166 (assoc-ref %outputs "out") "/lib")
1167 (string-append "INSTALL_INCLUDE="
1168 (assoc-ref %outputs "out") "/include"))
1171 'install 'prepare-out
1172 ;; README.txt states that the target directories must exist prior to
1173 ;; running "make install".
1175 (mkdir-p (string-append (assoc-ref %outputs "out") "/lib"))
1176 (mkdir-p (string-append (assoc-ref %outputs "out") "/include")))
1177 ;; no configure script
1178 (alist-delete 'configure %standard-phases))))
1181 ("lapack" ,lapack)))
1182 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
1183 (synopsis "Suite of sparse matrix software")
1185 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
1186 multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
1187 multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
1188 simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
1189 CXSparse, a concise sparse Cholesky factorization package; and many other
1192 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
1194 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
1195 (license (list license:gpl2+ license:lgpl2.1+))))
1197 (define-public atlas
1203 (uri (string-append "mirror://sourceforge/math-atlas/atlas"
1204 version ".tar.bz2"))
1207 "0bqh4bdnjdyww4mcpg6kn0x7338mfqbdgysn97dzrwwb26di7ars"))))
1208 (build-system gnu-build-system)
1209 (home-page "http://math-atlas.sourceforge.net/")
1210 (inputs `(("gfortran" ,gfortran-4.8)
1211 ("lapack-tar" ,(package-source lapack))))
1212 (outputs '("out" "doc"))
1213 ;; For the moment we drop support for MIPS at it fails to compile. See
1214 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
1215 (supported-systems (delete "mips64el-linux" %supported-systems))
1217 `(#:parallel-build? #f
1218 #:parallel-tests? #f
1220 ;; ATLAS tunes itself for the machine it is built on, as explained at
1221 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
1222 ;; For this reason, we want users to build it locally instead of using
1226 #:modules ((srfi srfi-26)
1228 (guix build gnu-build-system)
1231 `(;; Generate position independent code suitable for dynamic libraries
1232 ;; and use WALL timer to get more accurate timing.
1233 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
1236 ,,(if (string-match "64" (%current-system))
1239 ;; Disable parallel build as it gives errors: atlas_pthread.h is
1240 ;; needed to compile C files before it is generated.
1241 "-Ss" "pmake" "make -j 1"
1242 ;; Probe is failing for MIPS. We therefore define the system
1243 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
1244 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
1245 ,,@(if (string-prefix? "mips" (%current-system))
1246 (list "-A" "49" "-V" "1")
1248 ;; Generate shared libraries.
1250 ;; Build a full LAPACK library.
1251 ,(string-append "--with-netlib-lapack-tarfile="
1252 (assoc-ref %build-inputs "lapack-tar")))
1255 'install 'install-doc
1256 (lambda* (#:key outputs inputs #:allow-other-keys)
1257 (let ((doc (string-append (assoc-ref outputs "doc")
1258 "/share/doc/atlas")))
1260 (fold (lambda (file previous)
1261 (and previous (zero? (system* "cp" file doc))))
1262 #t (find-files "../ATLAS/doc" ".*"))))
1265 (lambda _ (zero? (system* "make" "ptcheck")))
1266 ;; Fix files required to run configure.
1268 'configure 'fix-/bin/sh
1270 ;; Use `sh', not `/bin/sh'.
1271 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
1274 ;; Fix /bin/sh in generated make files.
1276 'configure 'fix-/bin/sh-in-generated-files
1278 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
1281 ;; ATLAS configure program does not accepts the default flags
1282 ;; passed by the 'gnu-build-system'.
1285 (lambda* (#:key native-inputs inputs outputs
1286 (configure-flags '())
1287 #:allow-other-keys #:rest args)
1288 (let* ((prefix (assoc-ref outputs "out"))
1289 (bash (or (and=> (assoc-ref
1290 (or native-inputs inputs) "bash")
1291 (cut string-append <> "/bin/bash"))
1293 (flags `(,(string-append "--prefix=" prefix)
1295 (abs-srcdir (getcwd))
1296 (srcdir (string-append "../" (basename abs-srcdir))))
1297 (format #t "source directory: ~s (relative from build: ~s)~%"
1301 (format #t "build directory: ~s~%" (getcwd))
1302 (format #t "configure flags: ~s~%" flags)
1303 (zero? (apply system* bash
1304 (string-append srcdir "/configure")
1306 %standard-phases)))))))
1307 (synopsis "Automatically Tuned Linear Algebra Software")
1309 "ATLAS is an automatically tuned linear algebra software library
1310 providing C and Fortran77 interfaces to a portably efficient BLAS
1311 implementation, as well as a few routines from LAPACK.
1313 Optimization occurs at build time. For this reason, the library is built on
1314 the machine where it is installed, without resorting to pre-built substitutes.
1316 Before building the library, CPU throttling should be disabled. This can be
1317 done in the BIOS, or, on GNU/Linux, with the following commands:
1319 cpufreq-selector -g performance -c 0
1321 cpufreq-selector -g performance -c N-1
1323 where N is the number of cores of your CPU. Failure to do so will result in a
1324 library with poor performance.")
1325 (license license:bsd-3)))
1334 (uri (string-append "mirror://sourceforge/ogl-math/glm-"
1338 "1cnjmi033a16a95v6xfkr1bvfmkd26hzdjka8j1819hgn5b1nr8l"))))
1339 (build-system cmake-build-system)
1341 `(("unzip" ,unzip)))
1342 (home-page "http://glm.g-truc.net")
1343 (synopsis "OpenGL Mathematics library")
1344 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
1345 library for graphics software based on the OpenGL Shading Language (GLSL)
1347 (license license:expat)))
1349 (define-public lpsolve
1356 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
1357 "/lp_solve_" version "_source.tar.gz"))
1360 "176c7f023mb6b8bfmv4rfqnrlw88lsg422ca74zjh19i2h5s69sq"))
1361 (modules '((guix build utils)))
1363 '(substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
1365 ;; Pretend to be on a 64 bit platform to obtain a common directory
1366 ;; name for the build results on all architectures; nothing else
1367 ;; seems to depend on it.
1368 (("^PLATFORM=.*$") "PLATFORM=ux64\n")))))
1369 (build-system gnu-build-system)
1371 `(#:tests? #f ; no check target
1373 (modify-phases %standard-phases
1377 (with-directory-excursion "lpsolve55"
1378 (system* "bash" "ccc"))
1379 (with-directory-excursion "lp_solve"
1380 (system* "bash" "ccc"))
1383 (lambda* (#:key outputs #:allow-other-keys)
1384 (let* ((out (assoc-ref outputs "out"))
1385 (bin (string-append out "/bin"))
1386 (lib (string-append out "/lib"))
1387 ;; This is where LibreOffice expects to find the header
1388 ;; files, and where they are installed by Debian.
1389 (include (string-append out "/include/lpsolve")))
1391 (copy-file "lpsolve55/bin/ux64/liblpsolve55.a"
1392 (string-append lib "/liblpsolve55.a"))
1393 (copy-file "lpsolve55/bin/ux64/liblpsolve55.so"
1394 (string-append lib "/liblpsolve55.so"))
1396 (copy-file "lp_solve/bin/ux64/lp_solve"
1397 (string-append bin "/lp_solve"))
1399 ;; Install a subset of the header files as on Debian
1400 ;; (plus lp_bit.h, which matches the regular expression).
1403 (copy-file name (string-append include "/" name)))
1404 (find-files "." "lp_[HMSa-z].*\\.h$"))
1405 (with-directory-excursion "shared"
1408 (copy-file name (string-append include "/" name)))
1409 (find-files "." "\\.h$")))
1411 (home-page "http://lpsolve.sourceforge.net/")
1412 (synopsis "Mixed integer linear programming (MILP) solver")
1414 "lp_solve is a mixed integer linear programming solver based on the
1415 revised simplex and the branch-and-bound methods.")
1416 (license license:lgpl2.1+)))