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>
10 ;;; This file is part of GNU Guix.
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25 (define-module (gnu packages maths)
26 #:use-module (ice-9 regex)
27 #:use-module (gnu packages)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix utils)
32 #:use-module (guix build-system cmake)
33 #:use-module (guix build-system gnu)
34 #:use-module (gnu packages algebra)
35 #:use-module (gnu packages bison)
36 #:use-module (gnu packages cmake)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages curl)
39 #:use-module (gnu packages elf)
40 #:use-module (gnu packages flex)
41 #:use-module (gnu packages fltk)
42 #:use-module (gnu packages fontutils)
43 #:use-module (gnu packages gettext)
44 #:use-module (gnu packages gcc)
45 #:use-module (gnu packages gd)
46 #:use-module (gnu packages ghostscript)
47 #:use-module (gnu packages glib)
48 #:use-module (gnu packages gtk)
49 #:use-module (gnu packages less)
50 #:use-module (gnu packages lisp)
51 #:use-module (gnu packages gnome)
52 #:use-module (gnu packages xorg)
53 #:use-module (gnu packages gl)
54 #:use-module (gnu packages m4)
55 #:use-module (gnu packages mpi)
56 #:use-module (gnu packages multiprecision)
57 #:use-module (gnu packages pcre)
58 #:use-module (gnu packages popt)
59 #:use-module (gnu packages perl)
60 #:use-module (gnu packages pkg-config)
61 #:use-module (gnu packages python)
62 #:use-module (gnu packages readline)
63 #:use-module (gnu packages tcsh)
64 #:use-module (gnu packages tcl)
65 #:use-module (gnu packages texinfo)
66 #:use-module (gnu packages texlive)
67 #:use-module (gnu packages xml))
75 (uri (string-append "mirror://gnu/units/units-" version
78 "1gjs3wc212aaiq4r76hx9nl1h3fa39n0ljwl9420d6ixl3rdmdjk"))))
79 (build-system gnu-build-system)
80 (synopsis "Conversion between thousands of scales")
82 "GNU Units converts numeric quantities between units of measure. It
83 can handle scale changes through adaptive usage of standard scale prefixes
84 (micro-, kilo-, etc.). It can also handle nonlinear conversions such as
85 Fahrenheit to Celsius. Its interpreter is powerful enough to be used
86 effectively as a scientific calculator.")
87 (license license:gpl3+)
88 (home-page "http://www.gnu.org/software/units/")))
90 (define-public dionysus
96 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
100 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
101 (build-system gnu-build-system)
102 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
103 (synopsis "Local search for universal constants and scientific values")
105 "GNU Dionysus is a convenient system for quickly retrieving the values of
106 mathematical constants used in science and engineering. Values can be
107 searched using a simple command-line tool, choosing from three databases:
108 universal constants, atomic numbers, and constants related to
110 (license license:gpl3+)
111 (home-page "http://www.gnu.org/software/dionysus/")))
120 (uri (string-append "mirror://gnu/gsl/gsl-"
124 "0lrgipi0z6559jqh82yx8n4xgnxkhzj46v96dl77hahdp58jzg3k"))))
125 (build-system gnu-build-system)
127 `(#:parallel-tests? #f
131 (lambda* (#:key target system outputs #:allow-other-keys #:rest args)
132 (let ((configure (assoc-ref %standard-phases 'configure)))
133 ;; disable numerically unstable test on i686, see thread at
134 ;; http://lists.gnu.org/archive/html/bug-gsl/2011-11/msg00019.html
135 (if (string=? (or target system) "i686-linux")
136 (substitute* "ode-initval2/Makefile.in"
137 (("TESTS = \\$\\(check_PROGRAMS\\)") "TESTS =")))
138 (apply configure args)))
140 (home-page "http://www.gnu.org/software/gsl/")
141 (synopsis "Numerical library for C and C++")
143 "The GNU Scientific Library is a library for numerical analysis in C
144 and C++. It includes a wide range of mathematical routines, with over 1000
145 functions in total. Subject areas covered by the library include:
146 differential equations, linear algebra, Fast Fourier Transforms and random
148 (license license:gpl3+)))
157 (uri (string-append "mirror://gnu/glpk/glpk-"
161 "1rqx5fzj1mhkifilip5mkxybpj2wkniq5qcn8h1w2vkr2rzhs29p"))))
162 (build-system gnu-build-system)
166 `(#:configure-flags '("--with-gmp")))
167 (home-page "http://www.gnu.org/software/glpk/")
168 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
170 "GLPK is a C library for solving large-scale linear programming (LP),
171 mixed integer programming (MIP), and other related problems. It supports the
172 GNU MathProg modeling language, a subset of the AMPL language, and features a
173 translator for the language. In addition to the C library, a stand-alone
174 LP/MIP solver is included in the package.")
175 (license license:gpl3+)))
184 (uri (string-append "mirror://gnu/pspp/pspp-"
188 "0b65q45x05ps95pph6glbg7ymdr638nfb0rk9x5x9qm5k073pk5z"))))
189 (build-system gnu-build-system)
192 ("fontconfig" ,fontconfig)
193 ("gettext" ,gnu-gettext)
197 ("readline" ,readline)
199 ("gtksourceview" ,gtksourceview)
202 `(("glib" ,glib "bin") ;for glib-genmarshal
204 ("pkg-config" ,pkg-config)))
205 (home-page "http://www.gnu.org/software/pspp/")
206 (synopsis "Statistical analysis")
208 "GNU PSPP is a statistical analysis program. It can perform
209 descriptive statistics, T-tests, linear regression and non-parametric tests.
210 It features both a graphical interface as well as command-line input. PSPP
211 is designed to interoperate with Gnumeric, LibreOffice and OpenOffice. Data
212 can be imported from spreadsheets, text files and database sources and it can
213 be output in text, PostScript, PDF or HTML.")
214 (license license:gpl3+)))
216 (define-public arpack-ng
223 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
227 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
228 (build-system gnu-build-system)
229 (home-page "https://github.com/opencollab/arpack-ng")
232 ("fortran" ,gfortran-4.8)))
233 (synopsis "Fortran subroutines for solving eigenvalue problems")
235 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
236 large scale eigenvalue problems.")
237 (license (license:bsd-style "file://COPYING"
238 "See COPYING in the distribution."))))
240 (define-public lapack
247 (uri (string-append "http://www.netlib.org/lapack/lapack-"
251 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
252 (build-system cmake-build-system)
253 (home-page "http://www.netlib.org/lapack/")
254 (native-inputs `(("patchelf" ,patchelf))) ;for augment-rpath
255 (inputs `(("fortran" ,gfortran-4.8)
256 ("python" ,python-2)))
258 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
259 #:phases (alist-cons-before
261 (lambda* (#:key inputs #:allow-other-keys)
262 (let ((python (assoc-ref inputs "python")))
263 (substitute* "lapack_testing.py"
264 (("/usr/bin/env python") python))))
266 (synopsis "Library for numerical linear algebra")
268 "LAPACK is a Fortran 90 library for solving the most commonly occurring
269 problems in numerical linear algebra.")
270 (license (license:bsd-style "file://LICENSE"
271 "See LICENSE in the distribution."))))
273 (define-public gnuplot
280 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
281 version "/gnuplot-" version ".tar.gz"))
284 "1xd7gqdhlk7k1p9yyqf9vkk811nadc7m4si0q3nb6cpv4pxglpyz"))))
285 (build-system gnu-build-system)
286 (inputs `(("readline" ,readline)
290 (native-inputs `(("texlive" ,texlive)
291 ("pkg-config" ,pkg-config)))
292 (home-page "http://www.gnuplot.info")
293 (synopsis "Command-line driven graphing utility")
294 (description "Gnuplot is a portable command-line driven graphing
295 utility. It was originally created to allow scientists and students to
296 visualize mathematical functions and data interactively, but has grown to
297 support many non-interactive uses such as web scripting. It is also used as a
298 plotting engine by third-party applications like Octave.")
299 ;; X11 Style with the additional restriction that derived works may only be
300 ;; distributed as patches to the original.
301 (license (license:fsf-free
302 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
311 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-"
315 (base32 "0f9n0v3p3lwc7564791a39c6cn1d3dbrn7d1j3ikqsi27a8hy23d"))))
316 (build-system gnu-build-system)
320 'configure 'patch-configure
322 (substitute* "configure"
325 (outputs '("out" "bin" "lib" "include"))
326 (home-page "http://www.hdfgroup.org")
327 (synopsis "Management suite for extremely large and complex data")
328 (description "HDF5 is a suite that makes possible the management of
329 extremely large and complex data collections.")
330 (license (license:x11-style
331 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
334 ;; For a fully featured Octave, users are strongly recommended also to install
335 ;; the following packages: texinfo, less, ghostscript, gnuplot.
336 (define-public octave
343 (uri (string-append "mirror://gnu/octave/octave-"
347 "0ks9pr154syw0vb3jn6xsnrkkrbvf9y7i7gaxa28rz6ngxbxvq9l"))))
348 (build-system gnu-build-system)
351 ("readline" ,readline)
356 ("fontconfig" ,fontconfig)
357 ("freetype" ,freetype)
358 ("hdf5-lib" ,hdf5 "lib")
359 ("hdf5-include" ,hdf5 "include")
364 `(("gfortran" ,gfortran-4.8)
365 ("pkg-config" ,pkg-config)
367 ;; The following inputs are not actually used in the build process. However, the
368 ;; ./configure gratuitously tests for their existence and assumes that programs not
369 ;; present at build time are also not, and can never be, available at run time!
370 ;; If these inputs are therefore not present, support for them will be built out.
371 ;; However, Octave will still run without them, albeit without the features they
375 ("ghostscript" ,ghostscript)
376 ("gnuplot" ,gnuplot)))
378 `(#:configure-flags (list (string-append "--with-shell="
379 (assoc-ref %build-inputs "bash")
381 (home-page "http://www.gnu.org/software/octave/")
382 (synopsis "High-level language for numerical computation")
383 (description "GNU Octave is a high-level interpreted language that is specialized
384 for numerical computations. It can be used for both linear and non-linear
385 applications and it provides great support for visualizing results. Work may
386 be performed both at the interactive command-line as well as via script
388 (license license:gpl3+)))
397 (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
398 version "-source.tgz"))
400 (base32 "0jv2yvk28w86rx5mvjkb0w12ff2jxih7axnpvznpd295lg5jg7hr"))
401 (modules '((guix build utils)))
403 ;; Remove non-free METIS code
404 '(delete-file-recursively "contrib/Metis"))))
405 (build-system cmake-build-system)
406 (native-inputs `(("patchelf" ,patchelf))) ;for augment-rpath
409 ("gfortran" ,gfortran-4.8)
411 ("hdf5-lib" ,hdf5 "lib")
412 ("hdf5-include" ,hdf5 "include")
417 ("libxext" ,libxext)))
419 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
420 "-DENABLE_BUILD_SHARED:BOOL=ON"
421 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")))
422 (home-page "http://www.geuz.org/gmsh/")
423 (synopsis "3D finite element grid generator")
424 (description "Gmsh is a 3D finite element grid generator with a built-in
425 CAD engine and post-processor. Its design goal is to provide a fast, light
426 and user-friendly meshing tool with parametric input and advanced
427 visualization capabilities. Gmsh is built around four modules: geometry,
428 mesh, solver and post-processing. The specification of any input to these
429 modules is done either interactively using the graphical user interface or in
430 ASCII text files using Gmsh's own scripting language.")
431 (license license:gpl2+)))
440 ;; The *-lite-* tarball does not contain the *large* documentation
441 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
442 "petsc-lite-" version ".tar.gz"))
444 (base32 "0v5dg6dhdjpi5ianvd4mm6hsvxzv1bsxwnh9f9myag0a0d9xk9iv"))
446 (list (search-patch "petsc-fix-threadcomm.patch")))))
447 (build-system gnu-build-system)
449 `(("python" ,python-2)
452 `(("gfortran" ,gfortran-4.8)
455 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
456 ;; leaving out opengl, as configuration seems to only be for mac
459 `(#:test-target "test"
465 ,(string-append "--with-superlu-include="
466 (assoc-ref %build-inputs "superlu") "/include")
467 ,(string-append "--with-superlu-lib="
468 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
472 ;; PETSc's configure script is actually a python script, so we can't
474 (lambda* (#:key outputs (configure-flags '())
476 (let* ((prefix (assoc-ref outputs "out"))
477 (flags `(,(string-append "--prefix=" prefix)
479 (format #t "build directory: ~s~%" (getcwd))
480 (format #t "configure flags: ~s~%" flags)
481 (zero? (apply system* "./configure" flags))))
483 'configure 'clean-local-references
484 ;; Try to keep build directory names from leaking into compiled code
485 (lambda* (#:key inputs outputs #:allow-other-keys)
486 (let ((out (assoc-ref outputs "out")))
487 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
490 'install 'clean-install
491 ;; Try to keep installed files from leaking build directory names.
492 (lambda* (#:key inputs outputs #:allow-other-keys)
493 (let ((out (assoc-ref outputs "out"))
494 (fortran (assoc-ref inputs "gfortran")))
495 (substitute* (map (lambda (file)
496 (string-append out "/" file))
497 '("conf/petscvariables"
498 "conf/PETScConfig.cmake"))
500 ;; Make compiler references point to the store
501 (substitute* (string-append out "/conf/petscvariables")
502 (("= g(cc|\\+\\+|fortran)" _ suffix)
503 (string-append "= " fortran "/bin/g" suffix)))
504 ;; PETSc installs some build logs, which aren't necessary.
505 (for-each (lambda (file)
506 (let ((f (string-append out "/" file)))
507 (when (file-exists? f)
509 '("conf/configure.log"
514 ;; Once installed, should uninstall with Guix
515 "conf/uninstall.py"))))
516 %standard-phases)))))
517 (home-page "http://www.mcs.anl.gov/petsc")
518 (synopsis "Library to solve PDEs")
519 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
520 data structures and routines for the scalable (parallel) solution of
521 scientific applications modeled by partial differential equations.")
522 (license (license:bsd-style
523 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
525 (define-public petsc-complex
526 (package (inherit petsc)
527 (location (source-properties->location (current-source-location)))
528 (name "petsc-complex")
530 (substitute-keyword-arguments (package-arguments petsc)
531 ((#:configure-flags cf)
532 `(cons "--with-scalar-type=complex" ,cf))))
533 (synopsis "Library to solve PDEs (with complex scalars)")))
535 (define-public petsc-openmpi
536 (package (inherit petsc)
537 (name "petsc-openmpi")
539 `(("openmpi" ,openmpi)
540 ,@(package-inputs petsc)))
542 (substitute-keyword-arguments (package-arguments petsc)
543 ((#:configure-flags cf)
544 ``("--with-mpiexec=mpirun"
545 ,(string-append "--with-mpi-dir="
546 (assoc-ref %build-inputs "openmpi"))
547 ,@(delete "--with-mpi=0" ,cf)))))
548 (synopsis "Library to solve PDEs (with MPI support)")))
550 (define-public petsc-complex-openmpi
551 (package (inherit petsc-complex)
552 (name "petsc-complex-openmpi")
554 `(("openmpi" ,openmpi)
555 ,@(package-inputs petsc-complex)))
557 (substitute-keyword-arguments (package-arguments petsc-complex)
558 ((#:configure-flags cf)
559 ``("--with-mpiexec=mpirun"
560 ,(string-append "--with-mpi-dir="
561 (assoc-ref %build-inputs "openmpi"))
562 ,@(delete "--with-mpi=0" ,cf)))))
563 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
565 (define-public superlu
572 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
573 "superlu_" version ".tar.gz"))
575 (base32 "10b785s9s4x0m9q7ihap09275pq4km3k2hk76jiwdfdr5qr2168n"))))
576 (build-system gnu-build-system)
581 ("gfortran" ,gfortran-4.8)))
583 `(#:parallel-build? #f
584 #:tests? #f ;tests are run as part of `make all`
588 (lambda* (#:key inputs outputs #:allow-other-keys)
589 (call-with-output-file "make.inc"
594 SUPERLULIB = ~a/lib/libsuperlu.a
596 BLASDEF = -DUSE_VENDOR_BLAS
597 BLASLIB = -L~a/lib -lblas
598 LIBS = $(SUPERLULIB) $(BLASLIB)
604 CFLAGS = -O3 -DPRNTlevel=0 $(PIC)
611 (assoc-ref outputs "out")
612 (assoc-ref inputs "lapack")))))
614 'build 'create-install-directories
615 (lambda* (#:key outputs #:allow-other-keys)
618 (mkdir-p (string-append (assoc-ref outputs "out")
623 (lambda* (#:key outputs #:allow-other-keys)
624 ;; Library is placed in lib during the build phase. Copy over
625 ;; headers to include.
626 (let* ((out (assoc-ref outputs "out"))
627 (incdir (string-append out "/include")))
628 (for-each (lambda (file)
629 (let ((base (basename file)))
630 (format #t "installing `~a' to `~a'~%"
633 (string-append incdir "/" base))))
634 (find-files "SRC" ".*\\.h$"))))
635 %standard-phases)))))
636 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
637 (synopsis "Supernodal direct solver for sparse linear systems")
639 "SuperLU is a general purpose library for the direct solution of large,
640 sparse, nonsymmetric systems of linear equations on high performance machines.
641 The library is written in C and is callable from either C or Fortran. The
642 library routines perform an LU decomposition with partial pivoting and
643 triangular system solves through forward and back substitution. The library
644 also provides threshold-based ILU factorization preconditioners.")
645 (license license:bsd-3)))
647 (define-public superlu-dist
649 (name "superlu-dist")
654 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
655 "superlu_dist_" version ".tar.gz"))
657 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
658 (patches (list (search-patch "superlu-dist-scotchmetis.patch")))))
659 (build-system gnu-build-system)
663 `(("gfortran" ,gfortran-4.8)))
665 `(("openmpi" ,openmpi) ;headers include MPI heades
666 ("lapack" ,lapack) ;required to link with output library
667 ("pt-scotch" ,pt-scotch))) ;same
669 `(#:parallel-build? #f ;race conditions using ar
673 (lambda* (#:key inputs outputs #:allow-other-keys)
674 (call-with-output-file "make.inc"
679 DSUPERLULIB = ~a/lib/libsuperlu_dist.a
680 BLASDEF = -DUSE_VENDOR_BLAS
681 BLASLIB = -L~a/lib -lblas
682 PARMETISLIB = -L~a/lib \
683 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
684 -lscotch -lscotcherr -lscotcherrexit
685 METISLIB = -L~:*~a/lib \
686 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
687 LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
693 CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
694 NOOPTS = -O0 -g $(PIC)
696 FFLAGS = -O2 -g $(PIC)
700 (assoc-ref outputs "out")
701 (assoc-ref inputs "lapack")
702 (assoc-ref inputs "pt-scotch")))))
704 'unpack 'remove-broken-symlinks
706 (for-each delete-file
707 (find-files "MAKE_INC" "\\.#make\\..*")))
709 'build 'create-install-directories
710 (lambda* (#:key outputs #:allow-other-keys)
713 (mkdir-p (string-append (assoc-ref outputs "out")
719 (with-directory-excursion "EXAMPLE"
721 (zero? (system* "mpirun" "-n" "2"
722 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
723 (zero? (system* "mpirun" "-n" "2"
724 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
727 (lambda* (#:key outputs #:allow-other-keys)
728 ;; Library is placed in lib during the build phase. Copy over
729 ;; headers to include.
730 (let* ((out (assoc-ref outputs "out"))
731 (incdir (string-append out "/include")))
732 (for-each (lambda (file)
733 (let ((base (basename file)))
734 (format #t "installing `~a' to `~a'~%"
737 (string-append incdir "/" base))))
738 (find-files "SRC" ".*\\.h$"))))
739 %standard-phases)))))))
740 (home-page (package-home-page superlu))
741 (synopsis "Parallel supernodal direct solver")
743 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
744 It is targeted for distributed memory parallel machines. SuperLU_DIST is
745 implemented in ANSI C, and MPI for communications.")
746 (license license:bsd-3)))
748 (define-public scotch
755 (uri (string-append "https://gforge.inria.fr/frs/download.php/31831/"
756 "scotch_" version ".tar.gz"))
758 (base32 "0yfqf9lk7chb3h42777x42x4adx0v3n0b41q0cdqrdmscp4iczp5"))
759 (patches (list (search-patch "scotch-test-threading.patch")))))
760 (build-system gnu-build-system)
768 'unpack 'chdir-to-src
769 (lambda _ (chdir "src"))
773 (call-with-output-file "Makefile.inc"
786 CFLAGS = -O2 -g $(CPPFLAGS)
787 LDFLAGS = -lz -lm -lrt -lpthread
789 LEX = flex -Pscotchyy -olex.yy.c
794 YACC = bison -pscotchyy -y -b y
796 '("COMMON_FILE_COMPRESS_GZ"
798 "COMMON_RANDOM_FIXED_SEED"
799 ;; TODO: Define once our MPI supports
800 ;; MPI_THREAD_MULTIPLE
802 ;; "SCOTCH_PTHREAD_NUMBER=2"
803 "restrict=__restrict")))))
806 (lambda* (#:key outputs #:allow-other-keys)
807 (let ((out (assoc-ref outputs "out")))
809 (zero? (system* "make"
810 (string-append "prefix=" out)
812 %standard-phases)))))
813 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
814 (synopsis "Programs and libraries for graph algorithms")
815 (description "SCOTCH is a set of programs and libraries which implement
816 the static mapping and sparse matrix reordering algorithms developed within
817 the SCOTCH project. Its purpose is to apply graph theory, with a divide and
818 conquer approach, to scientific computing problems such as graph and mesh
819 partitioning, static mapping, and sparse matrix ordering, in application
820 domains ranging from structural mechanics to operating systems or
822 ;; See LICENSE_en.txt
823 (license license:cecill-c)))
825 (define-public pt-scotch
826 (package (inherit scotch)
829 `(("openmpi" ,openmpi))) ;Headers include MPI headers
831 (substitute-keyword-arguments (package-arguments scotch)
832 ((#:phases scotch-phases)
835 ;; TODO: Would like to add parallelism here
838 (zero? (system* "make" "ptscotch"))
839 ;; Install the serial metis compatibility library
840 (zero? (system* "make" "-C" "libscotchmetis" "install"))))
843 (lambda _ (zero? (system* "make" "ptcheck")))
846 (lambda* (#:key outputs #:allow-other-keys)
847 (let ((out (assoc-ref outputs "out")))
849 (zero? (system* "make"
850 (string-append "prefix=" out)
853 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
855 (define-public gsegrafix
862 (uri (string-append "mirror://gnu/" name "/" name "-"
866 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
867 (build-system gnu-build-system)
869 `(#:configure-flags '("LDFLAGS=-lm")))
871 `(("libgnomecanvas" ,libgnomecanvas)
872 ("libbonoboui" ,libbonoboui)
873 ("libgnomeui" ,libgnomeui)
874 ("libgnomeprintui" ,libgnomeprintui)
877 `(("pkg-config" ,pkg-config)))
878 (home-page "http://www.gnu.org/software/gsegrafix/")
879 (synopsis "GNOME application to create scientific and engineering plots")
880 (description "GSEGrafix is an application which produces high-quality graphical
881 plots for science and engineering. Plots are specified via simple ASCII
882 parameter files and data files and are presented in an anti-aliased GNOME
883 canvas. The program supports rectangular two-dimensional plots, histograms,
884 polar-axis plots and three-dimensional plots. Plots can be printed or saved
885 to BMP, JPEG or PNG image formats.")
886 (license license:gpl3+)))
888 (define-public maxima
895 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
896 version "-source/" name "-" version ".tar.gz"))
899 "1dw9vfzldpj7lv303xbw0wpyn6ra6i2yzwlrjbcx7j0jm5n43ji0"))))
900 (build-system gnu-build-system)
903 ("gnuplot" ,gnuplot) ;for plots
904 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
906 `(("texinfo" ,texinfo)
911 (string-append "--with-posix-shell="
912 (assoc-ref %build-inputs "bash")
914 (string-append "--with-wish="
915 (assoc-ref %build-inputs "tk")
917 (let ((v ,(package-version tk)))
918 (string-take v (string-index-right v #\.)))))
919 ;; By default Maxima attempts to write temporary files to
920 ;; '/tmp/nix-build-maxima-5.34.1', which doesn't exist. Work around
922 #:make-flags (list "TMPDIR=/tmp")
923 #:phases (alist-cons-before
926 (chmod "src/maxima" #o555))
927 ;; Make sure the doc and emacs files are found in the
928 ;; standard location. Also configure maxima to find gnuplot
929 ;; without having it on the PATH.
931 'install 'post-install
932 (lambda* (#:key outputs inputs #:allow-other-keys)
933 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
934 (out (assoc-ref outputs "out"))
935 (datadir (string-append out "/share/maxima/" ,version)))
936 (with-directory-excursion out
937 (mkdir-p "share/emacs")
938 (mkdir-p "share/doc")
940 (string-append datadir "/emacs/")
941 (string-append out "/share/emacs/site-lisp"))
943 (string-append datadir "/doc/")
944 (string-append out "/share/doc/maxima"))
945 (with-atomic-file-replacement
946 (string-append datadir "/share/maxima-init.lisp")
948 (format out "~a ~s~a~%"
949 "(setf $gnuplot_command "
950 (string-append gnuplot "/bin/gnuplot") ")")
951 (dump-port in out))))))
953 (home-page "http://maxima.sourceforge.net")
954 (synopsis "Numeric and symbolic expression manipulation")
955 (description "Maxima is a system for the manipulation of symbolic and
956 numerical expressions. It yields high precision numeric results by using
957 exact fractions, arbitrary precision integers, and variable precision floating
959 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
960 ;; Others simply say "GNU General Public License" without stating a
961 ;; version (which implicitly means gpl1+).
962 ;; At least one file (src/maxima.asd) says "version 2."
963 ;; GPLv2 only is therefore the smallest subset.
964 (license license:gpl2)))
972 (uri (string-append "mirror://sourceforge/math-atlas/atlas"
976 "0bqh4bdnjdyww4mcpg6kn0x7338mfqbdgysn97dzrwwb26di7ars"))))
977 (build-system gnu-build-system)
978 (home-page "http://math-atlas.sourceforge.net/")
979 (inputs `(("gfortran" ,gfortran-4.8)
980 ("lapack-tar" ,(package-source lapack))))
981 (outputs '("out" "doc"))
982 ;; For the moment we drop support for MIPS at it fails to compile. See
983 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
984 (supported-systems (delete "mips64el-linux" %supported-systems))
986 `(#:parallel-build? #f
989 ;; ATLAS tunes itself for the machine it is built on, as explained at
990 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
991 ;; For this reason, we want users to build it locally instead of using
995 #:modules ((srfi srfi-26)
997 (guix build gnu-build-system)
1000 `(;; Generate position independent code suitable for dynamic libraries
1001 ;; and use WALL timer to get more accurate timing.
1002 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
1005 ,,(if (string-match "64" (%current-system))
1008 ;; Disable parallel build as it gives errors: atlas_pthread.h is
1009 ;; needed to compile C files before it is generated.
1010 "-Ss" "pmake" "make -j 1"
1011 ;; Probe is failing for MIPS. We therefore define the system
1012 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
1013 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
1014 ,,@(if (string-prefix? "mips" (%current-system))
1015 (list "-A" "49" "-V" "1")
1017 ;; Generate shared libraries.
1019 ;; Build a full LAPACK library.
1020 ,(string-append "--with-netlib-lapack-tarfile="
1021 (assoc-ref %build-inputs "lapack-tar")))
1024 'install 'install-doc
1025 (lambda* (#:key outputs inputs #:allow-other-keys)
1026 (let ((doc (string-append (assoc-ref outputs "doc")
1027 "/share/doc/atlas")))
1029 (fold (lambda (file previous)
1030 (and previous (zero? (system* "cp" file doc))))
1031 #t (find-files "../ATLAS/doc" ".*"))))
1034 (lambda _ (zero? (system* "make" "ptcheck")))
1035 ;; Fix files required to run configure.
1037 'configure 'fix-/bin/sh
1039 ;; Use `sh', not `/bin/sh'.
1040 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
1043 ;; Fix /bin/sh in generated make files.
1045 'configure 'fix-/bin/sh-in-generated-files
1047 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
1050 ;; ATLAS configure program does not accepts the default flags
1051 ;; passed by the 'gnu-build-system'.
1054 (lambda* (#:key native-inputs inputs outputs
1055 (configure-flags '())
1056 #:allow-other-keys #:rest args)
1057 (let* ((prefix (assoc-ref outputs "out"))
1058 (bash (or (and=> (assoc-ref
1059 (or native-inputs inputs) "bash")
1060 (cut string-append <> "/bin/bash"))
1062 (flags `(,(string-append "--prefix=" prefix)
1064 (abs-srcdir (getcwd))
1065 (srcdir (string-append "../" (basename abs-srcdir))))
1066 (format #t "source directory: ~s (relative from build: ~s)~%"
1070 (format #t "build directory: ~s~%" (getcwd))
1071 (format #t "configure flags: ~s~%" flags)
1072 (zero? (apply system* bash
1073 (string-append srcdir "/configure")
1075 %standard-phases)))))))
1076 (synopsis "Automatically Tuned Linear Algebra Software")
1078 "ATLAS is an automatically tuned linear algebra software library
1079 providing C and Fortran77 interfaces to a portably efficient BLAS
1080 implementation, as well as a few routines from LAPACK.
1082 Optimization occurs at build time. For this reason, the library is built on
1083 the machine where it is installed, without resorting to pre-built substitutes.
1085 Before building the library, CPU throttling should be disabled. This can be
1086 done in the BIOS, or, on GNU/Linux, with the following commands:
1088 cpufreq-selector -g performance -c 0
1090 cpufreq-selector -g performance -c N-1
1092 where N is the number of cores of your CPU. Failure to do so will result in a
1093 library with poor performance.")
1094 (license license:bsd-3)))