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>
10 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
12 ;;; This file is part of GNU Guix.
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27 (define-module (gnu packages maths)
28 #:use-module (ice-9 regex)
29 #:use-module (gnu packages)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix packages)
32 #:use-module (guix download)
33 #:use-module (guix svn-download)
34 #:use-module (guix utils)
35 #:use-module (guix build-system cmake)
36 #:use-module (guix build-system gnu)
37 #:use-module (gnu packages algebra)
38 #:use-module (gnu packages bison)
39 #:use-module (gnu packages check)
40 #:use-module (gnu packages cmake)
41 #:use-module (gnu packages compression)
42 #:use-module (gnu packages curl)
43 #:use-module (gnu packages elf)
44 #:use-module (gnu packages flex)
45 #:use-module (gnu packages fltk)
46 #:use-module (gnu packages fontutils)
47 #:use-module (gnu packages gettext)
48 #:use-module (gnu packages gcc)
49 #:use-module (gnu packages gd)
50 #:use-module (gnu packages ghostscript)
51 #:use-module (gnu packages glib)
52 #:use-module (gnu packages gtk)
53 #:use-module (gnu packages less)
54 #:use-module (gnu packages lisp)
55 #:use-module (gnu packages gnome)
56 #:use-module (gnu packages xorg)
57 #:use-module (gnu packages gl)
58 #:use-module (gnu packages m4)
59 #:use-module (gnu packages mpi)
60 #:use-module (gnu packages multiprecision)
61 #:use-module (gnu packages pcre)
62 #:use-module (gnu packages popt)
63 #:use-module (gnu packages perl)
64 #:use-module (gnu packages pkg-config)
65 #:use-module (gnu packages python)
66 #:use-module (gnu packages readline)
67 #:use-module (gnu packages tbb)
68 #:use-module (gnu packages tcsh)
69 #:use-module (gnu packages tcl)
70 #:use-module (gnu packages texinfo)
71 #:use-module (gnu packages texlive)
72 #:use-module (gnu packages wxwidgets)
73 #:use-module (gnu packages xml)
74 #:use-module (gnu packages zip))
82 (uri (string-append "mirror://gnu/units/units-" version
85 "1gjs3wc212aaiq4r76hx9nl1h3fa39n0ljwl9420d6ixl3rdmdjk"))))
86 (build-system gnu-build-system)
87 (synopsis "Conversion between thousands of scales")
89 "GNU Units converts numeric quantities between units of measure. It
90 can handle scale changes through adaptive usage of standard scale prefixes
91 (micro-, kilo-, etc.). It can also handle nonlinear conversions such as
92 Fahrenheit to Celsius. Its interpreter is powerful enough to be used
93 effectively as a scientific calculator.")
94 (license license:gpl3+)
95 (home-page "http://www.gnu.org/software/units/")))
97 (define-public double-conversion
99 (name "double-conversion")
104 "https://github.com/floitsch/double-conversion/archive/v"
106 (file-name (string-append name "-" version ".tar.gz"))
109 "0cnr8xhyjfxijay8ymkqcph3672wp2lj23qhdmr3m4kia5kpdf83"))))
110 (build-system cmake-build-system)
112 '(#:test-target "test"
113 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
114 "-DBUILD_TESTING=ON")))
115 (home-page "https://github.com/floitsch/double-conversion")
116 (synopsis "Conversion routines for IEEE doubles")
118 "The double-conversion library provides binary-decimal and decimal-binary
119 routines for IEEE doubles. The library consists of efficient conversion
120 routines that have been extracted from the V8 JavaScript engine.")
121 (license license:bsd-3)))
123 (define-public dionysus
129 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
133 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
134 (build-system gnu-build-system)
135 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
136 (synopsis "Local search for universal constants and scientific values")
138 "GNU Dionysus is a convenient system for quickly retrieving the values of
139 mathematical constants used in science and engineering. Values can be
140 searched using a simple command-line tool, choosing from three databases:
141 universal constants, atomic numbers, and constants related to
143 (license license:gpl3+)
144 (home-page "http://www.gnu.org/software/dionysus/")))
153 (uri (string-append "mirror://gnu/gsl/gsl-"
157 "0lrgipi0z6559jqh82yx8n4xgnxkhzj46v96dl77hahdp58jzg3k"))))
158 (build-system gnu-build-system)
160 `(#:parallel-tests? #f
164 (lambda* (#:key target system outputs #:allow-other-keys #:rest args)
165 (let ((configure (assoc-ref %standard-phases 'configure)))
166 ;; disable numerically unstable test on i686, see thread at
167 ;; http://lists.gnu.org/archive/html/bug-gsl/2011-11/msg00019.html
168 (if (string=? (or target system) "i686-linux")
169 (substitute* "ode-initval2/Makefile.in"
170 (("TESTS = \\$\\(check_PROGRAMS\\)") "TESTS =")))
171 (apply configure args)))
173 (home-page "http://www.gnu.org/software/gsl/")
174 (synopsis "Numerical library for C and C++")
176 "The GNU Scientific Library is a library for numerical analysis in C
177 and C++. It includes a wide range of mathematical routines, with over 1000
178 functions in total. Subject areas covered by the library include:
179 differential equations, linear algebra, Fast Fourier Transforms and random
181 (license license:gpl3+)))
190 (uri (string-append "mirror://gnu/glpk/glpk-"
194 "1rqx5fzj1mhkifilip5mkxybpj2wkniq5qcn8h1w2vkr2rzhs29p"))))
195 (build-system gnu-build-system)
199 `(#:configure-flags '("--with-gmp")))
200 (home-page "http://www.gnu.org/software/glpk/")
201 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
203 "GLPK is a C library for solving large-scale linear programming (LP),
204 mixed integer programming (MIP), and other related problems. It supports the
205 GNU MathProg modeling language, a subset of the AMPL language, and features a
206 translator for the language. In addition to the C library, a stand-alone
207 LP/MIP solver is included in the package.")
208 (license license:gpl3+)))
217 (uri (string-append "mirror://gnu/pspp/pspp-"
221 "0b65q45x05ps95pph6glbg7ymdr638nfb0rk9x5x9qm5k073pk5z"))))
222 (build-system gnu-build-system)
225 ("fontconfig" ,fontconfig)
226 ("gettext" ,gnu-gettext)
230 ("readline" ,readline)
232 ("gtksourceview" ,gtksourceview)
235 `(("glib" ,glib "bin") ;for glib-genmarshal
237 ("pkg-config" ,pkg-config)))
238 (home-page "http://www.gnu.org/software/pspp/")
239 (synopsis "Statistical analysis")
241 "GNU PSPP is a statistical analysis program. It can perform
242 descriptive statistics, T-tests, linear regression and non-parametric tests.
243 It features both a graphical interface as well as command-line input. PSPP
244 is designed to interoperate with Gnumeric, LibreOffice and OpenOffice. Data
245 can be imported from spreadsheets, text files and database sources and it can
246 be output in text, PostScript, PDF or HTML.")
247 (license license:gpl3+)))
249 (define-public arpack-ng
256 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
258 (file-name (string-append name "-" version ".tar.gz"))
261 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
262 (build-system gnu-build-system)
263 (home-page "https://github.com/opencollab/arpack-ng")
266 ("fortran" ,gfortran-4.8)))
267 (synopsis "Fortran subroutines for solving eigenvalue problems")
269 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
270 large scale eigenvalue problems.")
271 (license (license:non-copyleft "file://COPYING"
272 "See COPYING in the distribution."))))
274 (define-public lapack
281 (uri (string-append "http://www.netlib.org/lapack/lapack-"
285 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
286 (build-system cmake-build-system)
287 (home-page "http://www.netlib.org/lapack/")
288 (inputs `(("fortran" ,gfortran-4.8)
289 ("python" ,python-2)))
291 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
292 #:phases (alist-cons-before
294 (lambda* (#:key inputs #:allow-other-keys)
295 (let ((python (assoc-ref inputs "python")))
296 (substitute* "lapack_testing.py"
297 (("/usr/bin/env python") python))))
299 (synopsis "Library for numerical linear algebra")
301 "LAPACK is a Fortran 90 library for solving the most commonly occurring
302 problems in numerical linear algebra.")
303 (license (license:non-copyleft "file://LICENSE"
304 "See LICENSE in the distribution."))))
306 (define-public gnuplot
313 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
314 version "/gnuplot-" version ".tar.gz"))
317 "1xd7gqdhlk7k1p9yyqf9vkk811nadc7m4si0q3nb6cpv4pxglpyz"))))
318 (build-system gnu-build-system)
319 (inputs `(("readline" ,readline)
323 (native-inputs `(("texlive" ,texlive)
324 ("pkg-config" ,pkg-config)))
325 (home-page "http://www.gnuplot.info")
326 (synopsis "Command-line driven graphing utility")
327 (description "Gnuplot is a portable command-line driven graphing
328 utility. It was originally created to allow scientists and students to
329 visualize mathematical functions and data interactively, but has grown to
330 support many non-interactive uses such as web scripting. It is also used as a
331 plotting engine by third-party applications like Octave.")
332 ;; X11 Style with the additional restriction that derived works may only be
333 ;; distributed as patches to the original.
334 (license (license:fsf-free
335 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
344 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-"
348 (base32 "0f9n0v3p3lwc7564791a39c6cn1d3dbrn7d1j3ikqsi27a8hy23d"))))
349 (build-system gnu-build-system)
355 'configure 'patch-configure
357 (substitute* "configure"
360 (home-page "http://www.hdfgroup.org")
361 (synopsis "Management suite for extremely large and complex data")
362 (description "HDF5 is a suite that makes possible the management of
363 extremely large and complex data collections.")
364 (license (license:x11-style
365 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
368 ;; For a fully featured Octave, users are strongly recommended also to install
369 ;; the following packages: texinfo, less, ghostscript, gnuplot.
370 (define-public octave
377 (uri (string-append "mirror://gnu/octave/octave-"
381 "05slz8yx8k91fqlnfr1f0vni95iq9qmchz41c7nf4isn3b2fjn7j"))))
382 (build-system gnu-build-system)
385 ("readline" ,readline)
389 ("arpack" ,arpack-ng)
393 ("fontconfig" ,fontconfig)
394 ("freetype" ,freetype)
401 `(("gfortran" ,gfortran-4.8)
402 ("pkg-config" ,pkg-config)
404 ;; The following inputs are not actually used in the build process.
405 ;; However, the ./configure gratuitously tests for their existence and
406 ;; assumes that programs not present at build time are also not, and
407 ;; can never be, available at run time! If these inputs are therefore
408 ;; not present, support for them will be built out. However, Octave
409 ;; will still run without them, albeit without the features they
413 ("ghostscript" ,ghostscript)
414 ("gnuplot" ,gnuplot)))
416 `(#:configure-flags (list (string-append "--with-shell="
417 (assoc-ref %build-inputs "bash")
419 (home-page "http://www.gnu.org/software/octave/")
420 (synopsis "High-level language for numerical computation")
421 (description "GNU Octave is a high-level interpreted language that is
422 specialized for numerical computations. It can be used for both linear and
423 non-linear applications and it provides great support for visualizing results.
424 Work may be performed both at the interactive command-line as well as via
426 (license license:gpl3+)))
435 (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
436 version "-source.tgz"))
438 (base32 "0jv2yvk28w86rx5mvjkb0w12ff2jxih7axnpvznpd295lg5jg7hr"))
439 (modules '((guix build utils)))
441 ;; Remove non-free METIS code
442 '(delete-file-recursively "contrib/Metis"))))
443 (build-system cmake-build-system)
446 ("gfortran" ,gfortran-4.8)
453 ("libxext" ,libxext)))
455 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
456 "-DENABLE_BUILD_SHARED:BOOL=ON"
457 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")))
458 (home-page "http://www.geuz.org/gmsh/")
459 (synopsis "3D finite element grid generator")
460 (description "Gmsh is a 3D finite element grid generator with a built-in
461 CAD engine and post-processor. Its design goal is to provide a fast, light
462 and user-friendly meshing tool with parametric input and advanced
463 visualization capabilities. Gmsh is built around four modules: geometry,
464 mesh, solver and post-processing. The specification of any input to these
465 modules is done either interactively using the graphical user interface or in
466 ASCII text files using Gmsh's own scripting language.")
467 (license license:gpl2+)))
476 ;; The *-lite-* tarball does not contain the *large* documentation
477 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
478 "petsc-lite-" version ".tar.gz"))
480 (base32 "0v5dg6dhdjpi5ianvd4mm6hsvxzv1bsxwnh9f9myag0a0d9xk9iv"))
482 (list (search-patch "petsc-fix-threadcomm.patch")))))
483 (build-system gnu-build-system)
485 `(("python" ,python-2)
488 `(("gfortran" ,gfortran-4.8)
491 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
492 ;; leaving out opengl, as configuration seems to only be for mac
495 `(#:test-target "test"
501 ,(string-append "--with-superlu-include="
502 (assoc-ref %build-inputs "superlu") "/include")
503 ,(string-append "--with-superlu-lib="
504 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
508 ;; PETSc's configure script is actually a python script, so we can't
510 (lambda* (#:key outputs (configure-flags '())
512 (let* ((prefix (assoc-ref outputs "out"))
513 (flags `(,(string-append "--prefix=" prefix)
515 (format #t "build directory: ~s~%" (getcwd))
516 (format #t "configure flags: ~s~%" flags)
517 (zero? (apply system* "./configure" flags))))
519 'configure 'clean-local-references
520 ;; Try to keep build directory names from leaking into compiled code
521 (lambda* (#:key inputs outputs #:allow-other-keys)
522 (let ((out (assoc-ref outputs "out")))
523 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
526 'install 'clean-install
527 ;; Try to keep installed files from leaking build directory names.
528 (lambda* (#:key inputs outputs #:allow-other-keys)
529 (let ((out (assoc-ref outputs "out"))
530 (fortran (assoc-ref inputs "gfortran")))
531 (substitute* (map (lambda (file)
532 (string-append out "/" file))
533 '("conf/petscvariables"
534 "conf/PETScConfig.cmake"))
536 ;; Make compiler references point to the store
537 (substitute* (string-append out "/conf/petscvariables")
538 (("= g(cc|\\+\\+|fortran)" _ suffix)
539 (string-append "= " fortran "/bin/g" suffix)))
540 ;; PETSc installs some build logs, which aren't necessary.
541 (for-each (lambda (file)
542 (let ((f (string-append out "/" file)))
543 (when (file-exists? f)
545 '("conf/configure.log"
550 ;; Once installed, should uninstall with Guix
551 "conf/uninstall.py"))))
552 %standard-phases)))))
553 (home-page "http://www.mcs.anl.gov/petsc")
554 (synopsis "Library to solve PDEs")
555 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
556 data structures and routines for the scalable (parallel) solution of
557 scientific applications modeled by partial differential equations.")
558 (license (license:non-copyleft
559 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
561 (define-public petsc-complex
562 (package (inherit petsc)
563 (name "petsc-complex")
565 (substitute-keyword-arguments (package-arguments petsc)
566 ((#:configure-flags cf)
567 `(cons "--with-scalar-type=complex" ,cf))))
568 (synopsis "Library to solve PDEs (with complex scalars)")))
570 (define-public petsc-openmpi
571 (package (inherit petsc)
572 (name "petsc-openmpi")
574 `(("openmpi" ,openmpi)
575 ,@(package-inputs petsc)))
577 (substitute-keyword-arguments (package-arguments petsc)
578 ((#:configure-flags cf)
579 ``("--with-mpiexec=mpirun"
580 ,(string-append "--with-mpi-dir="
581 (assoc-ref %build-inputs "openmpi"))
582 ,@(delete "--with-mpi=0" ,cf)))))
583 (synopsis "Library to solve PDEs (with MPI support)")))
585 (define-public petsc-complex-openmpi
586 (package (inherit petsc-complex)
587 (name "petsc-complex-openmpi")
589 `(("openmpi" ,openmpi)
590 ,@(package-inputs petsc-complex)))
592 (substitute-keyword-arguments (package-arguments petsc-complex)
593 ((#:configure-flags cf)
594 ``("--with-mpiexec=mpirun"
595 ,(string-append "--with-mpi-dir="
596 (assoc-ref %build-inputs "openmpi"))
597 ,@(delete "--with-mpi=0" ,cf)))))
598 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
600 (define-public superlu
607 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
608 "superlu_" version ".tar.gz"))
610 (base32 "10b785s9s4x0m9q7ihap09275pq4km3k2hk76jiwdfdr5qr2168n"))))
611 (build-system gnu-build-system)
616 ("gfortran" ,gfortran-4.8)))
618 `(#:parallel-build? #f
619 #:tests? #f ;tests are run as part of `make all`
623 (lambda* (#:key inputs outputs #:allow-other-keys)
624 (call-with-output-file "make.inc"
629 SUPERLULIB = ~a/lib/libsuperlu.a
631 BLASDEF = -DUSE_VENDOR_BLAS
632 BLASLIB = -L~a/lib -lblas
633 LIBS = $(SUPERLULIB) $(BLASLIB)
639 CFLAGS = -O3 -DPRNTlevel=0 $(PIC)
646 (assoc-ref outputs "out")
647 (assoc-ref inputs "lapack")))))
649 'build 'create-install-directories
650 (lambda* (#:key outputs #:allow-other-keys)
653 (mkdir-p (string-append (assoc-ref outputs "out")
658 (lambda* (#:key outputs #:allow-other-keys)
659 ;; Library is placed in lib during the build phase. Copy over
660 ;; headers to include.
661 (let* ((out (assoc-ref outputs "out"))
662 (incdir (string-append out "/include")))
663 (for-each (lambda (file)
664 (let ((base (basename file)))
665 (format #t "installing `~a' to `~a'~%"
668 (string-append incdir "/" base))))
669 (find-files "SRC" ".*\\.h$"))))
670 %standard-phases)))))
671 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
672 (synopsis "Supernodal direct solver for sparse linear systems")
674 "SuperLU is a general purpose library for the direct solution of large,
675 sparse, nonsymmetric systems of linear equations on high performance machines.
676 The library is written in C and is callable from either C or Fortran. The
677 library routines perform an LU decomposition with partial pivoting and
678 triangular system solves through forward and back substitution. The library
679 also provides threshold-based ILU factorization preconditioners.")
680 (license license:bsd-3)))
682 (define-public superlu-dist
684 (name "superlu-dist")
689 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
690 "superlu_dist_" version ".tar.gz"))
692 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
693 (patches (list (search-patch "superlu-dist-scotchmetis.patch")))))
694 (build-system gnu-build-system)
698 `(("gfortran" ,gfortran-4.8)))
700 `(("openmpi" ,openmpi) ;headers include MPI heades
701 ("lapack" ,lapack) ;required to link with output library
702 ("pt-scotch" ,pt-scotch))) ;same
704 `(#:parallel-build? #f ;race conditions using ar
708 (lambda* (#:key inputs outputs #:allow-other-keys)
709 (call-with-output-file "make.inc"
714 DSUPERLULIB = ~a/lib/libsuperlu_dist.a
715 BLASDEF = -DUSE_VENDOR_BLAS
716 BLASLIB = -L~a/lib -lblas
717 PARMETISLIB = -L~a/lib \
718 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
719 -lscotch -lscotcherr -lscotcherrexit
720 METISLIB = -L~:*~a/lib \
721 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
722 LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
728 CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
729 NOOPTS = -O0 -g $(PIC)
731 FFLAGS = -O2 -g $(PIC)
735 (assoc-ref outputs "out")
736 (assoc-ref inputs "lapack")
737 (assoc-ref inputs "pt-scotch")))))
739 'unpack 'remove-broken-symlinks
741 (for-each delete-file
742 (find-files "MAKE_INC" "\\.#make\\..*")))
744 'build 'create-install-directories
745 (lambda* (#:key outputs #:allow-other-keys)
748 (mkdir-p (string-append (assoc-ref outputs "out")
754 (with-directory-excursion "EXAMPLE"
756 (zero? (system* "mpirun" "-n" "2"
757 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
758 (zero? (system* "mpirun" "-n" "2"
759 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
762 (lambda* (#:key outputs #:allow-other-keys)
763 ;; Library is placed in lib during the build phase. Copy over
764 ;; headers to include.
765 (let* ((out (assoc-ref outputs "out"))
766 (incdir (string-append out "/include")))
767 (for-each (lambda (file)
768 (let ((base (basename file)))
769 (format #t "installing `~a' to `~a'~%"
772 (string-append incdir "/" base))))
773 (find-files "SRC" ".*\\.h$"))))
774 %standard-phases)))))))
775 (home-page (package-home-page superlu))
776 (synopsis "Parallel supernodal direct solver")
778 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
779 It is targeted for distributed memory parallel machines. SuperLU_DIST is
780 implemented in ANSI C, and MPI for communications.")
781 (license license:bsd-3)))
783 (define-public scotch
790 (uri (string-append "https://gforge.inria.fr/frs/download.php/31831/"
791 "scotch_" version ".tar.gz"))
793 (base32 "0yfqf9lk7chb3h42777x42x4adx0v3n0b41q0cdqrdmscp4iczp5"))
794 (patches (list (search-patch "scotch-test-threading.patch")))))
795 (build-system gnu-build-system)
803 'unpack 'chdir-to-src
804 (lambda _ (chdir "src"))
808 (call-with-output-file "Makefile.inc"
821 CFLAGS = -O2 -g $(CPPFLAGS)
822 LDFLAGS = -lz -lm -lrt -lpthread
824 LEX = flex -Pscotchyy -olex.yy.c
829 YACC = bison -pscotchyy -y -b y
831 '("COMMON_FILE_COMPRESS_GZ"
833 "COMMON_RANDOM_FIXED_SEED"
834 ;; TODO: Define once our MPI supports
835 ;; MPI_THREAD_MULTIPLE
837 ;; "SCOTCH_PTHREAD_NUMBER=2"
838 "restrict=__restrict")))))
841 (lambda* (#:key outputs #:allow-other-keys)
842 (let ((out (assoc-ref outputs "out")))
844 (zero? (system* "make"
845 (string-append "prefix=" out)
847 %standard-phases)))))
848 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
849 (synopsis "Programs and libraries for graph algorithms")
850 (description "SCOTCH is a set of programs and libraries which implement
851 the static mapping and sparse matrix reordering algorithms developed within
852 the SCOTCH project. Its purpose is to apply graph theory, with a divide and
853 conquer approach, to scientific computing problems such as graph and mesh
854 partitioning, static mapping, and sparse matrix ordering, in application
855 domains ranging from structural mechanics to operating systems or
857 ;; See LICENSE_en.txt
858 (license license:cecill-c)))
860 (define-public pt-scotch
861 (package (inherit scotch)
864 `(("openmpi" ,openmpi))) ;Headers include MPI headers
866 (substitute-keyword-arguments (package-arguments scotch)
867 ((#:phases scotch-phases)
870 ;; TODO: Would like to add parallelism here
873 (zero? (system* "make" "ptscotch"))
874 ;; Install the serial metis compatibility library
875 (zero? (system* "make" "-C" "libscotchmetis" "install"))))
878 (lambda _ (zero? (system* "make" "ptcheck")))
881 (lambda* (#:key outputs #:allow-other-keys)
882 (let ((out (assoc-ref outputs "out")))
884 (zero? (system* "make"
885 (string-append "prefix=" out)
888 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
890 (define-public gsegrafix
897 (uri (string-append "mirror://gnu/" name "/" name "-"
901 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
902 (build-system gnu-build-system)
904 `(#:configure-flags '("LDFLAGS=-lm")))
906 `(("libgnomecanvas" ,libgnomecanvas)
907 ("libbonoboui" ,libbonoboui)
908 ("libgnomeui" ,libgnomeui)
909 ("libgnomeprintui" ,libgnomeprintui)
912 `(("pkg-config" ,pkg-config)))
913 (home-page "http://www.gnu.org/software/gsegrafix/")
914 (synopsis "GNOME application to create scientific and engineering plots")
915 (description "GSEGrafix is an application which produces high-quality graphical
916 plots for science and engineering. Plots are specified via simple ASCII
917 parameter files and data files and are presented in an anti-aliased GNOME
918 canvas. The program supports rectangular two-dimensional plots, histograms,
919 polar-axis plots and three-dimensional plots. Plots can be printed or saved
920 to BMP, JPEG or PNG image formats.")
921 (license license:gpl3+)))
923 (define-public maxima
930 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
931 version "-source/" name "-" version ".tar.gz"))
934 "0x1rk659sn3cq0n5c90848ilzr1gb1wf0072fl6jhkdq00qgh2s0"))
935 (patches (list (search-patch "maxima-defsystem-mkdir.patch")))))
936 (build-system gnu-build-system)
939 ("gnuplot" ,gnuplot) ;for plots
940 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
942 `(("texinfo" ,texinfo)
947 (string-append "--with-posix-shell="
948 (assoc-ref %build-inputs "bash")
950 (string-append "--with-wish="
951 (assoc-ref %build-inputs "tk")
953 (let ((v ,(package-version tk)))
954 (string-take v (string-index-right v #\.)))))
955 ;; By default Maxima attempts to write temporary files to
956 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
958 #:make-flags (list "TMPDIR=/tmp")
959 #:phases (alist-cons-before
962 (chmod "src/maxima" #o555))
963 ;; Make sure the doc and emacs files are found in the
964 ;; standard location. Also configure maxima to find gnuplot
965 ;; without having it on the PATH.
967 'install 'post-install
968 (lambda* (#:key outputs inputs #:allow-other-keys)
969 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
970 (out (assoc-ref outputs "out"))
971 (datadir (string-append out "/share/maxima/" ,version)))
972 (with-directory-excursion out
973 (mkdir-p "share/emacs")
974 (mkdir-p "share/doc")
976 (string-append datadir "/emacs/")
977 (string-append out "/share/emacs/site-lisp"))
979 (string-append datadir "/doc/")
980 (string-append out "/share/doc/maxima"))
981 (with-atomic-file-replacement
982 (string-append datadir "/share/maxima-init.lisp")
984 (format out "~a ~s~a~%"
985 "(setf $gnuplot_command "
986 (string-append gnuplot "/bin/gnuplot") ")")
987 (dump-port in out))))))
989 (home-page "http://maxima.sourceforge.net")
990 (synopsis "Numeric and symbolic expression manipulation")
991 (description "Maxima is a system for the manipulation of symbolic and
992 numerical expressions. It yields high precision numeric results by using
993 exact fractions, arbitrary precision integers, and variable precision floating
995 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
996 ;; Others simply say "GNU General Public License" without stating a
997 ;; version (which implicitly means gpl1+).
998 ;; At least one file (src/maxima.asd) says "version 2."
999 ;; GPLv2 only is therefore the smallest subset.
1000 (license license:gpl2)))
1002 (define-public wxmaxima
1009 (uri (string-append "mirror://sourceforge/wxmaxima/wxMaxima/"
1010 version "/" name "-" version ".tar.gz"))
1013 "1fm47ah4aw5qdjqhkz67w5fwhy8yfffa5z896crp0d3hk2bh4180"))))
1014 (build-system gnu-build-system)
1016 `(("wxwidgets" ,wxwidgets)
1017 ("maxima" ,maxima)))
1019 `(#:phases (modify-phases %standard-phases
1021 'install 'wrap-program
1022 (lambda* (#:key inputs outputs #:allow-other-keys)
1023 (wrap-program (string-append (assoc-ref outputs "out")
1026 (,(string-append (assoc-ref inputs "maxima")
1029 (home-page "https://andrejv.github.io/wxmaxima/")
1030 (synopsis "Graphical user interface for the Maxima computer algebra system")
1032 "wxMaxima is a graphical user interface for the Maxima computer algebra
1033 system. It eases the use of Maxima by making most of its commands available
1034 through a menu system and by providing input dialogs for commands that require
1035 more than one argument. It also implements its own display engine that
1036 outputs mathematical symbols directly instead of depicting them with ASCII
1039 wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
1040 text and mathematical calculations to create documents, exporting of input and
1041 output to TeX, and a browser for Maxima's manual including command index and
1042 full text searching.")
1043 (license license:gpl2+)))
1045 (define-public muparser
1053 (url "http://muparser.googlecode.com/svn/trunk/")
1057 "1d6bdbhx9zj3srwj3m7c9hvr18gnx1fx43h6d25my7q85gicpcwn"))))
1058 (build-system gnu-build-system)
1060 `(#:configure-flags '("--enable-samples=no")
1061 #:tests? #f)) ;no "check" target
1062 (home-page "http://muparser.beltoforion.de/")
1063 (synopsis "Fast parser library for mathematical expressions")
1065 "muParser is an extensible high performance math parser library. It is
1066 based on transforming an expression into a bytecode and precalculating
1067 constant parts of it.")
1068 (license license:expat)))
1070 (define-public openblas
1077 (uri (string-append "https://github.com/xianyi/OpenBLAS/tarball/v"
1079 (file-name (string-append name "-" version ".tar.gz"))
1082 "0av3pd96j8rx5i65f652xv9wqfkaqn0w4ma1gvbyz73i6j2hi9db"))))
1083 (build-system gnu-build-system)
1085 `(#:tests? #f ;no "check" target
1086 ;; DYNAMIC_ARCH is not supported on MIPS. When it is disabled,
1087 ;; OpenBLAS will tune itself to the build host, so we need to disable
1089 #:substitutable? ,(not (string-prefix? "mips" (%current-system)))
1091 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1094 ;; Build the library for all supported CPUs. This allows
1095 ;; switching CPU targets at runtime with the environment variable
1096 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
1097 ;; Unfortunately, this is not supported on MIPS.
1098 ,@(if (string-prefix? "mips" (%current-system))
1100 '("DYNAMIC_ARCH=1")))
1101 ;; no configure script
1102 #:phases (alist-delete 'configure %standard-phases)))
1104 `(("fortran" ,gfortran-4.8)))
1108 (home-page "http://www.openblas.net/")
1109 (synopsis "Optimized BLAS library based on GotoBLAS")
1111 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
1112 (license license:bsd-3)))
1114 (define-public openlibm
1121 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
1123 (file-name (string-append name "-" version ".tar.gz"))
1126 "0cwqqqlblj3kzp9aq1wnpfs1fl0qd1wp1xzm5shb09w06i4rh9nn"))))
1127 (build-system gnu-build-system)
1130 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1132 ;; no configure script
1133 (alist-delete 'configure %standard-phases)
1134 #:tests? #f)) ;the tests are part of the default target
1135 (home-page "http://openlibm.org/")
1136 (synopsis "Portable C mathematical library (libm)")
1138 "OpenLibm is an effort to have a high quality, portable, standalone C
1139 mathematical library (libm). It can be used standalone in applications and
1140 programming language implementations. The project was born out of a need to
1141 have a good libm for the Julia programming langage that worked consistently
1142 across compilers and operating systems, and in 32-bit and 64-bit
1144 ;; See LICENSE.md for details.
1145 (license (list license:expat
1148 license:public-domain
1149 license:lgpl2.1+))))
1151 (define-public openspecfun
1153 (name "openspecfun")
1158 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
1160 (file-name (string-append name "-" version ".tar.gz"))
1163 "0nsa3jjmlhcqkw5ba5ypbn3n0c8b6lc22zzlxnmxkxi9shhdx65z"))))
1164 (build-system gnu-build-system)
1166 '(#:tests? #f ;no "check" target
1168 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1169 ;; no configure script
1170 #:phases (alist-delete 'configure %standard-phases)))
1172 `(("fortran" ,gfortran-4.8)))
1173 (home-page "https://github.com/JuliaLang/openspecfun")
1174 (synopsis "Collection of special mathematical functions")
1176 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
1177 portable package for Bessel Functions of a Complex Argument and Nonnegative
1178 Order; it contains subroutines for computing Bessel functions and Airy
1179 functions. Faddeeva allows computing the various error functions of arbitrary
1180 complex arguments (Faddeeva function, error function, complementary error
1181 function, scaled complementary error function, imaginary error function, and
1182 Dawson function); given these, one can also easily compute Voigt functions,
1183 Fresnel integrals, and similar related functions as well.")
1184 ;; Faddeeva is released under the Expat license; AMOS is included as
1185 ;; public domain software.
1186 (license (list license:expat license:public-domain))))
1188 (define-public suitesparse
1190 (name "suitesparse")
1196 "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-"
1200 "100hdzr0mf4mzlwnqpmwpfw4pymgsf9n3g0ywb1yps2nk1zbkdy5"))))
1201 (build-system gnu-build-system)
1203 '(#:parallel-build? #f ;cholmod build fails otherwise
1204 #:tests? #f ;no "check" target
1209 "CHOLMOD_CONFIG=-DNPARTITION" ;required when METIS is not used
1210 (string-append "INSTALL_LIB="
1211 (assoc-ref %outputs "out") "/lib")
1212 (string-append "INSTALL_INCLUDE="
1213 (assoc-ref %outputs "out") "/include"))
1216 'install 'prepare-out
1217 ;; README.txt states that the target directories must exist prior to
1218 ;; running "make install".
1220 (mkdir-p (string-append (assoc-ref %outputs "out") "/lib"))
1221 (mkdir-p (string-append (assoc-ref %outputs "out") "/include")))
1222 ;; no configure script
1223 (alist-delete 'configure %standard-phases))))
1226 ("lapack" ,lapack)))
1227 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
1228 (synopsis "Suite of sparse matrix software")
1230 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
1231 multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
1232 multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
1233 simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
1234 CXSparse, a concise sparse Cholesky factorization package; and many other
1237 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
1239 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
1240 (license (list license:gpl2+ license:lgpl2.1+))))
1242 (define-public atlas
1248 (uri (string-append "mirror://sourceforge/math-atlas/atlas"
1249 version ".tar.bz2"))
1252 "0bqh4bdnjdyww4mcpg6kn0x7338mfqbdgysn97dzrwwb26di7ars"))))
1253 (build-system gnu-build-system)
1254 (home-page "http://math-atlas.sourceforge.net/")
1255 (inputs `(("gfortran" ,gfortran-4.8)
1256 ("lapack-tar" ,(package-source lapack))))
1257 (outputs '("out" "doc"))
1258 ;; For the moment we drop support for MIPS at it fails to compile. See
1259 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
1260 (supported-systems (delete "mips64el-linux" %supported-systems))
1262 `(#:parallel-build? #f
1263 #:parallel-tests? #f
1265 ;; ATLAS tunes itself for the machine it is built on, as explained at
1266 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
1267 ;; For this reason, we want users to build it locally instead of using
1271 #:modules ((srfi srfi-26)
1273 (guix build gnu-build-system)
1276 `(;; Generate position independent code suitable for dynamic libraries
1277 ;; and use WALL timer to get more accurate timing.
1278 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
1281 ,,(if (string-match "64" (%current-system))
1284 ;; Disable parallel build as it gives errors: atlas_pthread.h is
1285 ;; needed to compile C files before it is generated.
1286 "-Ss" "pmake" "make -j 1"
1287 ;; Probe is failing for MIPS. We therefore define the system
1288 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
1289 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
1290 ,,@(if (string-prefix? "mips" (%current-system))
1291 (list "-A" "49" "-V" "1")
1293 ;; Generate shared libraries.
1295 ;; Build a full LAPACK library.
1296 ,(string-append "--with-netlib-lapack-tarfile="
1297 (assoc-ref %build-inputs "lapack-tar")))
1300 'install 'install-doc
1301 (lambda* (#:key outputs inputs #:allow-other-keys)
1302 (let ((doc (string-append (assoc-ref outputs "doc")
1303 "/share/doc/atlas")))
1305 (fold (lambda (file previous)
1306 (and previous (zero? (system* "cp" file doc))))
1307 #t (find-files "../ATLAS/doc" ".*"))))
1310 (lambda _ (zero? (system* "make" "ptcheck")))
1311 ;; Fix files required to run configure.
1313 'configure 'fix-/bin/sh
1315 ;; Use `sh', not `/bin/sh'.
1316 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
1319 ;; Fix /bin/sh in generated make files.
1321 'configure 'fix-/bin/sh-in-generated-files
1323 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
1326 ;; ATLAS configure program does not accepts the default flags
1327 ;; passed by the 'gnu-build-system'.
1330 (lambda* (#:key native-inputs inputs outputs
1331 (configure-flags '())
1332 #:allow-other-keys #:rest args)
1333 (let* ((prefix (assoc-ref outputs "out"))
1334 (bash (or (and=> (assoc-ref
1335 (or native-inputs inputs) "bash")
1336 (cut string-append <> "/bin/bash"))
1338 (flags `(,(string-append "--prefix=" prefix)
1340 (abs-srcdir (getcwd))
1341 (srcdir (string-append "../" (basename abs-srcdir))))
1342 (format #t "source directory: ~s (relative from build: ~s)~%"
1346 (format #t "build directory: ~s~%" (getcwd))
1347 (format #t "configure flags: ~s~%" flags)
1348 (zero? (apply system* bash
1349 (string-append srcdir "/configure")
1351 %standard-phases)))))))
1352 (synopsis "Automatically Tuned Linear Algebra Software")
1354 "ATLAS is an automatically tuned linear algebra software library
1355 providing C and Fortran77 interfaces to a portably efficient BLAS
1356 implementation, as well as a few routines from LAPACK.
1358 Optimization occurs at build time. For this reason, the library is built on
1359 the machine where it is installed, without resorting to pre-built substitutes.
1361 Before building the library, CPU throttling should be disabled. This can be
1362 done in the BIOS, or, on GNU/Linux, with the following commands:
1364 cpufreq-selector -g performance -c 0
1366 cpufreq-selector -g performance -c N-1
1368 where N is the number of cores of your CPU. Failure to do so will result in a
1369 library with poor performance.")
1370 (license license:bsd-3)))
1379 (uri (string-append "mirror://sourceforge/ogl-math/glm-"
1383 "1cnjmi033a16a95v6xfkr1bvfmkd26hzdjka8j1819hgn5b1nr8l"))))
1384 (build-system cmake-build-system)
1386 `(("unzip" ,unzip)))
1387 (home-page "http://glm.g-truc.net")
1388 (synopsis "OpenGL Mathematics library")
1389 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
1390 library for graphics software based on the OpenGL Shading Language (GLSL)
1392 (license license:expat)))
1394 (define-public lpsolve
1401 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
1402 "/lp_solve_" version "_source.tar.gz"))
1405 "176c7f023mb6b8bfmv4rfqnrlw88lsg422ca74zjh19i2h5s69sq"))
1406 (modules '((guix build utils)))
1408 '(substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
1410 ;; Pretend to be on a 64 bit platform to obtain a common directory
1411 ;; name for the build results on all architectures; nothing else
1412 ;; seems to depend on it.
1413 (("^PLATFORM=.*$") "PLATFORM=ux64\n")))))
1414 (build-system gnu-build-system)
1416 `(#:tests? #f ; no check target
1418 (modify-phases %standard-phases
1422 (with-directory-excursion "lpsolve55"
1423 (system* "bash" "ccc"))
1424 (with-directory-excursion "lp_solve"
1425 (system* "bash" "ccc"))
1428 (lambda* (#:key outputs #:allow-other-keys)
1429 (let* ((out (assoc-ref outputs "out"))
1430 (bin (string-append out "/bin"))
1431 (lib (string-append out "/lib"))
1432 ;; This is where LibreOffice expects to find the header
1433 ;; files, and where they are installed by Debian.
1434 (include (string-append out "/include/lpsolve")))
1436 (copy-file "lpsolve55/bin/ux64/liblpsolve55.a"
1437 (string-append lib "/liblpsolve55.a"))
1438 (copy-file "lpsolve55/bin/ux64/liblpsolve55.so"
1439 (string-append lib "/liblpsolve55.so"))
1441 (copy-file "lp_solve/bin/ux64/lp_solve"
1442 (string-append bin "/lp_solve"))
1444 ;; Install a subset of the header files as on Debian
1445 ;; (plus lp_bit.h, which matches the regular expression).
1448 (copy-file name (string-append include "/" name)))
1449 (find-files "." "lp_[HMSa-z].*\\.h$"))
1450 (with-directory-excursion "shared"
1453 (copy-file name (string-append include "/" name)))
1454 (find-files "." "\\.h$")))
1456 (home-page "http://lpsolve.sourceforge.net/")
1457 (synopsis "Mixed integer linear programming (MILP) solver")
1459 "lp_solve is a mixed integer linear programming solver based on the
1460 revised simplex and the branch-and-bound methods.")
1461 (license license:lgpl2.1+)))