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, 2015 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 utils)
36 #:use-module (guix build-system cmake)
37 #:use-module (guix build-system gnu)
38 #:use-module (gnu packages algebra)
39 #:use-module (gnu packages bison)
40 #:use-module (gnu packages boost)
41 #:use-module (gnu packages check)
42 #:use-module (gnu packages cmake)
43 #:use-module (gnu packages compression)
44 #:use-module (gnu packages curl)
45 #:use-module (gnu packages elf)
46 #:use-module (gnu packages flex)
47 #:use-module (gnu packages fltk)
48 #:use-module (gnu packages fontutils)
49 #:use-module (gnu packages gettext)
50 #:use-module (gnu packages gcc)
51 #:use-module (gnu packages gd)
52 #:use-module (gnu packages ghostscript)
53 #:use-module (gnu packages glib)
54 #:use-module (gnu packages gtk)
55 #:use-module (gnu packages less)
56 #:use-module (gnu packages lisp)
57 #:use-module (gnu packages gnome)
58 #:use-module (gnu packages xorg)
59 #:use-module (gnu packages gl)
60 #:use-module (gnu packages m4)
61 #:use-module (gnu packages mpi)
62 #:use-module (gnu packages multiprecision)
63 #:use-module (gnu packages pcre)
64 #:use-module (gnu packages popt)
65 #:use-module (gnu packages perl)
66 #:use-module (gnu packages pkg-config)
67 #:use-module (gnu packages python)
68 #:use-module (gnu packages readline)
69 #:use-module (gnu packages tbb)
70 #:use-module (gnu packages tcsh)
71 #:use-module (gnu packages tcl)
72 #:use-module (gnu packages texinfo)
73 #:use-module (gnu packages texlive)
74 #:use-module (gnu packages wxwidgets)
75 #:use-module (gnu packages xml)
76 #:use-module (gnu packages zip)
77 #:use-module (srfi srfi-1))
85 (uri (string-append "mirror://gnu/units/units-" version
88 "1gjs3wc212aaiq4r76hx9nl1h3fa39n0ljwl9420d6ixl3rdmdjk"))))
89 (build-system gnu-build-system)
90 (synopsis "Conversion between thousands of scales")
92 "GNU Units converts numeric quantities between units of measure. It
93 can handle scale changes through adaptive usage of standard scale
94 prefixes (micro-, kilo-, etc.). It can also handle nonlinear
95 conversions such as Fahrenheit to Celsius. Its interpreter is powerful
96 enough to be used effectively as a scientific calculator.")
97 (license license:gpl3+)
98 (home-page "http://www.gnu.org/software/units/")))
100 (define-public double-conversion
102 (name "double-conversion")
107 "https://github.com/floitsch/double-conversion/archive/v"
109 (file-name (string-append name "-" version ".tar.gz"))
112 "0cnr8xhyjfxijay8ymkqcph3672wp2lj23qhdmr3m4kia5kpdf83"))))
113 (build-system cmake-build-system)
115 '(#:test-target "test"
116 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
117 "-DBUILD_TESTING=ON")))
118 (home-page "https://github.com/floitsch/double-conversion")
119 (synopsis "Conversion routines for IEEE doubles")
121 "The double-conversion library provides binary-decimal and decimal-binary
122 routines for IEEE doubles. The library consists of efficient conversion
123 routines that have been extracted from the V8 JavaScript engine.")
124 (license license:bsd-3)))
126 (define-public dionysus
132 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
136 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
137 (build-system gnu-build-system)
138 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
139 (synopsis "Local search for universal constants and scientific values")
141 "GNU Dionysus is a convenient system for quickly retrieving the values of
142 mathematical constants used in science and engineering. Values can be
143 searched using a simple command-line tool, choosing from three databases:
144 universal constants, atomic numbers, and constants related to
146 (license license:gpl3+)
147 (home-page "http://www.gnu.org/software/dionysus/")))
156 (uri (string-append "mirror://gnu/gsl/gsl-"
160 "0lrgipi0z6559jqh82yx8n4xgnxkhzj46v96dl77hahdp58jzg3k"))
161 (patches (map search-patch '("gsl-poly-test-fix-pt1.patch"
162 "gsl-poly-test-fix-pt2.patch")))))
163 (build-system gnu-build-system)
165 `(#:parallel-tests? #f
169 (lambda* (#:key target system outputs #:allow-other-keys #:rest args)
170 (let ((configure (assoc-ref %standard-phases 'configure)))
171 ;; disable numerically unstable test on i686, see thread at
172 ;; http://lists.gnu.org/archive/html/bug-gsl/2011-11/msg00019.html
173 (if (string=? (or target system) "i686-linux")
174 (substitute* "ode-initval2/Makefile.in"
175 (("TESTS = \\$\\(check_PROGRAMS\\)") "TESTS =")))
176 (apply configure args)))
178 (home-page "http://www.gnu.org/software/gsl/")
179 (synopsis "Numerical library for C and C++")
181 "The GNU Scientific Library is a library for numerical analysis in C
182 and C++. It includes a wide range of mathematical routines, with over 1000
183 functions in total. Subject areas covered by the library include:
184 differential equations, linear algebra, Fast Fourier Transforms and random
186 (license license:gpl3+)))
195 (uri (string-append "mirror://gnu/glpk/glpk-"
199 "1rqx5fzj1mhkifilip5mkxybpj2wkniq5qcn8h1w2vkr2rzhs29p"))))
200 (build-system gnu-build-system)
204 `(#:configure-flags '("--with-gmp")))
205 (home-page "http://www.gnu.org/software/glpk/")
206 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
208 "GLPK is a C library for solving large-scale linear programming (LP),
209 mixed integer programming (MIP), and other related problems. It supports the
210 GNU MathProg modeling language, a subset of the AMPL language, and features a
211 translator for the language. In addition to the C library, a stand-alone
212 LP/MIP solver is included in the package.")
213 (license license:gpl3+)))
222 (uri (string-append "mirror://gnu/pspp/pspp-"
226 "0b65q45x05ps95pph6glbg7ymdr638nfb0rk9x5x9qm5k073pk5z"))))
227 (build-system gnu-build-system)
230 ("fontconfig" ,fontconfig)
231 ("gettext" ,gnu-gettext)
235 ("readline" ,readline)
237 ("gtksourceview" ,gtksourceview)
240 `(("glib" ,glib "bin") ;for glib-genmarshal
242 ("pkg-config" ,pkg-config)))
243 (home-page "http://www.gnu.org/software/pspp/")
244 (synopsis "Statistical analysis")
246 "GNU PSPP is a statistical analysis program. It can perform
247 descriptive statistics, T-tests, linear regression and non-parametric tests.
248 It features both a graphical interface as well as command-line input. PSPP
249 is designed to interoperate with Gnumeric, LibreOffice and OpenOffice. Data
250 can be imported from spreadsheets, text files and database sources and it can
251 be output in text, PostScript, PDF or HTML.")
252 (license license:gpl3+)))
254 (define-public arpack-ng
261 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
263 (file-name (string-append name "-" version ".tar.gz"))
266 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
267 (build-system gnu-build-system)
268 (home-page "https://github.com/opencollab/arpack-ng")
271 ("fortran" ,gfortran)))
272 (synopsis "Fortran subroutines for solving eigenvalue problems")
274 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
275 large scale eigenvalue problems.")
276 (license (license:non-copyleft "file://COPYING"
277 "See COPYING in the distribution."))))
279 (define-public arpack-ng-openmpi
280 (package (inherit arpack-ng)
281 (name "arpack-ng-openmpi")
284 ,@(package-inputs arpack-ng)))
285 (arguments `(#:configure-flags '("--enable-mpi")))
286 (synopsis "Fortran subroutines for solving eigenvalue problems with MPI")))
288 (define-public lapack
295 (uri (string-append "http://www.netlib.org/lapack/lapack-"
299 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
300 (build-system cmake-build-system)
301 (home-page "http://www.netlib.org/lapack/")
302 (inputs `(("fortran" ,gfortran)
303 ("python" ,python-2)))
305 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
306 #:phases (alist-cons-before
308 (lambda* (#:key inputs #:allow-other-keys)
309 (let ((python (assoc-ref inputs "python")))
310 (substitute* "lapack_testing.py"
311 (("/usr/bin/env python") python))))
313 (synopsis "Library for numerical linear algebra")
315 "LAPACK is a Fortran 90 library for solving the most commonly occurring
316 problems in numerical linear algebra.")
317 (license (license:non-copyleft "file://LICENSE"
318 "See LICENSE in the distribution."))))
320 (define-public scalapack
327 (uri (string-append "http://www.netlib.org/scalapack/scalapack-"
331 "0p1r61ss1fq0bs8ynnx7xq4wwsdvs32ljvwjnx6yxr8gd6pawx0c"))))
332 (build-system cmake-build-system)
335 ("fortran" ,gfortran)
336 ("lapack" ,lapack))) ;for testing only
338 `(#:configure-flags `("-DBUILD_SHARED_LIBS:BOOL=YES")))
339 (home-page "http://www.netlib.org/scalapack/")
340 (synopsis "Library for scalable numerical linear algebra")
342 "ScaLAPACK is a Fortran 90 library of high-performance linear algebra
343 routines on parallel distributed memory machines. ScaLAPACK solves dense and
344 banded linear systems, least squares problems, eigenvalue problems, and
345 singular value problems.")
346 (license (license:bsd-style "file://LICENSE"
347 "See LICENSE in the distribution."))))
349 (define-public gnuplot
356 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
357 version "/gnuplot-" version ".tar.gz"))
360 "1xd7gqdhlk7k1p9yyqf9vkk811nadc7m4si0q3nb6cpv4pxglpyz"))))
361 (build-system gnu-build-system)
362 (inputs `(("readline" ,readline)
366 (native-inputs `(("texlive" ,texlive)
367 ("pkg-config" ,pkg-config)))
368 (home-page "http://www.gnuplot.info")
369 (synopsis "Command-line driven graphing utility")
370 (description "Gnuplot is a portable command-line driven graphing
371 utility. It was originally created to allow scientists and students to
372 visualize mathematical functions and data interactively, but has grown to
373 support many non-interactive uses such as web scripting. It is also used as a
374 plotting engine by third-party applications like Octave.")
375 ;; X11 Style with the additional restriction that derived works may only be
376 ;; distributed as patches to the original.
377 (license (license:fsf-free
378 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
387 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-"
391 (base32 "0f9n0v3p3lwc7564791a39c6cn1d3dbrn7d1j3ikqsi27a8hy23d"))))
392 (build-system gnu-build-system)
398 'configure 'patch-configure
400 (substitute* "configure"
403 (home-page "http://www.hdfgroup.org")
404 (synopsis "Management suite for extremely large and complex data")
405 (description "HDF5 is a suite that makes possible the management of
406 extremely large and complex data collections.")
407 (license (license:x11-style
408 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
411 ;; For a fully featured Octave, users are strongly recommended also to install
412 ;; the following packages: texinfo, less, ghostscript, gnuplot.
413 (define-public octave
420 (uri (string-append "mirror://gnu/octave/octave-"
424 "05slz8yx8k91fqlnfr1f0vni95iq9qmchz41c7nf4isn3b2fjn7j"))))
425 (build-system gnu-build-system)
428 ("readline" ,readline)
432 ("arpack" ,arpack-ng)
436 ("fontconfig" ,fontconfig)
437 ("freetype" ,freetype)
444 `(("gfortran" ,gfortran)
445 ("pkg-config" ,pkg-config)
447 ;; The following inputs are not actually used in the build process.
448 ;; However, the ./configure gratuitously tests for their existence and
449 ;; assumes that programs not present at build time are also not, and
450 ;; can never be, available at run time! If these inputs are therefore
451 ;; not present, support for them will be built out. However, Octave
452 ;; will still run without them, albeit without the features they
456 ("ghostscript" ,ghostscript)
457 ("gnuplot" ,gnuplot)))
459 `(#:configure-flags (list (string-append "--with-shell="
460 (assoc-ref %build-inputs "bash")
462 (home-page "http://www.gnu.org/software/octave/")
463 (synopsis "High-level language for numerical computation")
464 (description "GNU Octave is a high-level interpreted language that is
465 specialized for numerical computations. It can be used for both linear and
466 non-linear applications and it provides great support for visualizing results.
467 Work may be performed both at the interactive command-line as well as via
469 (license license:gpl3+)))
478 (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
479 version "-source.tgz"))
481 (base32 "0jv2yvk28w86rx5mvjkb0w12ff2jxih7axnpvznpd295lg5jg7hr"))
482 (modules '((guix build utils)))
484 ;; Remove non-free METIS code
485 '(delete-file-recursively "contrib/Metis"))))
486 (build-system cmake-build-system)
489 ("gfortran" ,gfortran)
496 ("libxext" ,libxext)))
498 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
499 "-DENABLE_BUILD_SHARED:BOOL=ON"
500 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")))
501 (home-page "http://www.geuz.org/gmsh/")
502 (synopsis "3D finite element grid generator")
503 (description "Gmsh is a 3D finite element grid generator with a built-in
504 CAD engine and post-processor. Its design goal is to provide a fast, light
505 and user-friendly meshing tool with parametric input and advanced
506 visualization capabilities. Gmsh is built around four modules: geometry,
507 mesh, solver and post-processing. The specification of any input to these
508 modules is done either interactively using the graphical user interface or in
509 ASCII text files using Gmsh's own scripting language.")
510 (license license:gpl2+)))
519 ;; The *-lite-* tarball does not contain the *large* documentation
520 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
521 "petsc-lite-" version ".tar.gz"))
523 (base32 "0lzhk1flgszks1wlhz2b92rnlx5np7bgad8vqy9fcqziz5b4pr26"))))
524 (build-system gnu-build-system)
526 `(("python" ,python-2)
529 `(("gfortran" ,gfortran)
532 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
533 ;; leaving out opengl, as configuration seems to only be for mac
536 `(#:test-target "test"
537 #:parallel-build? #f ;build is parallel by default
542 ,(string-append "--with-superlu-include="
543 (assoc-ref %build-inputs "superlu") "/include")
544 ,(string-append "--with-superlu-lib="
545 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
549 ;; PETSc's configure script is actually a python script, so we can't
551 (lambda* (#:key outputs (configure-flags '())
553 (let* ((prefix (assoc-ref outputs "out"))
554 (flags `(,(string-append "--prefix=" prefix)
556 (format #t "build directory: ~s~%" (getcwd))
557 (format #t "configure flags: ~s~%" flags)
558 (zero? (apply system* "./configure" flags))))
560 'configure 'clean-local-references
561 ;; Try to keep build directory names from leaking into compiled code
562 (lambda* (#:key inputs outputs #:allow-other-keys)
563 (let ((out (assoc-ref outputs "out")))
564 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
567 'install 'clean-install
568 ;; Try to keep installed files from leaking build directory names.
569 (lambda* (#:key inputs outputs #:allow-other-keys)
570 (let ((out (assoc-ref outputs "out"))
571 (fortran (assoc-ref inputs "gfortran")))
572 (substitute* (map (lambda (file)
573 (string-append out "/lib/petsc/conf/" file))
574 '("petscvariables" "PETScConfig.cmake"))
576 ;; Make compiler references point to the store
577 (substitute* (string-append out "/lib/petsc/conf/petscvariables")
578 (("= g(cc|\\+\\+|fortran)" _ suffix)
579 (string-append "= " fortran "/bin/g" suffix)))
580 ;; PETSc installs some build logs, which aren't necessary.
581 (for-each (lambda (file)
582 (let ((f (string-append out "/lib/petsc/conf/" file)))
583 (when (file-exists? f)
585 '("configure.log" "make.log" "gmake.log"
586 "test.log" "error.log" "RDict.db"
587 ;; Once installed, should uninstall with Guix
589 %standard-phases)))))
590 (home-page "http://www.mcs.anl.gov/petsc")
591 (synopsis "Library to solve PDEs")
592 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
593 data structures and routines for the scalable (parallel) solution of
594 scientific applications modeled by partial differential equations.")
595 (license (license:non-copyleft
596 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
598 (define-public petsc-complex
599 (package (inherit petsc)
600 (name "petsc-complex")
602 (substitute-keyword-arguments (package-arguments petsc)
603 ((#:configure-flags cf)
604 `(cons "--with-scalar-type=complex" ,cf))))
605 (synopsis "Library to solve PDEs (with complex scalars)")))
607 (define-public petsc-openmpi
608 (package (inherit petsc)
609 (name "petsc-openmpi")
611 `(("openmpi" ,openmpi)
612 ,@(package-inputs petsc)))
614 (substitute-keyword-arguments (package-arguments petsc)
615 ((#:configure-flags cf)
616 ``("--with-mpiexec=mpirun"
617 ,(string-append "--with-mpi-dir="
618 (assoc-ref %build-inputs "openmpi"))
619 ,@(delete "--with-mpi=0" ,cf)))))
620 (synopsis "Library to solve PDEs (with MPI support)")))
622 (define-public petsc-complex-openmpi
623 (package (inherit petsc-complex)
624 (name "petsc-complex-openmpi")
626 `(("openmpi" ,openmpi)
627 ,@(package-inputs petsc-complex)))
629 (substitute-keyword-arguments (package-arguments petsc-complex)
630 ((#:configure-flags cf)
631 ``("--with-mpiexec=mpirun"
632 ,(string-append "--with-mpi-dir="
633 (assoc-ref %build-inputs "openmpi"))
634 ,@(delete "--with-mpi=0" ,cf)))))
635 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
644 (uri (string-append "http://slepc.upv.es/download/download.php?"
645 "filename=slepc-" version ".tar.gz"))
648 "1ij8w864spzk4cq2mmkssqyj0mbckkkvxm0wpw9gywy2jgbj07jr"))))
649 (build-system gnu-build-system)
651 `(("python" ,python-2)))
653 `(("arpack" ,arpack-ng)
654 ("gfortran" ,gfortran)))
658 `(#:parallel-build? #f ;build is parallel by default
660 `(,(string-append "--with-arpack-dir="
661 (assoc-ref %build-inputs "arpack")))
663 (modify-phases %standard-phases
666 ;; configure is a python script, so we can't run it with bash.
667 (lambda* (#:key inputs outputs (configure-flags '())
669 (let* ((prefix (assoc-ref outputs "out"))
670 (flags `(,(string-append "--prefix=" prefix)
672 (format #t "build directory: ~s~%" (getcwd))
673 (format #t "configure flags: ~s~%" flags)
674 (setenv "SLEPC_DIR" (getcwd))
675 (setenv "PETSC_DIR" (assoc-ref %build-inputs "petsc"))
676 (zero? (apply system* "./configure" flags)))))
679 ;; TODO: SLEPc installs HTML documentation alongside headers in
680 ;; $out/include. We'd like to move them to share/doc, but delete
681 ;; them for now, as they are incomplete and installing the complete
682 ;; documentation is difficult.
683 (lambda* (#:key outputs #:allow-other-keys)
684 (let* ((out (assoc-ref outputs "out")))
685 (for-each delete-file (find-files out "\\.html$")))))
687 'install 'clean-install
688 ;; Clean up unnecessary build logs from installation.
689 (lambda* (#:key outputs #:allow-other-keys)
690 (let ((out (assoc-ref outputs "out")))
691 (for-each (lambda (file)
692 (let ((f (string-append out "/lib/slepc/conf/" file)))
693 (when (file-exists? f)
695 '("configure.log" "make.log" "gmake.log"
696 "test.log" "error.log" "RDict.db"
697 "uninstall.py"))))))))
698 (home-page "http://slepc.upv.es")
699 (synopsis "Scalable library for eigenproblems")
700 (description "SLEPc is a software library for the solution of large sparse
701 eigenproblems on parallel computers. It can be used for the solution of
702 linear eigenvalue problems formulated in either standard or generalized form,
703 as well as other related problems such as the singular value decomposition.
704 The emphasis of the software is on methods and techniques appropriate for
705 problems in which the associated matrices are sparse, for example, those
706 arising after the discretization of partial differential equations.")
707 (license license:lgpl3)))
709 (define-public slepc-complex
710 (package (inherit slepc)
711 (name "slepc-complex")
713 `(("petsc" ,petsc-complex)
714 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
715 (synopsis "Scalable library for eigenproblems (with complex scalars)")))
717 (define-public slepc-openmpi
718 (package (inherit slepc)
719 (name "slepc-openmpi")
722 ("arpack" ,arpack-ng-openmpi)
723 ,@(alist-delete "arpack" (package-inputs slepc))))
725 `(("petsc" ,petsc-openmpi)
726 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
727 (synopsis "Scalable library for eigenproblems (with MPI support)")))
729 (define-public slepc-complex-openmpi
730 (package (inherit slepc-openmpi)
731 (name "slepc-complex-openmpi")
733 `(("petsc" ,petsc-complex-openmpi)
734 ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
735 (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
744 (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
748 "0690yp73sqk8zn2jnrzdr5swnjdyd7j0774s4xamjjwcxarw87hr"))
749 (patches (list (search-patch "mumps-build-parallelism.patch")))))
750 (build-system gnu-build-system)
752 `(("fortran" ,gfortran)
753 ;; These are required for linking against mumps, but we let the user
754 ;; declare the dependency.
759 `(#:modules ((ice-9 match)
762 ,@%gnu-build-system-modules)
764 (modify-phases %standard-phases
767 (lambda* (#:key inputs #:allow-other-keys)
768 (call-with-output-file "Makefile.inc"
779 INCSEQ = -I$(topdir)/libseq
780 LIBSEQ = -L$(topdir)/libseq -lmpiseq
781 LIBSEQNEEDED = libseqneeded~;
785 AR = ar vr # rules require trailing space, ugh...
787 LIBBLAS = -L~a -lopenblas~@[
788 SCALAP = -L~a -lscalapack~]
792 OPTF = -O2 -DALLOW_NON_INIT $(PIC)
796 LIBS = $(SCALAP) $(LIBSEQ)
797 LPORDDIR = $(topdir)/PORD/lib
798 IPORD = -I$(topdir)/PORD/include
799 LPORD = -L$(LPORDDIR) -lpord
800 ORDERINGSF = -Dpord~@[
802 IMETIS = -I$(METISDIR)/include
803 LMETIS = -L$(METISDIR)/lib -lmetis
804 ORDERINGSF += -Dmetis~]~@[~:{
806 ISCOTCH = -I$(SCOTCHDIR)/include
807 LSCOTCH = -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
809 ORDERINGSC = $(ORDERINGSF)
810 LORDERINGS = $(LPORD) $(LMETIS) $(LSCOTCH)
811 IORDERINGSF = $(ISCOTCH)
812 IORDERINGSC = $(IPORD) $(IMETIS) $(ISCOTCH)"
813 (assoc-ref inputs "mpi")
814 (assoc-ref inputs "blas")
815 (assoc-ref inputs "scalapack")
816 (assoc-ref inputs "metis")
817 (match (list (assoc-ref inputs "pt-scotch")
818 (assoc-ref inputs "scotch"))
822 `((,scotch "" "-Dscotch")))
825 "-lptesmumps -lptscotch -lptscotcherr "
826 "-Dptscotch")))))))))
829 ;; By default only the d-precision library is built. Make with "all"
830 ;; target so that all precision libraries and examples are built.
832 (zero? (system* "make" "all"
833 (format #f "-j~a" (parallel-job-count))))))
836 ;; Run the simple test drivers, which read test input from stdin:
837 ;; from the "real" input for the single- and double-precision
838 ;; testers, and from the "cmplx" input for complex-precision
839 ;; testers. The EXEC-PREFIX key is used by the mumps-openmpi
840 ;; package to prefix execution with "mpirun".
841 (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
842 (with-directory-excursion "examples"
845 (let ((tester (apply open-pipe*
848 ,(string-append "./" prec
850 (input (open-input-file
851 (string-append "input_simpletest_" type))))
853 (dump-port input tester)
855 (zero? (close-pipe tester)))))
857 '("real" "real" "cmplx" "cmplx")))))
860 (lambda* (#:key outputs #:allow-other-keys)
861 (let ((out (assoc-ref outputs "out")))
862 (copy-recursively "lib" (string-append out "/lib"))
863 (copy-recursively "include" (string-append out "/include"))
864 (when (file-exists? "libseq/libmpiseq.a")
865 (copy-file "libseq/libmpiseq.a"
866 (string-append out "/lib/libmpiseq.a")))))))))
867 (home-page "http://mumps.enseeiht.fr")
868 (synopsis "Multifrontal sparse direct solver")
870 "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
871 sparse system of linear equations A x = b using Guassian elimination.")
872 (license license:cecill-c)))
874 (define-public mumps-metis
875 (package (inherit mumps)
878 (alist-delete "scotch" (package-inputs mumps)))))
880 (define-public mumps-openmpi
881 (package (inherit mumps)
882 (name "mumps-openmpi")
885 ("scalapack" ,scalapack)
886 ("pt-scotch" ,pt-scotch)
887 ,@(alist-delete "scotch" (package-inputs mumps))))
889 (substitute-keyword-arguments (package-arguments mumps)
891 `(modify-phases ,phases
895 ((assoc-ref ,phases 'check)
896 #:exec-prefix '("mpirun" "-n" "2"))))))))
897 (synopsis "Multifrontal sparse direct solver (with MPI)")))
899 (define-public mumps-metis-openmpi
900 (package (inherit mumps-openmpi)
901 (name "mumps-metis-openmpi")
903 (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
905 (define-public superlu
912 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
913 "superlu_" version ".tar.gz"))
915 (base32 "10b785s9s4x0m9q7ihap09275pq4km3k2hk76jiwdfdr5qr2168n"))))
916 (build-system gnu-build-system)
921 ("gfortran" ,gfortran)))
923 `(#:parallel-build? #f
924 #:tests? #f ;tests are run as part of `make all`
928 (lambda* (#:key inputs outputs #:allow-other-keys)
929 (call-with-output-file "make.inc"
934 SUPERLULIB = ~a/lib/libsuperlu.a
936 BLASDEF = -DUSE_VENDOR_BLAS
937 BLASLIB = -L~a/lib -lblas
938 LIBS = $(SUPERLULIB) $(BLASLIB)
944 CFLAGS = -O3 -DPRNTlevel=0 $(PIC)
951 (assoc-ref outputs "out")
952 (assoc-ref inputs "lapack")))))
954 'build 'create-install-directories
955 (lambda* (#:key outputs #:allow-other-keys)
958 (mkdir-p (string-append (assoc-ref outputs "out")
963 (lambda* (#:key outputs #:allow-other-keys)
964 ;; Library is placed in lib during the build phase. Copy over
965 ;; headers to include.
966 (let* ((out (assoc-ref outputs "out"))
967 (incdir (string-append out "/include")))
968 (for-each (lambda (file)
969 (let ((base (basename file)))
970 (format #t "installing `~a' to `~a'~%"
973 (string-append incdir "/" base))))
974 (find-files "SRC" ".*\\.h$"))))
975 %standard-phases)))))
976 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
977 (synopsis "Supernodal direct solver for sparse linear systems")
979 "SuperLU is a general purpose library for the direct solution of large,
980 sparse, nonsymmetric systems of linear equations on high performance machines.
981 The library is written in C and is callable from either C or Fortran. The
982 library routines perform an LU decomposition with partial pivoting and
983 triangular system solves through forward and back substitution. The library
984 also provides threshold-based ILU factorization preconditioners.")
985 (license license:bsd-3)))
987 (define-public superlu-dist
989 (name "superlu-dist")
994 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
995 "superlu_dist_" version ".tar.gz"))
997 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
998 (patches (list (search-patch "superlu-dist-scotchmetis.patch")))))
999 (build-system gnu-build-system)
1003 `(("gfortran" ,gfortran)))
1005 `(("openmpi" ,openmpi) ;headers include MPI heades
1006 ("lapack" ,lapack) ;required to link with output library
1007 ("pt-scotch" ,pt-scotch))) ;same
1009 `(#:parallel-build? #f ;race conditions using ar
1013 (lambda* (#:key inputs outputs #:allow-other-keys)
1014 (call-with-output-file "make.inc"
1019 DSUPERLULIB = ~a/lib/libsuperlu_dist.a
1020 BLASDEF = -DUSE_VENDOR_BLAS
1021 BLASLIB = -L~a/lib -lblas
1022 PARMETISLIB = -L~a/lib \
1023 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
1024 -lscotch -lscotcherr -lscotcherrexit
1025 METISLIB = -L~:*~a/lib \
1026 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
1027 LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
1033 CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
1034 NOOPTS = -O0 -g $(PIC)
1036 FFLAGS = -O2 -g $(PIC)
1040 (assoc-ref outputs "out")
1041 (assoc-ref inputs "lapack")
1042 (assoc-ref inputs "pt-scotch")))))
1044 'unpack 'remove-broken-symlinks
1046 (for-each delete-file
1047 (find-files "MAKE_INC" "\\.#make\\..*")))
1049 'build 'create-install-directories
1050 (lambda* (#:key outputs #:allow-other-keys)
1053 (mkdir-p (string-append (assoc-ref outputs "out")
1055 '("lib" "include")))
1059 (with-directory-excursion "EXAMPLE"
1061 (zero? (system* "mpirun" "-n" "2"
1062 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
1063 (zero? (system* "mpirun" "-n" "2"
1064 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
1067 (lambda* (#:key outputs #:allow-other-keys)
1068 ;; Library is placed in lib during the build phase. Copy over
1069 ;; headers to include.
1070 (let* ((out (assoc-ref outputs "out"))
1071 (incdir (string-append out "/include")))
1072 (for-each (lambda (file)
1073 (let ((base (basename file)))
1074 (format #t "installing `~a' to `~a'~%"
1077 (string-append incdir "/" base))))
1078 (find-files "SRC" ".*\\.h$"))))
1079 %standard-phases)))))))
1080 (home-page (package-home-page superlu))
1081 (synopsis "Parallel supernodal direct solver")
1083 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
1084 It is targeted for distributed memory parallel machines. SuperLU_DIST is
1085 implemented in ANSI C, and MPI for communications.")
1086 (license license:bsd-3)))
1088 (define-public scotch
1095 (uri (string-append "https://gforge.inria.fr/frs/download.php/34618/"
1096 "scotch_" version ".tar.gz"))
1098 (base32 "1ir088mvrqggyqdkx9qfynmiaffqbyih5qfl5mga2nrlm1qlsgzm"))
1099 (patches (list (search-patch "scotch-test-threading.patch")
1100 (search-patch "pt-scotch-build-parallelism.patch")))))
1101 (build-system gnu-build-system)
1108 (modify-phases %standard-phases
1110 'unpack 'chdir-to-src
1111 (lambda _ (chdir "src")))
1115 (call-with-output-file "Makefile.inc"
1129 CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
1130 LDFLAGS = -lz -lm -lrt -lpthread
1132 LEX = flex -Pscotchyy -olex.yy.c
1137 YACC = bison -pscotchyy -y -b y
1139 '("COMMON_FILE_COMPRESS_GZ"
1141 "COMMON_RANDOM_FIXED_SEED"
1142 ;; Prevents symbolc clashes with libesmumps
1144 ;; XXX: Causes invalid frees in superlu-dist tests
1146 ;; "SCOTCH_PTHREAD_NUMBER=2"
1147 "restrict=__restrict"))))))
1149 'build 'build-esmumps
1151 (zero? (system* "make"
1152 (format #f "-j~a" (parallel-job-count))
1156 (lambda* (#:key outputs #:allow-other-keys)
1157 (let ((out (assoc-ref outputs "out")))
1159 (zero? (system* "make"
1160 (string-append "prefix=" out)
1162 ;; esmumps files are not installed with the above
1163 (for-each (lambda (f)
1164 (copy-file f (string-append out "/include/" f)))
1165 (find-files "../include" ".*esmumps.h$"))
1166 (for-each (lambda (f)
1167 (copy-file f (string-append out "/lib/" f)))
1168 (find-files "../lib" "^lib.*esmumps.*"))))))))
1169 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
1170 (synopsis "Programs and libraries for graph algorithms")
1171 (description "SCOTCH is a set of programs and libraries which implement
1172 the static mapping and sparse matrix reordering algorithms developed within
1173 the SCOTCH project. Its purpose is to apply graph theory, with a divide and
1174 conquer approach, to scientific computing problems such as graph and mesh
1175 partitioning, static mapping, and sparse matrix ordering, in application
1176 domains ranging from structural mechanics to operating systems or
1178 ;; See LICENSE_en.txt
1179 (license license:cecill-c)))
1181 (define-public pt-scotch
1182 (package (inherit scotch)
1185 `(("openmpi" ,openmpi))) ;Headers include MPI headers
1187 (substitute-keyword-arguments (package-arguments scotch)
1188 ((#:phases scotch-phases)
1189 `(modify-phases ,scotch-phases
1194 (zero? (system* "make"
1195 (format #f "-j~a" (parallel-job-count))
1196 "ptscotch" "ptesmumps"))
1197 ;; Install the serial metis compatibility library
1198 (zero? (system* "make" "-C" "libscotchmetis" "install")))))
1201 (lambda _ (zero? (system* "make" "ptcheck"))))))))
1202 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
1204 (define-public metis
1211 (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
1212 "metis-" version ".tar.gz"))
1215 "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
1216 (build-system cmake-build-system)
1218 `(("blas" ,openblas)))
1220 `(#:tests? #f ;no tests
1221 #:configure-flags `("-DSHARED=ON"
1222 ,(string-append "-DGKLIB_PATH=" (getcwd)
1223 "/metis-" ,version "/GKlib"))))
1224 (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
1225 (synopsis "Graph partitioning and fill-reducing matrix ordering library")
1227 "METIS is a set of serial programs for partitioning graphs, partitioning
1228 finite element meshes, and producing fill-reducing orderings for sparse
1229 matrices. The algorithms implemented in METIS are based on the multilevel
1230 recursive-bisection, multilevel k-way, and multi-constraint partitioning
1232 (license license:asl2.0))) ;As of version 5.0.3
1234 (define-public p4est
1241 (uri (string-append "http://p4est.github.io/release/p4est-"
1245 "0faina2h5qsx3m2izbzaj9bbakma1krbbjmq43wrp1hcbyijflqb"))))
1246 (build-system gnu-build-system)
1248 `(("fortran" ,gfortran)
1253 `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
1254 (assoc-ref %build-inputs "blas")
1256 ,(string-append "LAPACK_LIBS=-L"
1257 (assoc-ref %build-inputs "lapack")
1259 (home-page "http://www.p4est.org")
1260 (synopsis "Adaptive mesh refinement on forests of octrees")
1262 "The p4est software library enables the dynamic management of a
1263 collection of adaptive octrees, conveniently called a forest of octrees.
1264 p4est is designed to work in parallel and scales to hundreds of thousands of
1266 (license license:gpl2+)))
1268 (define-public p4est-openmpi
1269 (package (inherit p4est)
1270 (name "p4est-openmpi")
1273 ,@(package-inputs p4est)))
1275 (substitute-keyword-arguments (package-arguments p4est)
1276 ((#:configure-flags cf)
1277 ``("--enable-mpi" ,@,cf))))
1278 (synopsis "Parallel adaptive mesh refinement on forests of octrees")))
1280 (define-public gsegrafix
1287 (uri (string-append "mirror://gnu/" name "/" name "-"
1291 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
1292 (build-system gnu-build-system)
1294 `(#:configure-flags '("LDFLAGS=-lm")))
1296 `(("libgnomecanvas" ,libgnomecanvas)
1297 ("libbonoboui" ,libbonoboui)
1298 ("libgnomeui" ,libgnomeui)
1299 ("libgnomeprintui" ,libgnomeprintui)
1302 `(("pkg-config" ,pkg-config)))
1303 (home-page "http://www.gnu.org/software/gsegrafix/")
1304 (synopsis "GNOME application to create scientific and engineering plots")
1305 (description "GSEGrafix is an application which produces high-quality graphical
1306 plots for science and engineering. Plots are specified via simple ASCII
1307 parameter files and data files and are presented in an anti-aliased GNOME
1308 canvas. The program supports rectangular two-dimensional plots, histograms,
1309 polar-axis plots and three-dimensional plots. Plots can be printed or saved
1310 to BMP, JPEG or PNG image formats.")
1311 (license license:gpl3+)))
1313 (define-public maxima
1320 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
1321 version "-source/" name "-" version ".tar.gz"))
1324 "0x1rk659sn3cq0n5c90848ilzr1gb1wf0072fl6jhkdq00qgh2s0"))
1325 (patches (list (search-patch "maxima-defsystem-mkdir.patch")))))
1326 (build-system gnu-build-system)
1329 ("gnuplot" ,gnuplot) ;for plots
1330 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
1332 `(("texinfo" ,texinfo)
1336 (list "--enable-gcl"
1337 (string-append "--with-posix-shell="
1338 (assoc-ref %build-inputs "bash")
1340 (string-append "--with-wish="
1341 (assoc-ref %build-inputs "tk")
1343 (let ((v ,(package-version tk)))
1344 (string-take v (string-index-right v #\.)))))
1345 ;; By default Maxima attempts to write temporary files to
1346 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
1347 ;; Work around that.
1348 #:make-flags (list "TMPDIR=/tmp")
1349 #:phases (alist-cons-before
1352 (chmod "src/maxima" #o555))
1353 ;; Make sure the doc and emacs files are found in the
1354 ;; standard location. Also configure maxima to find gnuplot
1355 ;; without having it on the PATH.
1357 'install 'post-install
1358 (lambda* (#:key outputs inputs #:allow-other-keys)
1359 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
1360 (out (assoc-ref outputs "out"))
1361 (datadir (string-append out "/share/maxima/" ,version)))
1362 (with-directory-excursion out
1363 (mkdir-p "share/emacs")
1364 (mkdir-p "share/doc")
1366 (string-append datadir "/emacs/")
1367 (string-append out "/share/emacs/site-lisp"))
1369 (string-append datadir "/doc/")
1370 (string-append out "/share/doc/maxima"))
1371 (with-atomic-file-replacement
1372 (string-append datadir "/share/maxima-init.lisp")
1374 (format out "~a ~s~a~%"
1375 "(setf $gnuplot_command "
1376 (string-append gnuplot "/bin/gnuplot") ")")
1377 (dump-port in out))))))
1378 %standard-phases))))
1379 (home-page "http://maxima.sourceforge.net")
1380 (synopsis "Numeric and symbolic expression manipulation")
1381 (description "Maxima is a system for the manipulation of symbolic and
1382 numerical expressions. It yields high precision numeric results by using
1383 exact fractions, arbitrary precision integers, and variable precision floating
1385 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
1386 ;; Others simply say "GNU General Public License" without stating a
1387 ;; version (which implicitly means gpl1+).
1388 ;; At least one file (src/maxima.asd) says "version 2."
1389 ;; GPLv2 only is therefore the smallest subset.
1390 (license license:gpl2)))
1392 (define-public wxmaxima
1399 (uri (string-append "mirror://sourceforge/wxmaxima/wxMaxima/"
1400 version "/" name "-" version ".tar.gz"))
1403 "1fm47ah4aw5qdjqhkz67w5fwhy8yfffa5z896crp0d3hk2bh4180"))))
1404 (build-system gnu-build-system)
1406 `(("wxwidgets" ,wxwidgets)
1407 ("maxima" ,maxima)))
1409 `(#:phases (modify-phases %standard-phases
1411 'install 'wrap-program
1412 (lambda* (#:key inputs outputs #:allow-other-keys)
1413 (wrap-program (string-append (assoc-ref outputs "out")
1416 (,(string-append (assoc-ref inputs "maxima")
1419 (home-page "https://andrejv.github.io/wxmaxima/")
1420 (synopsis "Graphical user interface for the Maxima computer algebra system")
1422 "wxMaxima is a graphical user interface for the Maxima computer algebra
1423 system. It eases the use of Maxima by making most of its commands available
1424 through a menu system and by providing input dialogs for commands that require
1425 more than one argument. It also implements its own display engine that
1426 outputs mathematical symbols directly instead of depicting them with ASCII
1429 wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
1430 text and mathematical calculations to create documents, exporting of input and
1431 output to TeX, and a browser for Maxima's manual including command index and
1432 full text searching.")
1433 (license license:gpl2+)))
1435 (define-public muparser
1443 (url "http://muparser.googlecode.com/svn/trunk/")
1447 "1d6bdbhx9zj3srwj3m7c9hvr18gnx1fx43h6d25my7q85gicpcwn"))))
1448 (build-system gnu-build-system)
1450 `(#:configure-flags '("--enable-samples=no")
1451 #:tests? #f)) ;no "check" target
1452 (home-page "http://muparser.beltoforion.de/")
1453 (synopsis "Fast parser library for mathematical expressions")
1455 "muParser is an extensible high performance math parser library. It is
1456 based on transforming an expression into a bytecode and precalculating
1457 constant parts of it.")
1458 (license license:expat)))
1460 (define-public openblas
1467 (uri (string-append "https://github.com/xianyi/OpenBLAS/tarball/v"
1469 (file-name (string-append name "-" version ".tar.gz"))
1472 "0av3pd96j8rx5i65f652xv9wqfkaqn0w4ma1gvbyz73i6j2hi9db"))))
1473 (build-system gnu-build-system)
1475 `(#:tests? #f ;no "check" target
1476 ;; DYNAMIC_ARCH is not supported on MIPS. When it is disabled,
1477 ;; OpenBLAS will tune itself to the build host, so we need to disable
1479 #:substitutable? ,(not (string-prefix? "mips" (%current-system)))
1481 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1484 ;; Build the library for all supported CPUs. This allows
1485 ;; switching CPU targets at runtime with the environment variable
1486 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
1487 ;; Unfortunately, this is not supported on MIPS.
1488 ,@(if (string-prefix? "mips" (%current-system))
1490 '("DYNAMIC_ARCH=1")))
1491 ;; no configure script
1492 #:phases (alist-delete 'configure %standard-phases)))
1494 `(("fortran" ,gfortran)))
1498 (home-page "http://www.openblas.net/")
1499 (synopsis "Optimized BLAS library based on GotoBLAS")
1501 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
1502 (license license:bsd-3)))
1504 (define-public openlibm
1511 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
1513 (file-name (string-append name "-" version ".tar.gz"))
1516 "0cwqqqlblj3kzp9aq1wnpfs1fl0qd1wp1xzm5shb09w06i4rh9nn"))))
1517 (build-system gnu-build-system)
1520 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1522 ;; no configure script
1523 (alist-delete 'configure %standard-phases)
1524 #:tests? #f)) ;the tests are part of the default target
1525 (home-page "http://openlibm.org/")
1526 (synopsis "Portable C mathematical library (libm)")
1528 "OpenLibm is an effort to have a high quality, portable, standalone C
1529 mathematical library (libm). It can be used standalone in applications and
1530 programming language implementations. The project was born out of a need to
1531 have a good libm for the Julia programming langage that worked consistently
1532 across compilers and operating systems, and in 32-bit and 64-bit
1534 ;; See LICENSE.md for details.
1535 (license (list license:expat
1538 license:public-domain
1539 license:lgpl2.1+))))
1541 (define-public openspecfun
1543 (name "openspecfun")
1548 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
1550 (file-name (string-append name "-" version ".tar.gz"))
1553 "0nsa3jjmlhcqkw5ba5ypbn3n0c8b6lc22zzlxnmxkxi9shhdx65z"))))
1554 (build-system gnu-build-system)
1556 '(#:tests? #f ;no "check" target
1558 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1559 ;; no configure script
1560 #:phases (alist-delete 'configure %standard-phases)))
1562 `(("fortran" ,gfortran)))
1563 (home-page "https://github.com/JuliaLang/openspecfun")
1564 (synopsis "Collection of special mathematical functions")
1566 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
1567 portable package for Bessel Functions of a Complex Argument and Nonnegative
1568 Order; it contains subroutines for computing Bessel functions and Airy
1569 functions. Faddeeva allows computing the various error functions of arbitrary
1570 complex arguments (Faddeeva function, error function, complementary error
1571 function, scaled complementary error function, imaginary error function, and
1572 Dawson function); given these, one can also easily compute Voigt functions,
1573 Fresnel integrals, and similar related functions as well.")
1574 ;; Faddeeva is released under the Expat license; AMOS is included as
1575 ;; public domain software.
1576 (license (list license:expat license:public-domain))))
1578 (define-public suitesparse
1580 (name "suitesparse")
1586 "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-"
1590 "100hdzr0mf4mzlwnqpmwpfw4pymgsf9n3g0ywb1yps2nk1zbkdy5"))))
1591 (build-system gnu-build-system)
1593 '(#:parallel-build? #f ;cholmod build fails otherwise
1594 #:tests? #f ;no "check" target
1599 "CHOLMOD_CONFIG=-DNPARTITION" ;required when METIS is not used
1600 (string-append "INSTALL_LIB="
1601 (assoc-ref %outputs "out") "/lib")
1602 (string-append "INSTALL_INCLUDE="
1603 (assoc-ref %outputs "out") "/include"))
1606 'install 'prepare-out
1607 ;; README.txt states that the target directories must exist prior to
1608 ;; running "make install".
1610 (mkdir-p (string-append (assoc-ref %outputs "out") "/lib"))
1611 (mkdir-p (string-append (assoc-ref %outputs "out") "/include")))
1612 ;; no configure script
1613 (alist-delete 'configure %standard-phases))))
1616 ("lapack" ,lapack)))
1617 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
1618 (synopsis "Suite of sparse matrix software")
1620 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
1621 multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
1622 multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
1623 simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
1624 CXSparse, a concise sparse Cholesky factorization package; and many other
1627 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
1629 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
1630 (license (list license:gpl2+ license:lgpl2.1+))))
1632 (define-public atlas
1638 (uri (string-append "mirror://sourceforge/math-atlas/atlas"
1639 version ".tar.bz2"))
1642 "0bqh4bdnjdyww4mcpg6kn0x7338mfqbdgysn97dzrwwb26di7ars"))))
1643 (build-system gnu-build-system)
1644 (home-page "http://math-atlas.sourceforge.net/")
1645 (inputs `(("gfortran" ,gfortran)
1646 ("lapack-tar" ,(package-source lapack))))
1647 (outputs '("out" "doc"))
1648 ;; For the moment we drop support for MIPS at it fails to compile. See
1649 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
1650 (supported-systems (delete "mips64el-linux" %supported-systems))
1652 `(#:parallel-build? #f
1653 #:parallel-tests? #f
1655 ;; ATLAS tunes itself for the machine it is built on, as explained at
1656 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
1657 ;; For this reason, we want users to build it locally instead of using
1661 #:modules ((srfi srfi-26)
1663 (guix build gnu-build-system)
1666 `(;; Generate position independent code suitable for dynamic libraries
1667 ;; and use WALL timer to get more accurate timing.
1668 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
1671 ,,(if (string-match "64" (%current-system))
1674 ;; Disable parallel build as it gives errors: atlas_pthread.h is
1675 ;; needed to compile C files before it is generated.
1676 "-Ss" "pmake" "make -j 1"
1677 ;; Probe is failing for MIPS. We therefore define the system
1678 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
1679 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
1680 ,,@(if (string-prefix? "mips" (%current-system))
1681 (list "-A" "49" "-V" "1")
1683 ;; Generate shared libraries.
1685 ;; Build a full LAPACK library.
1686 ,(string-append "--with-netlib-lapack-tarfile="
1687 (assoc-ref %build-inputs "lapack-tar")))
1690 'install 'install-doc
1691 (lambda* (#:key outputs inputs #:allow-other-keys)
1692 (let ((doc (string-append (assoc-ref outputs "doc")
1693 "/share/doc/atlas")))
1695 (fold (lambda (file previous)
1696 (and previous (zero? (system* "cp" file doc))))
1697 #t (find-files "../ATLAS/doc" ".*"))))
1700 (lambda _ (zero? (system* "make" "ptcheck")))
1701 ;; Fix files required to run configure.
1703 'configure 'fix-/bin/sh
1705 ;; Use `sh', not `/bin/sh'.
1706 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
1709 ;; Fix /bin/sh in generated make files.
1711 'configure 'fix-/bin/sh-in-generated-files
1713 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
1716 ;; ATLAS configure program does not accepts the default flags
1717 ;; passed by the 'gnu-build-system'.
1720 (lambda* (#:key native-inputs inputs outputs
1721 (configure-flags '())
1722 #:allow-other-keys #:rest args)
1723 (let* ((prefix (assoc-ref outputs "out"))
1724 (bash (or (and=> (assoc-ref
1725 (or native-inputs inputs) "bash")
1726 (cut string-append <> "/bin/bash"))
1728 (flags `(,(string-append "--prefix=" prefix)
1730 (abs-srcdir (getcwd))
1731 (srcdir (string-append "../" (basename abs-srcdir))))
1732 (format #t "source directory: ~s (relative from build: ~s)~%"
1736 (format #t "build directory: ~s~%" (getcwd))
1737 (format #t "configure flags: ~s~%" flags)
1738 (zero? (apply system* bash
1739 (string-append srcdir "/configure")
1741 %standard-phases)))))))
1742 (synopsis "Automatically Tuned Linear Algebra Software")
1744 "ATLAS is an automatically tuned linear algebra software library
1745 providing C and Fortran77 interfaces to a portably efficient BLAS
1746 implementation, as well as a few routines from LAPACK.
1748 Optimization occurs at build time. For this reason, the library is built on
1749 the machine where it is installed, without resorting to pre-built substitutes.
1751 Before building the library, CPU throttling should be disabled. This can be
1752 done in the BIOS, or, on GNU/Linux, with the following commands:
1754 cpufreq-selector -g performance -c 0
1756 cpufreq-selector -g performance -c N-1
1758 where N is the number of cores of your CPU. Failure to do so will result in a
1759 library with poor performance.")
1760 (license license:bsd-3)))
1769 (uri (string-append "mirror://sourceforge/ogl-math/glm-"
1773 "1cnjmi033a16a95v6xfkr1bvfmkd26hzdjka8j1819hgn5b1nr8l"))))
1774 (build-system cmake-build-system)
1776 `(("unzip" ,unzip)))
1777 (home-page "http://glm.g-truc.net")
1778 (synopsis "OpenGL Mathematics library")
1779 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
1780 library for graphics software based on the OpenGL Shading Language (GLSL)
1782 (license license:expat)))
1784 (define-public lpsolve
1791 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
1792 "/lp_solve_" version "_source.tar.gz"))
1795 "176c7f023mb6b8bfmv4rfqnrlw88lsg422ca74zjh19i2h5s69sq"))
1796 (modules '((guix build utils)))
1798 '(substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
1800 ;; Pretend to be on a 64 bit platform to obtain a common directory
1801 ;; name for the build results on all architectures; nothing else
1802 ;; seems to depend on it.
1803 (("^PLATFORM=.*$") "PLATFORM=ux64\n")))))
1804 (build-system gnu-build-system)
1806 `(#:tests? #f ; no check target
1808 (modify-phases %standard-phases
1812 (with-directory-excursion "lpsolve55"
1813 (system* "bash" "ccc"))
1814 (with-directory-excursion "lp_solve"
1815 (system* "bash" "ccc"))
1818 (lambda* (#:key outputs #:allow-other-keys)
1819 (let* ((out (assoc-ref outputs "out"))
1820 (bin (string-append out "/bin"))
1821 (lib (string-append out "/lib"))
1822 ;; This is where LibreOffice expects to find the header
1823 ;; files, and where they are installed by Debian.
1824 (include (string-append out "/include/lpsolve")))
1826 (copy-file "lpsolve55/bin/ux64/liblpsolve55.a"
1827 (string-append lib "/liblpsolve55.a"))
1828 (copy-file "lpsolve55/bin/ux64/liblpsolve55.so"
1829 (string-append lib "/liblpsolve55.so"))
1831 (copy-file "lp_solve/bin/ux64/lp_solve"
1832 (string-append bin "/lp_solve"))
1834 ;; Install a subset of the header files as on Debian
1835 ;; (plus lp_bit.h, which matches the regular expression).
1838 (copy-file name (string-append include "/" name)))
1839 (find-files "." "lp_[HMSa-z].*\\.h$"))
1840 (with-directory-excursion "shared"
1843 (copy-file name (string-append include "/" name)))
1844 (find-files "." "\\.h$")))
1846 (home-page "http://lpsolve.sourceforge.net/")
1847 (synopsis "Mixed integer linear programming (MILP) solver")
1849 "lp_solve is a mixed integer linear programming solver based on the
1850 revised simplex and the branch-and-bound methods.")
1851 (license license:lgpl2.1+)))
1853 (define-public dealii
1860 (uri (string-append "https://github.com/dealii/dealii/releases/"
1861 "download/v" version "/dealii-" version ".tar.gz"))
1864 "185jych0gdnpkjwxni7pd0dda149492zwq2457xdjg76bzj78mnp"))
1865 (patches (list (search-patch "dealii-p4est-interface.patch")))
1866 (modules '((guix build utils)))
1868 ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
1869 '(delete-file-recursively "bundled"))))
1870 (build-system cmake-build-system)
1878 ("arpack" ,arpack-ng)
1879 ("muparser" ,muparser)
1880 ("gfortran" ,gfortran)
1881 ("suitesparse" ,suitesparse))) ;for UMFPACK
1883 `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease
1884 #:configure-flags '("-DCOMPAT_FILES=OFF") ;Follow new directory structure
1885 #:phases (modify-phases %standard-phases
1887 'install 'hint-example-prefix
1888 ;; Set Cmake hints in examples so that they can find this
1889 ;; deal.II when configuring.
1890 (lambda* (#:key outputs #:allow-other-keys)
1891 (let* ((out (assoc-ref %outputs "out"))
1892 (exmpl (string-append out "/share/doc"
1893 "/dealii/examples")))
1894 (substitute* (find-files exmpl "CMakeLists.txt")
1895 (("([[:space:]]*HINTS.*)\n" _ line)
1896 (string-append line " $ENV{HOME}/.guix-profile "
1899 (home-page "https://www.dealii.org")
1900 (synopsis "Finite element library")
1902 "Deal.II is a C++ program library targeted at the computational solution
1903 of partial differential equations using adaptive finite elements. The main
1904 aim of deal.II is to enable rapid development of modern finite element codes,
1905 using among other aspects adaptive meshes and a wide array of tools often used
1906 in finite element programs.")
1907 (license license:lgpl2.1+)))
1909 (define-public dealii-openmpi
1910 (package (inherit dealii)
1911 (name "dealii-openmpi")
1914 ;;Supported only with MPI:
1915 ("p4est" ,p4est-openmpi)
1916 ("petsc" ,petsc-openmpi)
1917 ("slepc" ,slepc-openmpi)
1918 ("metis" ,metis) ;for MUMPS
1919 ("scalapack" ,scalapack) ;for MUMPS
1920 ("mumps" ,mumps-metis-openmpi) ;configure supports only metis orderings
1921 ("arpack" ,arpack-ng-openmpi)
1922 ,@(fold alist-delete (package-inputs dealii)
1923 '("p4est" "arpack"))))
1925 (substitute-keyword-arguments (package-arguments dealii)
1926 ((#:configure-flags cf)
1927 ``("-DMPI_C_COMPILER=mpicc"
1928 "-DMPI_CXX_COMPILER=mpicxx"
1929 "-DMPI_Fortran_COMPILER=mpifort"
1931 (synopsis "Finite element library (with MPI support)")))