1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
4 ;;; Copyright © 2014, 2016 John Darrington <jmd@gnu.org>
5 ;;; Copyright © 2014, 2015, 2016 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, 2016 Ricardo Wurmus <rekado@elephly.net>
9 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
10 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
11 ;;; Copyright © 2015, 2016 Efraim Flashner <efraim@flashner.co.il>
12 ;;; Copyright © 2015 Fabian Harfert <fhmgufs@web.de>
13 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
14 ;;; Copyright © 2016 Kei Kebreau <kei@openmailbox.org>
15 ;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
16 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
18 ;;; This file is part of GNU Guix.
20 ;;; GNU Guix is free software; you can redistribute it and/or modify it
21 ;;; under the terms of the GNU General Public License as published by
22 ;;; the Free Software Foundation; either version 3 of the License, or (at
23 ;;; your option) any later version.
25 ;;; GNU Guix is distributed in the hope that it will be useful, but
26 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
27 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 ;;; GNU General Public License for more details.
30 ;;; You should have received a copy of the GNU General Public License
31 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
33 (define-module (gnu packages maths)
34 #:use-module (ice-9 regex)
35 #:use-module (gnu packages)
36 #:use-module ((guix licenses) #:prefix license:)
37 #:use-module (guix packages)
38 #:use-module (guix download)
39 #:use-module (guix utils)
40 #:use-module (guix build utils)
41 #:use-module (guix build-system cmake)
42 #:use-module (guix build-system gnu)
43 #:use-module (guix build-system r)
44 #:use-module (gnu packages algebra)
45 #:use-module (gnu packages bison)
46 #:use-module (gnu packages boost)
47 #:use-module (gnu packages check)
48 #:use-module (gnu packages cmake)
49 #:use-module (gnu packages compression)
50 #:use-module (gnu packages curl)
51 #:use-module (gnu packages cyrus-sasl)
52 #:use-module (gnu packages documentation)
53 #:use-module (gnu packages elf)
54 #:use-module (gnu packages flex)
55 #:use-module (gnu packages fltk)
56 #:use-module (gnu packages fontutils)
57 #:use-module (gnu packages gettext)
58 #:use-module (gnu packages gcc)
59 #:use-module (gnu packages gd)
60 #:use-module (gnu packages ghostscript)
61 #:use-module (gnu packages graphviz)
62 #:use-module (gnu packages gtk)
63 #:use-module (gnu packages image)
64 #:use-module (gnu packages less)
65 #:use-module (gnu packages lisp)
66 #:use-module (gnu packages logging)
67 #:use-module (gnu packages gnome)
68 #:use-module (gnu packages guile)
69 #:use-module (gnu packages xorg)
70 #:use-module (gnu packages gl)
71 #:use-module (gnu packages m4)
72 #:use-module (gnu packages mpi)
73 #:use-module (gnu packages multiprecision)
74 #:use-module (gnu packages netpbm)
75 #:use-module (gnu packages pcre)
76 #:use-module (gnu packages popt)
77 #:use-module (gnu packages perl)
78 #:use-module (gnu packages pkg-config)
79 #:use-module (gnu packages python)
80 #:use-module (gnu packages readline)
81 #:use-module (gnu packages tbb)
82 #:use-module (gnu packages shells)
83 #:use-module (gnu packages tcl)
84 #:use-module (gnu packages texinfo)
85 #:use-module (gnu packages tex)
86 #:use-module (gnu packages tls)
87 #:use-module (gnu packages wxwidgets)
88 #:use-module (gnu packages xml)
89 #:use-module (gnu packages zip)
90 #:use-module (srfi srfi-1))
92 (define-public c-graph
98 (uri (string-append "mirror://gnu/c-graph/c-graph-" version
101 "1hlvpzrh7hzzf533diyfiabzskddi8zx92av9hwkjw3l46z7qv01"))))
102 (build-system gnu-build-system)
104 `(("fortran" ,gfortran)))
105 (synopsis "Visualizing and demonstrating convolution")
107 "GNU C-Graph is a tool for demonstrating the theory of convolution.
108 Thus, it can serve as an excellent aid to students of signal and systems
109 theory in visualizing the convolution process. Rather than forcing the
110 student to write code, the program offers an intuitive interface with
111 interactive dialogs to guide them.")
112 (license license:gpl3+)
113 (home-page "http://www.gnu.org/software/c-graph/")))
121 (uri (string-append "mirror://gnu/units/units-" version
124 "1awhjw9zjlfb8s5g3yyx63f7ddfcr1sanlbxpqifmrgq24ql198b"))))
125 (build-system gnu-build-system)
126 (synopsis "Conversion between thousands of scales")
128 "GNU Units converts numeric quantities between units of measure. It
129 can handle scale changes through adaptive usage of standard scale
130 prefixes (micro-, kilo-, etc.). It can also handle nonlinear
131 conversions such as Fahrenheit to Celsius. Its interpreter is powerful
132 enough to be used effectively as a scientific calculator.")
133 (license license:gpl3+)
134 (home-page "http://www.gnu.org/software/units/")))
136 (define-public double-conversion
138 (name "double-conversion")
143 "https://github.com/floitsch/double-conversion/archive/v"
145 (file-name (string-append name "-" version ".tar.gz"))
148 "0cnr8xhyjfxijay8ymkqcph3672wp2lj23qhdmr3m4kia5kpdf83"))))
149 (build-system cmake-build-system)
151 '(#:test-target "test"
152 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
153 "-DBUILD_TESTING=ON")))
154 (home-page "https://github.com/floitsch/double-conversion")
155 (synopsis "Conversion routines for IEEE doubles")
157 "The double-conversion library provides binary-decimal and decimal-binary
158 routines for IEEE doubles. The library consists of efficient conversion
159 routines that have been extracted from the V8 JavaScript engine.")
160 (license license:bsd-3)))
162 (define-public dionysus
168 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
172 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
173 (build-system gnu-build-system)
174 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
175 (synopsis "Local search for universal constants and scientific values")
177 "GNU Dionysus is a convenient system for quickly retrieving the values of
178 mathematical constants used in science and engineering. Values can be
179 searched using a simple command-line tool, choosing from three databases:
180 universal constants, atomic numbers, and constants related to
182 (license license:gpl3+)
183 (home-page "http://www.gnu.org/software/dionysus/")))
192 (uri (string-append "mirror://gnu/gsl/gsl-"
196 "0rhcia9jhr3p1f1wybwyllwqfs9bggz99i3mi5lpyqcpff1hdbar"))))
197 (build-system gnu-build-system)
199 `(#:parallel-tests? #f))
200 (home-page "http://www.gnu.org/software/gsl/")
201 (synopsis "Numerical library for C and C++")
203 "The GNU Scientific Library is a library for numerical analysis in C
204 and C++. It includes a wide range of mathematical routines, with over 1000
205 functions in total. Subject areas covered by the library include:
206 differential equations, linear algebra, Fast Fourier Transforms and random
208 (license license:gpl3+)))
217 (uri (string-append "mirror://gnu/glpk/glpk-"
221 "15z2ymzqhxwss6wgdj5f7vkyqlqdsjgrvm0x871kmlx0n0664mhk"))))
222 (build-system gnu-build-system)
226 `(#:configure-flags '("--with-gmp")))
227 (home-page "http://www.gnu.org/software/glpk/")
228 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
230 "GLPK is a C library for solving large-scale linear programming (LP),
231 mixed integer programming (MIP), and other related problems. It supports the
232 GNU MathProg modeling language, a subset of the AMPL language, and features a
233 translator for the language. In addition to the C library, a stand-alone
234 LP/MIP solver is included in the package.")
235 (license license:gpl3+)))
244 (uri (string-append "http://www.4ti2.de/version_" version
245 "/4ti2-" version ".tar.gz"))
248 "1frix3rnm9ffr93alqzw4cavxbfpf524l8rfbmcpyhwd3n1km0yl"))))
249 (build-system gnu-build-system)
251 `(("which" ,(@ (gnu packages base) which)))) ; for the tests
255 (home-page "http://www.4ti2.de/")
256 (synopsis "Mathematical tool suite for problems on linear spaces")
258 "4ti2 implements algorithms for solving algebraic, geometric and
259 combinatorial problems on linear spaces. Among others, it solves systems
260 of linear equations, computes extreme rays of polyhedral cones, solves
261 integer programming problems and computes Markov bases for statistics.")
262 (license license:gpl2+)))
264 (define-public cddlib
271 (uri (string-append "ftp://ftp.ifor.math.ethz.ch/pub/fukuda/cdd/cddlib-"
272 (string-delete #\. version) ".tar.gz"))
275 "1dasasscwfg793q8fwzgwf64xwj7w62yfvszpr8x8g38jka08vgy"))))
276 (build-system gnu-build-system)
279 (home-page "https://www.inf.ethz.ch/personal/fukudak/cdd_home/index.html")
280 (synopsis "Library for convex hulls and extreme rays of polyhedra")
282 "The C-library cddlib implements the Double Description Method of
283 Motzkin et al. for generating all vertices (i.e. extreme points) and extreme
284 rays of a general convex polyhedron given by a system of linear inequalities
285 in arbitrary dimension. It can also be used for the converse operation of
286 computing convex hulls.")
287 (license license:gpl2+)))
289 (define-public arpack-ng
296 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
298 (file-name (string-append name "-" version ".tar.gz"))
301 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
302 (build-system gnu-build-system)
303 (home-page "https://github.com/opencollab/arpack-ng")
306 ("fortran" ,gfortran)))
307 (synopsis "Fortran subroutines for solving eigenvalue problems")
309 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
310 large scale eigenvalue problems.")
311 (license (license:non-copyleft "file://COPYING"
312 "See COPYING in the distribution."))))
314 (define-public arpack-ng-openmpi
315 (package (inherit arpack-ng)
316 (name "arpack-ng-openmpi")
319 ,@(package-inputs arpack-ng)))
320 (arguments `(#:configure-flags '("--enable-mpi")))
321 (synopsis "Fortran subroutines for solving eigenvalue problems with MPI")))
323 (define-public lapack
330 (uri (string-append "http://www.netlib.org/lapack/lapack-"
334 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
335 (build-system cmake-build-system)
336 (home-page "http://www.netlib.org/lapack/")
337 (inputs `(("fortran" ,gfortran)
338 ("python" ,python-2)))
340 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES"
342 #:phases (alist-cons-before
344 (lambda* (#:key inputs #:allow-other-keys)
345 (let ((python (assoc-ref inputs "python")))
346 (substitute* "lapack_testing.py"
347 (("/usr/bin/env python") python))))
349 (synopsis "Library for numerical linear algebra")
351 "LAPACK is a Fortran 90 library for solving the most commonly occurring
352 problems in numerical linear algebra.")
353 (license (license:non-copyleft "file://LICENSE"
354 "See LICENSE in the distribution."))))
356 (define-public scalapack
363 (uri (string-append "http://www.netlib.org/scalapack/scalapack-"
367 "0p1r61ss1fq0bs8ynnx7xq4wwsdvs32ljvwjnx6yxr8gd6pawx0c"))))
368 (build-system cmake-build-system)
371 ("fortran" ,gfortran)
372 ("lapack" ,lapack))) ;for testing only
374 `(#:configure-flags `("-DBUILD_SHARED_LIBS:BOOL=YES")))
375 (home-page "http://www.netlib.org/scalapack/")
376 (synopsis "Library for scalable numerical linear algebra")
378 "ScaLAPACK is a Fortran 90 library of high-performance linear algebra
379 routines on parallel distributed memory machines. ScaLAPACK solves dense and
380 banded linear systems, least squares problems, eigenvalue problems, and
381 singular value problems.")
382 (license (license:bsd-style "file://LICENSE"
383 "See LICENSE in the distribution."))))
385 (define-public gnuplot
386 ;; Gnuplot version 5.0.4 was updated in-place, resulting in a hash mismatch.
387 ;; This can be removed at the next version update.
388 (let ((upstream-version "5.0.4")
392 (version (string-append upstream-version "-" guix-revision))
396 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
397 upstream-version "/gnuplot-"
398 upstream-version ".tar.gz"))
401 "07n3w12dkcxjnhsvsliaqnkhajhi818v6q8mkpmpbplbf92vh70m"))))
402 (build-system gnu-build-system)
403 (inputs `(("readline" ,readline)
407 (native-inputs `(("pkg-config" ,pkg-config)
408 ("texlive" ,texlive-minimal)))
409 (home-page "http://www.gnuplot.info")
410 (synopsis "Command-line driven graphing utility")
411 (description "Gnuplot is a portable command-line driven graphing
412 utility. It was originally created to allow scientists and students to
413 visualize mathematical functions and data interactively, but has grown to
414 support many non-interactive uses such as web scripting. It is also used as a
415 plotting engine by third-party applications like Octave.")
416 ;; X11 Style with the additional restriction that derived works may only be
417 ;; distributed as patches to the original.
418 (license (license:fsf-free
419 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright")))))
428 (uri (string-append "https://github.com/OkoSanto/GCTP/archive/v"
430 (file-name (string-append name "-" version ".tar.gz"))
433 "0l9aqnqynh9laicn5dxf3rsb1n14xiks79wbyqccirzmjqd1c1x4"))))
435 `(("fortran" ,gfortran)))
436 (build-system gnu-build-system)
437 (synopsis "General Cartographic Transformation Package (GCTP)")
439 "The General Cartographic Transformation Package (GCTP) is a system of
440 software routines designed to permit the transformation of coordinate pairs
441 from one map projection to another. The GCTP is the standard computer
442 software used by the National Mapping Division for map projection
444 (home-page "https://github.com/OkoSanto/GCTP")
445 (license license:public-domain))) ;https://www2.usgs.gov/laws/info_policies.html
454 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-"
458 (base32 "0sj8x0gfs5fb28gipnynb9wpkz113h8wq9sva9mxx66kv27xsdgw"))
459 (patches (list (search-patch "hdf5-config-date.patch")))))
460 (build-system gnu-build-system)
465 (modify-phases %standard-phases
466 (add-before 'configure 'patch-configure
468 (substitute* "configure"
471 (add-after 'install 'patch-references
472 (lambda* (#:key inputs outputs #:allow-other-keys)
473 (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
474 (zlib (assoc-ref inputs "zlib")))
475 (substitute* (find-files bin "h5p?cc")
477 (string-append "-L" zlib "/lib " lib)))
479 (home-page "http://www.hdfgroup.org")
480 (synopsis "Management suite for extremely large and complex data")
481 (description "HDF5 is a suite that makes possible the management of
482 extremely large and complex data collections.")
483 (license (license:x11-style
484 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
486 (define-public hdf5-parallel-openmpi
487 (package (inherit hdf5)
488 (name "hdf5-parallel-openmpi")
491 ,@(package-inputs hdf5)))
493 (substitute-keyword-arguments `(#:configure-flags '("--enable-parallel")
494 ,@(package-arguments hdf5))
496 `(modify-phases ,phases
497 (add-before 'check 'patch-tests
499 ;; OpenMPI's mpirun will exit with non-zero status if it
500 ;; detects an "abnormal termination", i.e. any process not
501 ;; calling MPI_Finalize(). Since the test is explicitely
502 ;; avoiding MPI_Finalize so as not to have at_exit and thus
503 ;; H5C_flush_cache from being called, mpirun will always
504 ;; complain, so turn this test off.
505 (substitute* "testpar/Makefile"
506 (("(^TEST_PROG_PARA.*)t_pflush1(.*)" front back)
507 (string-append front back "\n")))
508 (substitute* "tools/h5diff/testph5diff.sh"
509 (("/bin/sh") (which "sh")))
511 (synopsis "Management suite for data with parallel IO support")))
513 (define-public h5check
520 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/tools/"
521 "h5check/src/h5check-" version ".tar.gz"))
524 "1gm76jbwhz9adbxgn14zx8cj33dmjdr2g5xcy0m9c2gakp8w59kj"))))
525 (build-system gnu-build-system)
526 (inputs `(("hdf5" ,hdf5))) ;h5cc for tests
527 (home-page "https://www.hdfgroup.org/products/hdf5_tools/h5check.html")
528 (synopsis "HDF5 format checker")
529 (description "@code{h5check} is a validation tool for verifying that an
530 HDF5 file is encoded according to the HDF File Format Specification.")
531 (license (license:x11-style "file://COPYING"))))
533 (define-public netcdf
540 (uri (string-append "ftp://ftp.unidata.ucar.edu/pub/netcdf/"
541 "netcdf-" version ".tar.gz"))
544 "0y6gdcplarwqqnrav2xg1xd6ih732rzzbmdw78v3rl5b8mwcnh0d"))
545 (patches (list (search-patch "netcdf-config-date.patch")))))
546 (build-system gnu-build-system)
550 ("graphviz" ,graphviz)))
555 `(#:configure-flags '("--enable-doxygen" "--enable-dot")
556 #:parallel-tests? #f)) ;various race conditions
557 (home-page "http://www.unidata.ucar.edu/software/netcdf/")
558 (synopsis "Library for scientific data")
559 (description "NetCDF is an interface for scientific data access and a
560 software library that provides an implementation of the interface. The netCDF
561 library defines a machine-independent format for representing scientific data.
562 Together, the interface, library, and format support the creation, access, and
563 sharing of scientific data.")
564 (license (license:x11-style "file://COPYRIGHT"))))
566 (define-public netcdf-parallel-openmpi
567 (package (inherit netcdf)
568 (name "netcdf-parallel-openmpi")
571 ,@(alist-replace "hdf5" (list hdf5-parallel-openmpi)
572 (package-inputs netcdf))))
573 ;; TODO: Replace pkg-config references in nc-config with absolute references
575 (substitute-keyword-arguments (package-arguments netcdf)
576 ((#:configure-flags flags)
577 `(cons* "CC=mpicc" "CXX=mpicxx"
578 "--enable-parallel-tests"
579 ;; Shared libraries not supported with parallel IO.
580 "--disable-shared" "--with-pic"
589 (uri (string-append "http://ab-initio.mit.edu/nlopt/nlopt-"
592 (base32 "12cfkkhcdf4zmb6h7y6qvvdvqjs2xf9sjpa3rl3bq76px4yn76c0"))))
593 (build-system gnu-build-system)
595 `(;; Shared libraries are not built by default. They are required to
596 ;; build the Guile, Octave, and Python bindings.
597 #:configure-flags '("--enable-shared")
600 (modify-phases %standard-phases
601 (add-before 'configure 'set-libnlopt-file-name
602 (lambda* (#:key outputs #:allow-other-keys)
603 ;; Make sure the Scheme module refers to the library by its
604 ;; absolute file name (we cannot do that from a snippet
605 ;; because the expansion of @libdir@ contains
607 (let ((out (assoc-ref outputs "out")))
608 (substitute* "swig/nlopt.scm.in"
610 (string-append out "/lib/libnlopt")))
612 (inputs `(("guile" ,guile-2.0)))
613 (native-inputs `(("pkg-config" ,pkg-config)))
614 (home-page "http://ab-initio.mit.edu/wiki/")
615 (synopsis "Library for nonlinear optimization")
616 (description "NLopt is a library for nonlinear optimization, providing a
617 common interface for a number of different free optimization routines available
618 online as well as original implementations of various other algorithms.")
619 (license license:lgpl2.1+)))
628 "http://www.coin-or.org/download/source/Ipopt/Ipopt-"
632 "09bk2hqy2vgi4yi76xng9zxakddwqy3wij9nx7wf2vfbxxpazrsk"))
633 (modules '((guix build utils)))
635 ;; Make sure we don't use the bundled software.
636 '(delete-file-recursively "ThirdParty"))))
637 (build-system gnu-build-system)
639 '(#:phases (modify-phases %standard-phases
640 (add-after 'install 'add--L-flags-in-ipopt.pc
641 (lambda* (#:key inputs outputs #:allow-other-keys)
642 ;; The '.pc' file lists '-llapack -lblas' in "Libs";
643 ;; move it to "Libs.private" where it belongs, and add a
644 ;; '-L' flag for LAPACK.
645 (let ((out (assoc-ref outputs "out"))
646 (lapack (assoc-ref inputs "lapack")))
647 (substitute* (string-append out "/lib/pkgconfig/"
649 (("Libs: (.*)-llapack -lblas(.*)$" _ before after)
650 (string-append "Libs: " before " " after "\n"
651 "Libs.private: " before
652 "-L" lapack "/lib -llapack -lblas "
656 `(("gfortran" ,gfortran)))
658 ;; TODO: Maybe add dependency on COIN-MUMPS, ASL, and HSL.
659 `(("lapack" ,lapack))) ;for both libblas and liblapack
660 (home-page "http://www.coin-or.org")
661 (synopsis "Large-scale nonlinear optimizer")
663 "The Interior Point Optimizer (IPOPT) is a software package for
664 large-scale nonlinear optimization. It provides C++, C, and Fortran
666 (license license:epl1.0)))
670 (name "ceres-solver")
672 (home-page "http://ceres-solver.org/")
675 (uri (string-append home-page "ceres-solver-"
679 "0i7qkbf8g6pd8arxzldppga26ckv93y8zldsfz6wbd4n6b1nqrjd"))))
680 (build-system cmake-build-system)
682 ;; TODO: Build HTML user documentation and install separately.
683 '(#:configure-flags '("-DBUILD_EXAMPLES=OFF"
684 "-DBUILD_SHARED_LIBS=ON")
686 #:phases (modify-phases %standard-phases
687 (add-before 'configure 'set-library-directory
689 ;; Install libraries to lib/, not lib64/.
690 (substitute* "internal/ceres/CMakeLists.txt"
691 (("set\\(LIB_SUFFIX \"64\"\\)")
692 "set(LIB_SUFFIX \"\")"))
695 `(("pkg-config" ,pkg-config)))
697 `(("glog" ,glog))) ;for #include <glog/glog.h>
702 ("suitesparse" ,suitesparse)
704 (synopsis "C++ library for solving large optimization problems")
706 "Ceres Solver is a C++ library for modeling and solving large,
707 complicated optimization problems. It is a feature rich, mature and
708 performant library which has been used in production since 2010. Ceres Solver
709 can solve two kinds of problems:
711 @item non-linear least squares problems with bounds constraints;
712 @item general unconstrained optimization problems.
714 (license license:bsd-3)))
716 ;; For a fully featured Octave, users are strongly recommended also to install
717 ;; the following packages: texinfo, less, ghostscript, gnuplot.
718 (define-public octave
725 (uri (string-append "mirror://gnu/octave/octave-"
729 "11day29k4yfvxh4101x5yf26ld992x5n6qvmhjjk6mzsd26fqayw"))))
730 (build-system gnu-build-system)
733 ("readline" ,readline)
737 ("arpack" ,arpack-ng)
740 ("fontconfig" ,fontconfig)
741 ("freetype" ,freetype)
748 `(("gfortran" ,gfortran)
749 ("pkg-config" ,pkg-config)
751 ;; The following inputs are not actually used in the build process.
752 ;; However, the ./configure gratuitously tests for their existence and
753 ;; assumes that programs not present at build time are also not, and
754 ;; can never be, available at run time! If these inputs are therefore
755 ;; not present, support for them will be built out. However, Octave
756 ;; will still run without them, albeit without the features they
760 ("ghostscript" ,ghostscript)
761 ("gnuplot" ,gnuplot)))
764 (list (string-append "--with-shell="
765 (assoc-ref %build-inputs "bash")
767 (home-page "http://www.gnu.org/software/octave/")
768 (synopsis "High-level language for numerical computation")
769 (description "GNU Octave is a high-level interpreted language that is
770 specialized for numerical computations. It can be used for both linear and
771 non-linear applications and it provides great support for visualizing results.
772 Work may be performed both at the interactive command-line as well as via
774 (license license:gpl3+)))
783 (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
784 version "-source.tgz"))
786 (base32 "1ilplibvjgf7a905grpnclrvkmqy9fgrpl7xyp3w4yl1qc682v9b"))
787 (modules '((guix build utils)))
789 ;; Remove non-free METIS code
790 '(delete-file-recursively "contrib/Metis"))))
791 (build-system cmake-build-system)
794 ("gfortran" ,gfortran)
801 ("libxext" ,libxext)))
803 `(("fontconfig" ,fontconfig)
806 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
807 "-DENABLE_BUILD_SHARED:BOOL=ON"
808 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")
809 #:phases (modify-phases %standard-phases
813 (zero? (system* "make" "test"
814 ;; Disable this test. See
815 ;; https://geuz.org/trac/gmsh/ticket/271
816 "ARGS=-E component8_in_a_box")))))))
817 (home-page "http://www.geuz.org/gmsh/")
818 (synopsis "3D finite element grid generator")
819 (description "Gmsh is a 3D finite element grid generator with a built-in
820 CAD engine and post-processor. Its design goal is to provide a fast, light
821 and user-friendly meshing tool with parametric input and advanced
822 visualization capabilities. Gmsh is built around four modules: geometry,
823 mesh, solver and post-processing. The specification of any input to these
824 modules is done either interactively using the graphical user interface or in
825 ASCII text files using Gmsh's own scripting language.")
826 (license license:gpl2+)))
835 ;; The *-lite-* tarball does not contain the *large* documentation
836 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
837 "petsc-lite-" version ".tar.gz"))
839 (base32 "0jfrq6rd4zagw1iimz05m2w91k0jvz3qbik1lk8pqcxw3rvdqk5d"))))
840 (build-system gnu-build-system)
842 `(("python" ,python-2)
845 `(("gfortran" ,gfortran)
848 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
849 ;; leaving out opengl, as configuration seems to only be for mac
852 `(#:test-target "test"
853 #:parallel-build? #f ;build is parallel by default
858 ,(string-append "--with-superlu-include="
859 (assoc-ref %build-inputs "superlu") "/include")
860 ,(string-append "--with-superlu-lib="
861 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
863 (modify-phases %standard-phases
865 ;; PETSc's configure script is actually a python script, so we can't
867 (lambda* (#:key outputs (configure-flags '())
869 (let* ((prefix (assoc-ref outputs "out"))
870 (flags `(,(string-append "--prefix=" prefix)
872 (format #t "build directory: ~s~%" (getcwd))
873 (format #t "configure flags: ~s~%" flags)
874 (zero? (apply system* "./configure" flags)))))
875 (add-after 'configure 'clean-local-references
876 (lambda* (#:key inputs outputs #:allow-other-keys)
877 (let ((out (assoc-ref outputs "out")))
878 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
879 ;; Prevent build directory from leaking into compiled code
881 ;; Scrub timestamp for reproducibility
882 ((".*Libraries compiled on.*") ""))
884 (add-after 'install 'clean-install
885 ;; Try to keep installed files from leaking build directory names.
886 (lambda* (#:key inputs outputs #:allow-other-keys)
887 (let ((out (assoc-ref outputs "out")))
888 (substitute* (map (lambda (file)
889 (string-append out "/lib/petsc/conf/" file))
892 ;; Make compiler references point to the store
893 (substitute* (string-append out "/lib/petsc/conf/petscvariables")
894 (("= (gcc|g\\+\\+|gfortran)" _ compiler)
895 (string-append "= " (which compiler))))
896 ;; PETSc installs some build logs, which aren't necessary.
897 (for-each (lambda (file)
898 (let ((f (string-append out "/lib/petsc/conf/" file)))
899 (when (file-exists? f)
901 '("configure.log" "make.log" "gmake.log"
902 "test.log" "error.log" "RDict.db"
903 "PETScBuildInternal.cmake"
904 ;; Once installed, should uninstall with Guix
907 (home-page "http://www.mcs.anl.gov/petsc")
908 (synopsis "Library to solve PDEs")
909 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
910 data structures and routines for the scalable (parallel) solution of
911 scientific applications modeled by partial differential equations.")
912 (license (license:non-copyleft
913 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
915 (define-public petsc-complex
916 (package (inherit petsc)
917 (name "petsc-complex")
919 (substitute-keyword-arguments (package-arguments petsc)
920 ((#:configure-flags cf)
921 `(cons "--with-scalar-type=complex" ,cf))))
922 (synopsis "Library to solve PDEs (with complex scalars)")))
924 (define-public petsc-openmpi
925 (package (inherit petsc)
926 (name "petsc-openmpi")
928 `(("openmpi" ,openmpi)
929 ,@(package-inputs petsc)))
931 (substitute-keyword-arguments (package-arguments petsc)
932 ((#:configure-flags cf)
933 ``("--with-mpiexec=mpirun"
934 ,(string-append "--with-mpi-dir="
935 (assoc-ref %build-inputs "openmpi"))
936 ,@(delete "--with-mpi=0" ,cf)))))
937 (synopsis "Library to solve PDEs (with MPI support)")))
939 (define-public petsc-complex-openmpi
940 (package (inherit petsc-complex)
941 (name "petsc-complex-openmpi")
943 `(("openmpi" ,openmpi)
944 ,@(package-inputs petsc-complex)))
946 (substitute-keyword-arguments (package-arguments petsc-complex)
947 ((#:configure-flags cf)
948 ``("--with-mpiexec=mpirun"
949 ,(string-append "--with-mpi-dir="
950 (assoc-ref %build-inputs "openmpi"))
951 ,@(delete "--with-mpi=0" ,cf)))))
952 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
961 (uri (string-append "http://slepc.upv.es/download/download.php?"
962 "filename=slepc-" version ".tar.gz"))
963 (file-name (string-append name "-" version ".tar.gz"))
966 "1hijlmrvxvfqslnx8yydzw5xqbsn1yy02g32w0hln1z3cgr1c0k7"))))
967 (build-system gnu-build-system)
969 `(("python" ,python-2)))
971 `(("arpack" ,arpack-ng)
972 ("gfortran" ,gfortran)))
976 `(#:parallel-build? #f ;build is parallel by default
978 `(,(string-append "--with-arpack-dir="
979 (assoc-ref %build-inputs "arpack") "/lib"))
981 (modify-phases %standard-phases
983 ;; configure is a python script, so we can't run it with bash.
984 (lambda* (#:key inputs outputs (configure-flags '())
986 (let* ((prefix (assoc-ref outputs "out"))
987 (flags `(,(string-append "--prefix=" prefix)
989 (format #t "build directory: ~s~%" (getcwd))
990 (format #t "configure flags: ~s~%" flags)
991 (setenv "SLEPC_DIR" (getcwd))
992 (setenv "PETSC_DIR" (assoc-ref inputs "petsc"))
993 (zero? (apply system* "./configure" flags)))))
994 (add-after 'install 'delete-doc
995 ;; TODO: SLEPc installs HTML documentation alongside headers in
996 ;; $out/include. We'd like to move them to share/doc, but delete
997 ;; them for now, as they are incomplete and installing the complete
998 ;; documentation is difficult.
999 (lambda* (#:key outputs #:allow-other-keys)
1000 (let* ((out (assoc-ref outputs "out")))
1001 (for-each delete-file (find-files out "\\.html$")))))
1002 (add-after 'install 'clean-install
1003 ;; Clean up unnecessary build logs from installation.
1004 (lambda* (#:key outputs #:allow-other-keys)
1005 (let ((out (assoc-ref outputs "out")))
1006 (for-each (lambda (file)
1007 (let ((f (string-append out "/lib/slepc/conf/" file)))
1008 (when (file-exists? f)
1010 '("configure.log" "make.log" "gmake.log"
1011 "test.log" "error.log" "RDict.db"
1012 "uninstall.py"))))))))
1013 (home-page "http://slepc.upv.es")
1014 (synopsis "Scalable library for eigenproblems")
1015 (description "SLEPc is a software library for the solution of large sparse
1016 eigenproblems on parallel computers. It can be used for the solution of
1017 linear eigenvalue problems formulated in either standard or generalized form,
1018 as well as other related problems such as the singular value decomposition.
1019 The emphasis of the software is on methods and techniques appropriate for
1020 problems in which the associated matrices are sparse, for example, those
1021 arising after the discretization of partial differential equations.")
1022 (license license:lgpl3)))
1024 (define-public slepc-complex
1025 (package (inherit slepc)
1026 (name "slepc-complex")
1028 `(("petsc" ,petsc-complex)
1029 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
1030 (synopsis "Scalable library for eigenproblems (with complex scalars)")))
1032 (define-public slepc-openmpi
1033 (package (inherit slepc)
1034 (name "slepc-openmpi")
1037 ("arpack" ,arpack-ng-openmpi)
1038 ,@(alist-delete "arpack" (package-inputs slepc))))
1040 `(("petsc" ,petsc-openmpi)
1041 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
1042 (synopsis "Scalable library for eigenproblems (with MPI support)")))
1044 (define-public slepc-complex-openmpi
1045 (package (inherit slepc-openmpi)
1046 (name "slepc-complex-openmpi")
1048 `(("petsc" ,petsc-complex-openmpi)
1049 ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
1050 (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
1052 (define-public mumps
1059 (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
1063 "1820jfp3mbl7n85765v5mp6p0gzqpgr4d2lrnhwj4gl7cwp5ndah"))
1064 (patches (search-patches "mumps-build-parallelism.patch"))))
1065 (build-system gnu-build-system)
1067 `(("fortran" ,gfortran)
1068 ;; These are required for linking against mumps, but we let the user
1069 ;; declare the dependency.
1072 ("scotch" ,scotch)))
1074 `(#:modules ((ice-9 match)
1077 ,@%gnu-build-system-modules)
1079 (modify-phases %standard-phases
1082 (lambda* (#:key inputs #:allow-other-keys)
1083 (call-with-output-file "Makefile.inc"
1094 INCSEQ = -I$(topdir)/libseq
1095 LIBSEQ = -L$(topdir)/libseq -lmpiseq
1096 LIBSEQNEEDED = libseqneeded~;
1100 AR = ar vr # rules require trailing space, ugh...
1102 LIBBLAS = -L~a -lopenblas~@[
1103 SCALAP = -L~a -lscalapack~]
1104 LIBOTHERS = -pthread
1107 OPTF = -O2 -DALLOW_NON_INIT $(PIC)
1111 LIBS = $(SCALAP) $(LIBSEQ)
1112 LPORDDIR = $(topdir)/PORD/lib
1113 IPORD = -I$(topdir)/PORD/include
1114 LPORD = -L$(LPORDDIR) -lpord
1115 ORDERINGSF = -Dpord~@[
1117 IMETIS = -I$(METISDIR)/include
1118 LMETIS = -L$(METISDIR)/lib -lmetis
1119 ORDERINGSF += -Dmetis~]~@[~:{
1121 ISCOTCH = -I$(SCOTCHDIR)/include
1122 LSCOTCH = -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
1123 ORDERINGSF += ~a~}~]
1124 ORDERINGSC = $(ORDERINGSF)
1125 LORDERINGS = $(LPORD) $(LMETIS) $(LSCOTCH)
1126 IORDERINGSF = $(ISCOTCH)
1127 IORDERINGSC = $(IPORD) $(IMETIS) $(ISCOTCH)"
1128 (assoc-ref inputs "mpi")
1129 (assoc-ref inputs "blas")
1130 (assoc-ref inputs "scalapack")
1131 (assoc-ref inputs "metis")
1132 (match (list (assoc-ref inputs "pt-scotch")
1133 (assoc-ref inputs "scotch"))
1137 `((,scotch "" "-Dscotch")))
1140 "-lptesmumps -lptscotch -lptscotcherr "
1141 "-Dptscotch")))))))))
1144 ;; By default only the d-precision library is built. Make with "all"
1145 ;; target so that all precision libraries and examples are built.
1147 (zero? (system* "make" "all"
1148 (format #f "-j~a" (parallel-job-count))))))
1151 ;; Run the simple test drivers, which read test input from stdin:
1152 ;; from the "real" input for the single- and double-precision
1153 ;; testers, and from the "cmplx" input for complex-precision
1154 ;; testers. The EXEC-PREFIX key is used by the mumps-openmpi
1155 ;; package to prefix execution with "mpirun".
1156 (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
1157 (with-directory-excursion "examples"
1160 (let ((tester (apply open-pipe*
1163 ,(string-append "./" prec
1165 (input (open-input-file
1166 (string-append "input_simpletest_" type))))
1168 (dump-port input tester)
1170 (zero? (close-pipe tester)))))
1172 '("real" "real" "cmplx" "cmplx")))))
1175 (lambda* (#:key outputs #:allow-other-keys)
1176 (let ((out (assoc-ref outputs "out")))
1177 (copy-recursively "lib" (string-append out "/lib"))
1178 (copy-recursively "include" (string-append out "/include"))
1179 (when (file-exists? "libseq/libmpiseq.a")
1180 (copy-file "libseq/libmpiseq.a"
1181 (string-append out "/lib/libmpiseq.a")))))))))
1182 (home-page "http://mumps.enseeiht.fr")
1183 (synopsis "Multifrontal sparse direct solver")
1185 "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
1186 sparse system of linear equations A x = b using Guassian elimination.")
1187 (license license:cecill-c)))
1189 (define-public mumps-metis
1190 (package (inherit mumps)
1191 (name "mumps-metis")
1193 (alist-delete "scotch" (package-inputs mumps)))))
1195 (define-public mumps-openmpi
1196 (package (inherit mumps)
1197 (name "mumps-openmpi")
1200 ("scalapack" ,scalapack)
1201 ("pt-scotch" ,pt-scotch)
1202 ,@(alist-delete "scotch" (package-inputs mumps))))
1204 (substitute-keyword-arguments (package-arguments mumps)
1206 `(modify-phases ,phases
1210 ((assoc-ref ,phases 'check)
1211 #:exec-prefix '("mpirun" "-n" "2"))))))))
1212 (synopsis "Multifrontal sparse direct solver (with MPI)")))
1214 (define-public mumps-metis-openmpi
1215 (package (inherit mumps-openmpi)
1216 (name "mumps-metis-openmpi")
1218 (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
1220 (define-public r-quadprog
1227 (uri (cran-uri "quadprog" version))
1230 "0jg3r6abmhp8r9vkbhpx9ldjfw6vyl1m4c5vwlyjhk1mi03656fr"))))
1231 (build-system r-build-system)
1233 `(("gfortran" ,gfortran)))
1234 (home-page "http://cran.r-project.org/web/packages/quadprog")
1235 (synopsis "Functions to solve quadratic programming problems")
1237 "This package contains routines and documentation for solving quadratic
1238 programming problems.")
1239 (license license:gpl3+)))
1241 (define-public r-pracma
1247 (uri (cran-uri "pracma" version))
1249 (base32 "19nr2jlkbcdgvw3gx5hry12av565lmvqd5q4h7zlch3q13avwwl2"))))
1250 (build-system r-build-system)
1252 `(("r-quadprog" ,r-quadprog)))
1253 (home-page "http://cran.r-project.org/web/packages/pracma")
1254 (synopsis "Practical numerical math functions")
1255 (description "This package provides functions for numerical analysis and
1256 linear algebra, numerical optimization, differential equations, plus some
1257 special functions. It uses Matlab function names where appropriate to simplify
1259 (license license:gpl3+)))
1261 (define-public superlu
1268 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
1269 "superlu_" version ".tar.gz"))
1271 (base32 "0qzlb7cd608q62kyppd0a8c65l03vrwqql6gsm465rky23b6dyr8"))
1272 (modules '((guix build utils)))
1274 ;; Replace the non-free implementation of MC64 with a stub adapted
1277 (use-modules (ice-9 regex)
1279 (call-with-output-file "SRC/mc64ad.c"
1284 void mc64id_(int *a) {
1285 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
1288 void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
1289 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
1290 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
1293 ;; Remove the corresponding license verbiage. MC64 license follows
1294 ;; a "------" line separator.
1295 (with-atomic-file-replacement "License.txt"
1296 (let ((rx (make-regexp "-{8}")))
1299 (let ((line (read-line in 'concat)))
1300 (unless (regexp-exec rx line)
1303 (build-system cmake-build-system)
1307 `(("blas" ,openblas)
1308 ("gfortran" ,gfortran)))
1310 `(#:configure-flags '("-Denable_blaslib:BOOL=NO" ;do not use internal cblas
1311 "-DTPL_BLAS_LIBRARIES=openblas"
1312 "-DBUILD_SHARED_LIBS:BOOL=YES"
1313 "-DCMAKE_INSTALL_LIBDIR=lib")))
1314 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
1315 (synopsis "Supernodal direct solver for sparse linear systems")
1317 "SuperLU is a general purpose library for the direct solution of large,
1318 sparse, nonsymmetric systems of linear equations on high performance machines.
1319 The library is written in C and is callable from either C or Fortran. The
1320 library routines perform an LU decomposition with partial pivoting and
1321 triangular system solves through forward and back substitution. The library
1322 also provides threshold-based ILU factorization preconditioners.")
1323 (license (list license:bsd-3
1324 license:gpl2+ ;EXAMPLE/*fgmr.c
1325 (license:fsf-free "file://SRC/colamd.h")))))
1327 (define-public superlu-dist
1329 (name "superlu-dist")
1334 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
1335 "superlu_dist_" version ".tar.gz"))
1337 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
1338 (modules '((guix build utils)))
1340 ;; Replace the non-free implementation of MC64 with a stub
1342 (use-modules (ice-9 regex)
1344 (call-with-output-file "SRC/mc64ad.c"
1349 void mc64id_(int *a) {
1350 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
1353 void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
1354 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
1355 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
1358 (delete-file "SRC/mc64ad.f.bak")
1359 (substitute* "SRC/util.c" ;adjust default algorithm
1360 (("RowPerm[[:blank:]]*=[[:blank:]]*LargeDiag")
1361 "RowPerm = NOROWPERM"))))
1362 (patches (search-patches "superlu-dist-scotchmetis.patch"))))
1363 (build-system gnu-build-system)
1367 `(("gfortran" ,gfortran)))
1369 `(("openmpi" ,openmpi) ;headers include MPI heades
1370 ("lapack" ,lapack) ;required to link with output library
1371 ("pt-scotch" ,pt-scotch))) ;same
1373 `(#:parallel-build? #f ;race conditions using ar
1377 (lambda* (#:key inputs outputs #:allow-other-keys)
1378 (call-with-output-file "make.inc"
1383 DSUPERLULIB = ~a/lib/libsuperlu_dist.a
1384 BLASDEF = -DUSE_VENDOR_BLAS
1385 BLASLIB = -L~a/lib -lblas
1386 PARMETISLIB = -L~a/lib \
1387 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
1388 -lscotch -lscotcherr -lscotcherrexit
1389 METISLIB = -L~:*~a/lib \
1390 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
1391 LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
1397 CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
1398 NOOPTS = -O0 -g $(PIC)
1400 FFLAGS = -O2 -g $(PIC)
1404 (assoc-ref outputs "out")
1405 (assoc-ref inputs "lapack")
1406 (assoc-ref inputs "pt-scotch")))))
1408 'unpack 'remove-broken-symlinks
1410 (for-each delete-file
1411 (find-files "MAKE_INC" "\\.#make\\..*")))
1413 'build 'create-install-directories
1414 (lambda* (#:key outputs #:allow-other-keys)
1417 (mkdir-p (string-append (assoc-ref outputs "out")
1419 '("lib" "include")))
1423 (with-directory-excursion "EXAMPLE"
1425 (zero? (system* "mpirun" "-n" "2"
1426 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
1427 (zero? (system* "mpirun" "-n" "2"
1428 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
1431 (lambda* (#:key outputs #:allow-other-keys)
1432 ;; Library is placed in lib during the build phase. Copy over
1433 ;; headers to include.
1434 (let* ((out (assoc-ref outputs "out"))
1435 (incdir (string-append out "/include")))
1436 (for-each (lambda (file)
1437 (let ((base (basename file)))
1438 (format #t "installing `~a' to `~a'~%"
1441 (string-append incdir "/" base))))
1442 (find-files "SRC" ".*\\.h$"))))
1443 %standard-phases)))))))
1444 (home-page (package-home-page superlu))
1445 (synopsis "Parallel supernodal direct solver")
1447 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
1448 It is targeted for distributed memory parallel machines. SuperLU_DIST is
1449 implemented in ANSI C, and MPI for communications.")
1450 (license license:bsd-3)))
1452 (define-public scotch
1459 (uri (string-append "https://gforge.inria.fr/frs/download.php/34618/"
1460 "scotch_" version ".tar.gz"))
1462 (base32 "1ir088mvrqggyqdkx9qfynmiaffqbyih5qfl5mga2nrlm1qlsgzm"))
1463 (patches (search-patches "scotch-test-threading.patch"
1464 "pt-scotch-build-parallelism.patch"))))
1465 (build-system gnu-build-system)
1472 (modify-phases %standard-phases
1474 'unpack 'chdir-to-src
1475 (lambda _ (chdir "src")))
1479 (call-with-output-file "Makefile.inc"
1493 CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
1494 LDFLAGS = -lz -lm -lrt -lpthread
1496 LEX = flex -Pscotchyy -olex.yy.c
1501 YACC = bison -pscotchyy -y -b y
1503 '("COMMON_FILE_COMPRESS_GZ"
1505 "COMMON_RANDOM_FIXED_SEED"
1506 ;; Prevents symbolc clashes with libesmumps
1508 ;; XXX: Causes invalid frees in superlu-dist tests
1510 ;; "SCOTCH_PTHREAD_NUMBER=2"
1511 "restrict=__restrict"))))))
1513 'build 'build-esmumps
1515 (zero? (system* "make"
1516 (format #f "-j~a" (parallel-job-count))
1520 (lambda* (#:key outputs #:allow-other-keys)
1521 (let ((out (assoc-ref outputs "out")))
1523 (zero? (system* "make"
1524 (string-append "prefix=" out)
1526 ;; esmumps files are not installed with the above
1527 (for-each (lambda (f)
1528 (copy-file f (string-append out "/include/" f)))
1529 (find-files "../include" ".*esmumps.h$"))
1530 (for-each (lambda (f)
1531 (copy-file f (string-append out "/lib/" f)))
1532 (find-files "../lib" "^lib.*esmumps.*"))))))))
1533 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
1534 (synopsis "Programs and libraries for graph algorithms")
1535 (description "SCOTCH is a set of programs and libraries which implement
1536 the static mapping and sparse matrix reordering algorithms developed within
1537 the SCOTCH project. Its purpose is to apply graph theory, with a divide and
1538 conquer approach, to scientific computing problems such as graph and mesh
1539 partitioning, static mapping, and sparse matrix ordering, in application
1540 domains ranging from structural mechanics to operating systems or
1542 ;; See LICENSE_en.txt
1543 (license license:cecill-c)))
1545 (define-public pt-scotch
1546 (package (inherit scotch)
1549 `(("openmpi" ,openmpi))) ;Headers include MPI headers
1551 (substitute-keyword-arguments (package-arguments scotch)
1552 ((#:phases scotch-phases)
1553 `(modify-phases ,scotch-phases
1558 (zero? (system* "make"
1559 (format #f "-j~a" (parallel-job-count))
1560 "ptscotch" "ptesmumps"))
1561 ;; Install the serial metis compatibility library
1562 (zero? (system* "make" "-C" "libscotchmetis" "install")))))
1565 (lambda _ (zero? (system* "make" "ptcheck"))))))))
1566 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
1568 (define-public metis
1575 (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
1576 "metis-" version ".tar.gz"))
1579 "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
1580 (build-system cmake-build-system)
1582 `(("blas" ,openblas)))
1584 `(#:tests? #f ;no tests
1585 #:configure-flags `("-DSHARED=ON"
1586 ,(string-append "-DGKLIB_PATH=" (getcwd)
1587 "/metis-" ,version "/GKlib"))))
1588 (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
1589 (synopsis "Graph partitioning and fill-reducing matrix ordering library")
1591 "METIS is a set of serial programs for partitioning graphs, partitioning
1592 finite element meshes, and producing fill-reducing orderings for sparse
1593 matrices. The algorithms implemented in METIS are based on the multilevel
1594 recursive-bisection, multilevel k-way, and multi-constraint partitioning
1596 (license license:asl2.0))) ;As of version 5.0.3
1598 (define-public p4est
1605 (uri (string-append "http://p4est.github.io/release/p4est-"
1609 "0faina2h5qsx3m2izbzaj9bbakma1krbbjmq43wrp1hcbyijflqb"))))
1610 (build-system gnu-build-system)
1612 `(("fortran" ,gfortran)
1617 `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
1618 (assoc-ref %build-inputs "blas")
1620 ,(string-append "LAPACK_LIBS=-L"
1621 (assoc-ref %build-inputs "lapack")
1623 (home-page "http://www.p4est.org")
1624 (synopsis "Adaptive mesh refinement on forests of octrees")
1626 "The p4est software library enables the dynamic management of a
1627 collection of adaptive octrees, conveniently called a forest of octrees.
1628 p4est is designed to work in parallel and scales to hundreds of thousands of
1630 (license license:gpl2+)))
1632 (define-public p4est-openmpi
1633 (package (inherit p4est)
1634 (name "p4est-openmpi")
1637 ,@(package-inputs p4est)))
1639 (substitute-keyword-arguments (package-arguments p4est)
1640 ((#:configure-flags cf)
1641 ``("--enable-mpi" ,@,cf))))
1642 (synopsis "Parallel adaptive mesh refinement on forests of octrees")))
1644 (define-public gsegrafix
1651 (uri (string-append "mirror://gnu/" name "/" name "-"
1655 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
1656 (build-system gnu-build-system)
1658 `(#:configure-flags '("LDFLAGS=-lm")))
1660 `(("libgnomecanvas" ,libgnomecanvas)
1661 ("libbonoboui" ,libbonoboui)
1662 ("libgnomeui" ,libgnomeui)
1663 ("libgnomeprintui" ,libgnomeprintui)
1666 `(("pkg-config" ,pkg-config)))
1667 (home-page "http://www.gnu.org/software/gsegrafix/")
1668 (synopsis "GNOME application to create scientific and engineering plots")
1669 (description "GSEGrafix is an application which produces high-quality graphical
1670 plots for science and engineering. Plots are specified via simple ASCII
1671 parameter files and data files and are presented in an anti-aliased GNOME
1672 canvas. The program supports rectangular two-dimensional plots, histograms,
1673 polar-axis plots and three-dimensional plots. Plots can be printed or saved
1674 to BMP, JPEG or PNG image formats.")
1675 (license license:gpl3+)))
1677 (define-public maxima
1684 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
1685 version "-source/" name "-" version ".tar.gz"))
1688 "0x1rk659sn3cq0n5c90848ilzr1gb1wf0072fl6jhkdq00qgh2s0"))
1689 (patches (search-patches "maxima-defsystem-mkdir.patch"))))
1690 (build-system gnu-build-system)
1693 ("gnuplot" ,gnuplot) ;for plots
1694 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
1696 `(("texinfo" ,texinfo)
1700 (list "--enable-gcl"
1701 (string-append "--with-posix-shell="
1702 (assoc-ref %build-inputs "bash")
1704 (string-append "--with-wish="
1705 (assoc-ref %build-inputs "tk")
1707 (let ((v ,(package-version tk)))
1708 (string-take v (string-index-right v #\.)))))
1709 ;; By default Maxima attempts to write temporary files to
1710 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
1711 ;; Work around that.
1712 #:make-flags (list "TMPDIR=/tmp")
1713 #:phases (alist-cons-before
1716 (chmod "src/maxima" #o555))
1717 ;; Make sure the doc and emacs files are found in the
1718 ;; standard location. Also configure maxima to find gnuplot
1719 ;; without having it on the PATH.
1721 'install 'post-install
1722 (lambda* (#:key outputs inputs #:allow-other-keys)
1723 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
1724 (out (assoc-ref outputs "out"))
1725 (datadir (string-append out "/share/maxima/" ,version)))
1726 (with-directory-excursion out
1727 (mkdir-p "share/emacs")
1728 (mkdir-p "share/doc")
1730 (string-append datadir "/emacs/")
1731 (string-append out "/share/emacs/site-lisp"))
1733 (string-append datadir "/doc/")
1734 (string-append out "/share/doc/maxima"))
1735 (with-atomic-file-replacement
1736 (string-append datadir "/share/maxima-init.lisp")
1738 (format out "~a ~s~a~%"
1739 "(setf $gnuplot_command "
1740 (string-append gnuplot "/bin/gnuplot") ")")
1741 (dump-port in out))))))
1742 %standard-phases))))
1743 (home-page "http://maxima.sourceforge.net")
1744 (synopsis "Numeric and symbolic expression manipulation")
1745 (description "Maxima is a system for the manipulation of symbolic and
1746 numerical expressions. It yields high precision numeric results by using
1747 exact fractions, arbitrary precision integers, and variable precision floating
1749 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
1750 ;; Others simply say "GNU General Public License" without stating a
1751 ;; version (which implicitly means gpl1+).
1752 ;; At least one file (src/maxima.asd) says "version 2."
1753 ;; GPLv2 only is therefore the smallest subset.
1754 (license license:gpl2)))
1756 (define-public wxmaxima
1763 (uri (string-append "mirror://sourceforge/wxmaxima/wxMaxima/"
1764 version "/" name "-" version ".tar.gz"))
1767 "1fpqzk1921isiqrpgpf433ldq41924qs9sy99fl1zn5661b2l73n"))))
1768 (build-system gnu-build-system)
1770 `(("wxwidgets" ,wxwidgets)
1773 ("adwaita-icon-theme" ,adwaita-icon-theme)
1775 ("shared-mime-info" ,shared-mime-info)))
1777 `(#:phases (modify-phases %standard-phases
1779 'install 'wrap-program
1780 (lambda* (#:key inputs outputs #:allow-other-keys)
1781 (wrap-program (string-append (assoc-ref outputs "out")
1784 (,(string-append (assoc-ref inputs "maxima")
1786 ;; For GtkFileChooserDialog.
1787 `("GSETTINGS_SCHEMA_DIR" =
1788 (,(string-append (assoc-ref inputs "gtk+")
1789 "/share/glib-2.0/schemas")))
1790 `("XDG_DATA_DIRS" ":" prefix
1791 (;; Needed by gdk-pixbuf to know supported icon formats.
1793 (assoc-ref inputs "shared-mime-info") "/share")
1794 ;; The default icon theme of GTK+.
1796 (assoc-ref inputs "adwaita-icon-theme") "/share"))))
1798 (home-page "https://andrejv.github.io/wxmaxima/")
1799 (synopsis "Graphical user interface for the Maxima computer algebra system")
1801 "wxMaxima is a graphical user interface for the Maxima computer algebra
1802 system. It eases the use of Maxima by making most of its commands available
1803 through a menu system and by providing input dialogs for commands that require
1804 more than one argument. It also implements its own display engine that
1805 outputs mathematical symbols directly instead of depicting them with ASCII
1808 wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
1809 text and mathematical calculations to create documents, exporting of input and
1810 output to TeX, and a browser for Maxima's manual including command index and
1811 full text searching.")
1812 (license license:gpl2+)))
1814 (define-public armadillo
1820 (uri (string-append "mirror://sourceforge/arma/armadillo-"
1824 "0xbidcxrvbq33xf7iysg2nic2ai9a043psl33kiv6ifkk7p8hcra"))))
1825 (build-system cmake-build-system)
1826 (arguments `(#:tests? #f)) ;no test target
1828 `(("openblas" ,openblas)
1830 ("arpack" ,arpack-ng)))
1831 (home-page "http://arma.sourceforge.net/")
1832 (synopsis "C++ linear algebra library")
1834 "Armadillo is a C++ linear algebra library, aiming towards a good balance
1835 between speed and ease of use. It is useful for algorithm development
1836 directly in C++, or quick conversion of research code into production
1837 environments. It can be used for machine learning, pattern recognition,
1838 signal processing, bioinformatics, statistics, econometrics, etc. The library
1839 provides efficient classes for vectors, matrices and cubes, as well as 150+
1840 associated functions (eg. contiguous and non-contiguous submatrix views).")
1841 (license license:mpl2.0)))
1843 (define-public armadillo-for-rcpparmadillo
1844 (package (inherit armadillo)
1848 (uri (string-append "mirror://sourceforge/arma/armadillo-"
1852 "0xmpnqhm9mwr1lssjyarj0cl8b4svbqv6z1xa1dxlwd2ly1srkg4"))))))
1854 (define-public muparser
1855 ;; When switching download sites, muparser re-issued a 2.2.5 release with a
1856 ;; different hash. In order to make `guix package --upgrade` work correctly,
1857 ;; we set a Guix packaging revision.
1858 ;; When the next version of muparser is released, we can remove
1859 ;; UPSTREAM-VERSION and REVISION and use the plain VERSION.
1860 (let ((upstream-version "2.2.5")
1864 (version (string-append upstream-version "-" revision))
1868 (uri (string-append "https://github.com/beltoforion/muparser/archive/v"
1869 upstream-version ".tar.gz"))
1870 (file-name (string-append name "-" version ".tar.gz"))
1873 "0277qsi5l23jsck1vhn383bmvc2n9l4a1dl5r9bf7hvjv9ayyrh6"))))
1874 (build-system gnu-build-system)
1876 `(#:configure-flags '("--enable-samples=no")
1877 #:tests? #f)) ;no "check" target
1878 (home-page "http://muparser.beltoforion.de/")
1879 (synopsis "Fast parser library for mathematical expressions")
1881 "muParser is an extensible high performance math parser library. It is
1882 based on transforming an expression into a bytecode and precalculating constant
1884 (license license:expat))))
1886 (define-public openblas
1893 (uri (string-append "https://github.com/xianyi/OpenBLAS/tarball/v"
1895 (file-name (string-append name "-" version ".tar.gz"))
1898 "1k5f6vjlk54qlplk5m7xkbaw6g2y7dl50lwwdv6xsbcsgsbxfcpy"))))
1899 (build-system gnu-build-system)
1901 `(#:tests? #f ;no "check" target
1902 ;; DYNAMIC_ARCH is only supported on x86. When it is disabled and no
1903 ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
1904 ;; we need to disable substitutions.
1906 ,(let ((system (or (%current-target-system) (%current-system))))
1907 (or (string-prefix? "x86_64" system)
1908 (string-prefix? "i686" system)
1909 (string-prefix? "mips" system)))
1911 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1914 ;; Build the library for all supported CPUs. This allows
1915 ;; switching CPU targets at runtime with the environment variable
1916 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
1917 ;; Unfortunately, this is not supported on non-x86 architectures,
1918 ;; where it leads to failed builds.
1919 ,@(let ((system (or (%current-target-system) (%current-system))))
1921 ((or (string-prefix? "x86_64" system)
1922 (string-prefix? "i686" system))
1923 '("DYNAMIC_ARCH=1"))
1924 ;; On MIPS we force the "SICORTEX" TARGET, as for the other
1925 ;; two available MIPS targets special extended instructions
1926 ;; for Loongson cores are used.
1927 ((string-prefix? "mips" system)
1928 '("TARGET=SICORTEX"))
1930 ;; no configure script
1931 #:phases (alist-delete 'configure %standard-phases)))
1933 `(("fortran" ,gfortran)))
1937 (home-page "http://www.openblas.net/")
1938 (synopsis "Optimized BLAS library based on GotoBLAS")
1940 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
1941 (license license:bsd-3)))
1943 (define-public openlibm
1950 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
1952 (file-name (string-append name "-" version ".tar.gz"))
1955 "11czx2z7nh6dfpz45s3xl7v38hw36jxzxfvny454bk3if14pfakq"))))
1956 (build-system gnu-build-system)
1959 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1961 ;; no configure script
1962 (alist-delete 'configure %standard-phases)
1963 #:tests? #f)) ;the tests are part of the default target
1964 (home-page "http://openlibm.org/")
1965 (synopsis "Portable C mathematical library (libm)")
1967 "OpenLibm is an effort to have a high quality, portable, standalone C
1968 mathematical library (libm). It can be used standalone in applications and
1969 programming language implementations. The project was born out of a need to
1970 have a good libm for the Julia programming language that worked consistently
1971 across compilers and operating systems, and in 32-bit and 64-bit
1973 ;; Each architecture has its own make target, and there is none for mips.
1974 (supported-systems (delete "mips64el-linux" %supported-systems))
1975 ;; See LICENSE.md for details.
1976 (license (list license:expat
1979 license:public-domain
1980 license:lgpl2.1+))))
1982 (define-public openspecfun
1984 (name "openspecfun")
1989 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
1991 (file-name (string-append name "-" version ".tar.gz"))
1994 "1y5b2h6f2k72536kym3vzy3li3bhpd23x463g7hdmjdi3cncavz1"))))
1995 (build-system gnu-build-system)
1997 '(#:tests? #f ;no "check" target
1999 (list (string-append "prefix=" (assoc-ref %outputs "out")))
2000 ;; no configure script
2001 #:phases (alist-delete 'configure %standard-phases)))
2003 `(("fortran" ,gfortran)))
2004 (home-page "https://github.com/JuliaLang/openspecfun")
2005 (synopsis "Collection of special mathematical functions")
2007 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
2008 portable package for Bessel Functions of a Complex Argument and Nonnegative
2009 Order; it contains subroutines for computing Bessel functions and Airy
2010 functions. Faddeeva allows computing the various error functions of arbitrary
2011 complex arguments (Faddeeva function, error function, complementary error
2012 function, scaled complementary error function, imaginary error function, and
2013 Dawson function); given these, one can also easily compute Voigt functions,
2014 Fresnel integrals, and similar related functions as well.")
2015 ;; Faddeeva is released under the Expat license; AMOS is included as
2016 ;; public domain software.
2017 (license (list license:expat license:public-domain))))
2019 (define-public suitesparse
2021 (name "suitesparse")
2027 "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-"
2031 "100hdzr0mf4mzlwnqpmwpfw4pymgsf9n3g0ywb1yps2nk1zbkdy5"))))
2032 (build-system gnu-build-system)
2034 '(#:parallel-build? #f ;cholmod build fails otherwise
2035 #:tests? #f ;no "check" target
2040 "CHOLMOD_CONFIG=-DNPARTITION" ;required when METIS is not used
2041 (string-append "INSTALL_LIB="
2042 (assoc-ref %outputs "out") "/lib")
2043 (string-append "INSTALL_INCLUDE="
2044 (assoc-ref %outputs "out") "/include"))
2047 'install 'prepare-out
2048 ;; README.txt states that the target directories must exist prior to
2049 ;; running "make install".
2051 (mkdir-p (string-append (assoc-ref %outputs "out") "/lib"))
2052 (mkdir-p (string-append (assoc-ref %outputs "out") "/include")))
2053 ;; no configure script
2054 (alist-delete 'configure %standard-phases))))
2057 ("lapack" ,lapack)))
2058 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
2059 (synopsis "Suite of sparse matrix software")
2061 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
2062 multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
2063 multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
2064 simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
2065 CXSparse, a concise sparse Cholesky factorization package; and many other
2068 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
2070 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
2071 (license (list license:gpl2+ license:lgpl2.1+))))
2073 (define-public atlas
2079 (uri (string-append "mirror://sourceforge/math-atlas/Stable/"
2080 version "/atlas" version ".tar.bz2"))
2083 "1dyjlq3fiparvm8ypwk6rsmjzmnwk81l88gkishphpvc79ryp216"))))
2084 (build-system gnu-build-system)
2085 (home-page "http://math-atlas.sourceforge.net/")
2086 (inputs `(("gfortran" ,gfortran)
2087 ("lapack-tar" ,(package-source lapack))))
2088 (outputs '("out" "doc"))
2089 ;; For the moment we drop support for MIPS at it fails to compile. See
2090 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
2091 (supported-systems (delete "mips64el-linux" %supported-systems))
2093 `(#:parallel-build? #f
2094 #:parallel-tests? #f
2096 ;; ATLAS tunes itself for the machine it is built on, as explained at
2097 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
2098 ;; For this reason, we want users to build it locally instead of using
2102 #:modules ((srfi srfi-26)
2104 (guix build gnu-build-system)
2107 `(;; Generate position independent code suitable for dynamic libraries
2108 ;; and use WALL timer to get more accurate timing.
2109 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
2112 ,,(if (string-match "64" (%current-system))
2115 ;; Disable parallel build as it gives errors: atlas_pthread.h is
2116 ;; needed to compile C files before it is generated.
2117 "-Ss" "pmake" "make -j 1"
2118 ;; Probe is failing for MIPS. We therefore define the system
2119 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
2120 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
2121 ,,@(if (string-prefix? "mips" (%current-system))
2122 (list "-A" "49" "-V" "1")
2124 ;; Generate shared libraries.
2126 ;; Build a full LAPACK library.
2127 ,(string-append "--with-netlib-lapack-tarfile="
2128 (assoc-ref %build-inputs "lapack-tar")))
2130 (modify-phases %standard-phases
2131 (add-after 'install 'install-doc
2132 (lambda* (#:key outputs inputs #:allow-other-keys)
2133 (let ((doc (string-append (assoc-ref outputs "doc")
2134 "/share/doc/atlas")))
2136 (fold (lambda (file previous)
2137 (and previous (zero? (system* "cp" file doc))))
2138 #t (find-files "../ATLAS/doc" ".*")))))
2139 (add-after 'check 'check-pt
2140 (lambda _ (zero? (system* "make" "ptcheck"))))
2141 ;; Fix files required to run configure.
2142 (add-before 'configure 'fix-/bin/sh
2144 ;; Use `sh', not `/bin/sh'.
2145 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
2148 ;; Fix /bin/sh in generated make files.
2149 (add-after 'configure 'fix-/bin/sh-in-generated-files
2151 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
2154 ;; ATLAS configure program does not accepts the default flags
2155 ;; passed by the 'gnu-build-system'.
2157 (lambda* (#:key native-inputs inputs outputs
2158 (configure-flags '())
2159 #:allow-other-keys #:rest args)
2160 (let* ((prefix (assoc-ref outputs "out"))
2161 (bash (or (and=> (assoc-ref
2162 (or native-inputs inputs) "bash")
2163 (cut string-append <> "/bin/bash"))
2165 (flags `(,(string-append "--prefix=" prefix)
2167 (abs-srcdir (getcwd))
2168 (srcdir (string-append "../" (basename abs-srcdir))))
2169 (format #t "source directory: ~s (relative from build: ~s)~%"
2173 (format #t "build directory: ~s~%" (getcwd))
2174 (format #t "configure flags: ~s~%" flags)
2175 (zero? (apply system* bash
2176 (string-append srcdir "/configure")
2178 (synopsis "Automatically Tuned Linear Algebra Software")
2180 "ATLAS is an automatically tuned linear algebra software library
2181 providing C and Fortran77 interfaces to a portably efficient BLAS
2182 implementation, as well as a few routines from LAPACK.
2184 Optimization occurs at build time. For this reason, the library is built on
2185 the machine where it is installed, without resorting to pre-built substitutes.
2187 Before building the library, CPU throttling should be disabled. This can be
2188 done in the BIOS, or, on GNU/Linux, with the following command:
2191 # cpupower --governor performance
2194 Failure to do so will result in a library with poor performance.")
2195 (license license:bsd-3)))
2204 (uri (string-append "mirror://sourceforge/ogl-math/glm-" version
2205 "/glm-" version ".zip"))
2208 "1cnjmi033a16a95v6xfkr1bvfmkd26hzdjka8j1819hgn5b1nr8l"))))
2209 (build-system cmake-build-system)
2211 `(("unzip" ,unzip)))
2212 (home-page "http://glm.g-truc.net")
2213 (synopsis "OpenGL Mathematics library")
2214 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
2215 library for graphics software based on the OpenGL Shading Language (GLSL)
2217 (license license:expat)))
2219 (define-public lpsolve
2226 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
2227 "/lp_solve_" version "_source.tar.gz"))
2230 "176c7f023mb6b8bfmv4rfqnrlw88lsg422ca74zjh19i2h5s69sq"))
2231 (modules '((guix build utils)))
2233 '(substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
2235 ;; Pretend to be on a 64 bit platform to obtain a common directory
2236 ;; name for the build results on all architectures; nothing else
2237 ;; seems to depend on it.
2238 (("^PLATFORM=.*$") "PLATFORM=ux64\n")
2240 ;; The check for 'isnan' as it is written fails with
2241 ;; "non-floating-point argument in call to function
2242 ;; ‘__builtin_isnan’", which leads to the 'NOISNAN' cpp macro
2243 ;; definition, which in turn leads to bad things. Fix the feature
2245 (("isnan\\(0\\)") "isnan(0.)")))))
2246 (build-system gnu-build-system)
2248 `(#:tests? #f ; no check target
2250 (modify-phases %standard-phases
2254 (and (with-directory-excursion "lpsolve55"
2255 (zero? (system* "bash" "ccc")))
2256 (with-directory-excursion "lp_solve"
2257 (zero? (system* "bash" "ccc"))))))
2259 (lambda* (#:key outputs #:allow-other-keys)
2260 (let* ((out (assoc-ref outputs "out"))
2261 (bin (string-append out "/bin"))
2262 (lib (string-append out "/lib"))
2263 ;; This is where LibreOffice expects to find the header
2264 ;; files, and where they are installed by Debian.
2265 (include (string-append out "/include/lpsolve")))
2267 (copy-file "lpsolve55/bin/ux64/liblpsolve55.a"
2268 (string-append lib "/liblpsolve55.a"))
2269 (copy-file "lpsolve55/bin/ux64/liblpsolve55.so"
2270 (string-append lib "/liblpsolve55.so"))
2271 (install-file "lp_solve/bin/ux64/lp_solve" bin)
2273 ;; Install a subset of the header files as on Debian
2274 ;; (plus lp_bit.h, which matches the regular expression).
2275 (for-each (lambda (name)
2276 (install-file name include))
2277 (find-files "." "lp_[HMSa-z].*\\.h$"))
2278 (with-directory-excursion "shared"
2279 (for-each (lambda (name)
2280 (install-file name include))
2281 (find-files "." "\\.h$")))
2283 (home-page "http://lpsolve.sourceforge.net/")
2284 (synopsis "Mixed integer linear programming (MILP) solver")
2286 "lp_solve is a mixed integer linear programming solver based on the
2287 revised simplex and the branch-and-bound methods.")
2288 (license license:lgpl2.1+)))
2290 (define-public dealii
2297 (uri (string-append "https://github.com/dealii/dealii/releases/"
2298 "download/v" version "/dealii-" version ".tar.gz"))
2301 "1bdksvvyp1rj37df1ndh8j3x9nzpc3sazw8nd0hzvnlw0qnyk800"))
2302 (modules '((guix build utils)))
2304 ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
2305 '(delete-file-recursively "bundled"))))
2306 (build-system cmake-build-system)
2314 ("arpack" ,arpack-ng)
2315 ("muparser" ,muparser)
2316 ("gfortran" ,gfortran)
2317 ("suitesparse" ,suitesparse))) ;for UMFPACK
2319 `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease
2320 #:configure-flags '("-DCOMPAT_FILES=OFF") ;Follow new directory structure
2321 #:phases (modify-phases %standard-phases
2323 'install 'hint-example-prefix
2324 ;; Set Cmake hints in examples so that they can find this
2325 ;; deal.II when configuring.
2326 (lambda* (#:key outputs #:allow-other-keys)
2327 (let* ((out (assoc-ref %outputs "out"))
2328 (exmpl (string-append out "/share/doc"
2329 "/dealii/examples")))
2330 (substitute* (find-files exmpl "CMakeLists.txt")
2331 (("([[:space:]]*HINTS.*)\n" _ line)
2332 (string-append line " $ENV{HOME}/.guix-profile "
2335 (home-page "https://www.dealii.org")
2336 (synopsis "Finite element library")
2338 "Deal.II is a C++ program library targeted at the computational solution
2339 of partial differential equations using adaptive finite elements. The main
2340 aim of deal.II is to enable rapid development of modern finite element codes,
2341 using among other aspects adaptive meshes and a wide array of tools often used
2342 in finite element programs.")
2343 (license license:lgpl2.1+)))
2345 (define-public dealii-openmpi
2346 (package (inherit dealii)
2347 (name "dealii-openmpi")
2350 ;;Supported only with MPI:
2351 ("p4est" ,p4est-openmpi)
2352 ("petsc" ,petsc-openmpi)
2353 ("slepc" ,slepc-openmpi)
2354 ("metis" ,metis) ;for MUMPS
2355 ("scalapack" ,scalapack) ;for MUMPS
2356 ("mumps" ,mumps-metis-openmpi) ;configure supports only metis orderings
2357 ("arpack" ,arpack-ng-openmpi)
2358 ,@(fold alist-delete (package-inputs dealii)
2359 '("p4est" "arpack"))))
2361 (substitute-keyword-arguments (package-arguments dealii)
2362 ((#:configure-flags cf)
2363 ``("-DMPI_C_COMPILER=mpicc"
2364 "-DMPI_CXX_COMPILER=mpicxx"
2365 "-DMPI_Fortran_COMPILER=mpifort"
2367 (synopsis "Finite element library (with MPI support)")))
2369 (define-public flann
2378 "http://www.cs.ubc.ca/research/flann/uploads/FLANN/flann-"
2379 version "-src.zip"))
2382 "022w8hph7bli5zbpnk3z1qh1c2sl5hm8fw2ccim651ynn0hr7fyz"))))
2383 (build-system cmake-build-system)
2385 `(("unzip" ,unzip)))
2389 ("python" ,python-2) ; print syntax
2390 ;; ("python2-numpy" ,python2-numpy) ; only required for the tests
2393 `(;; The 'share/flann/octave' contains a .mex file, which is an ELF file
2394 ;; taken 46 MiB unstripped, and 6 MiB stripped.
2395 #:strip-directories '("lib" "lib64" "libexec"
2396 "bin" "sbin" "share/flann/octave")
2398 ;; Save 12 MiB by not installing .a files. Passing
2399 ;; '-DBUILD_STATIC_LIBS=OFF' has no effect.
2400 #:phases (modify-phases %standard-phases
2401 (add-after 'install 'remove-static-libraries
2402 (lambda* (#:key outputs #:allow-other-keys)
2403 (let* ((out (assoc-ref outputs "out"))
2404 (lib (string-append out "/lib")))
2405 (for-each delete-file
2406 (find-files lib "\\.a$"))
2409 #:tests? #f)) ; The test data are downloaded from the Internet.
2410 (home-page "http://www.cs.ubc.ca/research/flann/")
2411 (synopsis "Library for approximate nearest neighbors computation")
2412 (description "FLANN is a library for performing fast approximate
2413 nearest neighbor searches in high dimensional spaces. It implements a
2414 collection of algorithms and a system for automatically choosing the best
2415 algorithm and optimum parameters depending on the dataset.
2417 FLANN is written in C++ and contains bindings for C, Octave and Python.")
2418 (license (license:non-copyleft "file://COPYING"
2419 "See COPYING in the distribution."))))
2421 (define-public wcalc
2428 (uri (string-append "mirror://sourceforge/w-calc/Wcalc/" version "/"
2429 "wcalc-" version ".tar.bz2"))
2432 "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
2433 (build-system gnu-build-system)
2436 ("readline" ,readline)))
2437 (home-page "http://w-calc.sourceforge.net/index.php")
2438 (synopsis "Flexible command-line scientific calculator")
2439 (description "Wcalc is a very capable calculator. It has standard functions
2440 (sin, asin, and sinh for example, in either radians or degrees), many
2441 pre-defined constants (pi, e, c, etc.), support for using variables, \"active\"
2442 variables, a command history, hex/octal/binary input and output, unit
2443 conversions, embedded comments, and an expandable expression entry field. It
2444 evaluates expressions using the standard order of operations.")
2445 (license license:gpl2+)))
2453 (uri (string-append "mirror://sourceforge/xaos/XaoS/" version
2454 "/xaos-" version ".tar.gz"))
2457 "15cd1cx1dyygw6g2nhjqq3bsfdj8sj8m4va9n75i0f3ryww3x7wq"))))
2458 (build-system gnu-build-system)
2459 (native-inputs `(("gettext" ,gnu-gettext)))
2460 (inputs `(("libx11" ,libx11)
2465 `(#:tests? #f ;no "check" target
2466 #:make-flags '("LOCALEDIR=$DATAROOTDIR/locale")))
2467 (synopsis "Real-time fractal zoomer")
2468 (description "GNU XaoS is a graphical program that generates fractal
2469 patterns and allows you to zoom in and out of them infinitely in a fluid,
2470 continuous manner. It also includes tutorials that help to explain how fractals
2471 are built. It can generate many different fractal types such as the Mandelbrot
2473 (home-page "http://www.gnu.org/software/xaos/")
2474 (license license:gpl2+)))
2476 (define-public hypre
2482 (uri (string-append "https://github.com/LLNL/hypre/archive/"
2483 "v" version ".tar.gz"))
2484 (file-name (string-append name "-" version ".tar.gz"))
2487 "0q69ia0jivzcr8p049dn3mg8yjpn6nwq4sw9iqac8vr63vi54l6m"))
2488 (modules '((guix build utils)))
2491 ;; Remove use of __DATE__ and __TIME__ for reproducibility;
2492 ;; substitute the tarball creation time.
2493 (substitute* "src/utilities/HYPRE_utilities.h"
2494 (("Date Compiled: .*$")
2495 "Date Compiled: Mar 28 2016 20:19:59 +0000\"\n"))
2497 (build-system gnu-build-system)
2498 (outputs '("out" ;6.1 MiB of headers and libraries
2499 "doc")) ;4.8 MiB of documentation
2503 ("texlive" ,texlive) ;full package required for fonts
2504 ("ghostscript" ,ghostscript)))
2506 `(("blas" ,openblas)
2507 ("lapack" ,lapack)))
2509 `(#:modules ((srfi srfi-1)
2510 ,@%gnu-build-system-modules)
2511 #:configure-flags '("--enable-shared"
2519 (modify-phases %standard-phases
2520 (add-before 'configure 'chdir-src
2521 (lambda _ (chdir "src")))
2523 (lambda* (#:key build target configure-flags
2524 #:allow-other-keys #:rest args)
2525 (let* ((configure (assoc-ref %standard-phases 'configure)))
2528 (list #:configure-flags
2529 (cons (string-append
2530 "--host=" (or target build))
2531 configure-flags)))))))
2532 (add-after 'build 'build-docs
2534 (zero? (system* "make" "-Cdocs" "pdf" "html"))))
2537 (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/hypre/lib"))
2538 (setenv "PATH" (string-append "." ":" (getenv "PATH")))
2539 (and (system* "make" "check" "CHECKRUN=")
2540 (fold (lambda (filename result)
2542 (let ((size (stat:size (stat filename))))
2543 (when (not (zero? size))
2544 (format #t "~a size ~d; error indication~%"
2548 (find-files "test" ".*\\.err$")))))
2549 (add-after 'install 'install-docs
2550 (lambda* (#:key outputs #:allow-other-keys)
2551 ;; Custom install because docs/Makefile doesn't honor ${docdir}.
2552 (let* ((doc (assoc-ref outputs "doc"))
2553 (docdir (string-append doc "/share/doc/hypre-" ,version)))
2555 (with-directory-excursion "docs"
2556 (for-each (lambda (base)
2557 (install-file (string-append base ".pdf") docdir)
2558 (copy-recursively base docdir)) ;html docs
2559 '("HYPRE_usr_manual"
2560 "HYPRE_ref_manual")))
2562 (home-page "http://www.llnl.gov/casc/hypre/")
2563 (synopsis "Library of solvers and preconditioners for linear equations")
2565 "HYPRE is a software library of high performance preconditioners and
2566 solvers for the solution of large, sparse linear systems of equations. It
2567 features multigrid solvers for both structured and unstructured grid
2569 (license license:lgpl2.1)))
2571 (define-public hypre-openmpi
2572 (package (inherit hypre)
2573 (name "hypre-openmpi")
2576 ,@(package-inputs hypre)))
2578 (substitute-keyword-arguments (package-arguments hypre)
2579 ((#:configure-flags flags)
2581 ,@(delete "--without-MPI" ,flags)))))
2582 (synopsis "Parallel solvers and preconditioners for linear equations")
2584 "HYPRE is a software library of high performance preconditioners and
2585 solvers for the solution of large, sparse linear systems of equations on
2586 parallel computers. It features parallel multigrid solvers for both
2587 structured and unstructured grid problems.")))
2589 (define-public matio
2596 (uri (string-append "mirror://sourceforge/matio/matio/" version "/"
2597 "matio-" version ".tar.gz"))
2600 "0y2qymgxank8wdiwc68ap8bxdzrhvyw86i29yh3xgn4z1njfd9ir"))))
2601 (build-system gnu-build-system)
2605 (home-page "http://matio.sourceforge.net/")
2606 (synopsis "Library for reading and writing MAT files")
2607 (description "Matio is a library for reading and writing MAT files. It
2608 supports compressed MAT files, as well as newer (version 7.3) MAT files.")
2609 (license license:bsd-2)))
2611 (define-public libhilbert
2618 (uri (string-append "http://web.cs.dal.ca/~chamilto/hilbert/"
2619 "libhilbert-" version ".tar.gz"))
2622 "0v48x8405dj95gjn2saja4bzhw86d6zl6d3dg8h7dzac2qr97s34"))))
2623 (build-system gnu-build-system)
2624 (home-page "http://web.cs.dal.ca/~chamilto/hilbert")
2625 (synopsis "Hilbert indices for multidimensional data")
2626 (description "The libhilbert library can efficiently calculate Hilbert
2627 curves and order-preserving representations of Hilbert curve indices that use
2628 the same amount of space as the original point representation. This is useful
2629 when using the Gilbert curve as a space filling curve through a
2630 high-dimensional space where not all demensions have the same cardinality.")
2631 (license license:lgpl2.1+)))