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>
17 ;;; Copyright © 2016 Thomas Danckaert <post@thomasdanckaert.be>
19 ;;; This file is part of GNU Guix.
21 ;;; GNU Guix is free software; you can redistribute it and/or modify it
22 ;;; under the terms of the GNU General Public License as published by
23 ;;; the Free Software Foundation; either version 3 of the License, or (at
24 ;;; your option) any later version.
26 ;;; GNU Guix is distributed in the hope that it will be useful, but
27 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
28 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 ;;; GNU General Public License for more details.
31 ;;; You should have received a copy of the GNU General Public License
32 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
34 (define-module (gnu packages maths)
35 #:use-module (ice-9 regex)
36 #:use-module (gnu packages)
37 #:use-module ((guix licenses) #:prefix license:)
38 #:use-module (guix packages)
39 #:use-module (guix download)
40 #:use-module (guix utils)
41 #:use-module (guix build utils)
42 #:use-module (guix build-system cmake)
43 #:use-module (guix build-system gnu)
44 #:use-module (guix build-system r)
45 #:use-module (gnu packages algebra)
46 #:use-module (gnu packages bison)
47 #:use-module (gnu packages boost)
48 #:use-module (gnu packages check)
49 #:use-module (gnu packages cmake)
50 #:use-module (gnu packages compression)
51 #:use-module (gnu packages curl)
52 #:use-module (gnu packages cyrus-sasl)
53 #:use-module (gnu packages documentation)
54 #:use-module (gnu packages elf)
55 #:use-module (gnu packages flex)
56 #:use-module (gnu packages fltk)
57 #:use-module (gnu packages fontutils)
58 #:use-module (gnu packages gettext)
59 #:use-module (gnu packages gcc)
60 #:use-module (gnu packages gd)
61 #:use-module (gnu packages ghostscript)
62 #:use-module (gnu packages graphviz)
63 #:use-module (gnu packages gtk)
64 #:use-module (gnu packages image)
65 #:use-module (gnu packages less)
66 #:use-module (gnu packages lisp)
67 #:use-module (gnu packages logging)
68 #:use-module (gnu packages gnome)
69 #:use-module (gnu packages guile)
70 #:use-module (gnu packages xorg)
71 #:use-module (gnu packages gl)
72 #:use-module (gnu packages m4)
73 #:use-module (gnu packages mpi)
74 #:use-module (gnu packages multiprecision)
75 #:use-module (gnu packages netpbm)
76 #:use-module (gnu packages pcre)
77 #:use-module (gnu packages popt)
78 #:use-module (gnu packages perl)
79 #:use-module (gnu packages pkg-config)
80 #:use-module (gnu packages python)
81 #:use-module (gnu packages readline)
82 #:use-module (gnu packages tbb)
83 #:use-module (gnu packages shells)
84 #:use-module (gnu packages tcl)
85 #:use-module (gnu packages texinfo)
86 #:use-module (gnu packages tex)
87 #:use-module (gnu packages tls)
88 #:use-module (gnu packages wxwidgets)
89 #:use-module (gnu packages xml)
90 #:use-module (gnu packages zip)
91 #:use-module (srfi srfi-1))
93 (define-public c-graph
99 (uri (string-append "mirror://gnu/c-graph/c-graph-" version
102 "1hlvpzrh7hzzf533diyfiabzskddi8zx92av9hwkjw3l46z7qv01"))))
103 (build-system gnu-build-system)
105 `(("fortran" ,gfortran)))
106 (synopsis "Visualizing and demonstrating convolution")
108 "GNU C-Graph is a tool for demonstrating the theory of convolution.
109 Thus, it can serve as an excellent aid to students of signal and systems
110 theory in visualizing the convolution process. Rather than forcing the
111 student to write code, the program offers an intuitive interface with
112 interactive dialogs to guide them.")
113 (license license:gpl3+)
114 (home-page "http://www.gnu.org/software/c-graph/")))
123 (uri (string-append "https://github.com/stcorp/coda/releases/download/"
124 version "/coda-" version ".tar.gz"))
126 (base32 "04b9l3wzcix0mnfq77mwnil6cbr8h2mki8myvy0lzn236qcwaq1h"))
127 (patches (search-patches "coda-use-system-libs.patch"))
128 (modules '((guix build utils)))
130 ;; Make sure we don't use the bundled software.
131 '(for-each (lambda (d)
132 (delete-file-recursively (string-append "libcoda/" d)))
133 '("zlib" "pcre" "expat")))))
135 `(("fortran" ,gfortran)
137 ("python-numpy" ,python-numpy)))
144 (build-system gnu-build-system)
146 '(#:configure-flags '("--with-hdf4" "--with-hdf5" "--enable-python"
147 "LIBS= -lz -lpcre -lexpat")))
148 (synopsis "A common interface to various earth observation data formats")
150 "The Common Data Access toolbox (CODA) provides a set of interfaces for
151 reading remote sensing data from earth observation data files. It consists of
152 command line applications and interfaces to the C, Fortran, Python, and Java
153 programming languages.")
154 (home-page "https://stcorp.nl/coda")
155 (license license:gpl2+)))
163 (uri (string-append "mirror://gnu/units/units-" version
166 "1awhjw9zjlfb8s5g3yyx63f7ddfcr1sanlbxpqifmrgq24ql198b"))))
167 (build-system gnu-build-system)
168 (synopsis "Conversion between thousands of scales")
170 "GNU Units converts numeric quantities between units of measure. It
171 can handle scale changes through adaptive usage of standard scale
172 prefixes (micro-, kilo-, etc.). It can also handle nonlinear
173 conversions such as Fahrenheit to Celsius. Its interpreter is powerful
174 enough to be used effectively as a scientific calculator.")
175 (license license:gpl3+)
176 (home-page "http://www.gnu.org/software/units/")))
178 (define-public double-conversion
180 (name "double-conversion")
185 "https://github.com/floitsch/double-conversion/archive/v"
187 (file-name (string-append name "-" version ".tar.gz"))
190 "0cnr8xhyjfxijay8ymkqcph3672wp2lj23qhdmr3m4kia5kpdf83"))))
191 (build-system cmake-build-system)
193 '(#:test-target "test"
194 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
195 "-DBUILD_TESTING=ON")))
196 (home-page "https://github.com/floitsch/double-conversion")
197 (synopsis "Conversion routines for IEEE doubles")
199 "The double-conversion library provides binary-decimal and decimal-binary
200 routines for IEEE doubles. The library consists of efficient conversion
201 routines that have been extracted from the V8 JavaScript engine.")
202 (license license:bsd-3)))
204 (define-public dionysus
210 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
214 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
215 (build-system gnu-build-system)
216 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
217 (synopsis "Local search for universal constants and scientific values")
219 "GNU Dionysus is a convenient system for quickly retrieving the values of
220 mathematical constants used in science and engineering. Values can be
221 searched using a simple command-line tool, choosing from three databases:
222 universal constants, atomic numbers, and constants related to
224 (license license:gpl3+)
225 (home-page "http://www.gnu.org/software/dionysus/")))
233 (uri (string-append "mirror://gnu/gsl/gsl-"
237 "095hp01d8lkqdvv0p1k25kvbisgfdmvx1rzpyc2i8kl2n33kvlhk"))
238 (patches (search-patches "gsl-test-i686.patch"))))
239 (build-system gnu-build-system)
241 `(#:parallel-tests? #f))
242 (home-page "http://www.gnu.org/software/gsl/")
243 (synopsis "Numerical library for C and C++")
245 "The GNU Scientific Library is a library for numerical analysis in C
246 and C++. It includes a wide range of mathematical routines, with over 1000
247 functions in total. Subject areas covered by the library include:
248 differential equations, linear algebra, Fast Fourier Transforms and random
250 (license license:gpl3+)))
259 (uri (string-append "mirror://gnu/glpk/glpk-"
263 "15z2ymzqhxwss6wgdj5f7vkyqlqdsjgrvm0x871kmlx0n0664mhk"))))
264 (build-system gnu-build-system)
268 `(#:configure-flags '("--with-gmp")))
269 (home-page "http://www.gnu.org/software/glpk/")
270 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
272 "GLPK is a C library for solving large-scale linear programming (LP),
273 mixed integer programming (MIP), and other related problems. It supports the
274 GNU MathProg modeling language, a subset of the AMPL language, and features a
275 translator for the language. In addition to the C library, a stand-alone
276 LP/MIP solver is included in the package.")
277 (license license:gpl3+)))
286 (uri (string-append "http://www.4ti2.de/version_" version
287 "/4ti2-" version ".tar.gz"))
290 "1frix3rnm9ffr93alqzw4cavxbfpf524l8rfbmcpyhwd3n1km0yl"))))
291 (build-system gnu-build-system)
293 `(("which" ,(@ (gnu packages base) which)))) ; for the tests
297 (home-page "http://www.4ti2.de/")
298 (synopsis "Mathematical tool suite for problems on linear spaces")
300 "4ti2 implements algorithms for solving algebraic, geometric and
301 combinatorial problems on linear spaces. Among others, it solves systems
302 of linear equations, computes extreme rays of polyhedral cones, solves
303 integer programming problems and computes Markov bases for statistics.")
304 (license license:gpl2+)))
306 (define-public cddlib
313 (uri (string-append "ftp://ftp.ifor.math.ethz.ch/pub/fukuda/cdd/cddlib-"
314 (string-delete #\. version) ".tar.gz"))
317 "1dasasscwfg793q8fwzgwf64xwj7w62yfvszpr8x8g38jka08vgy"))))
318 (build-system gnu-build-system)
321 (home-page "https://www.inf.ethz.ch/personal/fukudak/cdd_home/index.html")
322 (synopsis "Library for convex hulls and extreme rays of polyhedra")
324 "The C-library cddlib implements the Double Description Method of
325 Motzkin et al. for generating all vertices (i.e. extreme points) and extreme
326 rays of a general convex polyhedron given by a system of linear inequalities
327 in arbitrary dimension. It can also be used for the converse operation of
328 computing convex hulls.")
329 (license license:gpl2+)))
331 (define-public arpack-ng
338 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
340 (file-name (string-append name "-" version ".tar.gz"))
343 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
344 (build-system gnu-build-system)
345 (home-page "https://github.com/opencollab/arpack-ng")
348 ("fortran" ,gfortran)))
349 (synopsis "Fortran subroutines for solving eigenvalue problems")
351 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
352 large scale eigenvalue problems.")
353 (license (license:non-copyleft "file://COPYING"
354 "See COPYING in the distribution."))))
356 (define-public arpack-ng-openmpi
357 (package (inherit arpack-ng)
358 (name "arpack-ng-openmpi")
361 ,@(package-inputs arpack-ng)))
362 (arguments `(#:configure-flags '("--enable-mpi")))
363 (synopsis "Fortran subroutines for solving eigenvalue problems with MPI")))
365 (define-public lapack
372 (uri (string-append "http://www.netlib.org/lapack/lapack-"
376 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
377 (build-system cmake-build-system)
378 (home-page "http://www.netlib.org/lapack/")
379 (inputs `(("fortran" ,gfortran)
380 ("python" ,python-2)))
382 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES"
384 #:phases (alist-cons-before
386 (lambda* (#:key inputs #:allow-other-keys)
387 (let ((python (assoc-ref inputs "python")))
388 (substitute* "lapack_testing.py"
389 (("/usr/bin/env python") python))))
391 (synopsis "Library for numerical linear algebra")
393 "LAPACK is a Fortran 90 library for solving the most commonly occurring
394 problems in numerical linear algebra.")
395 (license (license:non-copyleft "file://LICENSE"
396 "See LICENSE in the distribution."))))
398 (define-public scalapack
405 (uri (string-append "http://www.netlib.org/scalapack/scalapack-"
409 "0p1r61ss1fq0bs8ynnx7xq4wwsdvs32ljvwjnx6yxr8gd6pawx0c"))))
410 (build-system cmake-build-system)
413 ("fortran" ,gfortran)
414 ("lapack" ,lapack))) ;for testing only
416 `(#:configure-flags `("-DBUILD_SHARED_LIBS:BOOL=YES")))
417 (home-page "http://www.netlib.org/scalapack/")
418 (synopsis "Library for scalable numerical linear algebra")
420 "ScaLAPACK is a Fortran 90 library of high-performance linear algebra
421 routines on parallel distributed memory machines. ScaLAPACK solves dense and
422 banded linear systems, least squares problems, eigenvalue problems, and
423 singular value problems.")
424 (license (license:bsd-style "file://LICENSE"
425 "See LICENSE in the distribution."))))
427 (define-public gnuplot
428 ;; Gnuplot version 5.0.4 was updated in-place, resulting in a hash mismatch.
429 ;; This can be removed at the next version update.
430 (let ((upstream-version "5.0.4")
434 (version (string-append upstream-version "-" guix-revision))
438 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
439 upstream-version "/gnuplot-"
440 upstream-version ".tar.gz"))
443 "07n3w12dkcxjnhsvsliaqnkhajhi818v6q8mkpmpbplbf92vh70m"))))
444 (build-system gnu-build-system)
445 (inputs `(("readline" ,readline)
449 (native-inputs `(("pkg-config" ,pkg-config)
450 ("texlive" ,texlive-minimal)))
451 (home-page "http://www.gnuplot.info")
452 (synopsis "Command-line driven graphing utility")
453 (description "Gnuplot is a portable command-line driven graphing
454 utility. It was originally created to allow scientists and students to
455 visualize mathematical functions and data interactively, but has grown to
456 support many non-interactive uses such as web scripting. It is also used as a
457 plotting engine by third-party applications like Octave.")
458 ;; X11 Style with the additional restriction that derived works may only be
459 ;; distributed as patches to the original.
460 (license (license:fsf-free
461 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright")))))
470 (uri (string-append "https://github.com/OkoSanto/GCTP/archive/v"
472 (file-name (string-append name "-" version ".tar.gz"))
475 "0l9aqnqynh9laicn5dxf3rsb1n14xiks79wbyqccirzmjqd1c1x4"))))
477 `(("fortran" ,gfortran)))
478 (build-system gnu-build-system)
479 (synopsis "General Cartographic Transformation Package (GCTP)")
481 "The General Cartographic Transformation Package (GCTP) is a system of
482 software routines designed to permit the transformation of coordinate pairs
483 from one map projection to another. The GCTP is the standard computer
484 software used by the National Mapping Division for map projection
486 (home-page "https://github.com/OkoSanto/GCTP")
487 (license license:public-domain))) ;https://www2.usgs.gov/laws/info_policies.html
496 (uri (string-append "https://support.hdfgroup.org/ftp/HDF/releases/HDF"
497 version "/src/hdf-" version ".tar.bz2"))
499 (base32 "16yr50j845zlfx20skmw3y75ww77akk9gg0affjqkg66ih5r03mv"))
500 (patches (search-patches "hdf4-architectures.patch"
501 "hdf4-reproducibility.patch"
502 "hdf4-shared-fortran.patch"))))
504 (build-system gnu-build-system)
506 `(("gfortran" ,gfortran)
511 ("libjpeg" ,libjpeg)))
513 `(#:parallel-tests? #f
514 #:configure-flags '("--enable-shared")
516 (modify-phases %standard-phases
517 (add-before 'configure 'patchbuild
520 '("mfhdf/hdfimport/testutil.sh.in" "hdf/util/testutil.sh.in")
522 (("/bin/mkdir") "mkdir"))
523 (substitute* (find-files "." "^Makefile\\.in$")
524 (("@HDF_BUILD_XDR_TRUE@XDR_ADD = \
525 -R\\$\\(abs_top_builddir\\)/mfhdf/xdr/\\.libs") "")
526 (("@HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = \
527 -R\\$\\(abs_top_builddir\\)/mfhdf/libsrc/\\.libs \
528 -R\\$\\(abs_top_builddir\\)/hdf/src/\\.libs \\$\\(XDR_ADD\\)") "")))))))
529 (home-page "https://www.hdfgroup.org/products/hdf4/")
531 "Library and multi-object file format for storing and managing data")
532 (description "HDF4 is a library and multi-object file format for storing
533 and managing data between machines. HDF4 is an older hierarchical data format,
534 incompatible with HDF5.")
536 (license:non-copyleft
537 "https://www.hdfgroup.org/ftp/HDF/HDF_Current/src/unpacked/COPYING"))))
539 (define-public hdf4-alt
544 (substitute-keyword-arguments (package-arguments hdf4)
545 ((#:configure-flags flags) `(cons* "--disable-netcdf" ,flags))))
547 "HDF4 without netCDF API, can be combined with the regular netCDF library")))
556 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-"
560 (base32 "0sj8x0gfs5fb28gipnynb9wpkz113h8wq9sva9mxx66kv27xsdgw"))
561 (patches (list (search-patch "hdf5-config-date.patch")))))
562 (build-system gnu-build-system)
567 (modify-phases %standard-phases
568 (add-before 'configure 'patch-configure
570 (substitute* "configure"
573 (add-after 'install 'patch-references
574 (lambda* (#:key inputs outputs #:allow-other-keys)
575 (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
576 (zlib (assoc-ref inputs "zlib")))
577 (substitute* (find-files bin "h5p?cc")
579 (string-append "-L" zlib "/lib " lib)))
581 (home-page "http://www.hdfgroup.org")
582 (synopsis "Management suite for extremely large and complex data")
583 (description "HDF5 is a suite that makes possible the management of
584 extremely large and complex data collections.")
585 (license (license:x11-style
586 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
588 (define-public hdf-eos2
595 (uri "ftp://edhs1.gsfc.nasa.gov\
596 /edhs/hdfeos/latest_release/HDF-EOS2.19v1.00.tar.Z")
598 (base32 "0c9fcz25s292ldap12wxmlrvnyz99z24p63d8fwx51bf8s0s1zrz"))
599 (patches (search-patches "hdf-eos2-remove-gctp.patch"
600 "hdf-eos2-build-shared.patch"
601 "hdf-eos2-fortrantests.patch"))))
602 (build-system gnu-build-system)
604 `(("gfortran" ,gfortran)))
606 `(("hdf4" ,hdf4-alt) ; assume most HDF-EOS2 users won't use the HDF4 netCDF API
611 `( #:configure-flags '("--enable-install-include" "--enable-shared"
612 "CC=h4cc -Df2cFortran" "LIBS=-lgctp")
613 #:parallel-tests? #f))
614 (home-page "http://hdfeos.org/software/library.php#HDF-EOS2")
615 (synopsis "HDF4-based data format for NASA's Earth Observing System")
616 (description "HDF-EOS2 is a software library built on HDF4 which supports
617 the construction of data structures used in NASA's Earth Observing
618 System (Grid, Point and Swath).")
620 ;; Source files carry a permissive license header.
621 (license (license:non-copyleft home-page))))
623 (define-public hdf-eos5
629 (uri (string-append "ftp://edhs1.gsfc.nasa.gov\
630 /edhs/hdfeos5/latest_release/HDF-EOS5." version ".tar.Z"))
633 "1p83333nzzy8rn5chxlm0hrkjjnhh2w1ji8ac0f9q4xzg838i58i"))
634 (patches (search-patches "hdf-eos5-build-shared.patch"
635 "hdf-eos5-remove-gctp.patch"
636 "hdf-eos5-fix-szip.patch"
637 "hdf-eos5-fortrantests.patch"))))
639 `(("gfortran" ,gfortran)))
640 (build-system gnu-build-system)
646 `(#:configure-flags '("--enable-install-include" "--enable-shared"
647 "CC=h5cc -Df2cFortran" "LIBS=-lgctp")
648 #:parallel-tests? #f))
649 (synopsis "HDF5-based data format for NASA's Earth Observing System")
651 "HDF-EOS5 is a software library built on HDF5 to support the construction
652 of data structures used in NASA's Earth Observing System (Grid, Point and
654 (home-page "http://www.hdfeos.org/software/library.php#HDF-EOS5")
656 ;; Source files carry a permissive license header.
657 (license (license:non-copyleft home-page))))
659 (define-public hdf5-parallel-openmpi
660 (package (inherit hdf5)
661 (name "hdf5-parallel-openmpi")
664 ,@(package-inputs hdf5)))
666 (substitute-keyword-arguments `(#:configure-flags '("--enable-parallel")
667 ,@(package-arguments hdf5))
669 `(modify-phases ,phases
670 (add-before 'check 'patch-tests
672 ;; OpenMPI's mpirun will exit with non-zero status if it
673 ;; detects an "abnormal termination", i.e. any process not
674 ;; calling MPI_Finalize(). Since the test is explicitely
675 ;; avoiding MPI_Finalize so as not to have at_exit and thus
676 ;; H5C_flush_cache from being called, mpirun will always
677 ;; complain, so turn this test off.
678 (substitute* "testpar/Makefile"
679 (("(^TEST_PROG_PARA.*)t_pflush1(.*)" front back)
680 (string-append front back "\n")))
681 (substitute* "tools/h5diff/testph5diff.sh"
682 (("/bin/sh") (which "sh")))
684 (synopsis "Management suite for data with parallel IO support")))
686 (define-public h5check
693 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/tools/"
694 "h5check/src/h5check-" version ".tar.gz"))
697 "1gm76jbwhz9adbxgn14zx8cj33dmjdr2g5xcy0m9c2gakp8w59kj"))))
698 (build-system gnu-build-system)
699 (inputs `(("hdf5" ,hdf5))) ;h5cc for tests
700 (home-page "https://www.hdfgroup.org/products/hdf5_tools/h5check.html")
701 (synopsis "HDF5 format checker")
702 (description "@code{h5check} is a validation tool for verifying that an
703 HDF5 file is encoded according to the HDF File Format Specification.")
704 (license (license:x11-style "file://COPYING"))))
706 (define-public netcdf
713 (uri (string-append "ftp://ftp.unidata.ucar.edu/pub/netcdf/"
714 "netcdf-" version ".tar.gz"))
717 "0y6gdcplarwqqnrav2xg1xd6ih732rzzbmdw78v3rl5b8mwcnh0d"))
718 (patches (list (search-patch "netcdf-config-date.patch")))))
719 (build-system gnu-build-system)
723 ("graphviz" ,graphviz)))
728 `(#:configure-flags '("--enable-doxygen" "--enable-dot")
729 #:parallel-tests? #f)) ;various race conditions
730 (home-page "http://www.unidata.ucar.edu/software/netcdf/")
731 (synopsis "Library for scientific data")
732 (description "NetCDF is an interface for scientific data access and a
733 software library that provides an implementation of the interface. The netCDF
734 library defines a machine-independent format for representing scientific data.
735 Together, the interface, library, and format support the creation, access, and
736 sharing of scientific data.")
737 (license (license:x11-style "file://COPYRIGHT"))))
739 (define-public netcdf-parallel-openmpi
740 (package (inherit netcdf)
741 (name "netcdf-parallel-openmpi")
744 ,@(alist-replace "hdf5" (list hdf5-parallel-openmpi)
745 (package-inputs netcdf))))
746 ;; TODO: Replace pkg-config references in nc-config with absolute references
748 (substitute-keyword-arguments (package-arguments netcdf)
749 ((#:configure-flags flags)
750 `(cons* "CC=mpicc" "CXX=mpicxx"
751 "--enable-parallel-tests"
752 ;; Shared libraries not supported with parallel IO.
753 "--disable-shared" "--with-pic"
762 (uri (string-append "http://ab-initio.mit.edu/nlopt/nlopt-"
765 (base32 "12cfkkhcdf4zmb6h7y6qvvdvqjs2xf9sjpa3rl3bq76px4yn76c0"))))
766 (build-system gnu-build-system)
768 `(;; Shared libraries are not built by default. They are required to
769 ;; build the Guile, Octave, and Python bindings.
770 #:configure-flags '("--enable-shared")
773 (modify-phases %standard-phases
774 (add-before 'configure 'set-libnlopt-file-name
775 (lambda* (#:key outputs #:allow-other-keys)
776 ;; Make sure the Scheme module refers to the library by its
777 ;; absolute file name (we cannot do that from a snippet
778 ;; because the expansion of @libdir@ contains
780 (let ((out (assoc-ref outputs "out")))
781 (substitute* "swig/nlopt.scm.in"
783 (string-append out "/lib/libnlopt")))
785 (inputs `(("guile" ,guile-2.0)))
786 (native-inputs `(("pkg-config" ,pkg-config)))
787 (home-page "http://ab-initio.mit.edu/wiki/")
788 (synopsis "Library for nonlinear optimization")
789 (description "NLopt is a library for nonlinear optimization, providing a
790 common interface for a number of different free optimization routines available
791 online as well as original implementations of various other algorithms.")
792 (license license:lgpl2.1+)))
801 "http://www.coin-or.org/download/source/Ipopt/Ipopt-"
805 "09bk2hqy2vgi4yi76xng9zxakddwqy3wij9nx7wf2vfbxxpazrsk"))
806 (modules '((guix build utils)))
808 ;; Make sure we don't use the bundled software.
809 '(delete-file-recursively "ThirdParty"))))
810 (build-system gnu-build-system)
812 '(#:phases (modify-phases %standard-phases
813 (add-after 'install 'add--L-flags-in-ipopt.pc
814 (lambda* (#:key inputs outputs #:allow-other-keys)
815 ;; The '.pc' file lists '-llapack -lblas' in "Libs";
816 ;; move it to "Libs.private" where it belongs, and add a
817 ;; '-L' flag for LAPACK.
818 (let ((out (assoc-ref outputs "out"))
819 (lapack (assoc-ref inputs "lapack")))
820 (substitute* (string-append out "/lib/pkgconfig/"
822 (("Libs: (.*)-llapack -lblas(.*)$" _ before after)
823 (string-append "Libs: " before " " after "\n"
824 "Libs.private: " before
825 "-L" lapack "/lib -llapack -lblas "
829 `(("gfortran" ,gfortran)))
831 ;; TODO: Maybe add dependency on COIN-MUMPS, ASL, and HSL.
832 `(("lapack" ,lapack))) ;for both libblas and liblapack
833 (home-page "http://www.coin-or.org")
834 (synopsis "Large-scale nonlinear optimizer")
836 "The Interior Point Optimizer (IPOPT) is a software package for
837 large-scale nonlinear optimization. It provides C++, C, and Fortran
839 (license license:epl1.0)))
843 (name "ceres-solver")
845 (home-page "http://ceres-solver.org/")
848 (uri (string-append home-page "ceres-solver-"
852 "0i7qkbf8g6pd8arxzldppga26ckv93y8zldsfz6wbd4n6b1nqrjd"))))
853 (build-system cmake-build-system)
855 ;; TODO: Build HTML user documentation and install separately.
856 '(#:configure-flags '("-DBUILD_EXAMPLES=OFF"
857 "-DBUILD_SHARED_LIBS=ON")
859 #:phases (modify-phases %standard-phases
860 (add-before 'configure 'set-library-directory
862 ;; Install libraries to lib/, not lib64/.
863 (substitute* "internal/ceres/CMakeLists.txt"
864 (("set\\(LIB_SUFFIX \"64\"\\)")
865 "set(LIB_SUFFIX \"\")"))
868 `(("pkg-config" ,pkg-config)))
870 `(("glog" ,glog))) ;for #include <glog/glog.h>
875 ("suitesparse" ,suitesparse)
877 (synopsis "C++ library for solving large optimization problems")
879 "Ceres Solver is a C++ library for modeling and solving large,
880 complicated optimization problems. It is a feature rich, mature and
881 performant library which has been used in production since 2010. Ceres Solver
882 can solve two kinds of problems:
884 @item non-linear least squares problems with bounds constraints;
885 @item general unconstrained optimization problems.
887 (license license:bsd-3)))
889 ;; For a fully featured Octave, users are strongly recommended also to install
890 ;; the following packages: texinfo, less, ghostscript, gnuplot.
891 (define-public octave
898 (uri (string-append "mirror://gnu/octave/octave-"
902 "11day29k4yfvxh4101x5yf26ld992x5n6qvmhjjk6mzsd26fqayw"))))
903 (build-system gnu-build-system)
906 ("readline" ,readline)
910 ("arpack" ,arpack-ng)
913 ("fontconfig" ,fontconfig)
914 ("freetype" ,freetype)
921 `(("gfortran" ,gfortran)
922 ("pkg-config" ,pkg-config)
924 ;; The following inputs are not actually used in the build process.
925 ;; However, the ./configure gratuitously tests for their existence and
926 ;; assumes that programs not present at build time are also not, and
927 ;; can never be, available at run time! If these inputs are therefore
928 ;; not present, support for them will be built out. However, Octave
929 ;; will still run without them, albeit without the features they
933 ("ghostscript" ,ghostscript)
934 ("gnuplot" ,gnuplot)))
937 (list (string-append "--with-shell="
938 (assoc-ref %build-inputs "bash")
940 (home-page "http://www.gnu.org/software/octave/")
941 (synopsis "High-level language for numerical computation")
942 (description "GNU Octave is a high-level interpreted language that is
943 specialized for numerical computations. It can be used for both linear and
944 non-linear applications and it provides great support for visualizing results.
945 Work may be performed both at the interactive command-line as well as via
947 (license license:gpl3+)))
956 (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
957 version "-source.tgz"))
959 (base32 "1ilplibvjgf7a905grpnclrvkmqy9fgrpl7xyp3w4yl1qc682v9b"))
960 (modules '((guix build utils)))
962 ;; Remove non-free METIS code
963 '(delete-file-recursively "contrib/Metis"))))
964 (build-system cmake-build-system)
967 ("gfortran" ,gfortran)
974 ("libxext" ,libxext)))
976 `(("fontconfig" ,fontconfig)
979 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
980 "-DENABLE_BUILD_SHARED:BOOL=ON"
981 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")
982 #:phases (modify-phases %standard-phases
986 (zero? (system* "make" "test"
987 ;; Disable this test. See
988 ;; https://geuz.org/trac/gmsh/ticket/271
989 "ARGS=-E component8_in_a_box")))))))
990 (home-page "http://www.geuz.org/gmsh/")
991 (synopsis "3D finite element grid generator")
992 (description "Gmsh is a 3D finite element grid generator with a built-in
993 CAD engine and post-processor. Its design goal is to provide a fast, light
994 and user-friendly meshing tool with parametric input and advanced
995 visualization capabilities. Gmsh is built around four modules: geometry,
996 mesh, solver and post-processing. The specification of any input to these
997 modules is done either interactively using the graphical user interface or in
998 ASCII text files using Gmsh's own scripting language.")
999 (license license:gpl2+)))
1001 (define-public petsc
1008 ;; The *-lite-* tarball does not contain the *large* documentation
1009 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
1010 "petsc-lite-" version ".tar.gz"))
1012 (base32 "0jfrq6rd4zagw1iimz05m2w91k0jvz3qbik1lk8pqcxw3rvdqk5d"))))
1013 (build-system gnu-build-system)
1015 `(("python" ,python-2)
1018 `(("gfortran" ,gfortran)
1020 ("superlu" ,superlu)
1021 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
1022 ;; leaving out opengl, as configuration seems to only be for mac
1025 `(#:test-target "test"
1026 #:parallel-build? #f ;build is parallel by default
1031 ,(string-append "--with-superlu-include="
1032 (assoc-ref %build-inputs "superlu") "/include")
1033 ,(string-append "--with-superlu-lib="
1034 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
1036 (modify-phases %standard-phases
1038 ;; PETSc's configure script is actually a python script, so we can't
1039 ;; run it with bash.
1040 (lambda* (#:key outputs (configure-flags '())
1042 (let* ((prefix (assoc-ref outputs "out"))
1043 (flags `(,(string-append "--prefix=" prefix)
1044 ,@configure-flags)))
1045 (format #t "build directory: ~s~%" (getcwd))
1046 (format #t "configure flags: ~s~%" flags)
1047 (zero? (apply system* "./configure" flags)))))
1048 (add-after 'configure 'clean-local-references
1049 (lambda* (#:key inputs outputs #:allow-other-keys)
1050 (let ((out (assoc-ref outputs "out")))
1051 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
1052 ;; Prevent build directory from leaking into compiled code
1054 ;; Scrub timestamp for reproducibility
1055 ((".*Libraries compiled on.*") ""))
1057 (add-after 'install 'clean-install
1058 ;; Try to keep installed files from leaking build directory names.
1059 (lambda* (#:key inputs outputs #:allow-other-keys)
1060 (let ((out (assoc-ref outputs "out")))
1061 (substitute* (map (lambda (file)
1062 (string-append out "/lib/petsc/conf/" file))
1063 '("petscvariables"))
1065 ;; Make compiler references point to the store
1066 (substitute* (string-append out "/lib/petsc/conf/petscvariables")
1067 (("= (gcc|g\\+\\+|gfortran)" _ compiler)
1068 (string-append "= " (which compiler))))
1069 ;; PETSc installs some build logs, which aren't necessary.
1070 (for-each (lambda (file)
1071 (let ((f (string-append out "/lib/petsc/conf/" file)))
1072 (when (file-exists? f)
1074 '("configure.log" "make.log" "gmake.log"
1075 "test.log" "error.log" "RDict.db"
1076 "PETScBuildInternal.cmake"
1077 ;; Once installed, should uninstall with Guix
1080 (home-page "http://www.mcs.anl.gov/petsc")
1081 (synopsis "Library to solve PDEs")
1082 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
1083 data structures and routines for the scalable (parallel) solution of
1084 scientific applications modeled by partial differential equations.")
1085 (license (license:non-copyleft
1086 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
1088 (define-public petsc-complex
1089 (package (inherit petsc)
1090 (name "petsc-complex")
1092 (substitute-keyword-arguments (package-arguments petsc)
1093 ((#:configure-flags cf)
1094 `(cons "--with-scalar-type=complex" ,cf))))
1095 (synopsis "Library to solve PDEs (with complex scalars)")))
1097 (define-public petsc-openmpi
1098 (package (inherit petsc)
1099 (name "petsc-openmpi")
1101 `(("openmpi" ,openmpi)
1102 ,@(package-inputs petsc)))
1104 (substitute-keyword-arguments (package-arguments petsc)
1105 ((#:configure-flags cf)
1106 ``("--with-mpiexec=mpirun"
1107 ,(string-append "--with-mpi-dir="
1108 (assoc-ref %build-inputs "openmpi"))
1109 ,@(delete "--with-mpi=0" ,cf)))))
1110 (synopsis "Library to solve PDEs (with MPI support)")))
1112 (define-public petsc-complex-openmpi
1113 (package (inherit petsc-complex)
1114 (name "petsc-complex-openmpi")
1116 `(("openmpi" ,openmpi)
1117 ,@(package-inputs petsc-complex)))
1119 (substitute-keyword-arguments (package-arguments petsc-complex)
1120 ((#:configure-flags cf)
1121 ``("--with-mpiexec=mpirun"
1122 ,(string-append "--with-mpi-dir="
1123 (assoc-ref %build-inputs "openmpi"))
1124 ,@(delete "--with-mpi=0" ,cf)))))
1125 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
1127 (define-public slepc
1134 (uri (string-append "http://slepc.upv.es/download/download.php?"
1135 "filename=slepc-" version ".tar.gz"))
1136 (file-name (string-append name "-" version ".tar.gz"))
1139 "1hijlmrvxvfqslnx8yydzw5xqbsn1yy02g32w0hln1z3cgr1c0k7"))))
1140 (build-system gnu-build-system)
1142 `(("python" ,python-2)))
1144 `(("arpack" ,arpack-ng)
1145 ("gfortran" ,gfortran)))
1147 `(("petsc" ,petsc)))
1149 `(#:parallel-build? #f ;build is parallel by default
1151 `(,(string-append "--with-arpack-dir="
1152 (assoc-ref %build-inputs "arpack") "/lib"))
1154 (modify-phases %standard-phases
1156 ;; configure is a python script, so we can't run it with bash.
1157 (lambda* (#:key inputs outputs (configure-flags '())
1159 (let* ((prefix (assoc-ref outputs "out"))
1160 (flags `(,(string-append "--prefix=" prefix)
1161 ,@configure-flags)))
1162 (format #t "build directory: ~s~%" (getcwd))
1163 (format #t "configure flags: ~s~%" flags)
1164 (setenv "SLEPC_DIR" (getcwd))
1165 (setenv "PETSC_DIR" (assoc-ref inputs "petsc"))
1166 (zero? (apply system* "./configure" flags)))))
1167 (add-after 'install 'delete-doc
1168 ;; TODO: SLEPc installs HTML documentation alongside headers in
1169 ;; $out/include. We'd like to move them to share/doc, but delete
1170 ;; them for now, as they are incomplete and installing the complete
1171 ;; documentation is difficult.
1172 (lambda* (#:key outputs #:allow-other-keys)
1173 (let* ((out (assoc-ref outputs "out")))
1174 (for-each delete-file (find-files out "\\.html$")))))
1175 (add-after 'install 'clean-install
1176 ;; Clean up unnecessary build logs from installation.
1177 (lambda* (#:key outputs #:allow-other-keys)
1178 (let ((out (assoc-ref outputs "out")))
1179 (for-each (lambda (file)
1180 (let ((f (string-append out "/lib/slepc/conf/" file)))
1181 (when (file-exists? f)
1183 '("configure.log" "make.log" "gmake.log"
1184 "test.log" "error.log" "RDict.db"
1185 "uninstall.py"))))))))
1186 (home-page "http://slepc.upv.es")
1187 (synopsis "Scalable library for eigenproblems")
1188 (description "SLEPc is a software library for the solution of large sparse
1189 eigenproblems on parallel computers. It can be used for the solution of
1190 linear eigenvalue problems formulated in either standard or generalized form,
1191 as well as other related problems such as the singular value decomposition.
1192 The emphasis of the software is on methods and techniques appropriate for
1193 problems in which the associated matrices are sparse, for example, those
1194 arising after the discretization of partial differential equations.")
1195 (license license:lgpl3)))
1197 (define-public slepc-complex
1198 (package (inherit slepc)
1199 (name "slepc-complex")
1201 `(("petsc" ,petsc-complex)
1202 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
1203 (synopsis "Scalable library for eigenproblems (with complex scalars)")))
1205 (define-public slepc-openmpi
1206 (package (inherit slepc)
1207 (name "slepc-openmpi")
1210 ("arpack" ,arpack-ng-openmpi)
1211 ,@(alist-delete "arpack" (package-inputs slepc))))
1213 `(("petsc" ,petsc-openmpi)
1214 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
1215 (synopsis "Scalable library for eigenproblems (with MPI support)")))
1217 (define-public slepc-complex-openmpi
1218 (package (inherit slepc-openmpi)
1219 (name "slepc-complex-openmpi")
1221 `(("petsc" ,petsc-complex-openmpi)
1222 ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
1223 (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
1225 (define-public mumps
1232 (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
1236 "0igyc1pfzxdhpbad3v3lb86ixkdbqa1a8gbs15b04r2294h2nabp"))
1237 (patches (search-patches "mumps-build-parallelism.patch"))))
1238 (build-system gnu-build-system)
1240 `(("fortran" ,gfortran)
1241 ;; These are required for linking against mumps, but we let the user
1242 ;; declare the dependency.
1245 ("scotch" ,scotch)))
1247 `(#:modules ((ice-9 match)
1250 ,@%gnu-build-system-modules)
1252 (modify-phases %standard-phases
1254 (lambda* (#:key inputs #:allow-other-keys)
1255 (call-with-output-file "Makefile.inc"
1266 INCSEQ = -I$(topdir)/libseq
1267 LIBSEQ = -L$(topdir)/libseq -lmpiseq
1268 LIBSEQNEEDED = libseqneeded~;
1272 AR = ar vr # rules require trailing space, ugh...
1274 LIBBLAS = -L~a -lopenblas~@[
1275 SCALAP = -L~a -lscalapack~]
1276 LIBOTHERS = -pthread
1279 OPTF = -O2 -DALLOW_NON_INIT $(PIC)
1283 LIBS = $(SCALAP) $(LIBSEQ)
1284 LPORDDIR = $(topdir)/PORD/lib
1285 IPORD = -I$(topdir)/PORD/include
1286 LPORD = -L$(LPORDDIR) -lpord
1287 ORDERINGSF = -Dpord~@[
1289 IMETIS = -I$(METISDIR)/include
1290 LMETIS = -L$(METISDIR)/lib -lmetis
1291 ORDERINGSF += -Dmetis~]~@[~:{
1293 ISCOTCH = -I$(SCOTCHDIR)/include
1294 LSCOTCH = -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
1295 ORDERINGSF += ~a~}~]
1296 ORDERINGSC = $(ORDERINGSF)
1297 LORDERINGS = $(LPORD) $(LMETIS) $(LSCOTCH)
1298 IORDERINGSF = $(ISCOTCH)
1299 IORDERINGSC = $(IPORD) $(IMETIS) $(ISCOTCH)"
1300 (assoc-ref inputs "mpi")
1301 (assoc-ref inputs "blas")
1302 (assoc-ref inputs "scalapack")
1303 (assoc-ref inputs "metis")
1304 (match (list (assoc-ref inputs "pt-scotch")
1305 (assoc-ref inputs "scotch"))
1309 `((,scotch "" "-Dscotch")))
1312 "-lptesmumps -lptscotch -lptscotcherr "
1313 "-Dptscotch")))))))))
1315 ;; By default only the d-precision library is built. Make with "all"
1316 ;; target so that all precision libraries and examples are built.
1318 (zero? (system* "make" "all"
1319 (format #f "-j~a" (parallel-job-count))))))
1321 ;; Run the simple test drivers, which read test input from stdin:
1322 ;; from the "real" input for the single- and double-precision
1323 ;; testers, and from the "cmplx" input for complex-precision
1324 ;; testers. The EXEC-PREFIX key is used by the mumps-openmpi
1325 ;; package to prefix execution with "mpirun".
1326 (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
1327 (with-directory-excursion "examples"
1330 (let ((tester (apply open-pipe*
1333 ,(string-append "./" prec
1335 (input (open-input-file
1336 (string-append "input_simpletest_" type))))
1338 (dump-port input tester)
1340 (zero? (close-pipe tester)))))
1342 '("real" "real" "cmplx" "cmplx")))))
1344 (lambda* (#:key outputs #:allow-other-keys)
1345 (let* ((out (assoc-ref outputs "out"))
1346 (libdir (string-append out "/lib")))
1347 (copy-recursively "lib" libdir)
1348 (copy-recursively "include" (string-append out "/include"))
1349 (when (file-exists? "libseq/libmpiseq.a")
1350 (install-file "libseq/libmpiseq.a" libdir))
1352 (home-page "http://mumps.enseeiht.fr")
1353 (synopsis "Multifrontal sparse direct solver")
1355 "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
1356 sparse system of linear equations A x = b using Guassian elimination.")
1357 (license license:cecill-c)))
1359 (define-public mumps-metis
1360 (package (inherit mumps)
1361 (name "mumps-metis")
1363 (alist-delete "scotch" (package-inputs mumps)))))
1365 (define-public mumps-openmpi
1366 (package (inherit mumps)
1367 (name "mumps-openmpi")
1370 ("scalapack" ,scalapack)
1371 ("pt-scotch" ,pt-scotch)
1372 ,@(alist-delete "scotch" (package-inputs mumps))))
1374 (substitute-keyword-arguments (package-arguments mumps)
1376 `(modify-phases ,phases
1380 ((assoc-ref ,phases 'check)
1381 #:exec-prefix '("mpirun" "-n" "2"))))))))
1382 (synopsis "Multifrontal sparse direct solver (with MPI)")))
1384 (define-public mumps-metis-openmpi
1385 (package (inherit mumps-openmpi)
1386 (name "mumps-metis-openmpi")
1388 (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
1390 (define-public r-quadprog
1397 (uri (cran-uri "quadprog" version))
1400 "0jg3r6abmhp8r9vkbhpx9ldjfw6vyl1m4c5vwlyjhk1mi03656fr"))))
1401 (build-system r-build-system)
1403 `(("gfortran" ,gfortran)))
1404 (home-page "http://cran.r-project.org/web/packages/quadprog")
1405 (synopsis "Functions to solve quadratic programming problems")
1407 "This package contains routines and documentation for solving quadratic
1408 programming problems.")
1409 (license license:gpl3+)))
1411 (define-public r-pracma
1417 (uri (cran-uri "pracma" version))
1419 (base32 "19nr2jlkbcdgvw3gx5hry12av565lmvqd5q4h7zlch3q13avwwl2"))))
1420 (build-system r-build-system)
1422 `(("r-quadprog" ,r-quadprog)))
1423 (home-page "http://cran.r-project.org/web/packages/pracma")
1424 (synopsis "Practical numerical math functions")
1425 (description "This package provides functions for numerical analysis and
1426 linear algebra, numerical optimization, differential equations, plus some
1427 special functions. It uses Matlab function names where appropriate to simplify
1429 (license license:gpl3+)))
1431 (define-public superlu
1438 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
1439 "superlu_" version ".tar.gz"))
1441 (base32 "0qzlb7cd608q62kyppd0a8c65l03vrwqql6gsm465rky23b6dyr8"))
1442 (modules '((guix build utils)))
1444 ;; Replace the non-free implementation of MC64 with a stub adapted
1447 (use-modules (ice-9 regex)
1449 (call-with-output-file "SRC/mc64ad.c"
1454 void mc64id_(int *a) {
1455 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
1458 void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
1459 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
1460 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
1463 ;; Remove the corresponding license verbiage. MC64 license follows
1464 ;; a "------" line separator.
1465 (with-atomic-file-replacement "License.txt"
1466 (let ((rx (make-regexp "-{8}")))
1469 (let ((line (read-line in 'concat)))
1470 (unless (regexp-exec rx line)
1473 (build-system cmake-build-system)
1477 `(("blas" ,openblas)
1478 ("gfortran" ,gfortran)))
1480 `(#:configure-flags '("-Denable_blaslib:BOOL=NO" ;do not use internal cblas
1481 "-DTPL_BLAS_LIBRARIES=openblas"
1482 "-DBUILD_SHARED_LIBS:BOOL=YES"
1483 "-DCMAKE_INSTALL_LIBDIR=lib")))
1484 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
1485 (synopsis "Supernodal direct solver for sparse linear systems")
1487 "SuperLU is a general purpose library for the direct solution of large,
1488 sparse, nonsymmetric systems of linear equations on high performance machines.
1489 The library is written in C and is callable from either C or Fortran. The
1490 library routines perform an LU decomposition with partial pivoting and
1491 triangular system solves through forward and back substitution. The library
1492 also provides threshold-based ILU factorization preconditioners.")
1493 (license (list license:bsd-3
1494 license:gpl2+ ;EXAMPLE/*fgmr.c
1495 (license:fsf-free "file://SRC/colamd.h")))))
1497 (define-public superlu-dist
1499 (name "superlu-dist")
1504 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
1505 "superlu_dist_" version ".tar.gz"))
1507 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
1508 (modules '((guix build utils)))
1510 ;; Replace the non-free implementation of MC64 with a stub
1512 (use-modules (ice-9 regex)
1514 (call-with-output-file "SRC/mc64ad.c"
1519 void mc64id_(int *a) {
1520 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
1523 void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
1524 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
1525 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
1528 (delete-file "SRC/mc64ad.f.bak")
1529 (substitute* "SRC/util.c" ;adjust default algorithm
1530 (("RowPerm[[:blank:]]*=[[:blank:]]*LargeDiag")
1531 "RowPerm = NOROWPERM"))))
1532 (patches (search-patches "superlu-dist-scotchmetis.patch"))))
1533 (build-system gnu-build-system)
1537 `(("gfortran" ,gfortran)))
1539 `(("openmpi" ,openmpi) ;headers include MPI heades
1540 ("lapack" ,lapack) ;required to link with output library
1541 ("pt-scotch" ,pt-scotch))) ;same
1543 `(#:parallel-build? #f ;race conditions using ar
1547 (lambda* (#:key inputs outputs #:allow-other-keys)
1548 (call-with-output-file "make.inc"
1553 DSUPERLULIB = ~a/lib/libsuperlu_dist.a
1554 BLASDEF = -DUSE_VENDOR_BLAS
1555 BLASLIB = -L~a/lib -lblas
1556 PARMETISLIB = -L~a/lib \
1557 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
1558 -lscotch -lscotcherr -lscotcherrexit
1559 METISLIB = -L~:*~a/lib \
1560 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
1561 LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
1567 CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
1568 NOOPTS = -O0 -g $(PIC)
1570 FFLAGS = -O2 -g $(PIC)
1574 (assoc-ref outputs "out")
1575 (assoc-ref inputs "lapack")
1576 (assoc-ref inputs "pt-scotch")))))
1578 'unpack 'remove-broken-symlinks
1580 (for-each delete-file
1581 (find-files "MAKE_INC" "\\.#make\\..*")))
1583 'build 'create-install-directories
1584 (lambda* (#:key outputs #:allow-other-keys)
1587 (mkdir-p (string-append (assoc-ref outputs "out")
1589 '("lib" "include")))
1593 (with-directory-excursion "EXAMPLE"
1595 (zero? (system* "mpirun" "-n" "2"
1596 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
1597 (zero? (system* "mpirun" "-n" "2"
1598 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
1601 (lambda* (#:key outputs #:allow-other-keys)
1602 ;; Library is placed in lib during the build phase. Copy over
1603 ;; headers to include.
1604 (let* ((out (assoc-ref outputs "out"))
1605 (incdir (string-append out "/include")))
1606 (for-each (lambda (file)
1607 (let ((base (basename file)))
1608 (format #t "installing `~a' to `~a'~%"
1611 (string-append incdir "/" base))))
1612 (find-files "SRC" ".*\\.h$"))))
1613 %standard-phases)))))))
1614 (home-page (package-home-page superlu))
1615 (synopsis "Parallel supernodal direct solver")
1617 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
1618 It is targeted for distributed memory parallel machines. SuperLU_DIST is
1619 implemented in ANSI C, and MPI for communications.")
1620 (license license:bsd-3)))
1622 (define-public scotch
1629 (uri (string-append "https://gforge.inria.fr/frs/download.php/34618/"
1630 "scotch_" version ".tar.gz"))
1632 (base32 "1ir088mvrqggyqdkx9qfynmiaffqbyih5qfl5mga2nrlm1qlsgzm"))
1633 (patches (search-patches "scotch-test-threading.patch"
1634 "pt-scotch-build-parallelism.patch"))))
1635 (build-system gnu-build-system)
1642 (modify-phases %standard-phases
1644 'unpack 'chdir-to-src
1645 (lambda _ (chdir "src")))
1649 (call-with-output-file "Makefile.inc"
1663 CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
1664 LDFLAGS = -lz -lm -lrt -lpthread
1666 LEX = flex -Pscotchyy -olex.yy.c
1671 YACC = bison -pscotchyy -y -b y
1673 '("COMMON_FILE_COMPRESS_GZ"
1675 "COMMON_RANDOM_FIXED_SEED"
1676 ;; Prevents symbolc clashes with libesmumps
1678 ;; XXX: Causes invalid frees in superlu-dist tests
1680 ;; "SCOTCH_PTHREAD_NUMBER=2"
1681 "restrict=__restrict"))))))
1683 'build 'build-esmumps
1685 (zero? (system* "make"
1686 (format #f "-j~a" (parallel-job-count))
1690 (lambda* (#:key outputs #:allow-other-keys)
1691 (let ((out (assoc-ref outputs "out")))
1693 (zero? (system* "make"
1694 (string-append "prefix=" out)
1696 ;; esmumps files are not installed with the above
1697 (for-each (lambda (f)
1698 (copy-file f (string-append out "/include/" f)))
1699 (find-files "../include" ".*esmumps.h$"))
1700 (for-each (lambda (f)
1701 (copy-file f (string-append out "/lib/" f)))
1702 (find-files "../lib" "^lib.*esmumps.*"))))))))
1703 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
1704 (synopsis "Programs and libraries for graph algorithms")
1705 (description "SCOTCH is a set of programs and libraries which implement
1706 the static mapping and sparse matrix reordering algorithms developed within
1707 the SCOTCH project. Its purpose is to apply graph theory, with a divide and
1708 conquer approach, to scientific computing problems such as graph and mesh
1709 partitioning, static mapping, and sparse matrix ordering, in application
1710 domains ranging from structural mechanics to operating systems or
1712 ;; See LICENSE_en.txt
1713 (license license:cecill-c)))
1715 (define-public pt-scotch
1716 (package (inherit scotch)
1719 `(("openmpi" ,openmpi))) ;Headers include MPI headers
1721 (substitute-keyword-arguments (package-arguments scotch)
1722 ((#:phases scotch-phases)
1723 `(modify-phases ,scotch-phases
1728 (zero? (system* "make"
1729 (format #f "-j~a" (parallel-job-count))
1730 "ptscotch" "ptesmumps"))
1731 ;; Install the serial metis compatibility library
1732 (zero? (system* "make" "-C" "libscotchmetis" "install")))))
1735 (lambda _ (zero? (system* "make" "ptcheck"))))))))
1736 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
1738 (define-public metis
1745 (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
1746 "metis-" version ".tar.gz"))
1749 "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
1750 (build-system cmake-build-system)
1752 `(("blas" ,openblas)))
1754 `(#:tests? #f ;no tests
1755 #:configure-flags `("-DSHARED=ON"
1756 ,(string-append "-DGKLIB_PATH=" (getcwd)
1757 "/metis-" ,version "/GKlib"))))
1758 (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
1759 (synopsis "Graph partitioning and fill-reducing matrix ordering library")
1761 "METIS is a set of serial programs for partitioning graphs, partitioning
1762 finite element meshes, and producing fill-reducing orderings for sparse
1763 matrices. The algorithms implemented in METIS are based on the multilevel
1764 recursive-bisection, multilevel k-way, and multi-constraint partitioning
1766 (license license:asl2.0))) ;As of version 5.0.3
1768 (define-public p4est
1775 (uri (string-append "http://p4est.github.io/release/p4est-"
1779 "0faina2h5qsx3m2izbzaj9bbakma1krbbjmq43wrp1hcbyijflqb"))))
1780 (build-system gnu-build-system)
1782 `(("fortran" ,gfortran)
1787 `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
1788 (assoc-ref %build-inputs "blas")
1790 ,(string-append "LAPACK_LIBS=-L"
1791 (assoc-ref %build-inputs "lapack")
1793 (home-page "http://www.p4est.org")
1794 (synopsis "Adaptive mesh refinement on forests of octrees")
1796 "The p4est software library enables the dynamic management of a
1797 collection of adaptive octrees, conveniently called a forest of octrees.
1798 p4est is designed to work in parallel and scales to hundreds of thousands of
1800 (license license:gpl2+)))
1802 (define-public p4est-openmpi
1803 (package (inherit p4est)
1804 (name "p4est-openmpi")
1807 ,@(package-inputs p4est)))
1809 (substitute-keyword-arguments (package-arguments p4est)
1810 ((#:configure-flags cf)
1811 ``("--enable-mpi" ,@,cf))))
1812 (synopsis "Parallel adaptive mesh refinement on forests of octrees")))
1814 (define-public gsegrafix
1821 (uri (string-append "mirror://gnu/" name "/" name "-"
1825 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
1826 (build-system gnu-build-system)
1828 `(#:configure-flags '("LDFLAGS=-lm")))
1830 `(("libgnomecanvas" ,libgnomecanvas)
1831 ("libbonoboui" ,libbonoboui)
1832 ("libgnomeui" ,libgnomeui)
1833 ("libgnomeprintui" ,libgnomeprintui)
1836 `(("pkg-config" ,pkg-config)))
1837 (home-page "http://www.gnu.org/software/gsegrafix/")
1838 (synopsis "GNOME application to create scientific and engineering plots")
1839 (description "GSEGrafix is an application which produces high-quality graphical
1840 plots for science and engineering. Plots are specified via simple ASCII
1841 parameter files and data files and are presented in an anti-aliased GNOME
1842 canvas. The program supports rectangular two-dimensional plots, histograms,
1843 polar-axis plots and three-dimensional plots. Plots can be printed or saved
1844 to BMP, JPEG or PNG image formats.")
1845 (license license:gpl3+)))
1847 (define-public maxima
1854 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
1855 version "-source/" name "-" version ".tar.gz"))
1858 "1p6646rvq43hk09msyp0dk50cqpkh07mf4x0bc2fqisqmcv6b1hf"))
1859 (patches (search-patches "maxima-defsystem-mkdir.patch"))))
1860 (build-system gnu-build-system)
1863 ("gnuplot" ,gnuplot) ;for plots
1864 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
1866 `(("texinfo" ,texinfo)
1868 ("python" ,python)))
1871 (list "--enable-gcl"
1872 (string-append "--with-posix-shell="
1873 (assoc-ref %build-inputs "bash")
1875 (string-append "--with-wish="
1876 (assoc-ref %build-inputs "tk")
1878 (let ((v ,(package-version tk)))
1879 (string-take v (string-index-right v #\.)))))
1880 ;; By default Maxima attempts to write temporary files to
1881 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
1882 ;; Work around that.
1883 #:make-flags (list "TMPDIR=/tmp")
1884 #:phases (alist-cons-before
1887 (chmod "src/maxima" #o555))
1888 ;; Make sure the doc and emacs files are found in the
1889 ;; standard location. Also configure maxima to find gnuplot
1890 ;; without having it on the PATH.
1892 'install 'post-install
1893 (lambda* (#:key outputs inputs #:allow-other-keys)
1894 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
1895 (out (assoc-ref outputs "out"))
1896 (datadir (string-append out "/share/maxima/" ,version)))
1897 (with-directory-excursion out
1898 (mkdir-p "share/emacs")
1899 (mkdir-p "share/doc")
1901 (string-append datadir "/emacs/")
1902 (string-append out "/share/emacs/site-lisp"))
1904 (string-append datadir "/doc/")
1905 (string-append out "/share/doc/maxima"))
1906 (with-atomic-file-replacement
1907 (string-append datadir "/share/maxima-init.lisp")
1909 (format out "~a ~s~a~%"
1910 "(setf $gnuplot_command "
1911 (string-append gnuplot "/bin/gnuplot") ")")
1912 (dump-port in out))))))
1913 %standard-phases))))
1914 (home-page "http://maxima.sourceforge.net")
1915 (synopsis "Numeric and symbolic expression manipulation")
1916 (description "Maxima is a system for the manipulation of symbolic and
1917 numerical expressions. It yields high precision numeric results by using
1918 exact fractions, arbitrary precision integers, and variable precision floating
1920 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
1921 ;; Others simply say "GNU General Public License" without stating a
1922 ;; version (which implicitly means gpl1+).
1923 ;; At least one file (src/maxima.asd) says "version 2."
1924 ;; GPLv2 only is therefore the smallest subset.
1925 (license license:gpl2)))
1927 (define-public wxmaxima
1934 (uri (string-append "mirror://sourceforge/wxmaxima/wxMaxima/"
1935 version "/" name "-" version ".tar.gz"))
1938 "1fpqzk1921isiqrpgpf433ldq41924qs9sy99fl1zn5661b2l73n"))))
1939 (build-system gnu-build-system)
1941 `(("wxwidgets" ,wxwidgets)
1944 ("adwaita-icon-theme" ,adwaita-icon-theme)
1946 ("shared-mime-info" ,shared-mime-info)))
1948 `(#:phases (modify-phases %standard-phases
1950 'install 'wrap-program
1951 (lambda* (#:key inputs outputs #:allow-other-keys)
1952 (wrap-program (string-append (assoc-ref outputs "out")
1955 (,(string-append (assoc-ref inputs "maxima")
1957 ;; For GtkFileChooserDialog.
1958 `("GSETTINGS_SCHEMA_DIR" =
1959 (,(string-append (assoc-ref inputs "gtk+")
1960 "/share/glib-2.0/schemas")))
1961 `("XDG_DATA_DIRS" ":" prefix
1962 (;; Needed by gdk-pixbuf to know supported icon formats.
1964 (assoc-ref inputs "shared-mime-info") "/share")
1965 ;; The default icon theme of GTK+.
1967 (assoc-ref inputs "adwaita-icon-theme") "/share"))))
1969 (home-page "https://andrejv.github.io/wxmaxima/")
1970 (synopsis "Graphical user interface for the Maxima computer algebra system")
1972 "wxMaxima is a graphical user interface for the Maxima computer algebra
1973 system. It eases the use of Maxima by making most of its commands available
1974 through a menu system and by providing input dialogs for commands that require
1975 more than one argument. It also implements its own display engine that
1976 outputs mathematical symbols directly instead of depicting them with ASCII
1979 wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
1980 text and mathematical calculations to create documents, exporting of input and
1981 output to TeX, and a browser for Maxima's manual including command index and
1982 full text searching.")
1983 (license license:gpl2+)))
1985 (define-public armadillo
1991 (uri (string-append "mirror://sourceforge/arma/armadillo-"
1995 "1x98d32cgxbzbbma2ak6c37wnbpq13xxyxyd6jjvflv748mzi9ks"))))
1996 (build-system cmake-build-system)
1997 (arguments `(#:tests? #f)) ;no test target
1999 `(("openblas" ,openblas)
2001 ("arpack" ,arpack-ng)))
2002 (home-page "http://arma.sourceforge.net/")
2003 (synopsis "C++ linear algebra library")
2005 "Armadillo is a C++ linear algebra library, aiming towards a good balance
2006 between speed and ease of use. It is useful for algorithm development
2007 directly in C++, or quick conversion of research code into production
2008 environments. It can be used for machine learning, pattern recognition,
2009 signal processing, bioinformatics, statistics, econometrics, etc. The library
2010 provides efficient classes for vectors, matrices and cubes, as well as 150+
2011 associated functions (eg. contiguous and non-contiguous submatrix views).")
2012 (license license:mpl2.0)))
2014 (define-public armadillo-for-rcpparmadillo
2015 (package (inherit armadillo)
2019 (uri (string-append "mirror://sourceforge/arma/armadillo-"
2023 "1x98d32cgxbzbbma2ak6c37wnbpq13xxyxyd6jjvflv748mzi9ks"))))))
2025 (define-public muparser
2026 ;; When switching download sites, muparser re-issued a 2.2.5 release with a
2027 ;; different hash. In order to make `guix package --upgrade` work correctly,
2028 ;; we set a Guix packaging revision.
2029 ;; When the next version of muparser is released, we can remove
2030 ;; UPSTREAM-VERSION and REVISION and use the plain VERSION.
2031 (let ((upstream-version "2.2.5")
2035 (version (string-append upstream-version "-" revision))
2039 (uri (string-append "https://github.com/beltoforion/muparser/archive/v"
2040 upstream-version ".tar.gz"))
2041 (file-name (string-append name "-" version ".tar.gz"))
2044 "0277qsi5l23jsck1vhn383bmvc2n9l4a1dl5r9bf7hvjv9ayyrh6"))))
2045 (build-system gnu-build-system)
2047 `(#:configure-flags '("--enable-samples=no")
2048 #:tests? #f)) ;no "check" target
2049 (home-page "http://muparser.beltoforion.de/")
2050 (synopsis "Fast parser library for mathematical expressions")
2052 "muParser is an extensible high performance math parser library. It is
2053 based on transforming an expression into a bytecode and precalculating constant
2055 (license license:expat))))
2057 (define-public openblas
2064 (uri (string-append "https://github.com/xianyi/OpenBLAS/tarball/v"
2066 (file-name (string-append name "-" version ".tar.gz"))
2069 "1k5f6vjlk54qlplk5m7xkbaw6g2y7dl50lwwdv6xsbcsgsbxfcpy"))))
2070 (build-system gnu-build-system)
2072 `(#:tests? #f ;no "check" target
2073 ;; DYNAMIC_ARCH is only supported on x86. When it is disabled and no
2074 ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
2075 ;; we need to disable substitutions.
2077 ,(let ((system (or (%current-target-system) (%current-system))))
2078 (or (string-prefix? "x86_64" system)
2079 (string-prefix? "i686" system)
2080 (string-prefix? "mips" system)))
2082 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
2085 ;; Build the library for all supported CPUs. This allows
2086 ;; switching CPU targets at runtime with the environment variable
2087 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
2088 ;; Unfortunately, this is not supported on non-x86 architectures,
2089 ;; where it leads to failed builds.
2090 ,@(let ((system (or (%current-target-system) (%current-system))))
2092 ((or (string-prefix? "x86_64" system)
2093 (string-prefix? "i686" system))
2094 '("DYNAMIC_ARCH=1"))
2095 ;; On MIPS we force the "SICORTEX" TARGET, as for the other
2096 ;; two available MIPS targets special extended instructions
2097 ;; for Loongson cores are used.
2098 ((string-prefix? "mips" system)
2099 '("TARGET=SICORTEX"))
2101 ;; no configure script
2102 #:phases (alist-delete 'configure %standard-phases)))
2104 `(("fortran" ,gfortran)))
2108 (home-page "http://www.openblas.net/")
2109 (synopsis "Optimized BLAS library based on GotoBLAS")
2111 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
2112 (license license:bsd-3)))
2114 (define-public openlibm
2121 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
2123 (file-name (string-append name "-" version ".tar.gz"))
2126 "11czx2z7nh6dfpz45s3xl7v38hw36jxzxfvny454bk3if14pfakq"))))
2127 (build-system gnu-build-system)
2130 (list (string-append "prefix=" (assoc-ref %outputs "out")))
2132 ;; no configure script
2133 (alist-delete 'configure %standard-phases)
2134 #:tests? #f)) ;the tests are part of the default target
2135 (home-page "http://openlibm.org/")
2136 (synopsis "Portable C mathematical library (libm)")
2138 "OpenLibm is an effort to have a high quality, portable, standalone C
2139 mathematical library (libm). It can be used standalone in applications and
2140 programming language implementations. The project was born out of a need to
2141 have a good libm for the Julia programming language that worked consistently
2142 across compilers and operating systems, and in 32-bit and 64-bit
2144 ;; Each architecture has its own make target, and there is none for mips.
2145 (supported-systems (delete "mips64el-linux" %supported-systems))
2146 ;; See LICENSE.md for details.
2147 (license (list license:expat
2150 license:public-domain
2151 license:lgpl2.1+))))
2153 (define-public openspecfun
2155 (name "openspecfun")
2160 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
2162 (file-name (string-append name "-" version ".tar.gz"))
2165 "1y5b2h6f2k72536kym3vzy3li3bhpd23x463g7hdmjdi3cncavz1"))))
2166 (build-system gnu-build-system)
2168 '(#:tests? #f ;no "check" target
2170 (list (string-append "prefix=" (assoc-ref %outputs "out")))
2171 ;; no configure script
2172 #:phases (alist-delete 'configure %standard-phases)))
2174 `(("fortran" ,gfortran)))
2175 (home-page "https://github.com/JuliaLang/openspecfun")
2176 (synopsis "Collection of special mathematical functions")
2178 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
2179 portable package for Bessel Functions of a Complex Argument and Nonnegative
2180 Order; it contains subroutines for computing Bessel functions and Airy
2181 functions. Faddeeva allows computing the various error functions of arbitrary
2182 complex arguments (Faddeeva function, error function, complementary error
2183 function, scaled complementary error function, imaginary error function, and
2184 Dawson function); given these, one can also easily compute Voigt functions,
2185 Fresnel integrals, and similar related functions as well.")
2186 ;; Faddeeva is released under the Expat license; AMOS is included as
2187 ;; public domain software.
2188 (license (list license:expat license:public-domain))))
2190 (define-public suitesparse
2192 (name "suitesparse")
2198 "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-"
2202 "100hdzr0mf4mzlwnqpmwpfw4pymgsf9n3g0ywb1yps2nk1zbkdy5"))))
2203 (build-system gnu-build-system)
2205 '(#:parallel-build? #f ;cholmod build fails otherwise
2206 #:tests? #f ;no "check" target
2211 "CHOLMOD_CONFIG=-DNPARTITION" ;required when METIS is not used
2212 (string-append "INSTALL_LIB="
2213 (assoc-ref %outputs "out") "/lib")
2214 (string-append "INSTALL_INCLUDE="
2215 (assoc-ref %outputs "out") "/include"))
2218 'install 'prepare-out
2219 ;; README.txt states that the target directories must exist prior to
2220 ;; running "make install".
2222 (mkdir-p (string-append (assoc-ref %outputs "out") "/lib"))
2223 (mkdir-p (string-append (assoc-ref %outputs "out") "/include")))
2224 ;; no configure script
2225 (alist-delete 'configure %standard-phases))))
2228 ("lapack" ,lapack)))
2229 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
2230 (synopsis "Suite of sparse matrix software")
2232 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
2233 multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
2234 multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
2235 simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
2236 CXSparse, a concise sparse Cholesky factorization package; and many other
2239 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
2241 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
2242 (license (list license:gpl2+ license:lgpl2.1+))))
2244 (define-public atlas
2250 (uri (string-append "mirror://sourceforge/math-atlas/Stable/"
2251 version "/atlas" version ".tar.bz2"))
2254 "1dyjlq3fiparvm8ypwk6rsmjzmnwk81l88gkishphpvc79ryp216"))))
2255 (build-system gnu-build-system)
2256 (home-page "http://math-atlas.sourceforge.net/")
2257 (inputs `(("gfortran" ,gfortran)
2258 ("lapack-tar" ,(package-source lapack))))
2259 (outputs '("out" "doc"))
2260 ;; For the moment we drop support for MIPS at it fails to compile. See
2261 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
2262 (supported-systems (delete "mips64el-linux" %supported-systems))
2264 `(#:parallel-build? #f
2265 #:parallel-tests? #f
2267 ;; ATLAS tunes itself for the machine it is built on, as explained at
2268 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
2269 ;; For this reason, we want users to build it locally instead of using
2273 #:modules ((srfi srfi-26)
2275 (guix build gnu-build-system)
2278 `(;; Generate position independent code suitable for dynamic libraries
2279 ;; and use WALL timer to get more accurate timing.
2280 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
2283 ,,(if (string-match "64" (%current-system))
2286 ;; Disable parallel build as it gives errors: atlas_pthread.h is
2287 ;; needed to compile C files before it is generated.
2288 "-Ss" "pmake" "make -j 1"
2289 ;; Probe is failing for MIPS. We therefore define the system
2290 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
2291 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
2292 ,,@(if (string-prefix? "mips" (%current-system))
2293 (list "-A" "49" "-V" "1")
2295 ;; Generate shared libraries.
2297 ;; Build a full LAPACK library.
2298 ,(string-append "--with-netlib-lapack-tarfile="
2299 (assoc-ref %build-inputs "lapack-tar")))
2301 (modify-phases %standard-phases
2302 (add-after 'install 'install-doc
2303 (lambda* (#:key outputs inputs #:allow-other-keys)
2304 (let ((doc (string-append (assoc-ref outputs "doc")
2305 "/share/doc/atlas")))
2307 (fold (lambda (file previous)
2308 (and previous (zero? (system* "cp" file doc))))
2309 #t (find-files "../ATLAS/doc" ".*")))))
2310 (add-after 'check 'check-pt
2311 (lambda _ (zero? (system* "make" "ptcheck"))))
2312 ;; Fix files required to run configure.
2313 (add-before 'configure 'fix-/bin/sh
2315 ;; Use `sh', not `/bin/sh'.
2316 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
2319 ;; Fix /bin/sh in generated make files.
2320 (add-after 'configure 'fix-/bin/sh-in-generated-files
2322 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
2325 ;; ATLAS configure program does not accepts the default flags
2326 ;; passed by the 'gnu-build-system'.
2328 (lambda* (#:key native-inputs inputs outputs
2329 (configure-flags '())
2330 #:allow-other-keys #:rest args)
2331 (let* ((prefix (assoc-ref outputs "out"))
2332 (bash (or (and=> (assoc-ref
2333 (or native-inputs inputs) "bash")
2334 (cut string-append <> "/bin/bash"))
2336 (flags `(,(string-append "--prefix=" prefix)
2338 (abs-srcdir (getcwd))
2339 (srcdir (string-append "../" (basename abs-srcdir))))
2340 (format #t "source directory: ~s (relative from build: ~s)~%"
2344 (format #t "build directory: ~s~%" (getcwd))
2345 (format #t "configure flags: ~s~%" flags)
2346 (zero? (apply system* bash
2347 (string-append srcdir "/configure")
2349 (synopsis "Automatically Tuned Linear Algebra Software")
2351 "ATLAS is an automatically tuned linear algebra software library
2352 providing C and Fortran77 interfaces to a portably efficient BLAS
2353 implementation, as well as a few routines from LAPACK.
2355 Optimization occurs at build time. For this reason, the library is built on
2356 the machine where it is installed, without resorting to pre-built substitutes.
2358 Before building the library, CPU throttling should be disabled. This can be
2359 done in the BIOS, or, on GNU/Linux, with the following command:
2362 # cpupower --governor performance
2365 Failure to do so will result in a library with poor performance.")
2366 (license license:bsd-3)))
2375 (uri (string-append "mirror://sourceforge/ogl-math/glm-" version
2376 "/glm-" version ".zip"))
2379 "1cnjmi033a16a95v6xfkr1bvfmkd26hzdjka8j1819hgn5b1nr8l"))))
2380 (build-system cmake-build-system)
2382 `(("unzip" ,unzip)))
2383 (home-page "http://glm.g-truc.net")
2384 (synopsis "OpenGL Mathematics library")
2385 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
2386 library for graphics software based on the OpenGL Shading Language (GLSL)
2388 (license license:expat)))
2390 (define-public lpsolve
2397 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
2398 "/lp_solve_" version "_source.tar.gz"))
2401 "176c7f023mb6b8bfmv4rfqnrlw88lsg422ca74zjh19i2h5s69sq"))
2402 (modules '((guix build utils)))
2404 '(substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
2406 ;; Pretend to be on a 64 bit platform to obtain a common directory
2407 ;; name for the build results on all architectures; nothing else
2408 ;; seems to depend on it.
2409 (("^PLATFORM=.*$") "PLATFORM=ux64\n")
2411 ;; The check for 'isnan' as it is written fails with
2412 ;; "non-floating-point argument in call to function
2413 ;; ‘__builtin_isnan’", which leads to the 'NOISNAN' cpp macro
2414 ;; definition, which in turn leads to bad things. Fix the feature
2416 (("isnan\\(0\\)") "isnan(0.)")))))
2417 (build-system gnu-build-system)
2419 `(#:tests? #f ; no check target
2421 (modify-phases %standard-phases
2425 (and (with-directory-excursion "lpsolve55"
2426 (zero? (system* "bash" "ccc")))
2427 (with-directory-excursion "lp_solve"
2428 (zero? (system* "bash" "ccc"))))))
2430 (lambda* (#:key outputs #:allow-other-keys)
2431 (let* ((out (assoc-ref outputs "out"))
2432 (bin (string-append out "/bin"))
2433 (lib (string-append out "/lib"))
2434 ;; This is where LibreOffice expects to find the header
2435 ;; files, and where they are installed by Debian.
2436 (include (string-append out "/include/lpsolve")))
2438 (copy-file "lpsolve55/bin/ux64/liblpsolve55.a"
2439 (string-append lib "/liblpsolve55.a"))
2440 (copy-file "lpsolve55/bin/ux64/liblpsolve55.so"
2441 (string-append lib "/liblpsolve55.so"))
2442 (install-file "lp_solve/bin/ux64/lp_solve" bin)
2444 ;; Install a subset of the header files as on Debian
2445 ;; (plus lp_bit.h, which matches the regular expression).
2446 (for-each (lambda (name)
2447 (install-file name include))
2448 (find-files "." "lp_[HMSa-z].*\\.h$"))
2449 (with-directory-excursion "shared"
2450 (for-each (lambda (name)
2451 (install-file name include))
2452 (find-files "." "\\.h$")))
2454 (home-page "http://lpsolve.sourceforge.net/")
2455 (synopsis "Mixed integer linear programming (MILP) solver")
2457 "lp_solve is a mixed integer linear programming solver based on the
2458 revised simplex and the branch-and-bound methods.")
2459 (license license:lgpl2.1+)))
2461 (define-public dealii
2468 (uri (string-append "https://github.com/dealii/dealii/releases/"
2469 "download/v" version "/dealii-" version ".tar.gz"))
2472 "1bdksvvyp1rj37df1ndh8j3x9nzpc3sazw8nd0hzvnlw0qnyk800"))
2473 (modules '((guix build utils)))
2475 ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
2476 '(delete-file-recursively "bundled"))))
2477 (build-system cmake-build-system)
2485 ("arpack" ,arpack-ng)
2486 ("muparser" ,muparser)
2487 ("gfortran" ,gfortran)
2488 ("suitesparse" ,suitesparse))) ;for UMFPACK
2490 `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease
2491 #:configure-flags '("-DCOMPAT_FILES=OFF") ;Follow new directory structure
2492 #:phases (modify-phases %standard-phases
2494 'install 'hint-example-prefix
2495 ;; Set Cmake hints in examples so that they can find this
2496 ;; deal.II when configuring.
2497 (lambda* (#:key outputs #:allow-other-keys)
2498 (let* ((out (assoc-ref %outputs "out"))
2499 (exmpl (string-append out "/share/doc"
2500 "/dealii/examples")))
2501 (substitute* (find-files exmpl "CMakeLists.txt")
2502 (("([[:space:]]*HINTS.*)\n" _ line)
2503 (string-append line " $ENV{HOME}/.guix-profile "
2506 (home-page "https://www.dealii.org")
2507 (synopsis "Finite element library")
2509 "Deal.II is a C++ program library targeted at the computational solution
2510 of partial differential equations using adaptive finite elements. The main
2511 aim of deal.II is to enable rapid development of modern finite element codes,
2512 using among other aspects adaptive meshes and a wide array of tools often used
2513 in finite element programs.")
2514 (license license:lgpl2.1+)))
2516 (define-public dealii-openmpi
2517 (package (inherit dealii)
2518 (name "dealii-openmpi")
2521 ;;Supported only with MPI:
2522 ("p4est" ,p4est-openmpi)
2523 ("petsc" ,petsc-openmpi)
2524 ("slepc" ,slepc-openmpi)
2525 ("metis" ,metis) ;for MUMPS
2526 ("scalapack" ,scalapack) ;for MUMPS
2527 ("mumps" ,mumps-metis-openmpi) ;configure supports only metis orderings
2528 ("arpack" ,arpack-ng-openmpi)
2529 ,@(fold alist-delete (package-inputs dealii)
2530 '("p4est" "arpack"))))
2532 (substitute-keyword-arguments (package-arguments dealii)
2533 ((#:configure-flags cf)
2534 ``("-DMPI_C_COMPILER=mpicc"
2535 "-DMPI_CXX_COMPILER=mpicxx"
2536 "-DMPI_Fortran_COMPILER=mpifort"
2538 (synopsis "Finite element library (with MPI support)")))
2540 (define-public flann
2549 "http://www.cs.ubc.ca/research/flann/uploads/FLANN/flann-"
2550 version "-src.zip"))
2553 "022w8hph7bli5zbpnk3z1qh1c2sl5hm8fw2ccim651ynn0hr7fyz"))))
2554 (build-system cmake-build-system)
2556 `(("unzip" ,unzip)))
2560 ("python" ,python-2) ; print syntax
2561 ;; ("python2-numpy" ,python2-numpy) ; only required for the tests
2564 `(;; The 'share/flann/octave' contains a .mex file, which is an ELF file
2565 ;; taken 46 MiB unstripped, and 6 MiB stripped.
2566 #:strip-directories '("lib" "lib64" "libexec"
2567 "bin" "sbin" "share/flann/octave")
2569 ;; Save 12 MiB by not installing .a files. Passing
2570 ;; '-DBUILD_STATIC_LIBS=OFF' has no effect.
2571 #:phases (modify-phases %standard-phases
2572 (add-after 'install 'remove-static-libraries
2573 (lambda* (#:key outputs #:allow-other-keys)
2574 (let* ((out (assoc-ref outputs "out"))
2575 (lib (string-append out "/lib")))
2576 (for-each delete-file
2577 (find-files lib "\\.a$"))
2580 #:tests? #f)) ; The test data are downloaded from the Internet.
2581 (home-page "http://www.cs.ubc.ca/research/flann/")
2582 (synopsis "Library for approximate nearest neighbors computation")
2583 (description "FLANN is a library for performing fast approximate
2584 nearest neighbor searches in high dimensional spaces. It implements a
2585 collection of algorithms and a system for automatically choosing the best
2586 algorithm and optimum parameters depending on the dataset.
2588 FLANN is written in C++ and contains bindings for C, Octave and Python.")
2589 (license (license:non-copyleft "file://COPYING"
2590 "See COPYING in the distribution."))))
2592 (define-public wcalc
2599 (uri (string-append "mirror://sourceforge/w-calc/Wcalc/" version "/"
2600 "wcalc-" version ".tar.bz2"))
2603 "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
2604 (build-system gnu-build-system)
2607 ("readline" ,readline)))
2608 (home-page "http://w-calc.sourceforge.net/index.php")
2609 (synopsis "Flexible command-line scientific calculator")
2610 (description "Wcalc is a very capable calculator. It has standard functions
2611 (sin, asin, and sinh for example, in either radians or degrees), many
2612 pre-defined constants (pi, e, c, etc.), support for using variables, \"active\"
2613 variables, a command history, hex/octal/binary input and output, unit
2614 conversions, embedded comments, and an expandable expression entry field. It
2615 evaluates expressions using the standard order of operations.")
2616 (license license:gpl2+)))
2624 (uri (string-append "mirror://sourceforge/xaos/XaoS/" version
2625 "/xaos-" version ".tar.gz"))
2628 "15cd1cx1dyygw6g2nhjqq3bsfdj8sj8m4va9n75i0f3ryww3x7wq"))))
2629 (build-system gnu-build-system)
2630 (native-inputs `(("gettext" ,gnu-gettext)))
2631 (inputs `(("libx11" ,libx11)
2636 `(#:tests? #f ;no "check" target
2637 #:make-flags '("LOCALEDIR=$DATAROOTDIR/locale")))
2638 (synopsis "Real-time fractal zoomer")
2639 (description "GNU XaoS is a graphical program that generates fractal
2640 patterns and allows you to zoom in and out of them infinitely in a fluid,
2641 continuous manner. It also includes tutorials that help to explain how fractals
2642 are built. It can generate many different fractal types such as the Mandelbrot
2644 (home-page "http://www.gnu.org/software/xaos/")
2645 (license license:gpl2+)))
2647 (define-public hypre
2653 (uri (string-append "https://github.com/LLNL/hypre/archive/"
2654 "v" version ".tar.gz"))
2655 (file-name (string-append name "-" version ".tar.gz"))
2658 "0q69ia0jivzcr8p049dn3mg8yjpn6nwq4sw9iqac8vr63vi54l6m"))
2659 (modules '((guix build utils)))
2662 ;; Remove use of __DATE__ and __TIME__ for reproducibility;
2663 ;; substitute the tarball creation time.
2664 (substitute* "src/utilities/HYPRE_utilities.h"
2665 (("Date Compiled: .*$")
2666 "Date Compiled: Mar 28 2016 20:19:59 +0000\"\n"))
2668 (build-system gnu-build-system)
2669 (outputs '("out" ;6.1 MiB of headers and libraries
2670 "doc")) ;4.8 MiB of documentation
2674 ("texlive" ,texlive) ;full package required for fonts
2675 ("ghostscript" ,ghostscript)))
2677 `(("blas" ,openblas)
2678 ("lapack" ,lapack)))
2680 `(#:modules ((srfi srfi-1)
2681 ,@%gnu-build-system-modules)
2682 #:configure-flags '("--enable-shared"
2690 (modify-phases %standard-phases
2691 (add-before 'configure 'chdir-src
2692 (lambda _ (chdir "src")))
2694 (lambda* (#:key build target configure-flags
2695 #:allow-other-keys #:rest args)
2696 (let* ((configure (assoc-ref %standard-phases 'configure)))
2699 (list #:configure-flags
2700 (cons (string-append
2701 "--host=" (or target build))
2702 configure-flags)))))))
2703 (add-after 'build 'build-docs
2705 (zero? (system* "make" "-Cdocs" "pdf" "html"))))
2708 (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/hypre/lib"))
2709 (setenv "PATH" (string-append "." ":" (getenv "PATH")))
2710 (and (system* "make" "check" "CHECKRUN=")
2711 (fold (lambda (filename result)
2713 (let ((size (stat:size (stat filename))))
2714 (when (not (zero? size))
2715 (format #t "~a size ~d; error indication~%"
2719 (find-files "test" ".*\\.err$")))))
2720 (add-after 'install 'install-docs
2721 (lambda* (#:key outputs #:allow-other-keys)
2722 ;; Custom install because docs/Makefile doesn't honor ${docdir}.
2723 (let* ((doc (assoc-ref outputs "doc"))
2724 (docdir (string-append doc "/share/doc/hypre-" ,version)))
2726 (with-directory-excursion "docs"
2727 (for-each (lambda (base)
2728 (install-file (string-append base ".pdf") docdir)
2729 (copy-recursively base docdir)) ;html docs
2730 '("HYPRE_usr_manual"
2731 "HYPRE_ref_manual")))
2733 (home-page "http://www.llnl.gov/casc/hypre/")
2734 (synopsis "Library of solvers and preconditioners for linear equations")
2736 "HYPRE is a software library of high performance preconditioners and
2737 solvers for the solution of large, sparse linear systems of equations. It
2738 features multigrid solvers for both structured and unstructured grid
2740 (license license:lgpl2.1)))
2742 (define-public hypre-openmpi
2743 (package (inherit hypre)
2744 (name "hypre-openmpi")
2747 ,@(package-inputs hypre)))
2749 (substitute-keyword-arguments (package-arguments hypre)
2750 ((#:configure-flags flags)
2752 ,@(delete "--without-MPI" ,flags)))))
2753 (synopsis "Parallel solvers and preconditioners for linear equations")
2755 "HYPRE is a software library of high performance preconditioners and
2756 solvers for the solution of large, sparse linear systems of equations on
2757 parallel computers. It features parallel multigrid solvers for both
2758 structured and unstructured grid problems.")))
2760 (define-public matio
2767 (uri (string-append "mirror://sourceforge/matio/matio/" version "/"
2768 "matio-" version ".tar.gz"))
2771 "0y2qymgxank8wdiwc68ap8bxdzrhvyw86i29yh3xgn4z1njfd9ir"))))
2772 (build-system gnu-build-system)
2776 (home-page "http://matio.sourceforge.net/")
2777 (synopsis "Library for reading and writing MAT files")
2778 (description "Matio is a library for reading and writing MAT files. It
2779 supports compressed MAT files, as well as newer (version 7.3) MAT files.")
2780 (license license:bsd-2)))
2782 (define-public libhilbert
2789 (uri (string-append "http://web.cs.dal.ca/~chamilto/hilbert/"
2790 "libhilbert-" version ".tar.gz"))
2793 "0v48x8405dj95gjn2saja4bzhw86d6zl6d3dg8h7dzac2qr97s34"))))
2794 (build-system gnu-build-system)
2795 (home-page "http://web.cs.dal.ca/~chamilto/hilbert")
2796 (synopsis "Hilbert indices for multidimensional data")
2797 (description "The libhilbert library can efficiently calculate Hilbert
2798 curves and order-preserving representations of Hilbert curve indices that use
2799 the same amount of space as the original point representation. This is useful
2800 when using the Gilbert curve as a space filling curve through a
2801 high-dimensional space where not all demensions have the same cardinality.")
2802 (license license:lgpl2.1+)))
2809 (origin (method url-fetch)
2810 (uri (string-append "https://github.com/VcDevel/Vc/releases/"
2811 "download/" version "/Vc-" version ".tar.gz"))
2814 "1rh6dhqar3y07n4xqyml0sa0v48qv3ch9dc3yc2in855hlh4vnqi"))))
2815 (build-system cmake-build-system)
2818 '("-DBUILD_TESTING=ON")))
2819 (synopsis "SIMD vector classes for C++")
2820 (description "Vc provides portable, zero-overhead C++ types for explicitly
2821 data-parallel programming. It is a library designed to ease explicit
2822 vectorization of C++ code. Its types enable explicitly stating data-parallel
2823 operations on multiple values. The parallelism is therefore added via the type
2824 system. Vc has an intuitive API and provides portability between different
2825 compilers and compiler versions as well as portability between different vector
2826 instruction sets. Thus, an application written with Vc can be compiled for:
2829 @item SSE2 upto SSE4.2 or SSE4a
2832 @item NEON (in development)
2833 @item NVIDIA GPUs / CUDA (in development)
2835 (home-page "https://github.com/VcDevel/Vc")
2836 (license license:bsd-3)))