gnu: Move cursynth to (gnu packages music).
[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 Efraim Flashner <efraim@flashner.co.il>
12 ;;;
13 ;;; This file is part of GNU Guix.
14 ;;;
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.
19 ;;;
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.
24 ;;;
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/>.
27
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))
79
80 (define-public units
81 (package
82 (name "units")
83 (version "2.12")
84 (source (origin
85 (method url-fetch)
86 (uri (string-append "mirror://gnu/units/units-" version
87 ".tar.gz"))
88 (sha256 (base32
89 "1jxvjknz2jhq773jrwx9gc1df3gfy73yqmkjkygqxzpi318yls3q"))))
90 (build-system gnu-build-system)
91 (synopsis "Conversion between thousands of scales")
92 (description
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/")))
100
101 (define-public double-conversion
102 (package
103 (name "double-conversion")
104 (version "1.1.5")
105 (source (origin
106 (method url-fetch)
107 (uri (string-append
108 "https://github.com/floitsch/double-conversion/archive/v"
109 version ".tar.gz"))
110 (file-name (string-append name "-" version ".tar.gz"))
111 (sha256
112 (base32
113 "0cnr8xhyjfxijay8ymkqcph3672wp2lj23qhdmr3m4kia5kpdf83"))))
114 (build-system cmake-build-system)
115 (arguments
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")
121 (description
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)))
126
127 (define-public dionysus
128 (package
129 (name "dionysus")
130 (version "1.3.0")
131 (source (origin
132 (method url-fetch)
133 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
134 ".tar.gz"))
135 (sha256
136 (base32
137 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
138 (build-system gnu-build-system)
139 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
140 (synopsis "Local search for universal constants and scientific values")
141 (description
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
146 semiconductors.")
147 (license license:gpl3+)
148 (home-page "http://www.gnu.org/software/dionysus/")))
149
150 (define-public gsl
151 (package
152 (name "gsl")
153 (version "2.1")
154 (source
155 (origin
156 (method url-fetch)
157 (uri (string-append "mirror://gnu/gsl/gsl-"
158 version ".tar.gz"))
159 (sha256
160 (base32
161 "0rhcia9jhr3p1f1wybwyllwqfs9bggz99i3mi5lpyqcpff1hdbar"))))
162 (build-system gnu-build-system)
163 (arguments
164 `(#:parallel-tests? #f))
165 (home-page "http://www.gnu.org/software/gsl/")
166 (synopsis "Numerical library for C and C++")
167 (description
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
172 numbers.")
173 (license license:gpl3+)))
174
175 (define-public glpk
176 (package
177 (name "glpk")
178 (version "4.57")
179 (source
180 (origin
181 (method url-fetch)
182 (uri (string-append "mirror://gnu/glpk/glpk-"
183 version ".tar.gz"))
184 (sha256
185 (base32
186 "0p17jj1ixd2m9lnsvx8nywmfmnplfk5gvw25r1gy84qzrjkv48vk"))))
187 (build-system gnu-build-system)
188 (inputs
189 `(("gmp" ,gmp)))
190 (arguments
191 `(#:configure-flags '("--with-gmp")))
192 (home-page "http://www.gnu.org/software/glpk/")
193 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
194 (description
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+)))
201
202 (define-public pspp
203 (package
204 (name "pspp")
205 (version "0.8.5")
206 (source
207 (origin
208 (method url-fetch)
209 (uri (string-append "mirror://gnu/pspp/pspp-"
210 version ".tar.gz"))
211 (sha256
212 (base32
213 "0c8326yykidi94xi7jn27j8iqxc38vc07d4wf5zyk0l8lpzx5vz7"))))
214 (build-system gnu-build-system)
215 (inputs
216 `(("cairo" ,cairo)
217 ("fontconfig" ,fontconfig)
218 ("gettext" ,gnu-gettext)
219 ("gsl" ,gsl)
220 ("libxml2" ,libxml2)
221 ("pango" ,pango)
222 ("readline" ,readline)
223 ("gtk" ,gtk+-2)
224 ("gtksourceview" ,gtksourceview-2)
225 ("zlib" ,zlib)))
226 (native-inputs
227 `(("glib" ,glib "bin") ;for glib-genmarshal
228 ("perl" ,perl)
229 ("texinfo" ,texinfo)
230 ("pkg-config" ,pkg-config)))
231 (home-page "http://www.gnu.org/software/pspp/")
232 (synopsis "Statistical analysis")
233 (description
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+)))
241
242 (define-public arpack-ng
243 (package
244 (name "arpack-ng")
245 (version "3.2.0")
246 (source
247 (origin
248 (method url-fetch)
249 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
250 version ".tar.gz"))
251 (file-name (string-append name "-" version ".tar.gz"))
252 (sha256
253 (base32
254 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
255 (build-system gnu-build-system)
256 (home-page "https://github.com/opencollab/arpack-ng")
257 (inputs
258 `(("lapack" ,lapack)
259 ("fortran" ,gfortran)))
260 (synopsis "Fortran subroutines for solving eigenvalue problems")
261 (description
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."))))
266
267 (define-public arpack-ng-openmpi
268 (package (inherit arpack-ng)
269 (name "arpack-ng-openmpi")
270 (inputs
271 `(("mpi" ,openmpi)
272 ,@(package-inputs arpack-ng)))
273 (arguments `(#:configure-flags '("--enable-mpi")))
274 (synopsis "Fortran subroutines for solving eigenvalue problems with MPI")))
275
276 (define-public lapack
277 (package
278 (name "lapack")
279 (version "3.5.0")
280 (source
281 (origin
282 (method url-fetch)
283 (uri (string-append "http://www.netlib.org/lapack/lapack-"
284 version ".tgz"))
285 (sha256
286 (base32
287 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
288 (build-system cmake-build-system)
289 (home-page "http://www.netlib.org/lapack/")
290 (inputs `(("fortran" ,gfortran)
291 ("python" ,python-2)))
292 (arguments
293 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
294 #:phases (alist-cons-before
295 'check 'patch-python
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))))
300 %standard-phases)))
301 (synopsis "Library for numerical linear algebra")
302 (description
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."))))
307
308 (define-public scalapack
309 (package
310 (name "scalapack")
311 (version "2.0.2")
312 (source
313 (origin
314 (method url-fetch)
315 (uri (string-append "http://www.netlib.org/scalapack/scalapack-"
316 version ".tgz"))
317 (sha256
318 (base32
319 "0p1r61ss1fq0bs8ynnx7xq4wwsdvs32ljvwjnx6yxr8gd6pawx0c"))))
320 (build-system cmake-build-system)
321 (inputs
322 `(("mpi" ,openmpi)
323 ("fortran" ,gfortran)
324 ("lapack" ,lapack))) ;for testing only
325 (arguments
326 `(#:configure-flags `("-DBUILD_SHARED_LIBS:BOOL=YES")))
327 (home-page "http://www.netlib.org/scalapack/")
328 (synopsis "Library for scalable numerical linear algebra")
329 (description
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."))))
336
337 (define-public gnuplot
338 (package
339 (name "gnuplot")
340 (version "5.0.1")
341 (source
342 (origin
343 (method url-fetch)
344 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
345 version "/gnuplot-" version ".tar.gz"))
346 (sha256
347 (base32
348 "0irwig94w3f8bn4a444hrjnp7w55vqwv8gqj42jiwn6zf5z5bg3w"))))
349 (build-system gnu-build-system)
350 (inputs `(("readline" ,readline)
351 ("cairo" ,cairo)
352 ("pango" ,pango)
353 ("gd" ,gd)))
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"))))
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.8.4")
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 "0jv2yvk28w86rx5mvjkb0w12ff2jxih7axnpvznpd295lg5jg7hr"))
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 (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+)))
501
502 (define-public petsc
503 (package
504 (name "petsc")
505 (version "3.6.2")
506 (source
507 (origin
508 (method url-fetch)
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"))
512 (sha256
513 (base32 "13h0m5f9xsdpps4lsp59iz2m7zkapwavq2zfkfvs3ab6sndla0l9"))))
514 (build-system gnu-build-system)
515 (native-inputs
516 `(("python" ,python-2)
517 ("perl" ,perl)))
518 (inputs
519 `(("gfortran" ,gfortran)
520 ("lapack" ,lapack)
521 ("superlu" ,superlu)
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
524 ))
525 (arguments
526 `(#:test-target "test"
527 #:parallel-build? #f ;build is parallel by default
528 #:configure-flags
529 `("--with-mpi=0"
530 "--with-openmp=1"
531 "--with-superlu=1"
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"))
536 #:phases
537 (alist-replace
538 'configure
539 ;; PETSc's configure script is actually a python script, so we can't
540 ;; run it with bash.
541 (lambda* (#:key outputs (configure-flags '())
542 #:allow-other-keys)
543 (let* ((prefix (assoc-ref outputs "out"))
544 (flags `(,(string-append "--prefix=" prefix)
545 ,@configure-flags)))
546 (format #t "build directory: ~s~%" (getcwd))
547 (format #t "configure flags: ~s~%" flags)
548 (zero? (apply system* "./configure" flags))))
549 (alist-cons-after
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$")
555 (((getcwd)) out))))
556 (alist-cons-after
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"))
565 (((getcwd)) out))
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)
574 (delete-file f))))
575 '("configure.log" "make.log" "gmake.log"
576 "test.log" "error.log" "RDict.db"
577 ;; Once installed, should uninstall with Guix
578 "uninstall.py"))))
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"))))
587
588 (define-public petsc-complex
589 (package (inherit petsc)
590 (name "petsc-complex")
591 (arguments
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)")))
596
597 (define-public petsc-openmpi
598 (package (inherit petsc)
599 (name "petsc-openmpi")
600 (inputs
601 `(("openmpi" ,openmpi)
602 ,@(package-inputs petsc)))
603 (arguments
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)")))
611
612 (define-public petsc-complex-openmpi
613 (package (inherit petsc-complex)
614 (name "petsc-complex-openmpi")
615 (inputs
616 `(("openmpi" ,openmpi)
617 ,@(package-inputs petsc-complex)))
618 (arguments
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)")))
626
627 (define-public slepc
628 (package
629 (name "slepc")
630 (version "3.6.2")
631 (source
632 (origin
633 (method url-fetch)
634 (uri (string-append "http://slepc.upv.es/download/download.php?"
635 "filename=slepc-" version ".tar.gz"))
636 (sha256
637 (base32
638 "1pv5iqz2kc8sj49zsabyz4arnfpana8mjrhq31vzgk16xldk3d1a"))))
639 (build-system gnu-build-system)
640 (native-inputs
641 `(("python" ,python-2)))
642 (inputs
643 `(("arpack" ,arpack-ng)
644 ("gfortran" ,gfortran)))
645 (propagated-inputs
646 `(("petsc" ,petsc)))
647 (arguments
648 `(#:parallel-build? #f ;build is parallel by default
649 #:configure-flags
650 `(,(string-append "--with-arpack-dir="
651 (assoc-ref %build-inputs "arpack") "/lib"))
652 #:phases
653 (modify-phases %standard-phases
654 (replace
655 'configure
656 ;; configure is a python script, so we can't run it with bash.
657 (lambda* (#:key inputs outputs (configure-flags '())
658 #:allow-other-keys)
659 (let* ((prefix (assoc-ref outputs "out"))
660 (flags `(,(string-append "--prefix=" prefix)
661 ,@configure-flags)))
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)))))
667 (add-after
668 'install 'delete-doc
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$")))))
676 (add-after
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)
684 (delete-file 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)))
698
699 (define-public slepc-complex
700 (package (inherit slepc)
701 (name "slepc-complex")
702 (propagated-inputs
703 `(("petsc" ,petsc-complex)
704 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
705 (synopsis "Scalable library for eigenproblems (with complex scalars)")))
706
707 (define-public slepc-openmpi
708 (package (inherit slepc)
709 (name "slepc-openmpi")
710 (inputs
711 `(("mpi" ,openmpi)
712 ("arpack" ,arpack-ng-openmpi)
713 ,@(alist-delete "arpack" (package-inputs slepc))))
714 (propagated-inputs
715 `(("petsc" ,petsc-openmpi)
716 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
717 (synopsis "Scalable library for eigenproblems (with MPI support)")))
718
719 (define-public slepc-complex-openmpi
720 (package (inherit slepc-openmpi)
721 (name "slepc-complex-openmpi")
722 (propagated-inputs
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)")))
726
727 (define-public mumps
728 (package
729 (name "mumps")
730 (version "5.0.1")
731 (source
732 (origin
733 (method url-fetch)
734 (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
735 version ".tar.gz"))
736 (sha256
737 (base32
738 "1820jfp3mbl7n85765v5mp6p0gzqpgr4d2lrnhwj4gl7cwp5ndah"))
739 (patches (list (search-patch "mumps-build-parallelism.patch")))))
740 (build-system gnu-build-system)
741 (inputs
742 `(("fortran" ,gfortran)
743 ;; These are required for linking against mumps, but we let the user
744 ;; declare the dependency.
745 ("blas" ,openblas)
746 ("metis" ,metis)
747 ("scotch" ,scotch)))
748 (arguments
749 `(#:modules ((ice-9 match)
750 (ice-9 popen)
751 (srfi srfi-1)
752 ,@%gnu-build-system-modules)
753 #:phases
754 (modify-phases %standard-phases
755 (replace
756 'configure
757 (lambda* (#:key inputs #:allow-other-keys)
758 (call-with-output-file "Makefile.inc"
759 (lambda (port)
760 (format port "
761 PLAT =
762 LIBEXT = .a
763 OUTC = -o
764 OUTF = -o
765 RM = rm -f~:[
766 CC = gcc
767 FC = gfortran
768 FL = gfortran
769 INCSEQ = -I$(topdir)/libseq
770 LIBSEQ = -L$(topdir)/libseq -lmpiseq
771 LIBSEQNEEDED = libseqneeded~;
772 CC = mpicc
773 FC = mpifort
774 FL = mpifort~]
775 AR = ar vr # rules require trailing space, ugh...
776 RANLIB = ranlib
777 LIBBLAS = -L~a -lopenblas~@[
778 SCALAP = -L~a -lscalapack~]
779 LIBOTHERS = -pthread
780 CDEFS = -DAdd_
781 PIC = -fPIC
782 OPTF = -O2 -DALLOW_NON_INIT $(PIC)
783 OPTL = -O2 $(PIC)
784 OPTC = -O2 $(PIC)
785 INCS = $(INCSEQ)
786 LIBS = $(SCALAP) $(LIBSEQ)
787 LPORDDIR = $(topdir)/PORD/lib
788 IPORD = -I$(topdir)/PORD/include
789 LPORD = -L$(LPORDDIR) -lpord
790 ORDERINGSF = -Dpord~@[
791 METISDIR = ~a
792 IMETIS = -I$(METISDIR)/include
793 LMETIS = -L$(METISDIR)/lib -lmetis
794 ORDERINGSF += -Dmetis~]~@[~:{
795 SCOTCHDIR = ~a
796 ISCOTCH = -I$(SCOTCHDIR)/include
797 LSCOTCH = -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
798 ORDERINGSF += ~a~}~]
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"))
809 ((#f #f)
810 #f)
811 ((#f scotch)
812 `((,scotch "" "-Dscotch")))
813 ((ptscotch _)
814 `((,ptscotch
815 "-lptesmumps -lptscotch -lptscotcherr "
816 "-Dptscotch")))))))))
817 (replace
818 'build
819 ;; By default only the d-precision library is built. Make with "all"
820 ;; target so that all precision libraries and examples are built.
821 (lambda _
822 (zero? (system* "make" "all"
823 (format #f "-j~a" (parallel-job-count))))))
824 (replace
825 'check
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"
833 (every
834 (lambda (prec type)
835 (let ((tester (apply open-pipe*
836 `(,OPEN_WRITE
837 ,@exec-prefix
838 ,(string-append "./" prec
839 "simpletest"))))
840 (input (open-input-file
841 (string-append "input_simpletest_" type))))
842 (begin
843 (dump-port input tester)
844 (close-port input)
845 (zero? (close-pipe tester)))))
846 '("s" "d" "c" "z")
847 '("real" "real" "cmplx" "cmplx")))))
848 (replace
849 'install
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")
859 (description
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)))
863
864 (define-public mumps-metis
865 (package (inherit mumps)
866 (name "mumps-metis")
867 (inputs
868 (alist-delete "scotch" (package-inputs mumps)))))
869
870 (define-public mumps-openmpi
871 (package (inherit mumps)
872 (name "mumps-openmpi")
873 (inputs
874 `(("mpi" ,openmpi)
875 ("scalapack" ,scalapack)
876 ("pt-scotch" ,pt-scotch)
877 ,@(alist-delete "scotch" (package-inputs mumps))))
878 (arguments
879 (substitute-keyword-arguments (package-arguments mumps)
880 ((#:phases phases)
881 `(modify-phases ,phases
882 (replace
883 'check
884 (lambda _
885 ((assoc-ref ,phases 'check)
886 #:exec-prefix '("mpirun" "-n" "2"))))))))
887 (synopsis "Multifrontal sparse direct solver (with MPI)")))
888
889 (define-public mumps-metis-openmpi
890 (package (inherit mumps-openmpi)
891 (name "mumps-metis-openmpi")
892 (inputs
893 (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
894
895 (define-public superlu
896 (package
897 (name "superlu")
898 (version "4.3")
899 (source
900 (origin
901 (method url-fetch)
902 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
903 "superlu_" version ".tar.gz"))
904 (sha256
905 (base32 "10b785s9s4x0m9q7ihap09275pq4km3k2hk76jiwdfdr5qr2168n"))))
906 (build-system gnu-build-system)
907 (native-inputs
908 `(("tcsh" ,tcsh)))
909 (inputs
910 `(("lapack" ,lapack)
911 ("gfortran" ,gfortran)))
912 (arguments
913 `(#:parallel-build? #f
914 #:tests? #f ;tests are run as part of `make all`
915 #:phases
916 (alist-replace
917 'configure
918 (lambda* (#:key inputs outputs #:allow-other-keys)
919 (call-with-output-file "make.inc"
920 (lambda (port)
921 (format port "
922 PLAT =
923 SuperLUroot = ~a
924 SUPERLULIB = ~a/lib/libsuperlu.a
925 TMGLIB = libtmglib.a
926 BLASDEF = -DUSE_VENDOR_BLAS
927 BLASLIB = -L~a/lib -lblas
928 LIBS = $(SUPERLULIB) $(BLASLIB)
929 ARCH = ar
930 ARCHFLAGS = cr
931 RANLIB = ranlib
932 CC = gcc
933 PIC = -fPIC
934 CFLAGS = -O3 -DPRNTlevel=0 $(PIC)
935 NOOPTS = -O0 $(PIC)
936 FORTRAN = gfortran
937 FFLAGS = -O2 $(PIC)
938 LOADER = $(CC)
939 CDEFS = -DAdd_"
940 (getcwd)
941 (assoc-ref outputs "out")
942 (assoc-ref inputs "lapack")))))
943 (alist-cons-before
944 'build 'create-install-directories
945 (lambda* (#:key outputs #:allow-other-keys)
946 (for-each
947 (lambda (dir)
948 (mkdir-p (string-append (assoc-ref outputs "out")
949 "/" dir)))
950 '("lib" "include")))
951 (alist-replace
952 'install
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'~%"
961 base incdir)
962 (copy-file file
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")
968 (description
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)))
976
977 (define-public superlu-dist
978 (package
979 (name "superlu-dist")
980 (version "3.3")
981 (source
982 (origin
983 (method url-fetch)
984 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
985 "superlu_dist_" version ".tar.gz"))
986 (sha256
987 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
988 (patches (list (search-patch "superlu-dist-scotchmetis.patch")))))
989 (build-system gnu-build-system)
990 (native-inputs
991 `(("tcsh" ,tcsh)))
992 (inputs
993 `(("gfortran" ,gfortran)))
994 (propagated-inputs
995 `(("openmpi" ,openmpi) ;headers include MPI heades
996 ("lapack" ,lapack) ;required to link with output library
997 ("pt-scotch" ,pt-scotch))) ;same
998 (arguments
999 `(#:parallel-build? #f ;race conditions using ar
1000 #:phases
1001 (alist-replace
1002 'configure
1003 (lambda* (#:key inputs outputs #:allow-other-keys)
1004 (call-with-output-file "make.inc"
1005 (lambda (port)
1006 (format port "
1007 PLAT =
1008 DSuperLUroot = ~a
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)
1018 ARCH = ar
1019 ARCHFLAGS = cr
1020 RANLIB = ranlib
1021 CC = mpicc
1022 PIC = -fPIC
1023 CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
1024 NOOPTS = -O0 -g $(PIC)
1025 FORTRAN = mpifort
1026 FFLAGS = -O2 -g $(PIC)
1027 LOADER = $(CC)
1028 CDEFS = -DAdd_"
1029 (getcwd)
1030 (assoc-ref outputs "out")
1031 (assoc-ref inputs "lapack")
1032 (assoc-ref inputs "pt-scotch")))))
1033 (alist-cons-after
1034 'unpack 'remove-broken-symlinks
1035 (lambda _
1036 (for-each delete-file
1037 (find-files "MAKE_INC" "\\.#make\\..*")))
1038 (alist-cons-before
1039 'build 'create-install-directories
1040 (lambda* (#:key outputs #:allow-other-keys)
1041 (for-each
1042 (lambda (dir)
1043 (mkdir-p (string-append (assoc-ref outputs "out")
1044 "/" dir)))
1045 '("lib" "include")))
1046 (alist-replace
1047 'check
1048 (lambda _
1049 (with-directory-excursion "EXAMPLE"
1050 (and
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")))))
1055 (alist-replace
1056 'install
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'~%"
1065 base incdir)
1066 (copy-file file
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")
1072 (description
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)))
1077
1078 (define-public scotch
1079 (package
1080 (name "scotch")
1081 (version "6.0.4")
1082 (source
1083 (origin
1084 (method url-fetch)
1085 (uri (string-append "https://gforge.inria.fr/frs/download.php/34618/"
1086 "scotch_" version ".tar.gz"))
1087 (sha256
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)
1092 (inputs
1093 `(("zlib" ,zlib)
1094 ("flex" ,flex)
1095 ("bison" ,bison)))
1096 (arguments
1097 `(#:phases
1098 (modify-phases %standard-phases
1099 (add-after
1100 'unpack 'chdir-to-src
1101 (lambda _ (chdir "src")))
1102 (replace
1103 'configure
1104 (lambda _
1105 (call-with-output-file "Makefile.inc"
1106 (lambda (port)
1107 (format port "
1108 EXE =
1109 LIB = .a
1110 OBJ = .o
1111 MAKE = make
1112 AR = ar
1113 ARFLAGS = -ruv
1114 CAT = cat
1115 CCS = gcc
1116 CCP = mpicc
1117 CCD = gcc
1118 CPPFLAGS =~{ -D~a~}
1119 CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
1120 LDFLAGS = -lz -lm -lrt -lpthread
1121 CP = cp
1122 LEX = flex -Pscotchyy -olex.yy.c
1123 LN = ln
1124 MKDIR = mkdir
1125 MV = mv
1126 RANLIB = ranlib
1127 YACC = bison -pscotchyy -y -b y
1128 "
1129 '("COMMON_FILE_COMPRESS_GZ"
1130 "COMMON_PTHREAD"
1131 "COMMON_RANDOM_FIXED_SEED"
1132 ;; Prevents symbolc clashes with libesmumps
1133 "SCOTCH_RENAME"
1134 ;; XXX: Causes invalid frees in superlu-dist tests
1135 ;; "SCOTCH_PTHREAD"
1136 ;; "SCOTCH_PTHREAD_NUMBER=2"
1137 "restrict=__restrict"))))))
1138 (add-after
1139 'build 'build-esmumps
1140 (lambda _
1141 (zero? (system* "make"
1142 (format #f "-j~a" (parallel-job-count))
1143 "esmumps"))))
1144 (replace
1145 'install
1146 (lambda* (#:key outputs #:allow-other-keys)
1147 (let ((out (assoc-ref outputs "out")))
1148 (mkdir out)
1149 (zero? (system* "make"
1150 (string-append "prefix=" out)
1151 "install"))
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
1167 bio-chemistry.")
1168 ;; See LICENSE_en.txt
1169 (license license:cecill-c)))
1170
1171 (define-public pt-scotch
1172 (package (inherit scotch)
1173 (name "pt-scotch")
1174 (propagated-inputs
1175 `(("openmpi" ,openmpi))) ;Headers include MPI headers
1176 (arguments
1177 (substitute-keyword-arguments (package-arguments scotch)
1178 ((#:phases scotch-phases)
1179 `(modify-phases ,scotch-phases
1180 (replace
1181 'build
1182 (lambda _
1183 (and
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")))))
1189 (replace
1190 'check
1191 (lambda _ (zero? (system* "make" "ptcheck"))))))))
1192 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
1193
1194 (define-public metis
1195 (package
1196 (name "metis")
1197 (version "5.1.0")
1198 (source
1199 (origin
1200 (method url-fetch)
1201 (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
1202 "metis-" version ".tar.gz"))
1203 (sha256
1204 (base32
1205 "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
1206 (build-system cmake-build-system)
1207 (inputs
1208 `(("blas" ,openblas)))
1209 (arguments
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")
1216 (description
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
1221 schemes.")
1222 (license license:asl2.0))) ;As of version 5.0.3
1223
1224 (define-public p4est
1225 (package
1226 (name "p4est")
1227 (version "1.1")
1228 (source
1229 (origin
1230 (method url-fetch)
1231 (uri (string-append "http://p4est.github.io/release/p4est-"
1232 version ".tar.gz"))
1233 (sha256
1234 (base32
1235 "0faina2h5qsx3m2izbzaj9bbakma1krbbjmq43wrp1hcbyijflqb"))))
1236 (build-system gnu-build-system)
1237 (inputs
1238 `(("fortran" ,gfortran)
1239 ("blas" ,openblas)
1240 ("lapack" ,lapack)
1241 ("zlib" ,zlib)))
1242 (arguments
1243 `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
1244 (assoc-ref %build-inputs "blas")
1245 " -lopenblas")
1246 ,(string-append "LAPACK_LIBS=-L"
1247 (assoc-ref %build-inputs "lapack")
1248 " -llapack"))))
1249 (home-page "http://www.p4est.org")
1250 (synopsis "Adaptive mesh refinement on forests of octrees")
1251 (description
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
1255 processor cores.")
1256 (license license:gpl2+)))
1257
1258 (define-public p4est-openmpi
1259 (package (inherit p4est)
1260 (name "p4est-openmpi")
1261 (inputs
1262 `(("mpi" ,openmpi)
1263 ,@(package-inputs p4est)))
1264 (arguments
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")))
1269
1270 (define-public gsegrafix
1271 (package
1272 (name "gsegrafix")
1273 (version "1.0.6")
1274 (source
1275 (origin
1276 (method url-fetch)
1277 (uri (string-append "mirror://gnu/" name "/" name "-"
1278 version ".tar.gz"))
1279 (sha256
1280 (base32
1281 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
1282 (build-system gnu-build-system)
1283 (arguments
1284 `(#:configure-flags '("LDFLAGS=-lm")))
1285 (inputs
1286 `(("libgnomecanvas" ,libgnomecanvas)
1287 ("libbonoboui" ,libbonoboui)
1288 ("libgnomeui" ,libgnomeui)
1289 ("libgnomeprintui" ,libgnomeprintui)
1290 ("popt" ,popt)))
1291 (native-inputs
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+)))
1302
1303 (define-public maxima
1304 (package
1305 (name "maxima")
1306 (version "5.36.1")
1307 (source
1308 (origin
1309 (method url-fetch)
1310 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
1311 version "-source/" name "-" version ".tar.gz"))
1312 (sha256
1313 (base32
1314 "0x1rk659sn3cq0n5c90848ilzr1gb1wf0072fl6jhkdq00qgh2s0"))
1315 (patches (list (search-patch "maxima-defsystem-mkdir.patch")))))
1316 (build-system gnu-build-system)
1317 (inputs
1318 `(("gcl" ,gcl)
1319 ("gnuplot" ,gnuplot) ;for plots
1320 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
1321 (native-inputs
1322 `(("texinfo" ,texinfo)
1323 ("perl" ,perl)))
1324 (arguments
1325 `(#:configure-flags
1326 (list "--enable-gcl"
1327 (string-append "--with-posix-shell="
1328 (assoc-ref %build-inputs "bash")
1329 "/bin/sh")
1330 (string-append "--with-wish="
1331 (assoc-ref %build-inputs "tk")
1332 "/bin/wish"
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
1340 'check 'pre-check
1341 (lambda _
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.
1346 (alist-cons-after
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")
1355 (symlink
1356 (string-append datadir "/emacs/")
1357 (string-append out "/share/emacs/site-lisp"))
1358 (symlink
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")
1363 (lambda (in out)
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
1374 point numbers.")
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)))
1381
1382 (define-public wxmaxima
1383 (package
1384 (name "wxmaxima")
1385 (version "15.04.0")
1386 (source
1387 (origin
1388 (method url-fetch)
1389 (uri (string-append "mirror://sourceforge/wxmaxima/wxMaxima/"
1390 version "/" name "-" version ".tar.gz"))
1391 (sha256
1392 (base32
1393 "1fm47ah4aw5qdjqhkz67w5fwhy8yfffa5z896crp0d3hk2bh4180"))))
1394 (build-system gnu-build-system)
1395 (inputs
1396 `(("wxwidgets" ,wxwidgets)
1397 ("maxima" ,maxima)))
1398 (arguments
1399 `(#:phases (modify-phases %standard-phases
1400 (add-after
1401 'install 'wrap-program
1402 (lambda* (#:key inputs outputs #:allow-other-keys)
1403 (wrap-program (string-append (assoc-ref outputs "out")
1404 "/bin/wxmaxima")
1405 `("PATH" ":" prefix
1406 (,(string-append (assoc-ref inputs "maxima")
1407 "/bin"))))
1408 #t)))))
1409 (home-page "https://andrejv.github.io/wxmaxima/")
1410 (synopsis "Graphical user interface for the Maxima computer algebra system")
1411 (description
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
1417 characters.
1418
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+)))
1424
1425 (define-public armadillo
1426 (package
1427 (name "armadillo")
1428 (version "6.400.3")
1429 (source (origin
1430 (method url-fetch)
1431 (uri (string-append "mirror://sourceforge/arma/armadillo-"
1432 version ".tar.gz"))
1433 (sha256
1434 (base32
1435 "0bsgrmldlx77w5x26n3axj1hg6iw6csyw0dwl1flrbdwl51f9701"))))
1436 (build-system cmake-build-system)
1437 (arguments `(#:tests? #f)) ;no test target
1438 (inputs
1439 `(("openblas" ,openblas)
1440 ("lapack" ,lapack)
1441 ("arpack" ,arpack-ng)))
1442 (home-page "http://arma.sourceforge.net/")
1443 (synopsis "C++ linear algebra library")
1444 (description
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)))
1453
1454 (define-public armadillo-for-rcpparmadillo
1455 (package (inherit armadillo)
1456 (version "6.200.2")
1457 (source (origin
1458 (method url-fetch)
1459 (uri (string-append "mirror://sourceforge/arma/armadillo-"
1460 version ".tar.gz"))
1461 (sha256
1462 (base32
1463 "1f69rlqhnf2wv8khyn2a8vi6gx1i72qgfy8b9b760ssk85dcl763"))))))
1464
1465 (define-public muparser
1466 (package
1467 (name "muparser")
1468 (version "2.2.5")
1469 (source
1470 (origin
1471 (method svn-fetch)
1472 (uri (svn-reference
1473 (url "http://muparser.googlecode.com/svn/trunk/")
1474 (revision 34)))
1475 (sha256
1476 (base32
1477 "1d6bdbhx9zj3srwj3m7c9hvr18gnx1fx43h6d25my7q85gicpcwn"))))
1478 (build-system gnu-build-system)
1479 (arguments
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")
1484 (description
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)))
1489
1490 (define-public openblas
1491 (package
1492 (name "openblas")
1493 (version "0.2.15")
1494 (source
1495 (origin
1496 (method url-fetch)
1497 (uri (string-append "https://github.com/xianyi/OpenBLAS/tarball/v"
1498 version))
1499 (file-name (string-append name "-" version ".tar.gz"))
1500 (sha256
1501 (base32
1502 "1k5f6vjlk54qlplk5m7xkbaw6g2y7dl50lwwdv6xsbcsgsbxfcpy"))))
1503 (build-system gnu-build-system)
1504 (arguments
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.
1509 #:substitutable?
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)))
1514 #:make-flags
1515 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1516 "SHELL=bash"
1517 "NO_LAPACK=1"
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))))
1524 (cond
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"))
1533 (else '()))))
1534 ;; no configure script
1535 #:phases (alist-delete 'configure %standard-phases)))
1536 (inputs
1537 `(("fortran" ,gfortran)))
1538 (native-inputs
1539 `(("cunit" ,cunit)
1540 ("perl" ,perl)))
1541 (home-page "http://www.openblas.net/")
1542 (synopsis "Optimized BLAS library based on GotoBLAS")
1543 (description
1544 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
1545 (license license:bsd-3)))
1546
1547 (define-public openlibm
1548 (package
1549 (name "openlibm")
1550 (version "0.4.1")
1551 (source
1552 (origin
1553 (method url-fetch)
1554 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
1555 version ".tar.gz"))
1556 (file-name (string-append name "-" version ".tar.gz"))
1557 (sha256
1558 (base32
1559 "0cwqqqlblj3kzp9aq1wnpfs1fl0qd1wp1xzm5shb09w06i4rh9nn"))))
1560 (build-system gnu-build-system)
1561 (arguments
1562 `(#:make-flags
1563 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1564 #:phases
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)")
1570 (description
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
1576 environments.")
1577 ;; See LICENSE.md for details.
1578 (license (list license:expat
1579 license:isc
1580 license:bsd-2
1581 license:public-domain
1582 license:lgpl2.1+))))
1583
1584 (define-public openspecfun
1585 (package
1586 (name "openspecfun")
1587 (version "0.4")
1588 (source
1589 (origin
1590 (method url-fetch)
1591 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
1592 version ".tar.gz"))
1593 (file-name (string-append name "-" version ".tar.gz"))
1594 (sha256
1595 (base32
1596 "0nsa3jjmlhcqkw5ba5ypbn3n0c8b6lc22zzlxnmxkxi9shhdx65z"))))
1597 (build-system gnu-build-system)
1598 (arguments
1599 '(#:tests? #f ;no "check" target
1600 #:make-flags
1601 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1602 ;; no configure script
1603 #:phases (alist-delete 'configure %standard-phases)))
1604 (inputs
1605 `(("fortran" ,gfortran)))
1606 (home-page "https://github.com/JuliaLang/openspecfun")
1607 (synopsis "Collection of special mathematical functions")
1608 (description
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))))
1620
1621 (define-public suitesparse
1622 (package
1623 (name "suitesparse")
1624 (version "4.4.3")
1625 (source
1626 (origin
1627 (method url-fetch)
1628 (uri (string-append
1629 "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-"
1630 version ".tar.gz"))
1631 (sha256
1632 (base32
1633 "100hdzr0mf4mzlwnqpmwpfw4pymgsf9n3g0ywb1yps2nk1zbkdy5"))))
1634 (build-system gnu-build-system)
1635 (arguments
1636 '(#:parallel-build? #f ;cholmod build fails otherwise
1637 #:tests? #f ;no "check" target
1638 #:make-flags
1639 (list "CC=gcc"
1640 "BLAS=-lblas"
1641 "TBB=-ltbb"
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"))
1647 #:phases
1648 (alist-cons-before
1649 'install 'prepare-out
1650 ;; README.txt states that the target directories must exist prior to
1651 ;; running "make install".
1652 (lambda _
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))))
1657 (inputs
1658 `(("tbb" ,tbb)
1659 ("lapack" ,lapack)))
1660 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
1661 (synopsis "Suite of sparse matrix software")
1662 (description
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
1668 packages.")
1669 ;; LGPLv2.1+:
1670 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
1671 ;; GPLv2+:
1672 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
1673 (license (list license:gpl2+ license:lgpl2.1+))))
1674
1675 (define-public atlas
1676 (package
1677 (name "atlas")
1678 (version "3.10.2")
1679 (source (origin
1680 (method url-fetch)
1681 (uri (string-append "mirror://sourceforge/math-atlas/atlas"
1682 version ".tar.bz2"))
1683 (sha256
1684 (base32
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))
1694 (arguments
1695 `(#:parallel-build? #f
1696 #:parallel-tests? #f
1697
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
1701 ;; substitutes.
1702 #:substitutable? #f
1703
1704 #:modules ((srfi srfi-26)
1705 (srfi srfi-1)
1706 (guix build gnu-build-system)
1707 (guix build utils))
1708 #:configure-flags
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"
1712 ;; Set word width.
1713 "-b"
1714 ,,(if (string-match "64" (%current-system))
1715 "64"
1716 "32")
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")
1725 (list))
1726 ;; Generate shared libraries.
1727 "--shared"
1728 ;; Build a full LAPACK library.
1729 ,(string-append "--with-netlib-lapack-tarfile="
1730 (assoc-ref %build-inputs "lapack-tar")))
1731 #:phases
1732 (alist-cons-after
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")))
1737 (mkdir-p doc)
1738 (fold (lambda (file previous)
1739 (and previous (zero? (system* "cp" file doc))))
1740 #t (find-files "../ATLAS/doc" ".*"))))
1741 (alist-cons-after
1742 'check 'check-pt
1743 (lambda _ (zero? (system* "make" "ptcheck")))
1744 ;; Fix files required to run configure.
1745 (alist-cons-before
1746 'configure 'fix-/bin/sh
1747 (lambda _
1748 ;; Use `sh', not `/bin/sh'.
1749 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
1750 (("/bin/sh")
1751 "sh")))
1752 ;; Fix /bin/sh in generated make files.
1753 (alist-cons-after
1754 'configure 'fix-/bin/sh-in-generated-files
1755 (lambda _
1756 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
1757 (("/bin/sh")
1758 "sh")))
1759 ;; ATLAS configure program does not accepts the default flags
1760 ;; passed by the 'gnu-build-system'.
1761 (alist-replace
1762 'configure
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"))
1770 "/bin/sh"))
1771 (flags `(,(string-append "--prefix=" prefix)
1772 ,@configure-flags))
1773 (abs-srcdir (getcwd))
1774 (srcdir (string-append "../" (basename abs-srcdir))))
1775 (format #t "source directory: ~s (relative from build: ~s)~%"
1776 abs-srcdir srcdir)
1777 (mkdir "../build")
1778 (chdir "../build")
1779 (format #t "build directory: ~s~%" (getcwd))
1780 (format #t "configure flags: ~s~%" flags)
1781 (zero? (apply system* bash
1782 (string-append srcdir "/configure")
1783 flags))))
1784 %standard-phases)))))))
1785 (synopsis "Automatically Tuned Linear Algebra Software")
1786 (description
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.
1790
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.
1793
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:
1796
1797 cpufreq-selector -g performance -c 0
1798 ...
1799 cpufreq-selector -g performance -c N-1
1800
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)))
1804
1805 (define-public glm
1806 (package
1807 (name "glm")
1808 (version "0.9.6.3")
1809 (source
1810 (origin
1811 (method url-fetch)
1812 (uri (string-append "mirror://sourceforge/ogl-math/glm-"
1813 version ".zip"))
1814 (sha256
1815 (base32
1816 "1cnjmi033a16a95v6xfkr1bvfmkd26hzdjka8j1819hgn5b1nr8l"))))
1817 (build-system cmake-build-system)
1818 (native-inputs
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)
1824 specifications.")
1825 (license license:expat)))
1826
1827 (define-public lpsolve
1828 (package
1829 (name "lpsolve")
1830 (version "5.5.2.0")
1831 (source
1832 (origin
1833 (method url-fetch)
1834 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
1835 "/lp_solve_" version "_source.tar.gz"))
1836 (sha256
1837 (base32
1838 "176c7f023mb6b8bfmv4rfqnrlw88lsg422ca74zjh19i2h5s69sq"))
1839 (modules '((guix build utils)))
1840 (snippet
1841 '(substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
1842 (("^c=cc") "c=gcc")
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)
1848 (arguments
1849 `(#:tests? #f ; no check target
1850 #:phases
1851 (modify-phases %standard-phases
1852 (delete 'configure)
1853 (replace 'build
1854 (lambda _
1855 (with-directory-excursion "lpsolve55"
1856 (system* "bash" "ccc"))
1857 (with-directory-excursion "lp_solve"
1858 (system* "bash" "ccc"))
1859 #t))
1860 (replace 'install
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")))
1868 (mkdir-p lib)
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)
1874
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$")))
1884 #t))))))
1885 (home-page "http://lpsolve.sourceforge.net/")
1886 (synopsis "Mixed integer linear programming (MILP) solver")
1887 (description
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+)))
1891
1892 (define-public dealii
1893 (package
1894 (name "dealii")
1895 (version "8.2.1")
1896 (source
1897 (origin
1898 (method url-fetch)
1899 (uri (string-append "https://github.com/dealii/dealii/releases/"
1900 "download/v" version "/dealii-" version ".tar.gz"))
1901 (sha256
1902 (base32
1903 "185jych0gdnpkjwxni7pd0dda149492zwq2457xdjg76bzj78mnp"))
1904 (patches (list (search-patch "dealii-p4est-interface.patch")))
1905 (modules '((guix build utils)))
1906 (snippet
1907 ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
1908 '(delete-file-recursively "bundled"))))
1909 (build-system cmake-build-system)
1910 (inputs
1911 `(("tbb" ,tbb)
1912 ("zlib" ,zlib)
1913 ("boost" ,boost)
1914 ("p4est" ,p4est)
1915 ("blas" ,openblas)
1916 ("lapack" ,lapack)
1917 ("arpack" ,arpack-ng)
1918 ("muparser" ,muparser)
1919 ("gfortran" ,gfortran)
1920 ("suitesparse" ,suitesparse))) ;for UMFPACK
1921 (arguments
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
1925 (add-after
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 "
1936 out "\n")))
1937 #t))))))
1938 (home-page "https://www.dealii.org")
1939 (synopsis "Finite element library")
1940 (description
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+)))
1947
1948 (define-public dealii-openmpi
1949 (package (inherit dealii)
1950 (name "dealii-openmpi")
1951 (inputs
1952 `(("mpi" ,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"))))
1963 (arguments
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"
1969 ,@,cf))))
1970 (synopsis "Finite element library (with MPI support)")))
1971
1972 (define-public flann
1973 (package
1974 (name "flann")
1975 (version "1.8.4")
1976 (source
1977 (origin
1978 (method url-fetch)
1979 (uri
1980 (string-append
1981 "http://www.cs.ubc.ca/research/flann/uploads/FLANN/flann-"
1982 version "-src.zip"))
1983 (sha256
1984 (base32
1985 "022w8hph7bli5zbpnk3z1qh1c2sl5hm8fw2ccim651ynn0hr7fyz"))))
1986 (build-system cmake-build-system)
1987 (native-inputs
1988 `(("unzip" ,unzip)))
1989 (inputs
1990 `(("hdf5" ,hdf5)
1991 ("octave" ,octave)
1992 ("python" ,python-2) ; print syntax
1993 ;; ("python2-numpy" ,python2-numpy) ; only required for the tests
1994 ("zlib" ,zlib)))
1995 (arguments
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.
2003
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."))))
2007
2008 (define-public wcalc
2009 (package
2010 (name "wcalc")
2011 (version "2.5")
2012 (source
2013 (origin
2014 (method url-fetch)
2015 (uri
2016 (string-append
2017 "mirror://sourceforge/w-calc/wcalc-" version ".tar.bz2"))
2018 (sha256
2019 (base32
2020 "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
2021 (build-system gnu-build-system)
2022 (inputs
2023 `(("mpfr" ,mpfr)
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+)))