gnu: slepc: Set origin file-name.
[jackhill/guix/guix.git] / gnu / packages / maths.scm
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, 2016 Efraim Flashner <efraim@flashner.co.il>
12 ;;; Copyright © 2015 Fabian Harfert <fhmgufs@web.de>
13 ;;;
14 ;;; This file is part of GNU Guix.
15 ;;;
16 ;;; GNU Guix is free software; you can redistribute it and/or modify it
17 ;;; under the terms of the GNU General Public License as published by
18 ;;; the Free Software Foundation; either version 3 of the License, or (at
19 ;;; your option) any later version.
20 ;;;
21 ;;; GNU Guix is distributed in the hope that it will be useful, but
22 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;;; GNU General Public License for more details.
25 ;;;
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29 (define-module (gnu packages maths)
30 #:use-module (ice-9 regex)
31 #:use-module (gnu packages)
32 #:use-module ((guix licenses) #:prefix license:)
33 #:use-module (guix packages)
34 #:use-module (guix download)
35 #:use-module (guix svn-download)
36 #:use-module (guix utils)
37 #:use-module (guix build utils)
38 #:use-module (guix build-system cmake)
39 #:use-module (guix build-system gnu)
40 #:use-module (gnu packages algebra)
41 #:use-module (gnu packages bison)
42 #:use-module (gnu packages boost)
43 #:use-module (gnu packages check)
44 #:use-module (gnu packages cmake)
45 #:use-module (gnu packages compression)
46 #:use-module (gnu packages curl)
47 #:use-module (gnu packages elf)
48 #:use-module (gnu packages flex)
49 #:use-module (gnu packages fltk)
50 #:use-module (gnu packages fontutils)
51 #:use-module (gnu packages gettext)
52 #:use-module (gnu packages gcc)
53 #:use-module (gnu packages gd)
54 #:use-module (gnu packages ghostscript)
55 #:use-module (gnu packages glib)
56 #:use-module (gnu packages gtk)
57 #:use-module (gnu packages image)
58 #:use-module (gnu packages less)
59 #:use-module (gnu packages lisp)
60 #:use-module (gnu packages gnome)
61 #:use-module (gnu packages xorg)
62 #:use-module (gnu packages gl)
63 #:use-module (gnu packages m4)
64 #:use-module (gnu packages mpi)
65 #:use-module (gnu packages multiprecision)
66 #:use-module (gnu packages pcre)
67 #:use-module (gnu packages popt)
68 #:use-module (gnu packages perl)
69 #:use-module (gnu packages pkg-config)
70 #:use-module (gnu packages python)
71 #:use-module (gnu packages readline)
72 #:use-module (gnu packages tbb)
73 #:use-module (gnu packages tcsh)
74 #:use-module (gnu packages tcl)
75 #:use-module (gnu packages texinfo)
76 #:use-module (gnu packages texlive)
77 #:use-module (gnu packages wxwidgets)
78 #:use-module (gnu packages xml)
79 #:use-module (gnu packages zip)
80 #:use-module (srfi srfi-1))
81
82 (define-public units
83 (package
84 (name "units")
85 (version "2.12")
86 (source (origin
87 (method url-fetch)
88 (uri (string-append "mirror://gnu/units/units-" version
89 ".tar.gz"))
90 (sha256 (base32
91 "1jxvjknz2jhq773jrwx9gc1df3gfy73yqmkjkygqxzpi318yls3q"))))
92 (build-system gnu-build-system)
93 (synopsis "Conversion between thousands of scales")
94 (description
95 "GNU Units converts numeric quantities between units of measure. It
96 can handle scale changes through adaptive usage of standard scale
97 prefixes (micro-, kilo-, etc.). It can also handle nonlinear
98 conversions such as Fahrenheit to Celsius. Its interpreter is powerful
99 enough to be used effectively as a scientific calculator.")
100 (license license:gpl3+)
101 (home-page "http://www.gnu.org/software/units/")))
102
103 (define-public double-conversion
104 (package
105 (name "double-conversion")
106 (version "1.1.5")
107 (source (origin
108 (method url-fetch)
109 (uri (string-append
110 "https://github.com/floitsch/double-conversion/archive/v"
111 version ".tar.gz"))
112 (file-name (string-append name "-" version ".tar.gz"))
113 (sha256
114 (base32
115 "0cnr8xhyjfxijay8ymkqcph3672wp2lj23qhdmr3m4kia5kpdf83"))))
116 (build-system cmake-build-system)
117 (arguments
118 '(#:test-target "test"
119 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
120 "-DBUILD_TESTING=ON")))
121 (home-page "https://github.com/floitsch/double-conversion")
122 (synopsis "Conversion routines for IEEE doubles")
123 (description
124 "The double-conversion library provides binary-decimal and decimal-binary
125 routines for IEEE doubles. The library consists of efficient conversion
126 routines that have been extracted from the V8 JavaScript engine.")
127 (license license:bsd-3)))
128
129 (define-public dionysus
130 (package
131 (name "dionysus")
132 (version "1.3.0")
133 (source (origin
134 (method url-fetch)
135 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
136 ".tar.gz"))
137 (sha256
138 (base32
139 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
140 (build-system gnu-build-system)
141 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
142 (synopsis "Local search for universal constants and scientific values")
143 (description
144 "GNU Dionysus is a convenient system for quickly retrieving the values of
145 mathematical constants used in science and engineering. Values can be
146 searched using a simple command-line tool, choosing from three databases:
147 universal constants, atomic numbers, and constants related to
148 semiconductors.")
149 (license license:gpl3+)
150 (home-page "http://www.gnu.org/software/dionysus/")))
151
152 (define-public gsl
153 (package
154 (name "gsl")
155 (version "2.1")
156 (source
157 (origin
158 (method url-fetch)
159 (uri (string-append "mirror://gnu/gsl/gsl-"
160 version ".tar.gz"))
161 (sha256
162 (base32
163 "0rhcia9jhr3p1f1wybwyllwqfs9bggz99i3mi5lpyqcpff1hdbar"))))
164 (build-system gnu-build-system)
165 (arguments
166 `(#:parallel-tests? #f))
167 (home-page "http://www.gnu.org/software/gsl/")
168 (synopsis "Numerical library for C and C++")
169 (description
170 "The GNU Scientific Library is a library for numerical analysis in C
171 and C++. It includes a wide range of mathematical routines, with over 1000
172 functions in total. Subject areas covered by the library include:
173 differential equations, linear algebra, Fast Fourier Transforms and random
174 numbers.")
175 (license license:gpl3+)))
176
177 (define-public glpk
178 (package
179 (name "glpk")
180 (version "4.59")
181 (source
182 (origin
183 (method url-fetch)
184 (uri (string-append "mirror://gnu/glpk/glpk-"
185 version ".tar.gz"))
186 (sha256
187 (base32
188 "1bpbp5z0378kaj5bqmc5m2j5h9c7553p0s2j6a28badqghpbx673"))))
189 (build-system gnu-build-system)
190 (inputs
191 `(("gmp" ,gmp)))
192 (arguments
193 `(#:configure-flags '("--with-gmp")))
194 (home-page "http://www.gnu.org/software/glpk/")
195 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
196 (description
197 "GLPK is a C library for solving large-scale linear programming (LP),
198 mixed integer programming (MIP), and other related problems. It supports the
199 GNU MathProg modeling language, a subset of the AMPL language, and features a
200 translator for the language. In addition to the C library, a stand-alone
201 LP/MIP solver is included in the package.")
202 (license license:gpl3+)))
203
204 (define-public pspp
205 (package
206 (name "pspp")
207 (version "0.8.5")
208 (source
209 (origin
210 (method url-fetch)
211 (uri (string-append "mirror://gnu/pspp/pspp-"
212 version ".tar.gz"))
213 (sha256
214 (base32
215 "0c8326yykidi94xi7jn27j8iqxc38vc07d4wf5zyk0l8lpzx5vz7"))))
216 (build-system gnu-build-system)
217 (inputs
218 `(("cairo" ,cairo)
219 ("fontconfig" ,fontconfig)
220 ("gettext" ,gnu-gettext)
221 ("gsl" ,gsl)
222 ("libxml2" ,libxml2)
223 ("pango" ,pango)
224 ("readline" ,readline)
225 ("gtk" ,gtk+-2)
226 ("gtksourceview" ,gtksourceview-2)
227 ("zlib" ,zlib)))
228 (native-inputs
229 `(("glib" ,glib "bin") ;for glib-genmarshal
230 ("perl" ,perl)
231 ("texinfo" ,texinfo)
232 ("pkg-config" ,pkg-config)))
233 (home-page "http://www.gnu.org/software/pspp/")
234 (synopsis "Statistical analysis")
235 (description
236 "GNU PSPP is a statistical analysis program. It can perform
237 descriptive statistics, T-tests, linear regression and non-parametric tests.
238 It features both a graphical interface as well as command-line input. PSPP
239 is designed to interoperate with Gnumeric, LibreOffice and OpenOffice. Data
240 can be imported from spreadsheets, text files and database sources and it can
241 be output in text, PostScript, PDF or HTML.")
242 (license license:gpl3+)))
243
244 (define-public arpack-ng
245 (package
246 (name "arpack-ng")
247 (version "3.2.0")
248 (source
249 (origin
250 (method url-fetch)
251 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
252 version ".tar.gz"))
253 (file-name (string-append name "-" version ".tar.gz"))
254 (sha256
255 (base32
256 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
257 (build-system gnu-build-system)
258 (home-page "https://github.com/opencollab/arpack-ng")
259 (inputs
260 `(("lapack" ,lapack)
261 ("fortran" ,gfortran)))
262 (synopsis "Fortran subroutines for solving eigenvalue problems")
263 (description
264 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
265 large scale eigenvalue problems.")
266 (license (license:non-copyleft "file://COPYING"
267 "See COPYING in the distribution."))))
268
269 (define-public arpack-ng-openmpi
270 (package (inherit arpack-ng)
271 (name "arpack-ng-openmpi")
272 (inputs
273 `(("mpi" ,openmpi)
274 ,@(package-inputs arpack-ng)))
275 (arguments `(#:configure-flags '("--enable-mpi")))
276 (synopsis "Fortran subroutines for solving eigenvalue problems with MPI")))
277
278 (define-public lapack
279 (package
280 (name "lapack")
281 (version "3.5.0")
282 (source
283 (origin
284 (method url-fetch)
285 (uri (string-append "http://www.netlib.org/lapack/lapack-"
286 version ".tgz"))
287 (sha256
288 (base32
289 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
290 (build-system cmake-build-system)
291 (home-page "http://www.netlib.org/lapack/")
292 (inputs `(("fortran" ,gfortran)
293 ("python" ,python-2)))
294 (arguments
295 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
296 #:phases (alist-cons-before
297 'check 'patch-python
298 (lambda* (#:key inputs #:allow-other-keys)
299 (let ((python (assoc-ref inputs "python")))
300 (substitute* "lapack_testing.py"
301 (("/usr/bin/env python") python))))
302 %standard-phases)))
303 (synopsis "Library for numerical linear algebra")
304 (description
305 "LAPACK is a Fortran 90 library for solving the most commonly occurring
306 problems in numerical linear algebra.")
307 (license (license:non-copyleft "file://LICENSE"
308 "See LICENSE in the distribution."))))
309
310 (define-public scalapack
311 (package
312 (name "scalapack")
313 (version "2.0.2")
314 (source
315 (origin
316 (method url-fetch)
317 (uri (string-append "http://www.netlib.org/scalapack/scalapack-"
318 version ".tgz"))
319 (sha256
320 (base32
321 "0p1r61ss1fq0bs8ynnx7xq4wwsdvs32ljvwjnx6yxr8gd6pawx0c"))))
322 (build-system cmake-build-system)
323 (inputs
324 `(("mpi" ,openmpi)
325 ("fortran" ,gfortran)
326 ("lapack" ,lapack))) ;for testing only
327 (arguments
328 `(#:configure-flags `("-DBUILD_SHARED_LIBS:BOOL=YES")))
329 (home-page "http://www.netlib.org/scalapack/")
330 (synopsis "Library for scalable numerical linear algebra")
331 (description
332 "ScaLAPACK is a Fortran 90 library of high-performance linear algebra
333 routines on parallel distributed memory machines. ScaLAPACK solves dense and
334 banded linear systems, least squares problems, eigenvalue problems, and
335 singular value problems.")
336 (license (license:bsd-style "file://LICENSE"
337 "See LICENSE in the distribution."))))
338
339 (define-public gnuplot
340 (package
341 (name "gnuplot")
342 (version "5.0.2")
343 (source
344 (origin
345 (method url-fetch)
346 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
347 version "/gnuplot-" version ".tar.gz"))
348 (sha256
349 (base32
350 "146qn414z96c7cc42a1kb9a4kpjc2q2hfdwk44kjjvgmfp9k2ass"))))
351 (build-system gnu-build-system)
352 (inputs `(("readline" ,readline)
353 ("cairo" ,cairo)
354 ("pango" ,pango)
355 ("gd" ,gd)))
356 (native-inputs `(("pkg-config" ,pkg-config)
357 ("texlive" ,texlive-minimal)))
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"))))
369
370 (define-public hdf5
371 (package
372 (name "hdf5")
373 (version "1.8.12")
374 (source
375 (origin
376 (method url-fetch)
377 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-"
378 version "/src/hdf5-"
379 version ".tar.bz2"))
380 (sha256
381 (base32 "0f9n0v3p3lwc7564791a39c6cn1d3dbrn7d1j3ikqsi27a8hy23d"))))
382 (build-system gnu-build-system)
383 (inputs
384 `(("zlib" ,zlib)))
385 (arguments
386 `(#:phases
387 (alist-cons-before
388 'configure 'patch-configure
389 (lambda _
390 (substitute* "configure"
391 (("/bin/mv") "mv")))
392 %standard-phases)))
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"))))
399
400
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
404 (package
405 (name "octave")
406 (version "4.0.0")
407 (source
408 (origin
409 (method url-fetch)
410 (uri (string-append "mirror://gnu/octave/octave-"
411 version ".tar.gz"))
412 (sha256
413 (base32
414 "101jr9yck798586jz4vkjcgk36zksmxf1pxrzvipgn2xgyay0zjc"))))
415 (build-system gnu-build-system)
416 (inputs
417 `(("lapack" ,lapack)
418 ("readline" ,readline)
419 ("glpk" ,glpk)
420 ("fftw" ,fftw)
421 ("fftwf" ,fftwf)
422 ("arpack" ,arpack-ng)
423 ("curl" ,curl)
424 ("pcre" ,pcre)
425 ("fltk" ,fltk)
426 ("fontconfig" ,fontconfig)
427 ("freetype" ,freetype)
428 ("hdf5" ,hdf5)
429 ("libxft" ,libxft)
430 ("mesa" ,mesa)
431 ("glu" ,glu)
432 ("zlib" ,zlib)))
433 (native-inputs
434 `(("gfortran" ,gfortran)
435 ("pkg-config" ,pkg-config)
436 ("perl" ,perl)
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
443 ;; provide.
444 ("less" ,less)
445 ("texinfo" ,texinfo)
446 ("ghostscript" ,ghostscript)
447 ("gnuplot" ,gnuplot)))
448 (arguments
449 `(#:configure-flags (list (string-append "--with-shell="
450 (assoc-ref %build-inputs "bash")
451 "/bin/sh"))))
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
458 script files.")
459 (license license:gpl3+)))
460
461 (define-public gmsh
462 (package
463 (name "gmsh")
464 (version "2.11.0")
465 (source
466 (origin
467 (method url-fetch)
468 (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
469 version "-source.tgz"))
470 (sha256
471 (base32 "1ilplibvjgf7a905grpnclrvkmqy9fgrpl7xyp3w4yl1qc682v9b"))
472 (modules '((guix build utils)))
473 (snippet
474 ;; Remove non-free METIS code
475 '(delete-file-recursively "contrib/Metis"))))
476 (build-system cmake-build-system)
477 (propagated-inputs
478 `(("fltk" ,fltk)
479 ("gfortran" ,gfortran)
480 ("gmp" ,gmp)
481 ("hdf5" ,hdf5)
482 ("lapack" ,lapack)
483 ("mesa" ,mesa)
484 ("glu" ,glu)
485 ("libx11" ,libx11)
486 ("libxext" ,libxext)))
487 (arguments
488 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
489 "-DENABLE_BUILD_SHARED:BOOL=ON"
490 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")
491 #:phases (modify-phases %standard-phases
492 (replace
493 'check
494 (lambda _
495 (zero? (system* "make" "test"
496 ;; Disable this test. See
497 ;; https://geuz.org/trac/gmsh/ticket/271
498 "ARGS=-E component8_in_a_box")))))))
499 (home-page "http://www.geuz.org/gmsh/")
500 (synopsis "3D finite element grid generator")
501 (description "Gmsh is a 3D finite element grid generator with a built-in
502 CAD engine and post-processor. Its design goal is to provide a fast, light
503 and user-friendly meshing tool with parametric input and advanced
504 visualization capabilities. Gmsh is built around four modules: geometry,
505 mesh, solver and post-processing. The specification of any input to these
506 modules is done either interactively using the graphical user interface or in
507 ASCII text files using Gmsh's own scripting language.")
508 (license license:gpl2+)))
509
510 (define-public petsc
511 (package
512 (name "petsc")
513 (version "3.6.2")
514 (source
515 (origin
516 (method url-fetch)
517 ;; The *-lite-* tarball does not contain the *large* documentation
518 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
519 "petsc-lite-" version ".tar.gz"))
520 (sha256
521 (base32 "13h0m5f9xsdpps4lsp59iz2m7zkapwavq2zfkfvs3ab6sndla0l9"))))
522 (build-system gnu-build-system)
523 (native-inputs
524 `(("python" ,python-2)
525 ("perl" ,perl)))
526 (inputs
527 `(("gfortran" ,gfortran)
528 ("lapack" ,lapack)
529 ("superlu" ,superlu)
530 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
531 ;; leaving out opengl, as configuration seems to only be for mac
532 ))
533 (arguments
534 `(#:test-target "test"
535 #:parallel-build? #f ;build is parallel by default
536 #:configure-flags
537 `("--with-mpi=0"
538 "--with-openmp=1"
539 "--with-superlu=1"
540 ,(string-append "--with-superlu-include="
541 (assoc-ref %build-inputs "superlu") "/include")
542 ,(string-append "--with-superlu-lib="
543 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
544 #:phases
545 (alist-replace
546 'configure
547 ;; PETSc's configure script is actually a python script, so we can't
548 ;; run it with bash.
549 (lambda* (#:key outputs (configure-flags '())
550 #:allow-other-keys)
551 (let* ((prefix (assoc-ref outputs "out"))
552 (flags `(,(string-append "--prefix=" prefix)
553 ,@configure-flags)))
554 (format #t "build directory: ~s~%" (getcwd))
555 (format #t "configure flags: ~s~%" flags)
556 (zero? (apply system* "./configure" flags))))
557 (alist-cons-after
558 'configure 'clean-local-references
559 ;; Try to keep build directory names from leaking into compiled code
560 (lambda* (#:key inputs outputs #:allow-other-keys)
561 (let ((out (assoc-ref outputs "out")))
562 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
563 (((getcwd)) out))))
564 (alist-cons-after
565 'install 'clean-install
566 ;; Try to keep installed files from leaking build directory names.
567 (lambda* (#:key inputs outputs #:allow-other-keys)
568 (let ((out (assoc-ref outputs "out"))
569 (fortran (assoc-ref inputs "gfortran")))
570 (substitute* (map (lambda (file)
571 (string-append out "/lib/petsc/conf/" file))
572 '("petscvariables" "PETScConfig.cmake"))
573 (((getcwd)) out))
574 ;; Make compiler references point to the store
575 (substitute* (string-append out "/lib/petsc/conf/petscvariables")
576 (("= g(cc|\\+\\+|fortran)" _ suffix)
577 (string-append "= " fortran "/bin/g" suffix)))
578 ;; PETSc installs some build logs, which aren't necessary.
579 (for-each (lambda (file)
580 (let ((f (string-append out "/lib/petsc/conf/" file)))
581 (when (file-exists? f)
582 (delete-file f))))
583 '("configure.log" "make.log" "gmake.log"
584 "test.log" "error.log" "RDict.db"
585 ;; Once installed, should uninstall with Guix
586 "uninstall.py"))))
587 %standard-phases)))))
588 (home-page "http://www.mcs.anl.gov/petsc")
589 (synopsis "Library to solve PDEs")
590 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
591 data structures and routines for the scalable (parallel) solution of
592 scientific applications modeled by partial differential equations.")
593 (license (license:non-copyleft
594 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
595
596 (define-public petsc-complex
597 (package (inherit petsc)
598 (name "petsc-complex")
599 (arguments
600 (substitute-keyword-arguments (package-arguments petsc)
601 ((#:configure-flags cf)
602 `(cons "--with-scalar-type=complex" ,cf))))
603 (synopsis "Library to solve PDEs (with complex scalars)")))
604
605 (define-public petsc-openmpi
606 (package (inherit petsc)
607 (name "petsc-openmpi")
608 (inputs
609 `(("openmpi" ,openmpi)
610 ,@(package-inputs petsc)))
611 (arguments
612 (substitute-keyword-arguments (package-arguments petsc)
613 ((#:configure-flags cf)
614 ``("--with-mpiexec=mpirun"
615 ,(string-append "--with-mpi-dir="
616 (assoc-ref %build-inputs "openmpi"))
617 ,@(delete "--with-mpi=0" ,cf)))))
618 (synopsis "Library to solve PDEs (with MPI support)")))
619
620 (define-public petsc-complex-openmpi
621 (package (inherit petsc-complex)
622 (name "petsc-complex-openmpi")
623 (inputs
624 `(("openmpi" ,openmpi)
625 ,@(package-inputs petsc-complex)))
626 (arguments
627 (substitute-keyword-arguments (package-arguments petsc-complex)
628 ((#:configure-flags cf)
629 ``("--with-mpiexec=mpirun"
630 ,(string-append "--with-mpi-dir="
631 (assoc-ref %build-inputs "openmpi"))
632 ,@(delete "--with-mpi=0" ,cf)))))
633 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
634
635 (define-public slepc
636 (package
637 (name "slepc")
638 (version "3.6.2")
639 (source
640 (origin
641 (method url-fetch)
642 (uri (string-append "http://slepc.upv.es/download/download.php?"
643 "filename=slepc-" version ".tar.gz"))
644 (file-name (string-append name "-" version ".tar.gz"))
645 (sha256
646 (base32
647 "1pv5iqz2kc8sj49zsabyz4arnfpana8mjrhq31vzgk16xldk3d1a"))))
648 (build-system gnu-build-system)
649 (native-inputs
650 `(("python" ,python-2)))
651 (inputs
652 `(("arpack" ,arpack-ng)
653 ("gfortran" ,gfortran)))
654 (propagated-inputs
655 `(("petsc" ,petsc)))
656 (arguments
657 `(#:parallel-build? #f ;build is parallel by default
658 #:configure-flags
659 `(,(string-append "--with-arpack-dir="
660 (assoc-ref %build-inputs "arpack") "/lib"))
661 #:phases
662 (modify-phases %standard-phases
663 (replace
664 'configure
665 ;; configure is a python script, so we can't run it with bash.
666 (lambda* (#:key inputs outputs (configure-flags '())
667 #:allow-other-keys)
668 (let* ((prefix (assoc-ref outputs "out"))
669 (flags `(,(string-append "--prefix=" prefix)
670 ,@configure-flags)))
671 (format #t "build directory: ~s~%" (getcwd))
672 (format #t "configure flags: ~s~%" flags)
673 (setenv "SLEPC_DIR" (getcwd))
674 (setenv "PETSC_DIR" (assoc-ref inputs "petsc"))
675 (zero? (apply system* "./configure" flags)))))
676 (add-after
677 'install 'delete-doc
678 ;; TODO: SLEPc installs HTML documentation alongside headers in
679 ;; $out/include. We'd like to move them to share/doc, but delete
680 ;; them for now, as they are incomplete and installing the complete
681 ;; documentation is difficult.
682 (lambda* (#:key outputs #:allow-other-keys)
683 (let* ((out (assoc-ref outputs "out")))
684 (for-each delete-file (find-files out "\\.html$")))))
685 (add-after
686 'install 'clean-install
687 ;; Clean up unnecessary build logs from installation.
688 (lambda* (#:key outputs #:allow-other-keys)
689 (let ((out (assoc-ref outputs "out")))
690 (for-each (lambda (file)
691 (let ((f (string-append out "/lib/slepc/conf/" file)))
692 (when (file-exists? f)
693 (delete-file f))))
694 '("configure.log" "make.log" "gmake.log"
695 "test.log" "error.log" "RDict.db"
696 "uninstall.py"))))))))
697 (home-page "http://slepc.upv.es")
698 (synopsis "Scalable library for eigenproblems")
699 (description "SLEPc is a software library for the solution of large sparse
700 eigenproblems on parallel computers. It can be used for the solution of
701 linear eigenvalue problems formulated in either standard or generalized form,
702 as well as other related problems such as the singular value decomposition.
703 The emphasis of the software is on methods and techniques appropriate for
704 problems in which the associated matrices are sparse, for example, those
705 arising after the discretization of partial differential equations.")
706 (license license:lgpl3)))
707
708 (define-public slepc-complex
709 (package (inherit slepc)
710 (name "slepc-complex")
711 (propagated-inputs
712 `(("petsc" ,petsc-complex)
713 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
714 (synopsis "Scalable library for eigenproblems (with complex scalars)")))
715
716 (define-public slepc-openmpi
717 (package (inherit slepc)
718 (name "slepc-openmpi")
719 (inputs
720 `(("mpi" ,openmpi)
721 ("arpack" ,arpack-ng-openmpi)
722 ,@(alist-delete "arpack" (package-inputs slepc))))
723 (propagated-inputs
724 `(("petsc" ,petsc-openmpi)
725 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
726 (synopsis "Scalable library for eigenproblems (with MPI support)")))
727
728 (define-public slepc-complex-openmpi
729 (package (inherit slepc-openmpi)
730 (name "slepc-complex-openmpi")
731 (propagated-inputs
732 `(("petsc" ,petsc-complex-openmpi)
733 ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
734 (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
735
736 (define-public mumps
737 (package
738 (name "mumps")
739 (version "5.0.1")
740 (source
741 (origin
742 (method url-fetch)
743 (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
744 version ".tar.gz"))
745 (sha256
746 (base32
747 "1820jfp3mbl7n85765v5mp6p0gzqpgr4d2lrnhwj4gl7cwp5ndah"))
748 (patches (list (search-patch "mumps-build-parallelism.patch")))))
749 (build-system gnu-build-system)
750 (inputs
751 `(("fortran" ,gfortran)
752 ;; These are required for linking against mumps, but we let the user
753 ;; declare the dependency.
754 ("blas" ,openblas)
755 ("metis" ,metis)
756 ("scotch" ,scotch)))
757 (arguments
758 `(#:modules ((ice-9 match)
759 (ice-9 popen)
760 (srfi srfi-1)
761 ,@%gnu-build-system-modules)
762 #:phases
763 (modify-phases %standard-phases
764 (replace
765 'configure
766 (lambda* (#:key inputs #:allow-other-keys)
767 (call-with-output-file "Makefile.inc"
768 (lambda (port)
769 (format port "
770 PLAT =
771 LIBEXT = .a
772 OUTC = -o
773 OUTF = -o
774 RM = rm -f~:[
775 CC = gcc
776 FC = gfortran
777 FL = gfortran
778 INCSEQ = -I$(topdir)/libseq
779 LIBSEQ = -L$(topdir)/libseq -lmpiseq
780 LIBSEQNEEDED = libseqneeded~;
781 CC = mpicc
782 FC = mpifort
783 FL = mpifort~]
784 AR = ar vr # rules require trailing space, ugh...
785 RANLIB = ranlib
786 LIBBLAS = -L~a -lopenblas~@[
787 SCALAP = -L~a -lscalapack~]
788 LIBOTHERS = -pthread
789 CDEFS = -DAdd_
790 PIC = -fPIC
791 OPTF = -O2 -DALLOW_NON_INIT $(PIC)
792 OPTL = -O2 $(PIC)
793 OPTC = -O2 $(PIC)
794 INCS = $(INCSEQ)
795 LIBS = $(SCALAP) $(LIBSEQ)
796 LPORDDIR = $(topdir)/PORD/lib
797 IPORD = -I$(topdir)/PORD/include
798 LPORD = -L$(LPORDDIR) -lpord
799 ORDERINGSF = -Dpord~@[
800 METISDIR = ~a
801 IMETIS = -I$(METISDIR)/include
802 LMETIS = -L$(METISDIR)/lib -lmetis
803 ORDERINGSF += -Dmetis~]~@[~:{
804 SCOTCHDIR = ~a
805 ISCOTCH = -I$(SCOTCHDIR)/include
806 LSCOTCH = -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
807 ORDERINGSF += ~a~}~]
808 ORDERINGSC = $(ORDERINGSF)
809 LORDERINGS = $(LPORD) $(LMETIS) $(LSCOTCH)
810 IORDERINGSF = $(ISCOTCH)
811 IORDERINGSC = $(IPORD) $(IMETIS) $(ISCOTCH)"
812 (assoc-ref inputs "mpi")
813 (assoc-ref inputs "blas")
814 (assoc-ref inputs "scalapack")
815 (assoc-ref inputs "metis")
816 (match (list (assoc-ref inputs "pt-scotch")
817 (assoc-ref inputs "scotch"))
818 ((#f #f)
819 #f)
820 ((#f scotch)
821 `((,scotch "" "-Dscotch")))
822 ((ptscotch _)
823 `((,ptscotch
824 "-lptesmumps -lptscotch -lptscotcherr "
825 "-Dptscotch")))))))))
826 (replace
827 'build
828 ;; By default only the d-precision library is built. Make with "all"
829 ;; target so that all precision libraries and examples are built.
830 (lambda _
831 (zero? (system* "make" "all"
832 (format #f "-j~a" (parallel-job-count))))))
833 (replace
834 'check
835 ;; Run the simple test drivers, which read test input from stdin:
836 ;; from the "real" input for the single- and double-precision
837 ;; testers, and from the "cmplx" input for complex-precision
838 ;; testers. The EXEC-PREFIX key is used by the mumps-openmpi
839 ;; package to prefix execution with "mpirun".
840 (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
841 (with-directory-excursion "examples"
842 (every
843 (lambda (prec type)
844 (let ((tester (apply open-pipe*
845 `(,OPEN_WRITE
846 ,@exec-prefix
847 ,(string-append "./" prec
848 "simpletest"))))
849 (input (open-input-file
850 (string-append "input_simpletest_" type))))
851 (begin
852 (dump-port input tester)
853 (close-port input)
854 (zero? (close-pipe tester)))))
855 '("s" "d" "c" "z")
856 '("real" "real" "cmplx" "cmplx")))))
857 (replace
858 'install
859 (lambda* (#:key outputs #:allow-other-keys)
860 (let ((out (assoc-ref outputs "out")))
861 (copy-recursively "lib" (string-append out "/lib"))
862 (copy-recursively "include" (string-append out "/include"))
863 (when (file-exists? "libseq/libmpiseq.a")
864 (copy-file "libseq/libmpiseq.a"
865 (string-append out "/lib/libmpiseq.a")))))))))
866 (home-page "http://mumps.enseeiht.fr")
867 (synopsis "Multifrontal sparse direct solver")
868 (description
869 "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
870 sparse system of linear equations A x = b using Guassian elimination.")
871 (license license:cecill-c)))
872
873 (define-public mumps-metis
874 (package (inherit mumps)
875 (name "mumps-metis")
876 (inputs
877 (alist-delete "scotch" (package-inputs mumps)))))
878
879 (define-public mumps-openmpi
880 (package (inherit mumps)
881 (name "mumps-openmpi")
882 (inputs
883 `(("mpi" ,openmpi)
884 ("scalapack" ,scalapack)
885 ("pt-scotch" ,pt-scotch)
886 ,@(alist-delete "scotch" (package-inputs mumps))))
887 (arguments
888 (substitute-keyword-arguments (package-arguments mumps)
889 ((#:phases phases)
890 `(modify-phases ,phases
891 (replace
892 'check
893 (lambda _
894 ((assoc-ref ,phases 'check)
895 #:exec-prefix '("mpirun" "-n" "2"))))))))
896 (synopsis "Multifrontal sparse direct solver (with MPI)")))
897
898 (define-public mumps-metis-openmpi
899 (package (inherit mumps-openmpi)
900 (name "mumps-metis-openmpi")
901 (inputs
902 (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
903
904 (define-public superlu
905 (package
906 (name "superlu")
907 (version "4.3")
908 (source
909 (origin
910 (method url-fetch)
911 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
912 "superlu_" version ".tar.gz"))
913 (sha256
914 (base32 "10b785s9s4x0m9q7ihap09275pq4km3k2hk76jiwdfdr5qr2168n"))))
915 (build-system gnu-build-system)
916 (native-inputs
917 `(("tcsh" ,tcsh)))
918 (inputs
919 `(("lapack" ,lapack)
920 ("gfortran" ,gfortran)))
921 (arguments
922 `(#:parallel-build? #f
923 #:tests? #f ;tests are run as part of `make all`
924 #:phases
925 (alist-replace
926 'configure
927 (lambda* (#:key inputs outputs #:allow-other-keys)
928 (call-with-output-file "make.inc"
929 (lambda (port)
930 (format port "
931 PLAT =
932 SuperLUroot = ~a
933 SUPERLULIB = ~a/lib/libsuperlu.a
934 TMGLIB = libtmglib.a
935 BLASDEF = -DUSE_VENDOR_BLAS
936 BLASLIB = -L~a/lib -lblas
937 LIBS = $(SUPERLULIB) $(BLASLIB)
938 ARCH = ar
939 ARCHFLAGS = cr
940 RANLIB = ranlib
941 CC = gcc
942 PIC = -fPIC
943 CFLAGS = -O3 -DPRNTlevel=0 $(PIC)
944 NOOPTS = -O0 $(PIC)
945 FORTRAN = gfortran
946 FFLAGS = -O2 $(PIC)
947 LOADER = $(CC)
948 CDEFS = -DAdd_"
949 (getcwd)
950 (assoc-ref outputs "out")
951 (assoc-ref inputs "lapack")))))
952 (alist-cons-before
953 'build 'create-install-directories
954 (lambda* (#:key outputs #:allow-other-keys)
955 (for-each
956 (lambda (dir)
957 (mkdir-p (string-append (assoc-ref outputs "out")
958 "/" dir)))
959 '("lib" "include")))
960 (alist-replace
961 'install
962 (lambda* (#:key outputs #:allow-other-keys)
963 ;; Library is placed in lib during the build phase. Copy over
964 ;; headers to include.
965 (let* ((out (assoc-ref outputs "out"))
966 (incdir (string-append out "/include")))
967 (for-each (lambda (file)
968 (let ((base (basename file)))
969 (format #t "installing `~a' to `~a'~%"
970 base incdir)
971 (copy-file file
972 (string-append incdir "/" base))))
973 (find-files "SRC" ".*\\.h$"))))
974 %standard-phases)))))
975 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
976 (synopsis "Supernodal direct solver for sparse linear systems")
977 (description
978 "SuperLU is a general purpose library for the direct solution of large,
979 sparse, nonsymmetric systems of linear equations on high performance machines.
980 The library is written in C and is callable from either C or Fortran. The
981 library routines perform an LU decomposition with partial pivoting and
982 triangular system solves through forward and back substitution. The library
983 also provides threshold-based ILU factorization preconditioners.")
984 (license license:bsd-3)))
985
986 (define-public superlu-dist
987 (package
988 (name "superlu-dist")
989 (version "3.3")
990 (source
991 (origin
992 (method url-fetch)
993 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
994 "superlu_dist_" version ".tar.gz"))
995 (sha256
996 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
997 (patches (list (search-patch "superlu-dist-scotchmetis.patch")))))
998 (build-system gnu-build-system)
999 (native-inputs
1000 `(("tcsh" ,tcsh)))
1001 (inputs
1002 `(("gfortran" ,gfortran)))
1003 (propagated-inputs
1004 `(("openmpi" ,openmpi) ;headers include MPI heades
1005 ("lapack" ,lapack) ;required to link with output library
1006 ("pt-scotch" ,pt-scotch))) ;same
1007 (arguments
1008 `(#:parallel-build? #f ;race conditions using ar
1009 #:phases
1010 (alist-replace
1011 'configure
1012 (lambda* (#:key inputs outputs #:allow-other-keys)
1013 (call-with-output-file "make.inc"
1014 (lambda (port)
1015 (format port "
1016 PLAT =
1017 DSuperLUroot = ~a
1018 DSUPERLULIB = ~a/lib/libsuperlu_dist.a
1019 BLASDEF = -DUSE_VENDOR_BLAS
1020 BLASLIB = -L~a/lib -lblas
1021 PARMETISLIB = -L~a/lib \
1022 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
1023 -lscotch -lscotcherr -lscotcherrexit
1024 METISLIB = -L~:*~a/lib \
1025 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
1026 LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
1027 ARCH = ar
1028 ARCHFLAGS = cr
1029 RANLIB = ranlib
1030 CC = mpicc
1031 PIC = -fPIC
1032 CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
1033 NOOPTS = -O0 -g $(PIC)
1034 FORTRAN = mpifort
1035 FFLAGS = -O2 -g $(PIC)
1036 LOADER = $(CC)
1037 CDEFS = -DAdd_"
1038 (getcwd)
1039 (assoc-ref outputs "out")
1040 (assoc-ref inputs "lapack")
1041 (assoc-ref inputs "pt-scotch")))))
1042 (alist-cons-after
1043 'unpack 'remove-broken-symlinks
1044 (lambda _
1045 (for-each delete-file
1046 (find-files "MAKE_INC" "\\.#make\\..*")))
1047 (alist-cons-before
1048 'build 'create-install-directories
1049 (lambda* (#:key outputs #:allow-other-keys)
1050 (for-each
1051 (lambda (dir)
1052 (mkdir-p (string-append (assoc-ref outputs "out")
1053 "/" dir)))
1054 '("lib" "include")))
1055 (alist-replace
1056 'check
1057 (lambda _
1058 (with-directory-excursion "EXAMPLE"
1059 (and
1060 (zero? (system* "mpirun" "-n" "2"
1061 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
1062 (zero? (system* "mpirun" "-n" "2"
1063 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
1064 (alist-replace
1065 'install
1066 (lambda* (#:key outputs #:allow-other-keys)
1067 ;; Library is placed in lib during the build phase. Copy over
1068 ;; headers to include.
1069 (let* ((out (assoc-ref outputs "out"))
1070 (incdir (string-append out "/include")))
1071 (for-each (lambda (file)
1072 (let ((base (basename file)))
1073 (format #t "installing `~a' to `~a'~%"
1074 base incdir)
1075 (copy-file file
1076 (string-append incdir "/" base))))
1077 (find-files "SRC" ".*\\.h$"))))
1078 %standard-phases)))))))
1079 (home-page (package-home-page superlu))
1080 (synopsis "Parallel supernodal direct solver")
1081 (description
1082 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
1083 It is targeted for distributed memory parallel machines. SuperLU_DIST is
1084 implemented in ANSI C, and MPI for communications.")
1085 (license license:bsd-3)))
1086
1087 (define-public scotch
1088 (package
1089 (name "scotch")
1090 (version "6.0.4")
1091 (source
1092 (origin
1093 (method url-fetch)
1094 (uri (string-append "https://gforge.inria.fr/frs/download.php/34618/"
1095 "scotch_" version ".tar.gz"))
1096 (sha256
1097 (base32 "1ir088mvrqggyqdkx9qfynmiaffqbyih5qfl5mga2nrlm1qlsgzm"))
1098 (patches (list (search-patch "scotch-test-threading.patch")
1099 (search-patch "pt-scotch-build-parallelism.patch")))))
1100 (build-system gnu-build-system)
1101 (inputs
1102 `(("zlib" ,zlib)
1103 ("flex" ,flex)
1104 ("bison" ,bison)))
1105 (arguments
1106 `(#:phases
1107 (modify-phases %standard-phases
1108 (add-after
1109 'unpack 'chdir-to-src
1110 (lambda _ (chdir "src")))
1111 (replace
1112 'configure
1113 (lambda _
1114 (call-with-output-file "Makefile.inc"
1115 (lambda (port)
1116 (format port "
1117 EXE =
1118 LIB = .a
1119 OBJ = .o
1120 MAKE = make
1121 AR = ar
1122 ARFLAGS = -ruv
1123 CAT = cat
1124 CCS = gcc
1125 CCP = mpicc
1126 CCD = gcc
1127 CPPFLAGS =~{ -D~a~}
1128 CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
1129 LDFLAGS = -lz -lm -lrt -lpthread
1130 CP = cp
1131 LEX = flex -Pscotchyy -olex.yy.c
1132 LN = ln
1133 MKDIR = mkdir
1134 MV = mv
1135 RANLIB = ranlib
1136 YACC = bison -pscotchyy -y -b y
1137 "
1138 '("COMMON_FILE_COMPRESS_GZ"
1139 "COMMON_PTHREAD"
1140 "COMMON_RANDOM_FIXED_SEED"
1141 ;; Prevents symbolc clashes with libesmumps
1142 "SCOTCH_RENAME"
1143 ;; XXX: Causes invalid frees in superlu-dist tests
1144 ;; "SCOTCH_PTHREAD"
1145 ;; "SCOTCH_PTHREAD_NUMBER=2"
1146 "restrict=__restrict"))))))
1147 (add-after
1148 'build 'build-esmumps
1149 (lambda _
1150 (zero? (system* "make"
1151 (format #f "-j~a" (parallel-job-count))
1152 "esmumps"))))
1153 (replace
1154 'install
1155 (lambda* (#:key outputs #:allow-other-keys)
1156 (let ((out (assoc-ref outputs "out")))
1157 (mkdir out)
1158 (zero? (system* "make"
1159 (string-append "prefix=" out)
1160 "install"))
1161 ;; esmumps files are not installed with the above
1162 (for-each (lambda (f)
1163 (copy-file f (string-append out "/include/" f)))
1164 (find-files "../include" ".*esmumps.h$"))
1165 (for-each (lambda (f)
1166 (copy-file f (string-append out "/lib/" f)))
1167 (find-files "../lib" "^lib.*esmumps.*"))))))))
1168 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
1169 (synopsis "Programs and libraries for graph algorithms")
1170 (description "SCOTCH is a set of programs and libraries which implement
1171 the static mapping and sparse matrix reordering algorithms developed within
1172 the SCOTCH project. Its purpose is to apply graph theory, with a divide and
1173 conquer approach, to scientific computing problems such as graph and mesh
1174 partitioning, static mapping, and sparse matrix ordering, in application
1175 domains ranging from structural mechanics to operating systems or
1176 bio-chemistry.")
1177 ;; See LICENSE_en.txt
1178 (license license:cecill-c)))
1179
1180 (define-public pt-scotch
1181 (package (inherit scotch)
1182 (name "pt-scotch")
1183 (propagated-inputs
1184 `(("openmpi" ,openmpi))) ;Headers include MPI headers
1185 (arguments
1186 (substitute-keyword-arguments (package-arguments scotch)
1187 ((#:phases scotch-phases)
1188 `(modify-phases ,scotch-phases
1189 (replace
1190 'build
1191 (lambda _
1192 (and
1193 (zero? (system* "make"
1194 (format #f "-j~a" (parallel-job-count))
1195 "ptscotch" "ptesmumps"))
1196 ;; Install the serial metis compatibility library
1197 (zero? (system* "make" "-C" "libscotchmetis" "install")))))
1198 (replace
1199 'check
1200 (lambda _ (zero? (system* "make" "ptcheck"))))))))
1201 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
1202
1203 (define-public metis
1204 (package
1205 (name "metis")
1206 (version "5.1.0")
1207 (source
1208 (origin
1209 (method url-fetch)
1210 (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
1211 "metis-" version ".tar.gz"))
1212 (sha256
1213 (base32
1214 "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
1215 (build-system cmake-build-system)
1216 (inputs
1217 `(("blas" ,openblas)))
1218 (arguments
1219 `(#:tests? #f ;no tests
1220 #:configure-flags `("-DSHARED=ON"
1221 ,(string-append "-DGKLIB_PATH=" (getcwd)
1222 "/metis-" ,version "/GKlib"))))
1223 (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
1224 (synopsis "Graph partitioning and fill-reducing matrix ordering library")
1225 (description
1226 "METIS is a set of serial programs for partitioning graphs, partitioning
1227 finite element meshes, and producing fill-reducing orderings for sparse
1228 matrices. The algorithms implemented in METIS are based on the multilevel
1229 recursive-bisection, multilevel k-way, and multi-constraint partitioning
1230 schemes.")
1231 (license license:asl2.0))) ;As of version 5.0.3
1232
1233 (define-public p4est
1234 (package
1235 (name "p4est")
1236 (version "1.1")
1237 (source
1238 (origin
1239 (method url-fetch)
1240 (uri (string-append "http://p4est.github.io/release/p4est-"
1241 version ".tar.gz"))
1242 (sha256
1243 (base32
1244 "0faina2h5qsx3m2izbzaj9bbakma1krbbjmq43wrp1hcbyijflqb"))))
1245 (build-system gnu-build-system)
1246 (inputs
1247 `(("fortran" ,gfortran)
1248 ("blas" ,openblas)
1249 ("lapack" ,lapack)
1250 ("zlib" ,zlib)))
1251 (arguments
1252 `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
1253 (assoc-ref %build-inputs "blas")
1254 " -lopenblas")
1255 ,(string-append "LAPACK_LIBS=-L"
1256 (assoc-ref %build-inputs "lapack")
1257 " -llapack"))))
1258 (home-page "http://www.p4est.org")
1259 (synopsis "Adaptive mesh refinement on forests of octrees")
1260 (description
1261 "The p4est software library enables the dynamic management of a
1262 collection of adaptive octrees, conveniently called a forest of octrees.
1263 p4est is designed to work in parallel and scales to hundreds of thousands of
1264 processor cores.")
1265 (license license:gpl2+)))
1266
1267 (define-public p4est-openmpi
1268 (package (inherit p4est)
1269 (name "p4est-openmpi")
1270 (inputs
1271 `(("mpi" ,openmpi)
1272 ,@(package-inputs p4est)))
1273 (arguments
1274 (substitute-keyword-arguments (package-arguments p4est)
1275 ((#:configure-flags cf)
1276 ``("--enable-mpi" ,@,cf))))
1277 (synopsis "Parallel adaptive mesh refinement on forests of octrees")))
1278
1279 (define-public gsegrafix
1280 (package
1281 (name "gsegrafix")
1282 (version "1.0.6")
1283 (source
1284 (origin
1285 (method url-fetch)
1286 (uri (string-append "mirror://gnu/" name "/" name "-"
1287 version ".tar.gz"))
1288 (sha256
1289 (base32
1290 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
1291 (build-system gnu-build-system)
1292 (arguments
1293 `(#:configure-flags '("LDFLAGS=-lm")))
1294 (inputs
1295 `(("libgnomecanvas" ,libgnomecanvas)
1296 ("libbonoboui" ,libbonoboui)
1297 ("libgnomeui" ,libgnomeui)
1298 ("libgnomeprintui" ,libgnomeprintui)
1299 ("popt" ,popt)))
1300 (native-inputs
1301 `(("pkg-config" ,pkg-config)))
1302 (home-page "http://www.gnu.org/software/gsegrafix/")
1303 (synopsis "GNOME application to create scientific and engineering plots")
1304 (description "GSEGrafix is an application which produces high-quality graphical
1305 plots for science and engineering. Plots are specified via simple ASCII
1306 parameter files and data files and are presented in an anti-aliased GNOME
1307 canvas. The program supports rectangular two-dimensional plots, histograms,
1308 polar-axis plots and three-dimensional plots. Plots can be printed or saved
1309 to BMP, JPEG or PNG image formats.")
1310 (license license:gpl3+)))
1311
1312 (define-public maxima
1313 (package
1314 (name "maxima")
1315 (version "5.36.1")
1316 (source
1317 (origin
1318 (method url-fetch)
1319 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
1320 version "-source/" name "-" version ".tar.gz"))
1321 (sha256
1322 (base32
1323 "0x1rk659sn3cq0n5c90848ilzr1gb1wf0072fl6jhkdq00qgh2s0"))
1324 (patches (list (search-patch "maxima-defsystem-mkdir.patch")))))
1325 (build-system gnu-build-system)
1326 (inputs
1327 `(("gcl" ,gcl)
1328 ("gnuplot" ,gnuplot) ;for plots
1329 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
1330 (native-inputs
1331 `(("texinfo" ,texinfo)
1332 ("perl" ,perl)))
1333 (arguments
1334 `(#:configure-flags
1335 (list "--enable-gcl"
1336 (string-append "--with-posix-shell="
1337 (assoc-ref %build-inputs "bash")
1338 "/bin/sh")
1339 (string-append "--with-wish="
1340 (assoc-ref %build-inputs "tk")
1341 "/bin/wish"
1342 (let ((v ,(package-version tk)))
1343 (string-take v (string-index-right v #\.)))))
1344 ;; By default Maxima attempts to write temporary files to
1345 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
1346 ;; Work around that.
1347 #:make-flags (list "TMPDIR=/tmp")
1348 #:phases (alist-cons-before
1349 'check 'pre-check
1350 (lambda _
1351 (chmod "src/maxima" #o555))
1352 ;; Make sure the doc and emacs files are found in the
1353 ;; standard location. Also configure maxima to find gnuplot
1354 ;; without having it on the PATH.
1355 (alist-cons-after
1356 'install 'post-install
1357 (lambda* (#:key outputs inputs #:allow-other-keys)
1358 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
1359 (out (assoc-ref outputs "out"))
1360 (datadir (string-append out "/share/maxima/" ,version)))
1361 (with-directory-excursion out
1362 (mkdir-p "share/emacs")
1363 (mkdir-p "share/doc")
1364 (symlink
1365 (string-append datadir "/emacs/")
1366 (string-append out "/share/emacs/site-lisp"))
1367 (symlink
1368 (string-append datadir "/doc/")
1369 (string-append out "/share/doc/maxima"))
1370 (with-atomic-file-replacement
1371 (string-append datadir "/share/maxima-init.lisp")
1372 (lambda (in out)
1373 (format out "~a ~s~a~%"
1374 "(setf $gnuplot_command "
1375 (string-append gnuplot "/bin/gnuplot") ")")
1376 (dump-port in out))))))
1377 %standard-phases))))
1378 (home-page "http://maxima.sourceforge.net")
1379 (synopsis "Numeric and symbolic expression manipulation")
1380 (description "Maxima is a system for the manipulation of symbolic and
1381 numerical expressions. It yields high precision numeric results by using
1382 exact fractions, arbitrary precision integers, and variable precision floating
1383 point numbers.")
1384 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
1385 ;; Others simply say "GNU General Public License" without stating a
1386 ;; version (which implicitly means gpl1+).
1387 ;; At least one file (src/maxima.asd) says "version 2."
1388 ;; GPLv2 only is therefore the smallest subset.
1389 (license license:gpl2)))
1390
1391 (define-public wxmaxima
1392 (package
1393 (name "wxmaxima")
1394 (version "15.04.0")
1395 (source
1396 (origin
1397 (method url-fetch)
1398 (uri (string-append "mirror://sourceforge/wxmaxima/wxMaxima/"
1399 version "/" name "-" version ".tar.gz"))
1400 (sha256
1401 (base32
1402 "1fm47ah4aw5qdjqhkz67w5fwhy8yfffa5z896crp0d3hk2bh4180"))))
1403 (build-system gnu-build-system)
1404 (inputs
1405 `(("wxwidgets" ,wxwidgets)
1406 ("maxima" ,maxima)))
1407 (arguments
1408 `(#:phases (modify-phases %standard-phases
1409 (add-after
1410 'install 'wrap-program
1411 (lambda* (#:key inputs outputs #:allow-other-keys)
1412 (wrap-program (string-append (assoc-ref outputs "out")
1413 "/bin/wxmaxima")
1414 `("PATH" ":" prefix
1415 (,(string-append (assoc-ref inputs "maxima")
1416 "/bin"))))
1417 #t)))))
1418 (home-page "https://andrejv.github.io/wxmaxima/")
1419 (synopsis "Graphical user interface for the Maxima computer algebra system")
1420 (description
1421 "wxMaxima is a graphical user interface for the Maxima computer algebra
1422 system. It eases the use of Maxima by making most of its commands available
1423 through a menu system and by providing input dialogs for commands that require
1424 more than one argument. It also implements its own display engine that
1425 outputs mathematical symbols directly instead of depicting them with ASCII
1426 characters.
1427
1428 wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
1429 text and mathematical calculations to create documents, exporting of input and
1430 output to TeX, and a browser for Maxima's manual including command index and
1431 full text searching.")
1432 (license license:gpl2+)))
1433
1434 (define-public armadillo
1435 (package
1436 (name "armadillo")
1437 (version "6.400.3")
1438 (source (origin
1439 (method url-fetch)
1440 (uri (string-append "mirror://sourceforge/arma/armadillo-"
1441 version ".tar.gz"))
1442 (sha256
1443 (base32
1444 "0bsgrmldlx77w5x26n3axj1hg6iw6csyw0dwl1flrbdwl51f9701"))))
1445 (build-system cmake-build-system)
1446 (arguments `(#:tests? #f)) ;no test target
1447 (inputs
1448 `(("openblas" ,openblas)
1449 ("lapack" ,lapack)
1450 ("arpack" ,arpack-ng)))
1451 (home-page "http://arma.sourceforge.net/")
1452 (synopsis "C++ linear algebra library")
1453 (description
1454 "Armadillo is a C++ linear algebra library, aiming towards a good balance
1455 between speed and ease of use. It is useful for algorithm development
1456 directly in C++, or quick conversion of research code into production
1457 environments. It can be used for machine learning, pattern recognition,
1458 signal processing, bioinformatics, statistics, econometrics, etc. The library
1459 provides efficient classes for vectors, matrices and cubes, as well as 150+
1460 associated functions (eg. contiguous and non-contiguous submatrix views).")
1461 (license license:mpl2.0)))
1462
1463 (define-public armadillo-for-rcpparmadillo
1464 (package (inherit armadillo)
1465 (version "6.200.2")
1466 (source (origin
1467 (method url-fetch)
1468 (uri (string-append "mirror://sourceforge/arma/armadillo-"
1469 version ".tar.gz"))
1470 (sha256
1471 (base32
1472 "1f69rlqhnf2wv8khyn2a8vi6gx1i72qgfy8b9b760ssk85dcl763"))))))
1473
1474 (define-public muparser
1475 (package
1476 (name "muparser")
1477 (version "2.2.5")
1478 (source
1479 (origin
1480 (method svn-fetch)
1481 (uri (svn-reference
1482 (url "http://muparser.googlecode.com/svn/trunk/")
1483 (revision 34)))
1484 (sha256
1485 (base32
1486 "1d6bdbhx9zj3srwj3m7c9hvr18gnx1fx43h6d25my7q85gicpcwn"))))
1487 (build-system gnu-build-system)
1488 (arguments
1489 `(#:configure-flags '("--enable-samples=no")
1490 #:tests? #f)) ;no "check" target
1491 (home-page "http://muparser.beltoforion.de/")
1492 (synopsis "Fast parser library for mathematical expressions")
1493 (description
1494 "muParser is an extensible high performance math parser library. It is
1495 based on transforming an expression into a bytecode and precalculating
1496 constant parts of it.")
1497 (license license:expat)))
1498
1499 (define-public openblas
1500 (package
1501 (name "openblas")
1502 (version "0.2.15")
1503 (source
1504 (origin
1505 (method url-fetch)
1506 (uri (string-append "https://github.com/xianyi/OpenBLAS/tarball/v"
1507 version))
1508 (file-name (string-append name "-" version ".tar.gz"))
1509 (sha256
1510 (base32
1511 "1k5f6vjlk54qlplk5m7xkbaw6g2y7dl50lwwdv6xsbcsgsbxfcpy"))))
1512 (build-system gnu-build-system)
1513 (arguments
1514 `(#:tests? #f ;no "check" target
1515 ;; DYNAMIC_ARCH is only supported on x86. When it is disabled and no
1516 ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
1517 ;; we need to disable substitutions.
1518 #:substitutable?
1519 ,(let ((system (or (%current-target-system) (%current-system))))
1520 (or (string-prefix? "x86_64" system)
1521 (string-prefix? "i686" system)
1522 (string-prefix? "mips" system)))
1523 #:make-flags
1524 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1525 "SHELL=bash"
1526 "NO_LAPACK=1"
1527 ;; Build the library for all supported CPUs. This allows
1528 ;; switching CPU targets at runtime with the environment variable
1529 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
1530 ;; Unfortunately, this is not supported on non-x86 architectures,
1531 ;; where it leads to failed builds.
1532 ,@(let ((system (or (%current-target-system) (%current-system))))
1533 (cond
1534 ((or (string-prefix? "x86_64" system)
1535 (string-prefix? "i686" system))
1536 '("DYNAMIC_ARCH=1"))
1537 ;; On MIPS we force the "SICORTEX" TARGET, as for the other
1538 ;; two available MIPS targets special extended instructions
1539 ;; for Loongson cores are used.
1540 ((string-prefix? "mips" system)
1541 '("TARGET=SICORTEX"))
1542 (else '()))))
1543 ;; no configure script
1544 #:phases (alist-delete 'configure %standard-phases)))
1545 (inputs
1546 `(("fortran" ,gfortran)))
1547 (native-inputs
1548 `(("cunit" ,cunit)
1549 ("perl" ,perl)))
1550 (home-page "http://www.openblas.net/")
1551 (synopsis "Optimized BLAS library based on GotoBLAS")
1552 (description
1553 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
1554 (license license:bsd-3)))
1555
1556 (define-public openlibm
1557 (package
1558 (name "openlibm")
1559 (version "0.4.1")
1560 (source
1561 (origin
1562 (method url-fetch)
1563 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
1564 version ".tar.gz"))
1565 (file-name (string-append name "-" version ".tar.gz"))
1566 (sha256
1567 (base32
1568 "0cwqqqlblj3kzp9aq1wnpfs1fl0qd1wp1xzm5shb09w06i4rh9nn"))))
1569 (build-system gnu-build-system)
1570 (arguments
1571 `(#:make-flags
1572 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1573 #:phases
1574 ;; no configure script
1575 (alist-delete 'configure %standard-phases)
1576 #:tests? #f)) ;the tests are part of the default target
1577 (home-page "http://openlibm.org/")
1578 (synopsis "Portable C mathematical library (libm)")
1579 (description
1580 "OpenLibm is an effort to have a high quality, portable, standalone C
1581 mathematical library (libm). It can be used standalone in applications and
1582 programming language implementations. The project was born out of a need to
1583 have a good libm for the Julia programming language that worked consistently
1584 across compilers and operating systems, and in 32-bit and 64-bit
1585 environments.")
1586 ;; See LICENSE.md for details.
1587 (license (list license:expat
1588 license:isc
1589 license:bsd-2
1590 license:public-domain
1591 license:lgpl2.1+))))
1592
1593 (define-public openspecfun
1594 (package
1595 (name "openspecfun")
1596 (version "0.4")
1597 (source
1598 (origin
1599 (method url-fetch)
1600 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
1601 version ".tar.gz"))
1602 (file-name (string-append name "-" version ".tar.gz"))
1603 (sha256
1604 (base32
1605 "0nsa3jjmlhcqkw5ba5ypbn3n0c8b6lc22zzlxnmxkxi9shhdx65z"))))
1606 (build-system gnu-build-system)
1607 (arguments
1608 '(#:tests? #f ;no "check" target
1609 #:make-flags
1610 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1611 ;; no configure script
1612 #:phases (alist-delete 'configure %standard-phases)))
1613 (inputs
1614 `(("fortran" ,gfortran)))
1615 (home-page "https://github.com/JuliaLang/openspecfun")
1616 (synopsis "Collection of special mathematical functions")
1617 (description
1618 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
1619 portable package for Bessel Functions of a Complex Argument and Nonnegative
1620 Order; it contains subroutines for computing Bessel functions and Airy
1621 functions. Faddeeva allows computing the various error functions of arbitrary
1622 complex arguments (Faddeeva function, error function, complementary error
1623 function, scaled complementary error function, imaginary error function, and
1624 Dawson function); given these, one can also easily compute Voigt functions,
1625 Fresnel integrals, and similar related functions as well.")
1626 ;; Faddeeva is released under the Expat license; AMOS is included as
1627 ;; public domain software.
1628 (license (list license:expat license:public-domain))))
1629
1630 (define-public suitesparse
1631 (package
1632 (name "suitesparse")
1633 (version "4.4.3")
1634 (source
1635 (origin
1636 (method url-fetch)
1637 (uri (string-append
1638 "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-"
1639 version ".tar.gz"))
1640 (sha256
1641 (base32
1642 "100hdzr0mf4mzlwnqpmwpfw4pymgsf9n3g0ywb1yps2nk1zbkdy5"))))
1643 (build-system gnu-build-system)
1644 (arguments
1645 '(#:parallel-build? #f ;cholmod build fails otherwise
1646 #:tests? #f ;no "check" target
1647 #:make-flags
1648 (list "CC=gcc"
1649 "BLAS=-lblas"
1650 "TBB=-ltbb"
1651 "CHOLMOD_CONFIG=-DNPARTITION" ;required when METIS is not used
1652 (string-append "INSTALL_LIB="
1653 (assoc-ref %outputs "out") "/lib")
1654 (string-append "INSTALL_INCLUDE="
1655 (assoc-ref %outputs "out") "/include"))
1656 #:phases
1657 (alist-cons-before
1658 'install 'prepare-out
1659 ;; README.txt states that the target directories must exist prior to
1660 ;; running "make install".
1661 (lambda _
1662 (mkdir-p (string-append (assoc-ref %outputs "out") "/lib"))
1663 (mkdir-p (string-append (assoc-ref %outputs "out") "/include")))
1664 ;; no configure script
1665 (alist-delete 'configure %standard-phases))))
1666 (inputs
1667 `(("tbb" ,tbb)
1668 ("lapack" ,lapack)))
1669 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
1670 (synopsis "Suite of sparse matrix software")
1671 (description
1672 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
1673 multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
1674 multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
1675 simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
1676 CXSparse, a concise sparse Cholesky factorization package; and many other
1677 packages.")
1678 ;; LGPLv2.1+:
1679 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
1680 ;; GPLv2+:
1681 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
1682 (license (list license:gpl2+ license:lgpl2.1+))))
1683
1684 (define-public atlas
1685 (package
1686 (name "atlas")
1687 (version "3.10.2")
1688 (source (origin
1689 (method url-fetch)
1690 (uri (string-append "mirror://sourceforge/math-atlas/atlas"
1691 version ".tar.bz2"))
1692 (sha256
1693 (base32
1694 "0bqh4bdnjdyww4mcpg6kn0x7338mfqbdgysn97dzrwwb26di7ars"))))
1695 (build-system gnu-build-system)
1696 (home-page "http://math-atlas.sourceforge.net/")
1697 (inputs `(("gfortran" ,gfortran)
1698 ("lapack-tar" ,(package-source lapack))))
1699 (outputs '("out" "doc"))
1700 ;; For the moment we drop support for MIPS at it fails to compile. See
1701 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
1702 (supported-systems (delete "mips64el-linux" %supported-systems))
1703 (arguments
1704 `(#:parallel-build? #f
1705 #:parallel-tests? #f
1706
1707 ;; ATLAS tunes itself for the machine it is built on, as explained at
1708 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
1709 ;; For this reason, we want users to build it locally instead of using
1710 ;; substitutes.
1711 #:substitutable? #f
1712
1713 #:modules ((srfi srfi-26)
1714 (srfi srfi-1)
1715 (guix build gnu-build-system)
1716 (guix build utils))
1717 #:configure-flags
1718 `(;; Generate position independent code suitable for dynamic libraries
1719 ;; and use WALL timer to get more accurate timing.
1720 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
1721 ;; Set word width.
1722 "-b"
1723 ,,(if (string-match "64" (%current-system))
1724 "64"
1725 "32")
1726 ;; Disable parallel build as it gives errors: atlas_pthread.h is
1727 ;; needed to compile C files before it is generated.
1728 "-Ss" "pmake" "make -j 1"
1729 ;; Probe is failing for MIPS. We therefore define the system
1730 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
1731 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
1732 ,,@(if (string-prefix? "mips" (%current-system))
1733 (list "-A" "49" "-V" "1")
1734 (list))
1735 ;; Generate shared libraries.
1736 "--shared"
1737 ;; Build a full LAPACK library.
1738 ,(string-append "--with-netlib-lapack-tarfile="
1739 (assoc-ref %build-inputs "lapack-tar")))
1740 #:phases
1741 (alist-cons-after
1742 'install 'install-doc
1743 (lambda* (#:key outputs inputs #:allow-other-keys)
1744 (let ((doc (string-append (assoc-ref outputs "doc")
1745 "/share/doc/atlas")))
1746 (mkdir-p doc)
1747 (fold (lambda (file previous)
1748 (and previous (zero? (system* "cp" file doc))))
1749 #t (find-files "../ATLAS/doc" ".*"))))
1750 (alist-cons-after
1751 'check 'check-pt
1752 (lambda _ (zero? (system* "make" "ptcheck")))
1753 ;; Fix files required to run configure.
1754 (alist-cons-before
1755 'configure 'fix-/bin/sh
1756 (lambda _
1757 ;; Use `sh', not `/bin/sh'.
1758 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
1759 (("/bin/sh")
1760 "sh")))
1761 ;; Fix /bin/sh in generated make files.
1762 (alist-cons-after
1763 'configure 'fix-/bin/sh-in-generated-files
1764 (lambda _
1765 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
1766 (("/bin/sh")
1767 "sh")))
1768 ;; ATLAS configure program does not accepts the default flags
1769 ;; passed by the 'gnu-build-system'.
1770 (alist-replace
1771 'configure
1772 (lambda* (#:key native-inputs inputs outputs
1773 (configure-flags '())
1774 #:allow-other-keys #:rest args)
1775 (let* ((prefix (assoc-ref outputs "out"))
1776 (bash (or (and=> (assoc-ref
1777 (or native-inputs inputs) "bash")
1778 (cut string-append <> "/bin/bash"))
1779 "/bin/sh"))
1780 (flags `(,(string-append "--prefix=" prefix)
1781 ,@configure-flags))
1782 (abs-srcdir (getcwd))
1783 (srcdir (string-append "../" (basename abs-srcdir))))
1784 (format #t "source directory: ~s (relative from build: ~s)~%"
1785 abs-srcdir srcdir)
1786 (mkdir "../build")
1787 (chdir "../build")
1788 (format #t "build directory: ~s~%" (getcwd))
1789 (format #t "configure flags: ~s~%" flags)
1790 (zero? (apply system* bash
1791 (string-append srcdir "/configure")
1792 flags))))
1793 %standard-phases)))))))
1794 (synopsis "Automatically Tuned Linear Algebra Software")
1795 (description
1796 "ATLAS is an automatically tuned linear algebra software library
1797 providing C and Fortran77 interfaces to a portably efficient BLAS
1798 implementation, as well as a few routines from LAPACK.
1799
1800 Optimization occurs at build time. For this reason, the library is built on
1801 the machine where it is installed, without resorting to pre-built substitutes.
1802
1803 Before building the library, CPU throttling should be disabled. This can be
1804 done in the BIOS, or, on GNU/Linux, with the following commands:
1805
1806 cpufreq-selector -g performance -c 0
1807 ...
1808 cpufreq-selector -g performance -c N-1
1809
1810 where N is the number of cores of your CPU. Failure to do so will result in a
1811 library with poor performance.")
1812 (license license:bsd-3)))
1813
1814 (define-public glm
1815 (package
1816 (name "glm")
1817 (version "0.9.6.3")
1818 (source
1819 (origin
1820 (method url-fetch)
1821 (uri (string-append "mirror://sourceforge/ogl-math/glm-"
1822 version ".zip"))
1823 (sha256
1824 (base32
1825 "1cnjmi033a16a95v6xfkr1bvfmkd26hzdjka8j1819hgn5b1nr8l"))))
1826 (build-system cmake-build-system)
1827 (native-inputs
1828 `(("unzip" ,unzip)))
1829 (home-page "http://glm.g-truc.net")
1830 (synopsis "OpenGL Mathematics library")
1831 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
1832 library for graphics software based on the OpenGL Shading Language (GLSL)
1833 specifications.")
1834 (license license:expat)))
1835
1836 (define-public lpsolve
1837 (package
1838 (name "lpsolve")
1839 (version "5.5.2.0")
1840 (source
1841 (origin
1842 (method url-fetch)
1843 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
1844 "/lp_solve_" version "_source.tar.gz"))
1845 (sha256
1846 (base32
1847 "176c7f023mb6b8bfmv4rfqnrlw88lsg422ca74zjh19i2h5s69sq"))
1848 (modules '((guix build utils)))
1849 (snippet
1850 '(substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
1851 (("^c=cc") "c=gcc")
1852 ;; Pretend to be on a 64 bit platform to obtain a common directory
1853 ;; name for the build results on all architectures; nothing else
1854 ;; seems to depend on it.
1855 (("^PLATFORM=.*$") "PLATFORM=ux64\n")))))
1856 (build-system gnu-build-system)
1857 (arguments
1858 `(#:tests? #f ; no check target
1859 #:phases
1860 (modify-phases %standard-phases
1861 (delete 'configure)
1862 (replace 'build
1863 (lambda _
1864 (with-directory-excursion "lpsolve55"
1865 (system* "bash" "ccc"))
1866 (with-directory-excursion "lp_solve"
1867 (system* "bash" "ccc"))
1868 #t))
1869 (replace 'install
1870 (lambda* (#:key outputs #:allow-other-keys)
1871 (let* ((out (assoc-ref outputs "out"))
1872 (bin (string-append out "/bin"))
1873 (lib (string-append out "/lib"))
1874 ;; This is where LibreOffice expects to find the header
1875 ;; files, and where they are installed by Debian.
1876 (include (string-append out "/include/lpsolve")))
1877 (mkdir-p lib)
1878 (copy-file "lpsolve55/bin/ux64/liblpsolve55.a"
1879 (string-append lib "/liblpsolve55.a"))
1880 (copy-file "lpsolve55/bin/ux64/liblpsolve55.so"
1881 (string-append lib "/liblpsolve55.so"))
1882 (install-file "lp_solve/bin/ux64/lp_solve" bin)
1883
1884 ;; Install a subset of the header files as on Debian
1885 ;; (plus lp_bit.h, which matches the regular expression).
1886 (for-each (lambda (name)
1887 (install-file name include))
1888 (find-files "." "lp_[HMSa-z].*\\.h$"))
1889 (with-directory-excursion "shared"
1890 (for-each (lambda (name)
1891 (install-file name include))
1892 (find-files "." "\\.h$")))
1893 #t))))))
1894 (home-page "http://lpsolve.sourceforge.net/")
1895 (synopsis "Mixed integer linear programming (MILP) solver")
1896 (description
1897 "lp_solve is a mixed integer linear programming solver based on the
1898 revised simplex and the branch-and-bound methods.")
1899 (license license:lgpl2.1+)))
1900
1901 (define-public dealii
1902 (package
1903 (name "dealii")
1904 (version "8.2.1")
1905 (source
1906 (origin
1907 (method url-fetch)
1908 (uri (string-append "https://github.com/dealii/dealii/releases/"
1909 "download/v" version "/dealii-" version ".tar.gz"))
1910 (sha256
1911 (base32
1912 "185jych0gdnpkjwxni7pd0dda149492zwq2457xdjg76bzj78mnp"))
1913 (patches (list (search-patch "dealii-p4est-interface.patch")))
1914 (modules '((guix build utils)))
1915 (snippet
1916 ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
1917 '(delete-file-recursively "bundled"))))
1918 (build-system cmake-build-system)
1919 (inputs
1920 `(("tbb" ,tbb)
1921 ("zlib" ,zlib)
1922 ("boost" ,boost)
1923 ("p4est" ,p4est)
1924 ("blas" ,openblas)
1925 ("lapack" ,lapack)
1926 ("arpack" ,arpack-ng)
1927 ("muparser" ,muparser)
1928 ("gfortran" ,gfortran)
1929 ("suitesparse" ,suitesparse))) ;for UMFPACK
1930 (arguments
1931 `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease
1932 #:configure-flags '("-DCOMPAT_FILES=OFF") ;Follow new directory structure
1933 #:phases (modify-phases %standard-phases
1934 (add-after
1935 'install 'hint-example-prefix
1936 ;; Set Cmake hints in examples so that they can find this
1937 ;; deal.II when configuring.
1938 (lambda* (#:key outputs #:allow-other-keys)
1939 (let* ((out (assoc-ref %outputs "out"))
1940 (exmpl (string-append out "/share/doc"
1941 "/dealii/examples")))
1942 (substitute* (find-files exmpl "CMakeLists.txt")
1943 (("([[:space:]]*HINTS.*)\n" _ line)
1944 (string-append line " $ENV{HOME}/.guix-profile "
1945 out "\n")))
1946 #t))))))
1947 (home-page "https://www.dealii.org")
1948 (synopsis "Finite element library")
1949 (description
1950 "Deal.II is a C++ program library targeted at the computational solution
1951 of partial differential equations using adaptive finite elements. The main
1952 aim of deal.II is to enable rapid development of modern finite element codes,
1953 using among other aspects adaptive meshes and a wide array of tools often used
1954 in finite element programs.")
1955 (license license:lgpl2.1+)))
1956
1957 (define-public dealii-openmpi
1958 (package (inherit dealii)
1959 (name "dealii-openmpi")
1960 (inputs
1961 `(("mpi" ,openmpi)
1962 ;;Supported only with MPI:
1963 ("p4est" ,p4est-openmpi)
1964 ("petsc" ,petsc-openmpi)
1965 ("slepc" ,slepc-openmpi)
1966 ("metis" ,metis) ;for MUMPS
1967 ("scalapack" ,scalapack) ;for MUMPS
1968 ("mumps" ,mumps-metis-openmpi) ;configure supports only metis orderings
1969 ("arpack" ,arpack-ng-openmpi)
1970 ,@(fold alist-delete (package-inputs dealii)
1971 '("p4est" "arpack"))))
1972 (arguments
1973 (substitute-keyword-arguments (package-arguments dealii)
1974 ((#:configure-flags cf)
1975 ``("-DMPI_C_COMPILER=mpicc"
1976 "-DMPI_CXX_COMPILER=mpicxx"
1977 "-DMPI_Fortran_COMPILER=mpifort"
1978 ,@,cf))))
1979 (synopsis "Finite element library (with MPI support)")))
1980
1981 (define-public flann
1982 (package
1983 (name "flann")
1984 (version "1.8.4")
1985 (source
1986 (origin
1987 (method url-fetch)
1988 (uri
1989 (string-append
1990 "http://www.cs.ubc.ca/research/flann/uploads/FLANN/flann-"
1991 version "-src.zip"))
1992 (sha256
1993 (base32
1994 "022w8hph7bli5zbpnk3z1qh1c2sl5hm8fw2ccim651ynn0hr7fyz"))))
1995 (build-system cmake-build-system)
1996 (native-inputs
1997 `(("unzip" ,unzip)))
1998 (inputs
1999 `(("hdf5" ,hdf5)
2000 ("octave" ,octave)
2001 ("python" ,python-2) ; print syntax
2002 ;; ("python2-numpy" ,python2-numpy) ; only required for the tests
2003 ("zlib" ,zlib)))
2004 (arguments
2005 `(#:tests? #f)) ; The test data are downloaded from the Internet.
2006 (home-page "http://www.cs.ubc.ca/research/flann/")
2007 (synopsis "Library for approximate nearest neighbors computation")
2008 (description "FLANN is a library for performing fast approximate
2009 nearest neighbor searches in high dimensional spaces. It implements a
2010 collection of algorithms and a system for automatically choosing the best
2011 algorithm and optimum parameters depending on the dataset.
2012
2013 FLANN is written in C++ and contains bindings for C, Octave and Python.")
2014 (license (license:non-copyleft "file://COPYING"
2015 "See COPYING in the distribution."))))
2016
2017 (define-public wcalc
2018 (package
2019 (name "wcalc")
2020 (version "2.5")
2021 (source
2022 (origin
2023 (method url-fetch)
2024 (uri
2025 (string-append
2026 "mirror://sourceforge/w-calc/wcalc-" version ".tar.bz2"))
2027 (sha256
2028 (base32
2029 "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
2030 (build-system gnu-build-system)
2031 (inputs
2032 `(("mpfr" ,mpfr)
2033 ("readline" ,readline)))
2034 (home-page "http://w-calc.sourceforge.net/index.php")
2035 (synopsis "Flexible command-line scientific calculator")
2036 (description "Wcalc is a very capable calculator. It has standard functions
2037 (sin, asin, and sinh for example, in either radians or degrees), many
2038 pre-defined constants (pi, e, c, etc.), support for using variables, \"active\"
2039 variables, a command history, hex/octal/binary input and output, unit
2040 conversions, embedded comments, and an expandable expression entry field. It
2041 evaluates expressions using the standard order of operations.")
2042 (license license:gpl2+)))
2043
2044 (define-public xaos
2045 (package
2046 (name "xaos")
2047 (version "3.6")
2048 (source (origin
2049 (method url-fetch)
2050 (uri (string-append "mirror://sourceforge/xaos/xaos-"
2051 version ".tar.gz"))
2052 (sha256
2053 (base32
2054 "15cd1cx1dyygw6g2nhjqq3bsfdj8sj8m4va9n75i0f3ryww3x7wq"))))
2055 (build-system gnu-build-system)
2056 (native-inputs `(("gettext" ,gnu-gettext)))
2057 (inputs `(("libx11" ,libx11)
2058 ("zlib" ,zlib)
2059 ("libpng" ,libpng)
2060 ("gsl" ,gsl)))
2061 (arguments
2062 `(#:tests? #f ;no "check" target
2063 #:make-flags '("LOCALEDIR=$DATAROOTDIR/locale")))
2064 (synopsis "Real-time fractal zoomer")
2065 (description "GNU XaoS is a graphical program that generates fractal
2066 patterns and allows you to zoom in and out of them infinitely in a fluid,
2067 continuous manner. It also includes tutorials that help to explain how fractals
2068 are built. It can generate many different fractal types such as the Mandelbrot
2069 set.")
2070 (home-page "http://www.gnu.org/software/xaos/")
2071 (license license:gpl2+)))