1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
4 ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
5 ;;; Copyright © 2014, 2015 Eric Bavier <bavier@member.fsf.org>
6 ;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch>
7 ;;; Copyright © 2014 Mathieu Lirzin <mathieu.lirzin@openmailbox.org>
8 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
9 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
10 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
11 ;;; Copyright © 2015 Efraim Flashner <efraim@flashner.co.il>
13 ;;; This file is part of GNU Guix.
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28 (define-module (gnu packages maths)
29 #:use-module (ice-9 regex)
30 #:use-module (gnu packages)
31 #:use-module ((guix licenses) #:prefix license:)
32 #:use-module (guix packages)
33 #:use-module (guix download)
34 #:use-module (guix svn-download)
35 #:use-module (guix utils)
36 #:use-module (guix build utils)
37 #:use-module (guix build-system cmake)
38 #:use-module (guix build-system gnu)
39 #:use-module (gnu packages algebra)
40 #:use-module (gnu packages bison)
41 #:use-module (gnu packages boost)
42 #:use-module (gnu packages check)
43 #:use-module (gnu packages cmake)
44 #:use-module (gnu packages compression)
45 #:use-module (gnu packages curl)
46 #:use-module (gnu packages elf)
47 #:use-module (gnu packages flex)
48 #:use-module (gnu packages fltk)
49 #:use-module (gnu packages fontutils)
50 #:use-module (gnu packages gettext)
51 #:use-module (gnu packages gcc)
52 #:use-module (gnu packages gd)
53 #:use-module (gnu packages ghostscript)
54 #:use-module (gnu packages glib)
55 #:use-module (gnu packages gtk)
56 #:use-module (gnu packages less)
57 #:use-module (gnu packages lisp)
58 #:use-module (gnu packages gnome)
59 #:use-module (gnu packages xorg)
60 #:use-module (gnu packages gl)
61 #:use-module (gnu packages m4)
62 #:use-module (gnu packages mpi)
63 #:use-module (gnu packages multiprecision)
64 #:use-module (gnu packages pcre)
65 #:use-module (gnu packages popt)
66 #:use-module (gnu packages perl)
67 #:use-module (gnu packages pkg-config)
68 #:use-module (gnu packages python)
69 #:use-module (gnu packages readline)
70 #:use-module (gnu packages tbb)
71 #:use-module (gnu packages tcsh)
72 #:use-module (gnu packages tcl)
73 #:use-module (gnu packages texinfo)
74 #:use-module (gnu packages texlive)
75 #:use-module (gnu packages wxwidgets)
76 #:use-module (gnu packages xml)
77 #:use-module (gnu packages zip)
78 #:use-module (srfi srfi-1))
86 (uri (string-append "mirror://gnu/units/units-" version
89 "1jxvjknz2jhq773jrwx9gc1df3gfy73yqmkjkygqxzpi318yls3q"))))
90 (build-system gnu-build-system)
91 (synopsis "Conversion between thousands of scales")
93 "GNU Units converts numeric quantities between units of measure. It
94 can handle scale changes through adaptive usage of standard scale
95 prefixes (micro-, kilo-, etc.). It can also handle nonlinear
96 conversions such as Fahrenheit to Celsius. Its interpreter is powerful
97 enough to be used effectively as a scientific calculator.")
98 (license license:gpl3+)
99 (home-page "http://www.gnu.org/software/units/")))
101 (define-public double-conversion
103 (name "double-conversion")
108 "https://github.com/floitsch/double-conversion/archive/v"
110 (file-name (string-append name "-" version ".tar.gz"))
113 "0cnr8xhyjfxijay8ymkqcph3672wp2lj23qhdmr3m4kia5kpdf83"))))
114 (build-system cmake-build-system)
116 '(#:test-target "test"
117 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
118 "-DBUILD_TESTING=ON")))
119 (home-page "https://github.com/floitsch/double-conversion")
120 (synopsis "Conversion routines for IEEE doubles")
122 "The double-conversion library provides binary-decimal and decimal-binary
123 routines for IEEE doubles. The library consists of efficient conversion
124 routines that have been extracted from the V8 JavaScript engine.")
125 (license license:bsd-3)))
127 (define-public dionysus
133 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
137 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
138 (build-system gnu-build-system)
139 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
140 (synopsis "Local search for universal constants and scientific values")
142 "GNU Dionysus is a convenient system for quickly retrieving the values of
143 mathematical constants used in science and engineering. Values can be
144 searched using a simple command-line tool, choosing from three databases:
145 universal constants, atomic numbers, and constants related to
147 (license license:gpl3+)
148 (home-page "http://www.gnu.org/software/dionysus/")))
157 (uri (string-append "mirror://gnu/gsl/gsl-"
161 "0rhcia9jhr3p1f1wybwyllwqfs9bggz99i3mi5lpyqcpff1hdbar"))))
162 (build-system gnu-build-system)
164 `(#:parallel-tests? #f))
165 (home-page "http://www.gnu.org/software/gsl/")
166 (synopsis "Numerical library for C and C++")
168 "The GNU Scientific Library is a library for numerical analysis in C
169 and C++. It includes a wide range of mathematical routines, with over 1000
170 functions in total. Subject areas covered by the library include:
171 differential equations, linear algebra, Fast Fourier Transforms and random
173 (license license:gpl3+)))
182 (uri (string-append "mirror://gnu/glpk/glpk-"
186 "0p17jj1ixd2m9lnsvx8nywmfmnplfk5gvw25r1gy84qzrjkv48vk"))))
187 (build-system gnu-build-system)
191 `(#:configure-flags '("--with-gmp")))
192 (home-page "http://www.gnu.org/software/glpk/")
193 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
195 "GLPK is a C library for solving large-scale linear programming (LP),
196 mixed integer programming (MIP), and other related problems. It supports the
197 GNU MathProg modeling language, a subset of the AMPL language, and features a
198 translator for the language. In addition to the C library, a stand-alone
199 LP/MIP solver is included in the package.")
200 (license license:gpl3+)))
209 (uri (string-append "mirror://gnu/pspp/pspp-"
213 "0c8326yykidi94xi7jn27j8iqxc38vc07d4wf5zyk0l8lpzx5vz7"))))
214 (build-system gnu-build-system)
217 ("fontconfig" ,fontconfig)
218 ("gettext" ,gnu-gettext)
222 ("readline" ,readline)
224 ("gtksourceview" ,gtksourceview-2)
227 `(("glib" ,glib "bin") ;for glib-genmarshal
230 ("pkg-config" ,pkg-config)))
231 (home-page "http://www.gnu.org/software/pspp/")
232 (synopsis "Statistical analysis")
234 "GNU PSPP is a statistical analysis program. It can perform
235 descriptive statistics, T-tests, linear regression and non-parametric tests.
236 It features both a graphical interface as well as command-line input. PSPP
237 is designed to interoperate with Gnumeric, LibreOffice and OpenOffice. Data
238 can be imported from spreadsheets, text files and database sources and it can
239 be output in text, PostScript, PDF or HTML.")
240 (license license:gpl3+)))
242 (define-public arpack-ng
249 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
251 (file-name (string-append name "-" version ".tar.gz"))
254 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
255 (build-system gnu-build-system)
256 (home-page "https://github.com/opencollab/arpack-ng")
259 ("fortran" ,gfortran)))
260 (synopsis "Fortran subroutines for solving eigenvalue problems")
262 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
263 large scale eigenvalue problems.")
264 (license (license:non-copyleft "file://COPYING"
265 "See COPYING in the distribution."))))
267 (define-public arpack-ng-openmpi
268 (package (inherit arpack-ng)
269 (name "arpack-ng-openmpi")
272 ,@(package-inputs arpack-ng)))
273 (arguments `(#:configure-flags '("--enable-mpi")))
274 (synopsis "Fortran subroutines for solving eigenvalue problems with MPI")))
276 (define-public lapack
283 (uri (string-append "http://www.netlib.org/lapack/lapack-"
287 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
288 (build-system cmake-build-system)
289 (home-page "http://www.netlib.org/lapack/")
290 (inputs `(("fortran" ,gfortran)
291 ("python" ,python-2)))
293 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
294 #:phases (alist-cons-before
296 (lambda* (#:key inputs #:allow-other-keys)
297 (let ((python (assoc-ref inputs "python")))
298 (substitute* "lapack_testing.py"
299 (("/usr/bin/env python") python))))
301 (synopsis "Library for numerical linear algebra")
303 "LAPACK is a Fortran 90 library for solving the most commonly occurring
304 problems in numerical linear algebra.")
305 (license (license:non-copyleft "file://LICENSE"
306 "See LICENSE in the distribution."))))
308 (define-public scalapack
315 (uri (string-append "http://www.netlib.org/scalapack/scalapack-"
319 "0p1r61ss1fq0bs8ynnx7xq4wwsdvs32ljvwjnx6yxr8gd6pawx0c"))))
320 (build-system cmake-build-system)
323 ("fortran" ,gfortran)
324 ("lapack" ,lapack))) ;for testing only
326 `(#:configure-flags `("-DBUILD_SHARED_LIBS:BOOL=YES")))
327 (home-page "http://www.netlib.org/scalapack/")
328 (synopsis "Library for scalable numerical linear algebra")
330 "ScaLAPACK is a Fortran 90 library of high-performance linear algebra
331 routines on parallel distributed memory machines. ScaLAPACK solves dense and
332 banded linear systems, least squares problems, eigenvalue problems, and
333 singular value problems.")
334 (license (license:bsd-style "file://LICENSE"
335 "See LICENSE in the distribution."))))
337 (define-public gnuplot
344 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
345 version "/gnuplot-" version ".tar.gz"))
348 "0irwig94w3f8bn4a444hrjnp7w55vqwv8gqj42jiwn6zf5z5bg3w"))))
349 (build-system gnu-build-system)
350 (inputs `(("readline" ,readline)
354 (native-inputs `(("pkg-config" ,pkg-config)
355 ;; Need 'tex', 'latex', 'pdflatex', 'kpsexand', and
356 ;; 'texhash' binaries.
357 ("texlive" ,texlive-bin)))
358 (home-page "http://www.gnuplot.info")
359 (synopsis "Command-line driven graphing utility")
360 (description "Gnuplot is a portable command-line driven graphing
361 utility. It was originally created to allow scientists and students to
362 visualize mathematical functions and data interactively, but has grown to
363 support many non-interactive uses such as web scripting. It is also used as a
364 plotting engine by third-party applications like Octave.")
365 ;; X11 Style with the additional restriction that derived works may only be
366 ;; distributed as patches to the original.
367 (license (license:fsf-free
368 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
377 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-"
381 (base32 "0f9n0v3p3lwc7564791a39c6cn1d3dbrn7d1j3ikqsi27a8hy23d"))))
382 (build-system gnu-build-system)
388 'configure 'patch-configure
390 (substitute* "configure"
393 (home-page "http://www.hdfgroup.org")
394 (synopsis "Management suite for extremely large and complex data")
395 (description "HDF5 is a suite that makes possible the management of
396 extremely large and complex data collections.")
397 (license (license:x11-style
398 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
401 ;; For a fully featured Octave, users are strongly recommended also to install
402 ;; the following packages: texinfo, less, ghostscript, gnuplot.
403 (define-public octave
410 (uri (string-append "mirror://gnu/octave/octave-"
414 "101jr9yck798586jz4vkjcgk36zksmxf1pxrzvipgn2xgyay0zjc"))))
415 (build-system gnu-build-system)
418 ("readline" ,readline)
422 ("arpack" ,arpack-ng)
426 ("fontconfig" ,fontconfig)
427 ("freetype" ,freetype)
434 `(("gfortran" ,gfortran)
435 ("pkg-config" ,pkg-config)
437 ;; The following inputs are not actually used in the build process.
438 ;; However, the ./configure gratuitously tests for their existence and
439 ;; assumes that programs not present at build time are also not, and
440 ;; can never be, available at run time! If these inputs are therefore
441 ;; not present, support for them will be built out. However, Octave
442 ;; will still run without them, albeit without the features they
446 ("ghostscript" ,ghostscript)
447 ("gnuplot" ,gnuplot)))
449 `(#:configure-flags (list (string-append "--with-shell="
450 (assoc-ref %build-inputs "bash")
452 (home-page "http://www.gnu.org/software/octave/")
453 (synopsis "High-level language for numerical computation")
454 (description "GNU Octave is a high-level interpreted language that is
455 specialized for numerical computations. It can be used for both linear and
456 non-linear applications and it provides great support for visualizing results.
457 Work may be performed both at the interactive command-line as well as via
459 (license license:gpl3+)))
468 (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
469 version "-source.tgz"))
471 (base32 "0jv2yvk28w86rx5mvjkb0w12ff2jxih7axnpvznpd295lg5jg7hr"))
472 (modules '((guix build utils)))
474 ;; Remove non-free METIS code
475 '(delete-file-recursively "contrib/Metis"))))
476 (build-system cmake-build-system)
479 ("gfortran" ,gfortran)
486 ("libxext" ,libxext)))
488 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
489 "-DENABLE_BUILD_SHARED:BOOL=ON"
490 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")))
491 (home-page "http://www.geuz.org/gmsh/")
492 (synopsis "3D finite element grid generator")
493 (description "Gmsh is a 3D finite element grid generator with a built-in
494 CAD engine and post-processor. Its design goal is to provide a fast, light
495 and user-friendly meshing tool with parametric input and advanced
496 visualization capabilities. Gmsh is built around four modules: geometry,
497 mesh, solver and post-processing. The specification of any input to these
498 modules is done either interactively using the graphical user interface or in
499 ASCII text files using Gmsh's own scripting language.")
500 (license license:gpl2+)))
509 ;; The *-lite-* tarball does not contain the *large* documentation
510 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
511 "petsc-lite-" version ".tar.gz"))
513 (base32 "13h0m5f9xsdpps4lsp59iz2m7zkapwavq2zfkfvs3ab6sndla0l9"))))
514 (build-system gnu-build-system)
516 `(("python" ,python-2)
519 `(("gfortran" ,gfortran)
522 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
523 ;; leaving out opengl, as configuration seems to only be for mac
526 `(#:test-target "test"
527 #:parallel-build? #f ;build is parallel by default
532 ,(string-append "--with-superlu-include="
533 (assoc-ref %build-inputs "superlu") "/include")
534 ,(string-append "--with-superlu-lib="
535 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
539 ;; PETSc's configure script is actually a python script, so we can't
541 (lambda* (#:key outputs (configure-flags '())
543 (let* ((prefix (assoc-ref outputs "out"))
544 (flags `(,(string-append "--prefix=" prefix)
546 (format #t "build directory: ~s~%" (getcwd))
547 (format #t "configure flags: ~s~%" flags)
548 (zero? (apply system* "./configure" flags))))
550 'configure 'clean-local-references
551 ;; Try to keep build directory names from leaking into compiled code
552 (lambda* (#:key inputs outputs #:allow-other-keys)
553 (let ((out (assoc-ref outputs "out")))
554 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
557 'install 'clean-install
558 ;; Try to keep installed files from leaking build directory names.
559 (lambda* (#:key inputs outputs #:allow-other-keys)
560 (let ((out (assoc-ref outputs "out"))
561 (fortran (assoc-ref inputs "gfortran")))
562 (substitute* (map (lambda (file)
563 (string-append out "/lib/petsc/conf/" file))
564 '("petscvariables" "PETScConfig.cmake"))
566 ;; Make compiler references point to the store
567 (substitute* (string-append out "/lib/petsc/conf/petscvariables")
568 (("= g(cc|\\+\\+|fortran)" _ suffix)
569 (string-append "= " fortran "/bin/g" suffix)))
570 ;; PETSc installs some build logs, which aren't necessary.
571 (for-each (lambda (file)
572 (let ((f (string-append out "/lib/petsc/conf/" file)))
573 (when (file-exists? f)
575 '("configure.log" "make.log" "gmake.log"
576 "test.log" "error.log" "RDict.db"
577 ;; Once installed, should uninstall with Guix
579 %standard-phases)))))
580 (home-page "http://www.mcs.anl.gov/petsc")
581 (synopsis "Library to solve PDEs")
582 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
583 data structures and routines for the scalable (parallel) solution of
584 scientific applications modeled by partial differential equations.")
585 (license (license:non-copyleft
586 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
588 (define-public petsc-complex
589 (package (inherit petsc)
590 (name "petsc-complex")
592 (substitute-keyword-arguments (package-arguments petsc)
593 ((#:configure-flags cf)
594 `(cons "--with-scalar-type=complex" ,cf))))
595 (synopsis "Library to solve PDEs (with complex scalars)")))
597 (define-public petsc-openmpi
598 (package (inherit petsc)
599 (name "petsc-openmpi")
601 `(("openmpi" ,openmpi)
602 ,@(package-inputs petsc)))
604 (substitute-keyword-arguments (package-arguments petsc)
605 ((#:configure-flags cf)
606 ``("--with-mpiexec=mpirun"
607 ,(string-append "--with-mpi-dir="
608 (assoc-ref %build-inputs "openmpi"))
609 ,@(delete "--with-mpi=0" ,cf)))))
610 (synopsis "Library to solve PDEs (with MPI support)")))
612 (define-public petsc-complex-openmpi
613 (package (inherit petsc-complex)
614 (name "petsc-complex-openmpi")
616 `(("openmpi" ,openmpi)
617 ,@(package-inputs petsc-complex)))
619 (substitute-keyword-arguments (package-arguments petsc-complex)
620 ((#:configure-flags cf)
621 ``("--with-mpiexec=mpirun"
622 ,(string-append "--with-mpi-dir="
623 (assoc-ref %build-inputs "openmpi"))
624 ,@(delete "--with-mpi=0" ,cf)))))
625 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
634 (uri (string-append "http://slepc.upv.es/download/download.php?"
635 "filename=slepc-" version ".tar.gz"))
638 "1pv5iqz2kc8sj49zsabyz4arnfpana8mjrhq31vzgk16xldk3d1a"))))
639 (build-system gnu-build-system)
641 `(("python" ,python-2)))
643 `(("arpack" ,arpack-ng)
644 ("gfortran" ,gfortran)))
648 `(#:parallel-build? #f ;build is parallel by default
650 `(,(string-append "--with-arpack-dir="
651 (assoc-ref %build-inputs "arpack") "/lib"))
653 (modify-phases %standard-phases
656 ;; configure is a python script, so we can't run it with bash.
657 (lambda* (#:key inputs outputs (configure-flags '())
659 (let* ((prefix (assoc-ref outputs "out"))
660 (flags `(,(string-append "--prefix=" prefix)
662 (format #t "build directory: ~s~%" (getcwd))
663 (format #t "configure flags: ~s~%" flags)
664 (setenv "SLEPC_DIR" (getcwd))
665 (setenv "PETSC_DIR" (assoc-ref inputs "petsc"))
666 (zero? (apply system* "./configure" flags)))))
669 ;; TODO: SLEPc installs HTML documentation alongside headers in
670 ;; $out/include. We'd like to move them to share/doc, but delete
671 ;; them for now, as they are incomplete and installing the complete
672 ;; documentation is difficult.
673 (lambda* (#:key outputs #:allow-other-keys)
674 (let* ((out (assoc-ref outputs "out")))
675 (for-each delete-file (find-files out "\\.html$")))))
677 'install 'clean-install
678 ;; Clean up unnecessary build logs from installation.
679 (lambda* (#:key outputs #:allow-other-keys)
680 (let ((out (assoc-ref outputs "out")))
681 (for-each (lambda (file)
682 (let ((f (string-append out "/lib/slepc/conf/" file)))
683 (when (file-exists? f)
685 '("configure.log" "make.log" "gmake.log"
686 "test.log" "error.log" "RDict.db"
687 "uninstall.py"))))))))
688 (home-page "http://slepc.upv.es")
689 (synopsis "Scalable library for eigenproblems")
690 (description "SLEPc is a software library for the solution of large sparse
691 eigenproblems on parallel computers. It can be used for the solution of
692 linear eigenvalue problems formulated in either standard or generalized form,
693 as well as other related problems such as the singular value decomposition.
694 The emphasis of the software is on methods and techniques appropriate for
695 problems in which the associated matrices are sparse, for example, those
696 arising after the discretization of partial differential equations.")
697 (license license:lgpl3)))
699 (define-public slepc-complex
700 (package (inherit slepc)
701 (name "slepc-complex")
703 `(("petsc" ,petsc-complex)
704 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
705 (synopsis "Scalable library for eigenproblems (with complex scalars)")))
707 (define-public slepc-openmpi
708 (package (inherit slepc)
709 (name "slepc-openmpi")
712 ("arpack" ,arpack-ng-openmpi)
713 ,@(alist-delete "arpack" (package-inputs slepc))))
715 `(("petsc" ,petsc-openmpi)
716 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
717 (synopsis "Scalable library for eigenproblems (with MPI support)")))
719 (define-public slepc-complex-openmpi
720 (package (inherit slepc-openmpi)
721 (name "slepc-complex-openmpi")
723 `(("petsc" ,petsc-complex-openmpi)
724 ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
725 (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
734 (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
738 "1820jfp3mbl7n85765v5mp6p0gzqpgr4d2lrnhwj4gl7cwp5ndah"))
739 (patches (list (search-patch "mumps-build-parallelism.patch")))))
740 (build-system gnu-build-system)
742 `(("fortran" ,gfortran)
743 ;; These are required for linking against mumps, but we let the user
744 ;; declare the dependency.
749 `(#:modules ((ice-9 match)
752 ,@%gnu-build-system-modules)
754 (modify-phases %standard-phases
757 (lambda* (#:key inputs #:allow-other-keys)
758 (call-with-output-file "Makefile.inc"
769 INCSEQ = -I$(topdir)/libseq
770 LIBSEQ = -L$(topdir)/libseq -lmpiseq
771 LIBSEQNEEDED = libseqneeded~;
775 AR = ar vr # rules require trailing space, ugh...
777 LIBBLAS = -L~a -lopenblas~@[
778 SCALAP = -L~a -lscalapack~]
782 OPTF = -O2 -DALLOW_NON_INIT $(PIC)
786 LIBS = $(SCALAP) $(LIBSEQ)
787 LPORDDIR = $(topdir)/PORD/lib
788 IPORD = -I$(topdir)/PORD/include
789 LPORD = -L$(LPORDDIR) -lpord
790 ORDERINGSF = -Dpord~@[
792 IMETIS = -I$(METISDIR)/include
793 LMETIS = -L$(METISDIR)/lib -lmetis
794 ORDERINGSF += -Dmetis~]~@[~:{
796 ISCOTCH = -I$(SCOTCHDIR)/include
797 LSCOTCH = -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
799 ORDERINGSC = $(ORDERINGSF)
800 LORDERINGS = $(LPORD) $(LMETIS) $(LSCOTCH)
801 IORDERINGSF = $(ISCOTCH)
802 IORDERINGSC = $(IPORD) $(IMETIS) $(ISCOTCH)"
803 (assoc-ref inputs "mpi")
804 (assoc-ref inputs "blas")
805 (assoc-ref inputs "scalapack")
806 (assoc-ref inputs "metis")
807 (match (list (assoc-ref inputs "pt-scotch")
808 (assoc-ref inputs "scotch"))
812 `((,scotch "" "-Dscotch")))
815 "-lptesmumps -lptscotch -lptscotcherr "
816 "-Dptscotch")))))))))
819 ;; By default only the d-precision library is built. Make with "all"
820 ;; target so that all precision libraries and examples are built.
822 (zero? (system* "make" "all"
823 (format #f "-j~a" (parallel-job-count))))))
826 ;; Run the simple test drivers, which read test input from stdin:
827 ;; from the "real" input for the single- and double-precision
828 ;; testers, and from the "cmplx" input for complex-precision
829 ;; testers. The EXEC-PREFIX key is used by the mumps-openmpi
830 ;; package to prefix execution with "mpirun".
831 (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
832 (with-directory-excursion "examples"
835 (let ((tester (apply open-pipe*
838 ,(string-append "./" prec
840 (input (open-input-file
841 (string-append "input_simpletest_" type))))
843 (dump-port input tester)
845 (zero? (close-pipe tester)))))
847 '("real" "real" "cmplx" "cmplx")))))
850 (lambda* (#:key outputs #:allow-other-keys)
851 (let ((out (assoc-ref outputs "out")))
852 (copy-recursively "lib" (string-append out "/lib"))
853 (copy-recursively "include" (string-append out "/include"))
854 (when (file-exists? "libseq/libmpiseq.a")
855 (copy-file "libseq/libmpiseq.a"
856 (string-append out "/lib/libmpiseq.a")))))))))
857 (home-page "http://mumps.enseeiht.fr")
858 (synopsis "Multifrontal sparse direct solver")
860 "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
861 sparse system of linear equations A x = b using Guassian elimination.")
862 (license license:cecill-c)))
864 (define-public mumps-metis
865 (package (inherit mumps)
868 (alist-delete "scotch" (package-inputs mumps)))))
870 (define-public mumps-openmpi
871 (package (inherit mumps)
872 (name "mumps-openmpi")
875 ("scalapack" ,scalapack)
876 ("pt-scotch" ,pt-scotch)
877 ,@(alist-delete "scotch" (package-inputs mumps))))
879 (substitute-keyword-arguments (package-arguments mumps)
881 `(modify-phases ,phases
885 ((assoc-ref ,phases 'check)
886 #:exec-prefix '("mpirun" "-n" "2"))))))))
887 (synopsis "Multifrontal sparse direct solver (with MPI)")))
889 (define-public mumps-metis-openmpi
890 (package (inherit mumps-openmpi)
891 (name "mumps-metis-openmpi")
893 (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
895 (define-public superlu
902 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
903 "superlu_" version ".tar.gz"))
905 (base32 "10b785s9s4x0m9q7ihap09275pq4km3k2hk76jiwdfdr5qr2168n"))))
906 (build-system gnu-build-system)
911 ("gfortran" ,gfortran)))
913 `(#:parallel-build? #f
914 #:tests? #f ;tests are run as part of `make all`
918 (lambda* (#:key inputs outputs #:allow-other-keys)
919 (call-with-output-file "make.inc"
924 SUPERLULIB = ~a/lib/libsuperlu.a
926 BLASDEF = -DUSE_VENDOR_BLAS
927 BLASLIB = -L~a/lib -lblas
928 LIBS = $(SUPERLULIB) $(BLASLIB)
934 CFLAGS = -O3 -DPRNTlevel=0 $(PIC)
941 (assoc-ref outputs "out")
942 (assoc-ref inputs "lapack")))))
944 'build 'create-install-directories
945 (lambda* (#:key outputs #:allow-other-keys)
948 (mkdir-p (string-append (assoc-ref outputs "out")
953 (lambda* (#:key outputs #:allow-other-keys)
954 ;; Library is placed in lib during the build phase. Copy over
955 ;; headers to include.
956 (let* ((out (assoc-ref outputs "out"))
957 (incdir (string-append out "/include")))
958 (for-each (lambda (file)
959 (let ((base (basename file)))
960 (format #t "installing `~a' to `~a'~%"
963 (string-append incdir "/" base))))
964 (find-files "SRC" ".*\\.h$"))))
965 %standard-phases)))))
966 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
967 (synopsis "Supernodal direct solver for sparse linear systems")
969 "SuperLU is a general purpose library for the direct solution of large,
970 sparse, nonsymmetric systems of linear equations on high performance machines.
971 The library is written in C and is callable from either C or Fortran. The
972 library routines perform an LU decomposition with partial pivoting and
973 triangular system solves through forward and back substitution. The library
974 also provides threshold-based ILU factorization preconditioners.")
975 (license license:bsd-3)))
977 (define-public superlu-dist
979 (name "superlu-dist")
984 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
985 "superlu_dist_" version ".tar.gz"))
987 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
988 (patches (list (search-patch "superlu-dist-scotchmetis.patch")))))
989 (build-system gnu-build-system)
993 `(("gfortran" ,gfortran)))
995 `(("openmpi" ,openmpi) ;headers include MPI heades
996 ("lapack" ,lapack) ;required to link with output library
997 ("pt-scotch" ,pt-scotch))) ;same
999 `(#:parallel-build? #f ;race conditions using ar
1003 (lambda* (#:key inputs outputs #:allow-other-keys)
1004 (call-with-output-file "make.inc"
1009 DSUPERLULIB = ~a/lib/libsuperlu_dist.a
1010 BLASDEF = -DUSE_VENDOR_BLAS
1011 BLASLIB = -L~a/lib -lblas
1012 PARMETISLIB = -L~a/lib \
1013 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
1014 -lscotch -lscotcherr -lscotcherrexit
1015 METISLIB = -L~:*~a/lib \
1016 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
1017 LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
1023 CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
1024 NOOPTS = -O0 -g $(PIC)
1026 FFLAGS = -O2 -g $(PIC)
1030 (assoc-ref outputs "out")
1031 (assoc-ref inputs "lapack")
1032 (assoc-ref inputs "pt-scotch")))))
1034 'unpack 'remove-broken-symlinks
1036 (for-each delete-file
1037 (find-files "MAKE_INC" "\\.#make\\..*")))
1039 'build 'create-install-directories
1040 (lambda* (#:key outputs #:allow-other-keys)
1043 (mkdir-p (string-append (assoc-ref outputs "out")
1045 '("lib" "include")))
1049 (with-directory-excursion "EXAMPLE"
1051 (zero? (system* "mpirun" "-n" "2"
1052 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
1053 (zero? (system* "mpirun" "-n" "2"
1054 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
1057 (lambda* (#:key outputs #:allow-other-keys)
1058 ;; Library is placed in lib during the build phase. Copy over
1059 ;; headers to include.
1060 (let* ((out (assoc-ref outputs "out"))
1061 (incdir (string-append out "/include")))
1062 (for-each (lambda (file)
1063 (let ((base (basename file)))
1064 (format #t "installing `~a' to `~a'~%"
1067 (string-append incdir "/" base))))
1068 (find-files "SRC" ".*\\.h$"))))
1069 %standard-phases)))))))
1070 (home-page (package-home-page superlu))
1071 (synopsis "Parallel supernodal direct solver")
1073 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
1074 It is targeted for distributed memory parallel machines. SuperLU_DIST is
1075 implemented in ANSI C, and MPI for communications.")
1076 (license license:bsd-3)))
1078 (define-public scotch
1085 (uri (string-append "https://gforge.inria.fr/frs/download.php/34618/"
1086 "scotch_" version ".tar.gz"))
1088 (base32 "1ir088mvrqggyqdkx9qfynmiaffqbyih5qfl5mga2nrlm1qlsgzm"))
1089 (patches (list (search-patch "scotch-test-threading.patch")
1090 (search-patch "pt-scotch-build-parallelism.patch")))))
1091 (build-system gnu-build-system)
1098 (modify-phases %standard-phases
1100 'unpack 'chdir-to-src
1101 (lambda _ (chdir "src")))
1105 (call-with-output-file "Makefile.inc"
1119 CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
1120 LDFLAGS = -lz -lm -lrt -lpthread
1122 LEX = flex -Pscotchyy -olex.yy.c
1127 YACC = bison -pscotchyy -y -b y
1129 '("COMMON_FILE_COMPRESS_GZ"
1131 "COMMON_RANDOM_FIXED_SEED"
1132 ;; Prevents symbolc clashes with libesmumps
1134 ;; XXX: Causes invalid frees in superlu-dist tests
1136 ;; "SCOTCH_PTHREAD_NUMBER=2"
1137 "restrict=__restrict"))))))
1139 'build 'build-esmumps
1141 (zero? (system* "make"
1142 (format #f "-j~a" (parallel-job-count))
1146 (lambda* (#:key outputs #:allow-other-keys)
1147 (let ((out (assoc-ref outputs "out")))
1149 (zero? (system* "make"
1150 (string-append "prefix=" out)
1152 ;; esmumps files are not installed with the above
1153 (for-each (lambda (f)
1154 (copy-file f (string-append out "/include/" f)))
1155 (find-files "../include" ".*esmumps.h$"))
1156 (for-each (lambda (f)
1157 (copy-file f (string-append out "/lib/" f)))
1158 (find-files "../lib" "^lib.*esmumps.*"))))))))
1159 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
1160 (synopsis "Programs and libraries for graph algorithms")
1161 (description "SCOTCH is a set of programs and libraries which implement
1162 the static mapping and sparse matrix reordering algorithms developed within
1163 the SCOTCH project. Its purpose is to apply graph theory, with a divide and
1164 conquer approach, to scientific computing problems such as graph and mesh
1165 partitioning, static mapping, and sparse matrix ordering, in application
1166 domains ranging from structural mechanics to operating systems or
1168 ;; See LICENSE_en.txt
1169 (license license:cecill-c)))
1171 (define-public pt-scotch
1172 (package (inherit scotch)
1175 `(("openmpi" ,openmpi))) ;Headers include MPI headers
1177 (substitute-keyword-arguments (package-arguments scotch)
1178 ((#:phases scotch-phases)
1179 `(modify-phases ,scotch-phases
1184 (zero? (system* "make"
1185 (format #f "-j~a" (parallel-job-count))
1186 "ptscotch" "ptesmumps"))
1187 ;; Install the serial metis compatibility library
1188 (zero? (system* "make" "-C" "libscotchmetis" "install")))))
1191 (lambda _ (zero? (system* "make" "ptcheck"))))))))
1192 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
1194 (define-public metis
1201 (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
1202 "metis-" version ".tar.gz"))
1205 "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
1206 (build-system cmake-build-system)
1208 `(("blas" ,openblas)))
1210 `(#:tests? #f ;no tests
1211 #:configure-flags `("-DSHARED=ON"
1212 ,(string-append "-DGKLIB_PATH=" (getcwd)
1213 "/metis-" ,version "/GKlib"))))
1214 (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
1215 (synopsis "Graph partitioning and fill-reducing matrix ordering library")
1217 "METIS is a set of serial programs for partitioning graphs, partitioning
1218 finite element meshes, and producing fill-reducing orderings for sparse
1219 matrices. The algorithms implemented in METIS are based on the multilevel
1220 recursive-bisection, multilevel k-way, and multi-constraint partitioning
1222 (license license:asl2.0))) ;As of version 5.0.3
1224 (define-public p4est
1231 (uri (string-append "http://p4est.github.io/release/p4est-"
1235 "0faina2h5qsx3m2izbzaj9bbakma1krbbjmq43wrp1hcbyijflqb"))))
1236 (build-system gnu-build-system)
1238 `(("fortran" ,gfortran)
1243 `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
1244 (assoc-ref %build-inputs "blas")
1246 ,(string-append "LAPACK_LIBS=-L"
1247 (assoc-ref %build-inputs "lapack")
1249 (home-page "http://www.p4est.org")
1250 (synopsis "Adaptive mesh refinement on forests of octrees")
1252 "The p4est software library enables the dynamic management of a
1253 collection of adaptive octrees, conveniently called a forest of octrees.
1254 p4est is designed to work in parallel and scales to hundreds of thousands of
1256 (license license:gpl2+)))
1258 (define-public p4est-openmpi
1259 (package (inherit p4est)
1260 (name "p4est-openmpi")
1263 ,@(package-inputs p4est)))
1265 (substitute-keyword-arguments (package-arguments p4est)
1266 ((#:configure-flags cf)
1267 ``("--enable-mpi" ,@,cf))))
1268 (synopsis "Parallel adaptive mesh refinement on forests of octrees")))
1270 (define-public gsegrafix
1277 (uri (string-append "mirror://gnu/" name "/" name "-"
1281 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
1282 (build-system gnu-build-system)
1284 `(#:configure-flags '("LDFLAGS=-lm")))
1286 `(("libgnomecanvas" ,libgnomecanvas)
1287 ("libbonoboui" ,libbonoboui)
1288 ("libgnomeui" ,libgnomeui)
1289 ("libgnomeprintui" ,libgnomeprintui)
1292 `(("pkg-config" ,pkg-config)))
1293 (home-page "http://www.gnu.org/software/gsegrafix/")
1294 (synopsis "GNOME application to create scientific and engineering plots")
1295 (description "GSEGrafix is an application which produces high-quality graphical
1296 plots for science and engineering. Plots are specified via simple ASCII
1297 parameter files and data files and are presented in an anti-aliased GNOME
1298 canvas. The program supports rectangular two-dimensional plots, histograms,
1299 polar-axis plots and three-dimensional plots. Plots can be printed or saved
1300 to BMP, JPEG or PNG image formats.")
1301 (license license:gpl3+)))
1303 (define-public maxima
1310 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
1311 version "-source/" name "-" version ".tar.gz"))
1314 "0x1rk659sn3cq0n5c90848ilzr1gb1wf0072fl6jhkdq00qgh2s0"))
1315 (patches (list (search-patch "maxima-defsystem-mkdir.patch")))))
1316 (build-system gnu-build-system)
1319 ("gnuplot" ,gnuplot) ;for plots
1320 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
1322 `(("texinfo" ,texinfo)
1326 (list "--enable-gcl"
1327 (string-append "--with-posix-shell="
1328 (assoc-ref %build-inputs "bash")
1330 (string-append "--with-wish="
1331 (assoc-ref %build-inputs "tk")
1333 (let ((v ,(package-version tk)))
1334 (string-take v (string-index-right v #\.)))))
1335 ;; By default Maxima attempts to write temporary files to
1336 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
1337 ;; Work around that.
1338 #:make-flags (list "TMPDIR=/tmp")
1339 #:phases (alist-cons-before
1342 (chmod "src/maxima" #o555))
1343 ;; Make sure the doc and emacs files are found in the
1344 ;; standard location. Also configure maxima to find gnuplot
1345 ;; without having it on the PATH.
1347 'install 'post-install
1348 (lambda* (#:key outputs inputs #:allow-other-keys)
1349 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
1350 (out (assoc-ref outputs "out"))
1351 (datadir (string-append out "/share/maxima/" ,version)))
1352 (with-directory-excursion out
1353 (mkdir-p "share/emacs")
1354 (mkdir-p "share/doc")
1356 (string-append datadir "/emacs/")
1357 (string-append out "/share/emacs/site-lisp"))
1359 (string-append datadir "/doc/")
1360 (string-append out "/share/doc/maxima"))
1361 (with-atomic-file-replacement
1362 (string-append datadir "/share/maxima-init.lisp")
1364 (format out "~a ~s~a~%"
1365 "(setf $gnuplot_command "
1366 (string-append gnuplot "/bin/gnuplot") ")")
1367 (dump-port in out))))))
1368 %standard-phases))))
1369 (home-page "http://maxima.sourceforge.net")
1370 (synopsis "Numeric and symbolic expression manipulation")
1371 (description "Maxima is a system for the manipulation of symbolic and
1372 numerical expressions. It yields high precision numeric results by using
1373 exact fractions, arbitrary precision integers, and variable precision floating
1375 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
1376 ;; Others simply say "GNU General Public License" without stating a
1377 ;; version (which implicitly means gpl1+).
1378 ;; At least one file (src/maxima.asd) says "version 2."
1379 ;; GPLv2 only is therefore the smallest subset.
1380 (license license:gpl2)))
1382 (define-public wxmaxima
1389 (uri (string-append "mirror://sourceforge/wxmaxima/wxMaxima/"
1390 version "/" name "-" version ".tar.gz"))
1393 "1fm47ah4aw5qdjqhkz67w5fwhy8yfffa5z896crp0d3hk2bh4180"))))
1394 (build-system gnu-build-system)
1396 `(("wxwidgets" ,wxwidgets)
1397 ("maxima" ,maxima)))
1399 `(#:phases (modify-phases %standard-phases
1401 'install 'wrap-program
1402 (lambda* (#:key inputs outputs #:allow-other-keys)
1403 (wrap-program (string-append (assoc-ref outputs "out")
1406 (,(string-append (assoc-ref inputs "maxima")
1409 (home-page "https://andrejv.github.io/wxmaxima/")
1410 (synopsis "Graphical user interface for the Maxima computer algebra system")
1412 "wxMaxima is a graphical user interface for the Maxima computer algebra
1413 system. It eases the use of Maxima by making most of its commands available
1414 through a menu system and by providing input dialogs for commands that require
1415 more than one argument. It also implements its own display engine that
1416 outputs mathematical symbols directly instead of depicting them with ASCII
1419 wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
1420 text and mathematical calculations to create documents, exporting of input and
1421 output to TeX, and a browser for Maxima's manual including command index and
1422 full text searching.")
1423 (license license:gpl2+)))
1425 (define-public armadillo
1431 (uri (string-append "mirror://sourceforge/arma/armadillo-"
1435 "0bsgrmldlx77w5x26n3axj1hg6iw6csyw0dwl1flrbdwl51f9701"))))
1436 (build-system cmake-build-system)
1437 (arguments `(#:tests? #f)) ;no test target
1439 `(("openblas" ,openblas)
1441 ("arpack" ,arpack-ng)))
1442 (home-page "http://arma.sourceforge.net/")
1443 (synopsis "C++ linear algebra library")
1445 "Armadillo is a C++ linear algebra library, aiming towards a good balance
1446 between speed and ease of use. It is useful for algorithm development
1447 directly in C++, or quick conversion of research code into production
1448 environments. It can be used for machine learning, pattern recognition,
1449 signal processing, bioinformatics, statistics, econometrics, etc. The library
1450 provides efficient classes for vectors, matrices and cubes, as well as 150+
1451 associated functions (eg. contiguous and non-contiguous submatrix views).")
1452 (license license:mpl2.0)))
1454 (define-public armadillo-for-rcpparmadillo
1455 (package (inherit armadillo)
1459 (uri (string-append "mirror://sourceforge/arma/armadillo-"
1463 "1f69rlqhnf2wv8khyn2a8vi6gx1i72qgfy8b9b760ssk85dcl763"))))))
1465 (define-public muparser
1473 (url "http://muparser.googlecode.com/svn/trunk/")
1477 "1d6bdbhx9zj3srwj3m7c9hvr18gnx1fx43h6d25my7q85gicpcwn"))))
1478 (build-system gnu-build-system)
1480 `(#:configure-flags '("--enable-samples=no")
1481 #:tests? #f)) ;no "check" target
1482 (home-page "http://muparser.beltoforion.de/")
1483 (synopsis "Fast parser library for mathematical expressions")
1485 "muParser is an extensible high performance math parser library. It is
1486 based on transforming an expression into a bytecode and precalculating
1487 constant parts of it.")
1488 (license license:expat)))
1490 (define-public openblas
1497 (uri (string-append "https://github.com/xianyi/OpenBLAS/tarball/v"
1499 (file-name (string-append name "-" version ".tar.gz"))
1502 "1k5f6vjlk54qlplk5m7xkbaw6g2y7dl50lwwdv6xsbcsgsbxfcpy"))))
1503 (build-system gnu-build-system)
1505 `(#:tests? #f ;no "check" target
1506 ;; DYNAMIC_ARCH is only supported on x86. When it is disabled and no
1507 ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
1508 ;; we need to disable substitutions.
1510 ,(let ((system (or (%current-target-system) (%current-system))))
1511 (or (string-prefix? "x86_64" system)
1512 (string-prefix? "i686" system)
1513 (string-prefix? "mips" system)))
1515 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1518 ;; Build the library for all supported CPUs. This allows
1519 ;; switching CPU targets at runtime with the environment variable
1520 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
1521 ;; Unfortunately, this is not supported on non-x86 architectures,
1522 ;; where it leads to failed builds.
1523 ,@(let ((system (or (%current-target-system) (%current-system))))
1525 ((or (string-prefix? "x86_64" system)
1526 (string-prefix? "i686" system))
1527 '("DYNAMIC_ARCH=1"))
1528 ;; On MIPS we force the "SICORTEX" TARGET, as for the other
1529 ;; two available MIPS targets special extended instructions
1530 ;; for Loongson cores are used.
1531 ((string-prefix? "mips" system)
1532 '("TARGET=SICORTEX"))
1534 ;; no configure script
1535 #:phases (alist-delete 'configure %standard-phases)))
1537 `(("fortran" ,gfortran)))
1541 (home-page "http://www.openblas.net/")
1542 (synopsis "Optimized BLAS library based on GotoBLAS")
1544 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
1545 (license license:bsd-3)))
1547 (define-public openlibm
1554 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
1556 (file-name (string-append name "-" version ".tar.gz"))
1559 "0cwqqqlblj3kzp9aq1wnpfs1fl0qd1wp1xzm5shb09w06i4rh9nn"))))
1560 (build-system gnu-build-system)
1563 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1565 ;; no configure script
1566 (alist-delete 'configure %standard-phases)
1567 #:tests? #f)) ;the tests are part of the default target
1568 (home-page "http://openlibm.org/")
1569 (synopsis "Portable C mathematical library (libm)")
1571 "OpenLibm is an effort to have a high quality, portable, standalone C
1572 mathematical library (libm). It can be used standalone in applications and
1573 programming language implementations. The project was born out of a need to
1574 have a good libm for the Julia programming language that worked consistently
1575 across compilers and operating systems, and in 32-bit and 64-bit
1577 ;; See LICENSE.md for details.
1578 (license (list license:expat
1581 license:public-domain
1582 license:lgpl2.1+))))
1584 (define-public openspecfun
1586 (name "openspecfun")
1591 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
1593 (file-name (string-append name "-" version ".tar.gz"))
1596 "0nsa3jjmlhcqkw5ba5ypbn3n0c8b6lc22zzlxnmxkxi9shhdx65z"))))
1597 (build-system gnu-build-system)
1599 '(#:tests? #f ;no "check" target
1601 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1602 ;; no configure script
1603 #:phases (alist-delete 'configure %standard-phases)))
1605 `(("fortran" ,gfortran)))
1606 (home-page "https://github.com/JuliaLang/openspecfun")
1607 (synopsis "Collection of special mathematical functions")
1609 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
1610 portable package for Bessel Functions of a Complex Argument and Nonnegative
1611 Order; it contains subroutines for computing Bessel functions and Airy
1612 functions. Faddeeva allows computing the various error functions of arbitrary
1613 complex arguments (Faddeeva function, error function, complementary error
1614 function, scaled complementary error function, imaginary error function, and
1615 Dawson function); given these, one can also easily compute Voigt functions,
1616 Fresnel integrals, and similar related functions as well.")
1617 ;; Faddeeva is released under the Expat license; AMOS is included as
1618 ;; public domain software.
1619 (license (list license:expat license:public-domain))))
1621 (define-public suitesparse
1623 (name "suitesparse")
1629 "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-"
1633 "100hdzr0mf4mzlwnqpmwpfw4pymgsf9n3g0ywb1yps2nk1zbkdy5"))))
1634 (build-system gnu-build-system)
1636 '(#:parallel-build? #f ;cholmod build fails otherwise
1637 #:tests? #f ;no "check" target
1642 "CHOLMOD_CONFIG=-DNPARTITION" ;required when METIS is not used
1643 (string-append "INSTALL_LIB="
1644 (assoc-ref %outputs "out") "/lib")
1645 (string-append "INSTALL_INCLUDE="
1646 (assoc-ref %outputs "out") "/include"))
1649 'install 'prepare-out
1650 ;; README.txt states that the target directories must exist prior to
1651 ;; running "make install".
1653 (mkdir-p (string-append (assoc-ref %outputs "out") "/lib"))
1654 (mkdir-p (string-append (assoc-ref %outputs "out") "/include")))
1655 ;; no configure script
1656 (alist-delete 'configure %standard-phases))))
1659 ("lapack" ,lapack)))
1660 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
1661 (synopsis "Suite of sparse matrix software")
1663 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
1664 multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
1665 multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
1666 simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
1667 CXSparse, a concise sparse Cholesky factorization package; and many other
1670 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
1672 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
1673 (license (list license:gpl2+ license:lgpl2.1+))))
1675 (define-public atlas
1681 (uri (string-append "mirror://sourceforge/math-atlas/atlas"
1682 version ".tar.bz2"))
1685 "0bqh4bdnjdyww4mcpg6kn0x7338mfqbdgysn97dzrwwb26di7ars"))))
1686 (build-system gnu-build-system)
1687 (home-page "http://math-atlas.sourceforge.net/")
1688 (inputs `(("gfortran" ,gfortran)
1689 ("lapack-tar" ,(package-source lapack))))
1690 (outputs '("out" "doc"))
1691 ;; For the moment we drop support for MIPS at it fails to compile. See
1692 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
1693 (supported-systems (delete "mips64el-linux" %supported-systems))
1695 `(#:parallel-build? #f
1696 #:parallel-tests? #f
1698 ;; ATLAS tunes itself for the machine it is built on, as explained at
1699 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
1700 ;; For this reason, we want users to build it locally instead of using
1704 #:modules ((srfi srfi-26)
1706 (guix build gnu-build-system)
1709 `(;; Generate position independent code suitable for dynamic libraries
1710 ;; and use WALL timer to get more accurate timing.
1711 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
1714 ,,(if (string-match "64" (%current-system))
1717 ;; Disable parallel build as it gives errors: atlas_pthread.h is
1718 ;; needed to compile C files before it is generated.
1719 "-Ss" "pmake" "make -j 1"
1720 ;; Probe is failing for MIPS. We therefore define the system
1721 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
1722 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
1723 ,,@(if (string-prefix? "mips" (%current-system))
1724 (list "-A" "49" "-V" "1")
1726 ;; Generate shared libraries.
1728 ;; Build a full LAPACK library.
1729 ,(string-append "--with-netlib-lapack-tarfile="
1730 (assoc-ref %build-inputs "lapack-tar")))
1733 'install 'install-doc
1734 (lambda* (#:key outputs inputs #:allow-other-keys)
1735 (let ((doc (string-append (assoc-ref outputs "doc")
1736 "/share/doc/atlas")))
1738 (fold (lambda (file previous)
1739 (and previous (zero? (system* "cp" file doc))))
1740 #t (find-files "../ATLAS/doc" ".*"))))
1743 (lambda _ (zero? (system* "make" "ptcheck")))
1744 ;; Fix files required to run configure.
1746 'configure 'fix-/bin/sh
1748 ;; Use `sh', not `/bin/sh'.
1749 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
1752 ;; Fix /bin/sh in generated make files.
1754 'configure 'fix-/bin/sh-in-generated-files
1756 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
1759 ;; ATLAS configure program does not accepts the default flags
1760 ;; passed by the 'gnu-build-system'.
1763 (lambda* (#:key native-inputs inputs outputs
1764 (configure-flags '())
1765 #:allow-other-keys #:rest args)
1766 (let* ((prefix (assoc-ref outputs "out"))
1767 (bash (or (and=> (assoc-ref
1768 (or native-inputs inputs) "bash")
1769 (cut string-append <> "/bin/bash"))
1771 (flags `(,(string-append "--prefix=" prefix)
1773 (abs-srcdir (getcwd))
1774 (srcdir (string-append "../" (basename abs-srcdir))))
1775 (format #t "source directory: ~s (relative from build: ~s)~%"
1779 (format #t "build directory: ~s~%" (getcwd))
1780 (format #t "configure flags: ~s~%" flags)
1781 (zero? (apply system* bash
1782 (string-append srcdir "/configure")
1784 %standard-phases)))))))
1785 (synopsis "Automatically Tuned Linear Algebra Software")
1787 "ATLAS is an automatically tuned linear algebra software library
1788 providing C and Fortran77 interfaces to a portably efficient BLAS
1789 implementation, as well as a few routines from LAPACK.
1791 Optimization occurs at build time. For this reason, the library is built on
1792 the machine where it is installed, without resorting to pre-built substitutes.
1794 Before building the library, CPU throttling should be disabled. This can be
1795 done in the BIOS, or, on GNU/Linux, with the following commands:
1797 cpufreq-selector -g performance -c 0
1799 cpufreq-selector -g performance -c N-1
1801 where N is the number of cores of your CPU. Failure to do so will result in a
1802 library with poor performance.")
1803 (license license:bsd-3)))
1812 (uri (string-append "mirror://sourceforge/ogl-math/glm-"
1816 "1cnjmi033a16a95v6xfkr1bvfmkd26hzdjka8j1819hgn5b1nr8l"))))
1817 (build-system cmake-build-system)
1819 `(("unzip" ,unzip)))
1820 (home-page "http://glm.g-truc.net")
1821 (synopsis "OpenGL Mathematics library")
1822 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
1823 library for graphics software based on the OpenGL Shading Language (GLSL)
1825 (license license:expat)))
1827 (define-public lpsolve
1834 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
1835 "/lp_solve_" version "_source.tar.gz"))
1838 "176c7f023mb6b8bfmv4rfqnrlw88lsg422ca74zjh19i2h5s69sq"))
1839 (modules '((guix build utils)))
1841 '(substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
1843 ;; Pretend to be on a 64 bit platform to obtain a common directory
1844 ;; name for the build results on all architectures; nothing else
1845 ;; seems to depend on it.
1846 (("^PLATFORM=.*$") "PLATFORM=ux64\n")))))
1847 (build-system gnu-build-system)
1849 `(#:tests? #f ; no check target
1851 (modify-phases %standard-phases
1855 (with-directory-excursion "lpsolve55"
1856 (system* "bash" "ccc"))
1857 (with-directory-excursion "lp_solve"
1858 (system* "bash" "ccc"))
1861 (lambda* (#:key outputs #:allow-other-keys)
1862 (let* ((out (assoc-ref outputs "out"))
1863 (bin (string-append out "/bin"))
1864 (lib (string-append out "/lib"))
1865 ;; This is where LibreOffice expects to find the header
1866 ;; files, and where they are installed by Debian.
1867 (include (string-append out "/include/lpsolve")))
1869 (copy-file "lpsolve55/bin/ux64/liblpsolve55.a"
1870 (string-append lib "/liblpsolve55.a"))
1871 (copy-file "lpsolve55/bin/ux64/liblpsolve55.so"
1872 (string-append lib "/liblpsolve55.so"))
1873 (install-file "lp_solve/bin/ux64/lp_solve" bin)
1875 ;; Install a subset of the header files as on Debian
1876 ;; (plus lp_bit.h, which matches the regular expression).
1877 (for-each (lambda (name)
1878 (install-file name include))
1879 (find-files "." "lp_[HMSa-z].*\\.h$"))
1880 (with-directory-excursion "shared"
1881 (for-each (lambda (name)
1882 (install-file name include))
1883 (find-files "." "\\.h$")))
1885 (home-page "http://lpsolve.sourceforge.net/")
1886 (synopsis "Mixed integer linear programming (MILP) solver")
1888 "lp_solve is a mixed integer linear programming solver based on the
1889 revised simplex and the branch-and-bound methods.")
1890 (license license:lgpl2.1+)))
1892 (define-public dealii
1899 (uri (string-append "https://github.com/dealii/dealii/releases/"
1900 "download/v" version "/dealii-" version ".tar.gz"))
1903 "185jych0gdnpkjwxni7pd0dda149492zwq2457xdjg76bzj78mnp"))
1904 (patches (list (search-patch "dealii-p4est-interface.patch")))
1905 (modules '((guix build utils)))
1907 ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
1908 '(delete-file-recursively "bundled"))))
1909 (build-system cmake-build-system)
1917 ("arpack" ,arpack-ng)
1918 ("muparser" ,muparser)
1919 ("gfortran" ,gfortran)
1920 ("suitesparse" ,suitesparse))) ;for UMFPACK
1922 `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease
1923 #:configure-flags '("-DCOMPAT_FILES=OFF") ;Follow new directory structure
1924 #:phases (modify-phases %standard-phases
1926 'install 'hint-example-prefix
1927 ;; Set Cmake hints in examples so that they can find this
1928 ;; deal.II when configuring.
1929 (lambda* (#:key outputs #:allow-other-keys)
1930 (let* ((out (assoc-ref %outputs "out"))
1931 (exmpl (string-append out "/share/doc"
1932 "/dealii/examples")))
1933 (substitute* (find-files exmpl "CMakeLists.txt")
1934 (("([[:space:]]*HINTS.*)\n" _ line)
1935 (string-append line " $ENV{HOME}/.guix-profile "
1938 (home-page "https://www.dealii.org")
1939 (synopsis "Finite element library")
1941 "Deal.II is a C++ program library targeted at the computational solution
1942 of partial differential equations using adaptive finite elements. The main
1943 aim of deal.II is to enable rapid development of modern finite element codes,
1944 using among other aspects adaptive meshes and a wide array of tools often used
1945 in finite element programs.")
1946 (license license:lgpl2.1+)))
1948 (define-public dealii-openmpi
1949 (package (inherit dealii)
1950 (name "dealii-openmpi")
1953 ;;Supported only with MPI:
1954 ("p4est" ,p4est-openmpi)
1955 ("petsc" ,petsc-openmpi)
1956 ("slepc" ,slepc-openmpi)
1957 ("metis" ,metis) ;for MUMPS
1958 ("scalapack" ,scalapack) ;for MUMPS
1959 ("mumps" ,mumps-metis-openmpi) ;configure supports only metis orderings
1960 ("arpack" ,arpack-ng-openmpi)
1961 ,@(fold alist-delete (package-inputs dealii)
1962 '("p4est" "arpack"))))
1964 (substitute-keyword-arguments (package-arguments dealii)
1965 ((#:configure-flags cf)
1966 ``("-DMPI_C_COMPILER=mpicc"
1967 "-DMPI_CXX_COMPILER=mpicxx"
1968 "-DMPI_Fortran_COMPILER=mpifort"
1970 (synopsis "Finite element library (with MPI support)")))
1972 (define-public flann
1981 "http://www.cs.ubc.ca/research/flann/uploads/FLANN/flann-"
1982 version "-src.zip"))
1985 "022w8hph7bli5zbpnk3z1qh1c2sl5hm8fw2ccim651ynn0hr7fyz"))))
1986 (build-system cmake-build-system)
1988 `(("unzip" ,unzip)))
1992 ("python" ,python-2) ; print syntax
1993 ;; ("python2-numpy" ,python2-numpy) ; only required for the tests
1996 `(#:tests? #f)) ; The test data are downloaded from the Internet.
1997 (home-page "http://www.cs.ubc.ca/research/flann/")
1998 (synopsis "Library for approximate nearest neighbors computation")
1999 (description "FLANN is a library for performing fast approximate
2000 nearest neighbor searches in high dimensional spaces. It implements a
2001 collection of algorithms and a system for automatically choosing the best
2002 algorithm and optimum parameters depending on the dataset.
2004 FLANN is written in C++ and contains bindings for C, Octave and Python.")
2005 (license (license:non-copyleft "file://COPYING"
2006 "See COPYING in the distribution."))))
2008 (define-public wcalc
2017 "mirror://sourceforge/w-calc/wcalc-" version ".tar.bz2"))
2020 "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
2021 (build-system gnu-build-system)
2024 ("readline" ,readline)))
2025 (home-page "http://w-calc.sourceforge.net/index.php")
2026 (synopsis "Flexible command-line scientific calculator")
2027 (description "Wcalc is a very capable calculator. It has standard functions
2028 (sin, asin, and sinh for example, in either radians or degrees), many
2029 pre-defined constants (pi, e, c, etc.), support for using variables, \"active\"
2030 variables, a command history, hex/octal/binary input and output, unit
2031 conversions, embedded comments, and an expandable expression entry field. It
2032 evaluates expressions using the standard order of operations.")
2033 (license license:gpl2+)))