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>
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 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))
77 (uri (string-append "mirror://gnu/units/units-" version
80 "1gjs3wc212aaiq4r76hx9nl1h3fa39n0ljwl9420d6ixl3rdmdjk"))))
81 (build-system gnu-build-system)
82 (synopsis "Conversion between thousands of scales")
84 "GNU Units converts numeric quantities between units of measure. It
85 can handle scale changes through adaptive usage of standard scale prefixes
86 (micro-, kilo-, etc.). It can also handle nonlinear conversions such as
87 Fahrenheit to Celsius. Its interpreter is powerful enough to be used
88 effectively as a scientific calculator.")
89 (license license:gpl3+)
90 (home-page "http://www.gnu.org/software/units/")))
92 (define-public dionysus
98 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
102 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
103 (build-system gnu-build-system)
104 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
105 (synopsis "Local search for universal constants and scientific values")
107 "GNU Dionysus is a convenient system for quickly retrieving the values of
108 mathematical constants used in science and engineering. Values can be
109 searched using a simple command-line tool, choosing from three databases:
110 universal constants, atomic numbers, and constants related to
112 (license license:gpl3+)
113 (home-page "http://www.gnu.org/software/dionysus/")))
122 (uri (string-append "mirror://gnu/gsl/gsl-"
126 "0lrgipi0z6559jqh82yx8n4xgnxkhzj46v96dl77hahdp58jzg3k"))))
127 (build-system gnu-build-system)
129 `(#:parallel-tests? #f
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)))
142 (home-page "http://www.gnu.org/software/gsl/")
143 (synopsis "Numerical library for C and C++")
145 "The GNU Scientific Library is a library for numerical analysis in C
146 and C++. It includes a wide range of mathematical routines, with over 1000
147 functions in total. Subject areas covered by the library include:
148 differential equations, linear algebra, Fast Fourier Transforms and random
150 (license license:gpl3+)))
159 (uri (string-append "mirror://gnu/glpk/glpk-"
163 "1rqx5fzj1mhkifilip5mkxybpj2wkniq5qcn8h1w2vkr2rzhs29p"))))
164 (build-system gnu-build-system)
168 `(#:configure-flags '("--with-gmp")))
169 (home-page "http://www.gnu.org/software/glpk/")
170 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
172 "GLPK is a C library for solving large-scale linear programming (LP),
173 mixed integer programming (MIP), and other related problems. It supports the
174 GNU MathProg modeling language, a subset of the AMPL language, and features a
175 translator for the language. In addition to the C library, a stand-alone
176 LP/MIP solver is included in the package.")
177 (license license:gpl3+)))
186 (uri (string-append "mirror://gnu/pspp/pspp-"
190 "0b65q45x05ps95pph6glbg7ymdr638nfb0rk9x5x9qm5k073pk5z"))))
191 (build-system gnu-build-system)
194 ("fontconfig" ,fontconfig)
195 ("gettext" ,gnu-gettext)
199 ("readline" ,readline)
201 ("gtksourceview" ,gtksourceview)
204 `(("glib" ,glib "bin") ;for glib-genmarshal
206 ("pkg-config" ,pkg-config)))
207 (home-page "http://www.gnu.org/software/pspp/")
208 (synopsis "Statistical analysis")
210 "GNU PSPP is a statistical analysis program. It can perform
211 descriptive statistics, T-tests, linear regression and non-parametric tests.
212 It features both a graphical interface as well as command-line input. PSPP
213 is designed to interoperate with Gnumeric, LibreOffice and OpenOffice. Data
214 can be imported from spreadsheets, text files and database sources and it can
215 be output in text, PostScript, PDF or HTML.")
216 (license license:gpl3+)))
218 (define-public arpack-ng
225 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
227 (file-name (string-append name "-" version ".tar.gz"))
230 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
231 (build-system gnu-build-system)
232 (home-page "https://github.com/opencollab/arpack-ng")
235 ("fortran" ,gfortran-4.8)))
236 (synopsis "Fortran subroutines for solving eigenvalue problems")
238 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
239 large scale eigenvalue problems.")
240 (license (license:bsd-style "file://COPYING"
241 "See COPYING in the distribution."))))
243 (define-public lapack
250 (uri (string-append "http://www.netlib.org/lapack/lapack-"
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)))
261 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
262 #:phases (alist-cons-before
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))))
269 (synopsis "Library for numerical linear algebra")
271 "LAPACK is a Fortran 90 library for solving the most commonly occurring
272 problems in numerical linear algebra.")
273 (license (license:bsd-style "file://LICENSE"
274 "See LICENSE in the distribution."))))
276 (define-public gnuplot
283 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
284 version "/gnuplot-" version ".tar.gz"))
287 "1xd7gqdhlk7k1p9yyqf9vkk811nadc7m4si0q3nb6cpv4pxglpyz"))))
288 (build-system gnu-build-system)
289 (inputs `(("readline" ,readline)
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
298 utility. It was originally created to allow scientists and students to
299 visualize mathematical functions and data interactively, but has grown to
300 support many non-interactive uses such as web scripting. It is also used as a
301 plotting 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"))))
314 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-"
318 (base32 "0f9n0v3p3lwc7564791a39c6cn1d3dbrn7d1j3ikqsi27a8hy23d"))))
319 (build-system gnu-build-system)
323 'configure 'patch-configure
325 (substitute* "configure"
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
332 extremely large and complex data collections.")
333 (license (license:x11-style
334 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
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
346 (uri (string-append "mirror://gnu/octave/octave-"
350 "05slz8yx8k91fqlnfr1f0vni95iq9qmchz41c7nf4isn3b2fjn7j"))))
351 (build-system gnu-build-system)
354 ("readline" ,readline)
359 ("fontconfig" ,fontconfig)
360 ("freetype" ,freetype)
361 ("hdf5-lib" ,hdf5 "lib")
362 ("hdf5-include" ,hdf5 "include")
367 `(("gfortran" ,gfortran-4.8)
368 ("pkg-config" ,pkg-config)
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
378 ("ghostscript" ,ghostscript)
379 ("gnuplot" ,gnuplot)))
381 `(#:configure-flags (list (string-append "--with-shell="
382 (assoc-ref %build-inputs "bash")
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
387 for numerical computations. It can be used for both linear and non-linear
388 applications and it provides great support for visualizing results. Work may
389 be performed both at the interactive command-line as well as via script
391 (license license:gpl3+)))
400 (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
401 version "-source.tgz"))
403 (base32 "0jv2yvk28w86rx5mvjkb0w12ff2jxih7axnpvznpd295lg5jg7hr"))
404 (modules '((guix build utils)))
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
412 ("gfortran" ,gfortran-4.8)
414 ("hdf5-lib" ,hdf5 "lib")
415 ("hdf5-include" ,hdf5 "include")
420 ("libxext" ,libxext)))
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
428 CAD engine and post-processor. Its design goal is to provide a fast, light
429 and user-friendly meshing tool with parametric input and advanced
430 visualization capabilities. Gmsh is built around four modules: geometry,
431 mesh, solver and post-processing. The specification of any input to these
432 modules is done either interactively using the graphical user interface or in
433 ASCII text files using Gmsh's own scripting language.")
434 (license license:gpl2+)))
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"))
447 (base32 "0v5dg6dhdjpi5ianvd4mm6hsvxzv1bsxwnh9f9myag0a0d9xk9iv"))
449 (list (search-patch "petsc-fix-threadcomm.patch")))))
450 (build-system gnu-build-system)
452 `(("python" ,python-2)
455 `(("gfortran" ,gfortran-4.8)
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
462 `(#:test-target "test"
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"))
475 ;; PETSc's configure script is actually a python script, so we can't
477 (lambda* (#:key outputs (configure-flags '())
479 (let* ((prefix (assoc-ref outputs "out"))
480 (flags `(,(string-append "--prefix=" prefix)
482 (format #t "build directory: ~s~%" (getcwd))
483 (format #t "configure flags: ~s~%" flags)
484 (zero? (apply system* "./configure" flags))))
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$")
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"))
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)
512 '("conf/configure.log"
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
523 data structures and routines for the scalable (parallel) solution of
524 scientific applications modeled by partial differential equations.")
525 (license (license:bsd-style
526 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
528 (define-public petsc-complex
529 (package (inherit petsc)
530 (location (source-properties->location (current-source-location)))
531 (name "petsc-complex")
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)")))
538 (define-public petsc-openmpi
539 (package (inherit petsc)
540 (name "petsc-openmpi")
542 `(("openmpi" ,openmpi)
543 ,@(package-inputs petsc)))
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)")))
553 (define-public petsc-complex-openmpi
554 (package (inherit petsc-complex)
555 (name "petsc-complex-openmpi")
557 `(("openmpi" ,openmpi)
558 ,@(package-inputs petsc-complex)))
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)")))
568 (define-public superlu
575 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
576 "superlu_" version ".tar.gz"))
578 (base32 "10b785s9s4x0m9q7ihap09275pq4km3k2hk76jiwdfdr5qr2168n"))))
579 (build-system gnu-build-system)
584 ("gfortran" ,gfortran-4.8)))
586 `(#:parallel-build? #f
587 #:tests? #f ;tests are run as part of `make all`
591 (lambda* (#:key inputs outputs #:allow-other-keys)
592 (call-with-output-file "make.inc"
597 SUPERLULIB = ~a/lib/libsuperlu.a
599 BLASDEF = -DUSE_VENDOR_BLAS
600 BLASLIB = -L~a/lib -lblas
601 LIBS = $(SUPERLULIB) $(BLASLIB)
607 CFLAGS = -O3 -DPRNTlevel=0 $(PIC)
614 (assoc-ref outputs "out")
615 (assoc-ref inputs "lapack")))))
617 'build 'create-install-directories
618 (lambda* (#:key outputs #:allow-other-keys)
621 (mkdir-p (string-append (assoc-ref outputs "out")
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'~%"
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")
642 "SuperLU is a general purpose library for the direct solution of large,
643 sparse, nonsymmetric systems of linear equations on high performance machines.
644 The library is written in C and is callable from either C or Fortran. The
645 library routines perform an LU decomposition with partial pivoting and
646 triangular system solves through forward and back substitution. The library
647 also provides threshold-based ILU factorization preconditioners.")
648 (license license:bsd-3)))
650 (define-public superlu-dist
652 (name "superlu-dist")
657 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
658 "superlu_dist_" version ".tar.gz"))
660 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
661 (patches (list (search-patch "superlu-dist-scotchmetis.patch")))))
662 (build-system gnu-build-system)
666 `(("gfortran" ,gfortran-4.8)))
668 `(("openmpi" ,openmpi) ;headers include MPI heades
669 ("lapack" ,lapack) ;required to link with output library
670 ("pt-scotch" ,pt-scotch))) ;same
672 `(#:parallel-build? #f ;race conditions using ar
676 (lambda* (#:key inputs outputs #:allow-other-keys)
677 (call-with-output-file "make.inc"
682 DSUPERLULIB = ~a/lib/libsuperlu_dist.a
683 BLASDEF = -DUSE_VENDOR_BLAS
684 BLASLIB = -L~a/lib -lblas
685 PARMETISLIB = -L~a/lib \
686 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
687 -lscotch -lscotcherr -lscotcherrexit
688 METISLIB = -L~:*~a/lib \
689 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
690 LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
696 CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
697 NOOPTS = -O0 -g $(PIC)
699 FFLAGS = -O2 -g $(PIC)
703 (assoc-ref outputs "out")
704 (assoc-ref inputs "lapack")
705 (assoc-ref inputs "pt-scotch")))))
707 'unpack 'remove-broken-symlinks
709 (for-each delete-file
710 (find-files "MAKE_INC" "\\.#make\\..*")))
712 'build 'create-install-directories
713 (lambda* (#:key outputs #:allow-other-keys)
716 (mkdir-p (string-append (assoc-ref outputs "out")
722 (with-directory-excursion "EXAMPLE"
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")))))
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'~%"
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")
746 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
747 It is targeted for distributed memory parallel machines. SuperLU_DIST is
748 implemented in ANSI C, and MPI for communications.")
749 (license license:bsd-3)))
751 (define-public scotch
758 (uri (string-append "https://gforge.inria.fr/frs/download.php/31831/"
759 "scotch_" version ".tar.gz"))
761 (base32 "0yfqf9lk7chb3h42777x42x4adx0v3n0b41q0cdqrdmscp4iczp5"))
762 (patches (list (search-patch "scotch-test-threading.patch")))))
763 (build-system gnu-build-system)
771 'unpack 'chdir-to-src
772 (lambda _ (chdir "src"))
776 (call-with-output-file "Makefile.inc"
789 CFLAGS = -O2 -g $(CPPFLAGS)
790 LDFLAGS = -lz -lm -lrt -lpthread
792 LEX = flex -Pscotchyy -olex.yy.c
797 YACC = bison -pscotchyy -y -b y
799 '("COMMON_FILE_COMPRESS_GZ"
801 "COMMON_RANDOM_FIXED_SEED"
802 ;; TODO: Define once our MPI supports
803 ;; MPI_THREAD_MULTIPLE
805 ;; "SCOTCH_PTHREAD_NUMBER=2"
806 "restrict=__restrict")))))
809 (lambda* (#:key outputs #:allow-other-keys)
810 (let ((out (assoc-ref outputs "out")))
812 (zero? (system* "make"
813 (string-append "prefix=" out)
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
819 the static mapping and sparse matrix reordering algorithms developed within
820 the SCOTCH project. Its purpose is to apply graph theory, with a divide and
821 conquer approach, to scientific computing problems such as graph and mesh
822 partitioning, static mapping, and sparse matrix ordering, in application
823 domains ranging from structural mechanics to operating systems or
825 ;; See LICENSE_en.txt
826 (license license:cecill-c)))
828 (define-public pt-scotch
829 (package (inherit scotch)
832 `(("openmpi" ,openmpi))) ;Headers include MPI headers
834 (substitute-keyword-arguments (package-arguments scotch)
835 ((#:phases scotch-phases)
838 ;; TODO: Would like to add parallelism here
841 (zero? (system* "make" "ptscotch"))
842 ;; Install the serial metis compatibility library
843 (zero? (system* "make" "-C" "libscotchmetis" "install"))))
846 (lambda _ (zero? (system* "make" "ptcheck")))
849 (lambda* (#:key outputs #:allow-other-keys)
850 (let ((out (assoc-ref outputs "out")))
852 (zero? (system* "make"
853 (string-append "prefix=" out)
856 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
858 (define-public gsegrafix
865 (uri (string-append "mirror://gnu/" name "/" name "-"
869 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
870 (build-system gnu-build-system)
872 `(#:configure-flags '("LDFLAGS=-lm")))
874 `(("libgnomecanvas" ,libgnomecanvas)
875 ("libbonoboui" ,libbonoboui)
876 ("libgnomeui" ,libgnomeui)
877 ("libgnomeprintui" ,libgnomeprintui)
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
884 plots for science and engineering. Plots are specified via simple ASCII
885 parameter files and data files and are presented in an anti-aliased GNOME
886 canvas. The program supports rectangular two-dimensional plots, histograms,
887 polar-axis plots and three-dimensional plots. Plots can be printed or saved
888 to BMP, JPEG or PNG image formats.")
889 (license license:gpl3+)))
891 (define-public maxima
898 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
899 version "-source/" name "-" version ".tar.gz"))
902 "1dw9vfzldpj7lv303xbw0wpyn6ra6i2yzwlrjbcx7j0jm5n43ji0"))))
903 (build-system gnu-build-system)
906 ("gnuplot" ,gnuplot) ;for plots
907 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
909 `(("texinfo" ,texinfo)
914 (string-append "--with-posix-shell="
915 (assoc-ref %build-inputs "bash")
917 (string-append "--with-wish="
918 (assoc-ref %build-inputs "tk")
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
925 #:make-flags (list "TMPDIR=/tmp")
926 #:phases (alist-cons-before
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.
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")
943 (string-append datadir "/emacs/")
944 (string-append out "/share/emacs/site-lisp"))
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")
951 (format out "~a ~s~a~%"
952 "(setf $gnuplot_command "
953 (string-append gnuplot "/bin/gnuplot") ")")
954 (dump-port in out))))))
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
959 numerical expressions. It yields high precision numeric results by using
960 exact fractions, arbitrary precision integers, and variable precision floating
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)))
969 (define-public muparser
977 (url "http://muparser.googlecode.com/svn/trunk/")
981 "1d6bdbhx9zj3srwj3m7c9hvr18gnx1fx43h6d25my7q85gicpcwn"))))
982 (build-system gnu-build-system)
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")
989 "muParser is an extensible high performance math parser library. It is
990 based on transforming an expression into a bytecode and precalculating
991 constant parts of it.")
992 (license license:expat)))
994 (define-public openlibm
1001 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
1003 (file-name (string-append name "-" version ".tar.gz"))
1006 "0cwqqqlblj3kzp9aq1wnpfs1fl0qd1wp1xzm5shb09w06i4rh9nn"))))
1007 (build-system gnu-build-system)
1010 (list (string-append "prefix=" (assoc-ref %outputs "out")))
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)")
1018 "OpenLibm is an effort to have a high quality, portable, standalone C
1019 mathematical library (libm). It can be used standalone in applications and
1020 programming language implementations. The project was born out of a need to
1021 have a good libm for the Julia programming langage that worked consistently
1022 across compilers and operating systems, and in 32-bit and 64-bit
1024 ;; See LICENSE.md for details.
1025 (license (list license:expat
1028 license:public-domain
1029 license:lgpl2.1+))))
1031 (define-public openspecfun
1033 (name "openspecfun")
1038 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
1040 (file-name (string-append name "-" version ".tar.gz"))
1043 "0nsa3jjmlhcqkw5ba5ypbn3n0c8b6lc22zzlxnmxkxi9shhdx65z"))))
1044 (build-system gnu-build-system)
1046 '(#:tests? #f ;no "check" target
1048 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1049 ;; no configure script
1050 #:phases (alist-delete 'configure %standard-phases)))
1052 `(("fortran" ,gfortran-4.8)))
1053 (home-page "https://github.com/JuliaLang/openspecfun")
1054 (synopsis "Collection of special mathematical functions")
1056 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
1057 portable package for Bessel Functions of a Complex Argument and Nonnegative
1058 Order; it contains subroutines for computing Bessel functions and Airy
1059 functions. Faddeeva allows computing the various error functions of arbitrary
1060 complex arguments (Faddeeva function, error function, complementary error
1061 function, scaled complementary error function, imaginary error function, and
1062 Dawson function); given these, one can also easily compute Voigt functions,
1063 Fresnel 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))))
1068 (define-public atlas
1074 (uri (string-append "mirror://sourceforge/math-atlas/atlas"
1075 version ".tar.bz2"))
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))
1088 `(#:parallel-build? #f
1089 #:parallel-tests? #f
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
1097 #:modules ((srfi srfi-26)
1099 (guix build gnu-build-system)
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"
1107 ,,(if (string-match "64" (%current-system))
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")
1119 ;; Generate shared libraries.
1121 ;; Build a full LAPACK library.
1122 ,(string-append "--with-netlib-lapack-tarfile="
1123 (assoc-ref %build-inputs "lapack-tar")))
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")))
1131 (fold (lambda (file previous)
1132 (and previous (zero? (system* "cp" file doc))))
1133 #t (find-files "../ATLAS/doc" ".*"))))
1136 (lambda _ (zero? (system* "make" "ptcheck")))
1137 ;; Fix files required to run configure.
1139 'configure 'fix-/bin/sh
1141 ;; Use `sh', not `/bin/sh'.
1142 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
1145 ;; Fix /bin/sh in generated make files.
1147 'configure 'fix-/bin/sh-in-generated-files
1149 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
1152 ;; ATLAS configure program does not accepts the default flags
1153 ;; passed by the 'gnu-build-system'.
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"))
1164 (flags `(,(string-append "--prefix=" prefix)
1166 (abs-srcdir (getcwd))
1167 (srcdir (string-append "../" (basename abs-srcdir))))
1168 (format #t "source directory: ~s (relative from build: ~s)~%"
1172 (format #t "build directory: ~s~%" (getcwd))
1173 (format #t "configure flags: ~s~%" flags)
1174 (zero? (apply system* bash
1175 (string-append srcdir "/configure")
1177 %standard-phases)))))))
1178 (synopsis "Automatically Tuned Linear Algebra Software")
1180 "ATLAS is an automatically tuned linear algebra software library
1181 providing C and Fortran77 interfaces to a portably efficient BLAS
1182 implementation, as well as a few routines from LAPACK.
1184 Optimization occurs at build time. For this reason, the library is built on
1185 the machine where it is installed, without resorting to pre-built substitutes.
1187 Before building the library, CPU throttling should be disabled. This can be
1188 done in the BIOS, or, on GNU/Linux, with the following commands:
1190 cpufreq-selector -g performance -c 0
1192 cpufreq-selector -g performance -c N-1
1194 where N is the number of cores of your CPU. Failure to do so will result in a
1195 library with poor performance.")
1196 (license license:bsd-3)))