gnu: lpsolve: Fail as early as possible.
[jackhill/guix/guix.git] / gnu / packages / maths.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
4 ;;; Copyright © 2014, 2016 John Darrington <jmd@gnu.org>
5 ;;; Copyright © 2014, 2015, 2016 Eric Bavier <bavier@member.fsf.org>
6 ;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch>
7 ;;; Copyright © 2014 Mathieu Lirzin <mathieu.lirzin@openmailbox.org>
8 ;;; Copyright © 2015, 2016 Ricardo Wurmus <rekado@elephly.net>
9 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
10 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
11 ;;; Copyright © 2015, 2016 Efraim Flashner <efraim@flashner.co.il>
12 ;;; Copyright © 2015 Fabian Harfert <fhmgufs@web.de>
13 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
14 ;;; Copyright © 2016 Kei Kebreau <kei@openmailbox.org>
15 ;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
16 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
17 ;;;
18 ;;; This file is part of GNU Guix.
19 ;;;
20 ;;; GNU Guix is free software; you can redistribute it and/or modify it
21 ;;; under the terms of the GNU General Public License as published by
22 ;;; the Free Software Foundation; either version 3 of the License, or (at
23 ;;; your option) any later version.
24 ;;;
25 ;;; GNU Guix is distributed in the hope that it will be useful, but
26 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
27 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 ;;; GNU General Public License for more details.
29 ;;;
30 ;;; You should have received a copy of the GNU General Public License
31 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
32
33 (define-module (gnu packages maths)
34 #:use-module (ice-9 regex)
35 #:use-module (gnu packages)
36 #:use-module ((guix licenses) #:prefix license:)
37 #:use-module (guix packages)
38 #:use-module (guix download)
39 #:use-module (guix utils)
40 #:use-module (guix build utils)
41 #:use-module (guix build-system cmake)
42 #:use-module (guix build-system gnu)
43 #:use-module (guix build-system r)
44 #:use-module (gnu packages algebra)
45 #:use-module (gnu packages bison)
46 #:use-module (gnu packages boost)
47 #:use-module (gnu packages check)
48 #:use-module (gnu packages cmake)
49 #:use-module (gnu packages compression)
50 #:use-module (gnu packages curl)
51 #:use-module (gnu packages cyrus-sasl)
52 #:use-module (gnu packages documentation)
53 #:use-module (gnu packages elf)
54 #:use-module (gnu packages flex)
55 #:use-module (gnu packages fltk)
56 #:use-module (gnu packages fontutils)
57 #:use-module (gnu packages gettext)
58 #:use-module (gnu packages gcc)
59 #:use-module (gnu packages gd)
60 #:use-module (gnu packages ghostscript)
61 #:use-module (gnu packages graphviz)
62 #:use-module (gnu packages gtk)
63 #:use-module (gnu packages image)
64 #:use-module (gnu packages less)
65 #:use-module (gnu packages lisp)
66 #:use-module (gnu packages logging)
67 #:use-module (gnu packages gnome)
68 #:use-module (gnu packages guile)
69 #:use-module (gnu packages xorg)
70 #:use-module (gnu packages gl)
71 #:use-module (gnu packages m4)
72 #:use-module (gnu packages mpi)
73 #:use-module (gnu packages multiprecision)
74 #:use-module (gnu packages netpbm)
75 #:use-module (gnu packages pcre)
76 #:use-module (gnu packages popt)
77 #:use-module (gnu packages perl)
78 #:use-module (gnu packages pkg-config)
79 #:use-module (gnu packages python)
80 #:use-module (gnu packages readline)
81 #:use-module (gnu packages tbb)
82 #:use-module (gnu packages tcsh)
83 #:use-module (gnu packages tcl)
84 #:use-module (gnu packages texinfo)
85 #:use-module (gnu packages tex)
86 #:use-module (gnu packages tls)
87 #:use-module (gnu packages wxwidgets)
88 #:use-module (gnu packages xml)
89 #:use-module (gnu packages zip)
90 #:use-module (srfi srfi-1))
91
92 (define-public c-graph
93 (package
94 (name "c-graph")
95 (version "2.0")
96 (source (origin
97 (method url-fetch)
98 (uri (string-append "mirror://gnu/c-graph/c-graph-" version
99 ".tar.gz"))
100 (sha256 (base32
101 "1hlvpzrh7hzzf533diyfiabzskddi8zx92av9hwkjw3l46z7qv01"))))
102 (build-system gnu-build-system)
103 (inputs
104 `(("fortran" ,gfortran)))
105 (synopsis "Visualize and analyze convolution operations")
106 (description
107 "GNU C-Graph demonstrates the theory of convolution underlying
108 engineering systems and signal analysis.")
109 (license license:gpl3+)
110 (home-page "http://www.gnu.org/software/c-graph/")))
111
112 (define-public units
113 (package
114 (name "units")
115 (version "2.12")
116 (source (origin
117 (method url-fetch)
118 (uri (string-append "mirror://gnu/units/units-" version
119 ".tar.gz"))
120 (sha256 (base32
121 "1jxvjknz2jhq773jrwx9gc1df3gfy73yqmkjkygqxzpi318yls3q"))))
122 (build-system gnu-build-system)
123 (synopsis "Conversion between thousands of scales")
124 (description
125 "GNU Units converts numeric quantities between units of measure. It
126 can handle scale changes through adaptive usage of standard scale
127 prefixes (micro-, kilo-, etc.). It can also handle nonlinear
128 conversions such as Fahrenheit to Celsius. Its interpreter is powerful
129 enough to be used effectively as a scientific calculator.")
130 (license license:gpl3+)
131 (home-page "http://www.gnu.org/software/units/")))
132
133 (define-public double-conversion
134 (package
135 (name "double-conversion")
136 (version "1.1.5")
137 (source (origin
138 (method url-fetch)
139 (uri (string-append
140 "https://github.com/floitsch/double-conversion/archive/v"
141 version ".tar.gz"))
142 (file-name (string-append name "-" version ".tar.gz"))
143 (sha256
144 (base32
145 "0cnr8xhyjfxijay8ymkqcph3672wp2lj23qhdmr3m4kia5kpdf83"))))
146 (build-system cmake-build-system)
147 (arguments
148 '(#:test-target "test"
149 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
150 "-DBUILD_TESTING=ON")))
151 (home-page "https://github.com/floitsch/double-conversion")
152 (synopsis "Conversion routines for IEEE doubles")
153 (description
154 "The double-conversion library provides binary-decimal and decimal-binary
155 routines for IEEE doubles. The library consists of efficient conversion
156 routines that have been extracted from the V8 JavaScript engine.")
157 (license license:bsd-3)))
158
159 (define-public dionysus
160 (package
161 (name "dionysus")
162 (version "1.3.0")
163 (source (origin
164 (method url-fetch)
165 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
166 ".tar.gz"))
167 (sha256
168 (base32
169 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
170 (build-system gnu-build-system)
171 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
172 (synopsis "Local search for universal constants and scientific values")
173 (description
174 "GNU Dionysus is a convenient system for quickly retrieving the values of
175 mathematical constants used in science and engineering. Values can be
176 searched using a simple command-line tool, choosing from three databases:
177 universal constants, atomic numbers, and constants related to
178 semiconductors.")
179 (license license:gpl3+)
180 (home-page "http://www.gnu.org/software/dionysus/")))
181
182 (define-public gsl
183 (package
184 (name "gsl")
185 (version "2.1")
186 (source
187 (origin
188 (method url-fetch)
189 (uri (string-append "mirror://gnu/gsl/gsl-"
190 version ".tar.gz"))
191 (sha256
192 (base32
193 "0rhcia9jhr3p1f1wybwyllwqfs9bggz99i3mi5lpyqcpff1hdbar"))))
194 (build-system gnu-build-system)
195 (arguments
196 `(#:parallel-tests? #f))
197 (home-page "http://www.gnu.org/software/gsl/")
198 (synopsis "Numerical library for C and C++")
199 (description
200 "The GNU Scientific Library is a library for numerical analysis in C
201 and C++. It includes a wide range of mathematical routines, with over 1000
202 functions in total. Subject areas covered by the library include:
203 differential equations, linear algebra, Fast Fourier Transforms and random
204 numbers.")
205 (license license:gpl3+)))
206
207 (define-public glpk
208 (package
209 (name "glpk")
210 (version "4.60")
211 (source
212 (origin
213 (method url-fetch)
214 (uri (string-append "mirror://gnu/glpk/glpk-"
215 version ".tar.gz"))
216 (sha256
217 (base32
218 "15z2ymzqhxwss6wgdj5f7vkyqlqdsjgrvm0x871kmlx0n0664mhk"))))
219 (build-system gnu-build-system)
220 (inputs
221 `(("gmp" ,gmp)))
222 (arguments
223 `(#:configure-flags '("--with-gmp")))
224 (home-page "http://www.gnu.org/software/glpk/")
225 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
226 (description
227 "GLPK is a C library for solving large-scale linear programming (LP),
228 mixed integer programming (MIP), and other related problems. It supports the
229 GNU MathProg modeling language, a subset of the AMPL language, and features a
230 translator for the language. In addition to the C library, a stand-alone
231 LP/MIP solver is included in the package.")
232 (license license:gpl3+)))
233
234 (define-public 4ti2
235 (package
236 (name "4ti2")
237 (version "1.6.7")
238 (source
239 (origin
240 (method url-fetch)
241 (uri (string-append "http://www.4ti2.de/version_" version
242 "/4ti2-" version ".tar.gz"))
243 (sha256
244 (base32
245 "1frix3rnm9ffr93alqzw4cavxbfpf524l8rfbmcpyhwd3n1km0yl"))))
246 (build-system gnu-build-system)
247 (native-inputs
248 `(("which" ,(@ (gnu packages base) which)))) ; for the tests
249 (inputs
250 `(("glpk" ,glpk)
251 ("gmp" ,gmp)))
252 (home-page "http://www.4ti2.de/")
253 (synopsis "Mathematical tool suite for problems on linear spaces")
254 (description
255 "4ti2 implements algorithms for solving algebraic, geometric and
256 combinatorial problems on linear spaces. Among others, it solves systems
257 of linear equations, computes extreme rays of polyhedral cones, solves
258 integer programming problems and computes Markov bases for statistics.")
259 (license license:gpl2+)))
260
261 (define-public cddlib
262 (package
263 (name "cddlib")
264 (version "0.94h")
265 (source
266 (origin
267 (method url-fetch)
268 (uri (string-append "ftp://ftp.ifor.math.ethz.ch/pub/fukuda/cdd/cddlib-"
269 (string-delete #\. version) ".tar.gz"))
270 (sha256
271 (base32
272 "1dasasscwfg793q8fwzgwf64xwj7w62yfvszpr8x8g38jka08vgy"))))
273 (build-system gnu-build-system)
274 (inputs
275 `(("gmp" ,gmp)))
276 (home-page "https://www.inf.ethz.ch/personal/fukudak/cdd_home/index.html")
277 (synopsis "Library for convex hulls and extreme rays of polyhedra")
278 (description
279 "The C-library cddlib implements the Double Description Method of
280 Motzkin et al. for generating all vertices (i.e. extreme points) and extreme
281 rays of a general convex polyhedron given by a system of linear inequalities
282 in arbitrary dimension. It can also be used for the converse operation of
283 computing convex hulls.")
284 (license license:gpl2+)))
285
286 (define-public arpack-ng
287 (package
288 (name "arpack-ng")
289 (version "3.2.0")
290 (source
291 (origin
292 (method url-fetch)
293 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
294 version ".tar.gz"))
295 (file-name (string-append name "-" version ".tar.gz"))
296 (sha256
297 (base32
298 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
299 (build-system gnu-build-system)
300 (home-page "https://github.com/opencollab/arpack-ng")
301 (inputs
302 `(("lapack" ,lapack)
303 ("fortran" ,gfortran)))
304 (synopsis "Fortran subroutines for solving eigenvalue problems")
305 (description
306 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
307 large scale eigenvalue problems.")
308 (license (license:non-copyleft "file://COPYING"
309 "See COPYING in the distribution."))))
310
311 (define-public arpack-ng-openmpi
312 (package (inherit arpack-ng)
313 (name "arpack-ng-openmpi")
314 (inputs
315 `(("mpi" ,openmpi)
316 ,@(package-inputs arpack-ng)))
317 (arguments `(#:configure-flags '("--enable-mpi")))
318 (synopsis "Fortran subroutines for solving eigenvalue problems with MPI")))
319
320 (define-public lapack
321 (package
322 (name "lapack")
323 (version "3.5.0")
324 (source
325 (origin
326 (method url-fetch)
327 (uri (string-append "http://www.netlib.org/lapack/lapack-"
328 version ".tgz"))
329 (sha256
330 (base32
331 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
332 (build-system cmake-build-system)
333 (home-page "http://www.netlib.org/lapack/")
334 (inputs `(("fortran" ,gfortran)
335 ("python" ,python-2)))
336 (arguments
337 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES"
338 "-DLAPACKE=ON")
339 #:phases (alist-cons-before
340 'check 'patch-python
341 (lambda* (#:key inputs #:allow-other-keys)
342 (let ((python (assoc-ref inputs "python")))
343 (substitute* "lapack_testing.py"
344 (("/usr/bin/env python") python))))
345 %standard-phases)))
346 (synopsis "Library for numerical linear algebra")
347 (description
348 "LAPACK is a Fortran 90 library for solving the most commonly occurring
349 problems in numerical linear algebra.")
350 (license (license:non-copyleft "file://LICENSE"
351 "See LICENSE in the distribution."))))
352
353 (define-public scalapack
354 (package
355 (name "scalapack")
356 (version "2.0.2")
357 (source
358 (origin
359 (method url-fetch)
360 (uri (string-append "http://www.netlib.org/scalapack/scalapack-"
361 version ".tgz"))
362 (sha256
363 (base32
364 "0p1r61ss1fq0bs8ynnx7xq4wwsdvs32ljvwjnx6yxr8gd6pawx0c"))))
365 (build-system cmake-build-system)
366 (inputs
367 `(("mpi" ,openmpi)
368 ("fortran" ,gfortran)
369 ("lapack" ,lapack))) ;for testing only
370 (arguments
371 `(#:configure-flags `("-DBUILD_SHARED_LIBS:BOOL=YES")))
372 (home-page "http://www.netlib.org/scalapack/")
373 (synopsis "Library for scalable numerical linear algebra")
374 (description
375 "ScaLAPACK is a Fortran 90 library of high-performance linear algebra
376 routines on parallel distributed memory machines. ScaLAPACK solves dense and
377 banded linear systems, least squares problems, eigenvalue problems, and
378 singular value problems.")
379 (license (license:bsd-style "file://LICENSE"
380 "See LICENSE in the distribution."))))
381
382 (define-public gnuplot
383 ;; Gnuplot version 5.0.4 was updated in-place, resulting in a hash mismatch.
384 ;; This can be removed at the next version update.
385 (let ((upstream-version "5.0.4")
386 (guix-revision "1"))
387 (package
388 (name "gnuplot")
389 (version (string-append upstream-version "-" guix-revision))
390 (source
391 (origin
392 (method url-fetch)
393 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
394 upstream-version "/gnuplot-"
395 upstream-version ".tar.gz"))
396 (sha256
397 (base32
398 "07n3w12dkcxjnhsvsliaqnkhajhi818v6q8mkpmpbplbf92vh70m"))))
399 (build-system gnu-build-system)
400 (inputs `(("readline" ,readline)
401 ("cairo" ,cairo)
402 ("pango" ,pango)
403 ("gd" ,gd)))
404 (native-inputs `(("pkg-config" ,pkg-config)
405 ("texlive" ,texlive-minimal)))
406 (home-page "http://www.gnuplot.info")
407 (synopsis "Command-line driven graphing utility")
408 (description "Gnuplot is a portable command-line driven graphing
409 utility. It was originally created to allow scientists and students to
410 visualize mathematical functions and data interactively, but has grown to
411 support many non-interactive uses such as web scripting. It is also used as a
412 plotting engine by third-party applications like Octave.")
413 ;; X11 Style with the additional restriction that derived works may only be
414 ;; distributed as patches to the original.
415 (license (license:fsf-free
416 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright")))))
417
418 (define-public hdf5
419 (package
420 (name "hdf5")
421 (version "1.8.17")
422 (source
423 (origin
424 (method url-fetch)
425 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-"
426 version "/src/hdf5-"
427 version ".tar.bz2"))
428 (sha256
429 (base32 "0sj8x0gfs5fb28gipnynb9wpkz113h8wq9sva9mxx66kv27xsdgw"))
430 (patches (list (search-patch "hdf5-config-date.patch")))))
431 (build-system gnu-build-system)
432 (inputs
433 `(("zlib" ,zlib)))
434 (arguments
435 `(#:phases
436 (modify-phases %standard-phases
437 (add-before 'configure 'patch-configure
438 (lambda _
439 (substitute* "configure"
440 (("/bin/mv") "mv"))
441 #t))
442 (add-after 'install 'patch-references
443 (lambda* (#:key inputs outputs #:allow-other-keys)
444 (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
445 (zlib (assoc-ref inputs "zlib")))
446 (substitute* (find-files bin "h5p?cc")
447 (("-lz" lib)
448 (string-append "-L" zlib "/lib " lib)))
449 #t))))))
450 (home-page "http://www.hdfgroup.org")
451 (synopsis "Management suite for extremely large and complex data")
452 (description "HDF5 is a suite that makes possible the management of
453 extremely large and complex data collections.")
454 (license (license:x11-style
455 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
456
457 (define-public hdf5-parallel-openmpi
458 (package (inherit hdf5)
459 (name "hdf5-parallel-openmpi")
460 (inputs
461 `(("mpi" ,openmpi)
462 ,@(package-inputs hdf5)))
463 (arguments
464 (substitute-keyword-arguments `(#:configure-flags '("--enable-parallel")
465 ,@(package-arguments hdf5))
466 ((#:phases phases)
467 `(modify-phases ,phases
468 (add-before 'check 'patch-tests
469 (lambda _
470 ;; OpenMPI's mpirun will exit with non-zero status if it
471 ;; detects an "abnormal termination", i.e. any process not
472 ;; calling MPI_Finalize(). Since the test is explicitely
473 ;; avoiding MPI_Finalize so as not to have at_exit and thus
474 ;; H5C_flush_cache from being called, mpirun will always
475 ;; complain, so turn this test off.
476 (substitute* "testpar/Makefile"
477 (("(^TEST_PROG_PARA.*)t_pflush1(.*)" front back)
478 (string-append front back "\n")))
479 (substitute* "tools/h5diff/testph5diff.sh"
480 (("/bin/sh") (which "sh")))
481 #t))))))
482 (synopsis "Management suite for data with parallel IO support")))
483
484 (define-public h5check
485 (package
486 (name "h5check")
487 (version "2.0.1")
488 (source
489 (origin
490 (method url-fetch)
491 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/tools/"
492 "h5check/src/h5check-" version ".tar.gz"))
493 (sha256
494 (base32
495 "1gm76jbwhz9adbxgn14zx8cj33dmjdr2g5xcy0m9c2gakp8w59kj"))))
496 (build-system gnu-build-system)
497 (inputs `(("hdf5" ,hdf5))) ;h5cc for tests
498 (home-page "https://www.hdfgroup.org/products/hdf5_tools/h5check.html")
499 (synopsis "HDF5 format checker")
500 (description "@code{h5check} is a validation tool for verifying that an
501 HDF5 file is encoded according to the HDF File Format Specification.")
502 (license (license:x11-style "file://COPYING"))))
503
504 (define-public netcdf
505 (package
506 (name "netcdf")
507 (version "4.4.0")
508 (source
509 (origin
510 (method url-fetch)
511 (uri (string-append "ftp://ftp.unidata.ucar.edu/pub/netcdf/"
512 "netcdf-" version ".tar.gz"))
513 (sha256
514 (base32
515 "0y6gdcplarwqqnrav2xg1xd6ih732rzzbmdw78v3rl5b8mwcnh0d"))
516 (patches (list (search-patch "netcdf-config-date.patch")))))
517 (build-system gnu-build-system)
518 (native-inputs
519 `(("m4" ,m4)
520 ("doxygen" ,doxygen)
521 ("graphviz" ,graphviz)))
522 (inputs
523 `(("hdf5" ,hdf5)
524 ("zlib" ,zlib)))
525 (arguments
526 `(#:configure-flags '("--enable-doxygen" "--enable-dot")
527 #:parallel-tests? #f)) ;various race conditions
528 (home-page "http://www.unidata.ucar.edu/software/netcdf/")
529 (synopsis "Library for scientific data")
530 (description "NetCDF is an interface for scientific data access and a
531 software library that provides an implementation of the interface. The netCDF
532 library defines a machine-independent format for representing scientific data.
533 Together, the interface, library, and format support the creation, access, and
534 sharing of scientific data.")
535 (license (license:x11-style "file://COPYRIGHT"))))
536
537 (define-public netcdf-parallel-openmpi
538 (package (inherit netcdf)
539 (name "netcdf-parallel-openmpi")
540 (inputs
541 `(("mpi" ,openmpi)
542 ,@(alist-replace "hdf5" (list hdf5-parallel-openmpi)
543 (package-inputs netcdf))))
544 ;; TODO: Replace pkg-config references in nc-config with absolute references
545 (arguments
546 (substitute-keyword-arguments (package-arguments netcdf)
547 ((#:configure-flags flags)
548 `(cons* "CC=mpicc" "CXX=mpicxx"
549 "--enable-parallel-tests"
550 ;; Shared libraries not supported with parallel IO.
551 "--disable-shared" "--with-pic"
552 ,flags))))))
553
554 (define-public nlopt
555 (package
556 (name "nlopt")
557 (version "2.4.2")
558 (source (origin
559 (method url-fetch)
560 (uri (string-append "http://ab-initio.mit.edu/nlopt/nlopt-"
561 version ".tar.gz"))
562 (sha256
563 (base32 "12cfkkhcdf4zmb6h7y6qvvdvqjs2xf9sjpa3rl3bq76px4yn76c0"))))
564 (build-system gnu-build-system)
565 (arguments
566 `(;; Shared libraries are not built by default. They are required to
567 ;; build the Guile, Octave, and Python bindings.
568 #:configure-flags '("--enable-shared")
569
570 #:phases
571 (modify-phases %standard-phases
572 (add-before 'configure 'set-libnlopt-file-name
573 (lambda* (#:key outputs #:allow-other-keys)
574 ;; Make sure the Scheme module refers to the library by its
575 ;; absolute file name (we cannot do that from a snippet
576 ;; because the expansion of @libdir@ contains
577 ;; ${exec_prefix}.)
578 (let ((out (assoc-ref outputs "out")))
579 (substitute* "swig/nlopt.scm.in"
580 (("libnlopt")
581 (string-append out "/lib/libnlopt")))
582 #t))))))
583 (inputs `(("guile" ,guile-2.0)))
584 (native-inputs `(("pkg-config" ,pkg-config)))
585 (home-page "http://ab-initio.mit.edu/wiki/")
586 (synopsis "Library for nonlinear optimization")
587 (description "NLopt is a library for nonlinear optimization, providing a
588 common interface for a number of different free optimization routines available
589 online as well as original implementations of various other algorithms.")
590 (license license:lgpl2.1+)))
591
592 (define-public ipopt
593 (package
594 (name "ipopt")
595 (version "3.12.5")
596 (source (origin
597 (method url-fetch)
598 (uri (string-append
599 "http://www.coin-or.org/download/source/Ipopt/Ipopt-"
600 version".tgz"))
601 (sha256
602 (base32
603 "09bk2hqy2vgi4yi76xng9zxakddwqy3wij9nx7wf2vfbxxpazrsk"))
604 (modules '((guix build utils)))
605 (snippet
606 ;; Make sure we don't use the bundled software.
607 '(delete-file-recursively "ThirdParty"))))
608 (build-system gnu-build-system)
609 (arguments
610 '(#:phases (modify-phases %standard-phases
611 (add-after 'install 'add--L-flags-in-ipopt.pc
612 (lambda* (#:key inputs outputs #:allow-other-keys)
613 ;; The '.pc' file lists '-llapack -lblas' in "Libs";
614 ;; move it to "Libs.private" where it belongs, and add a
615 ;; '-L' flag for LAPACK.
616 (let ((out (assoc-ref outputs "out"))
617 (lapack (assoc-ref inputs "lapack")))
618 (substitute* (string-append out "/lib/pkgconfig/"
619 "ipopt.pc")
620 (("Libs: (.*)-llapack -lblas(.*)$" _ before after)
621 (string-append "Libs: " before " " after "\n"
622 "Libs.private: " before
623 "-L" lapack "/lib -llapack -lblas "
624 after "\n")))
625 #t))))))
626 (native-inputs
627 `(("gfortran" ,gfortran)))
628 (inputs
629 ;; TODO: Maybe add dependency on COIN-MUMPS, ASL, and HSL.
630 `(("lapack" ,lapack))) ;for both libblas and liblapack
631 (home-page "http://www.coin-or.org")
632 (synopsis "Large-scale nonlinear optimizer")
633 (description
634 "The Interior Point Optimizer (IPOPT) is a software package for
635 large-scale nonlinear optimization. It provides C++, C, and Fortran
636 interfaces.")
637 (license license:epl1.0)))
638
639 (define-public ceres
640 (package
641 (name "ceres-solver")
642 (version "1.11.0")
643 (home-page "http://ceres-solver.org/")
644 (source (origin
645 (method url-fetch)
646 (uri (string-append home-page "ceres-solver-"
647 version ".tar.gz"))
648 (sha256
649 (base32
650 "0i7qkbf8g6pd8arxzldppga26ckv93y8zldsfz6wbd4n6b1nqrjd"))))
651 (build-system cmake-build-system)
652 (arguments
653 ;; TODO: Build HTML user documentation and install separately.
654 '(#:configure-flags '("-DBUILD_EXAMPLES=OFF"
655 "-DBUILD_SHARED_LIBS=ON")
656
657 #:phases (modify-phases %standard-phases
658 (add-before 'configure 'set-library-directory
659 (lambda _
660 ;; Install libraries to lib/, not lib64/.
661 (substitute* "internal/ceres/CMakeLists.txt"
662 (("set\\(LIB_SUFFIX \"64\"\\)")
663 "set(LIB_SUFFIX \"\")"))
664 #t)))))
665 (native-inputs
666 `(("pkg-config" ,pkg-config)))
667 (propagated-inputs
668 `(("glog" ,glog))) ;for #include <glog/glog.h>
669 (inputs
670 `(("eigen" ,eigen)
671 ("blas" ,openblas)
672 ("lapack" ,lapack)
673 ("suitesparse" ,suitesparse)
674 ("gflags" ,gflags)))
675 (synopsis "C++ library for solving large optimization problems")
676 (description
677 "Ceres Solver is a C++ library for modeling and solving large,
678 complicated optimization problems. It is a feature rich, mature and
679 performant library which has been used in production since 2010. Ceres Solver
680 can solve two kinds of problems:
681 @enumerate
682 @item non-linear least squares problems with bounds constraints;
683 @item general unconstrained optimization problems.
684 @end enumerate\n")
685 (license license:bsd-3)))
686
687 ;; For a fully featured Octave, users are strongly recommended also to install
688 ;; the following packages: texinfo, less, ghostscript, gnuplot.
689 (define-public octave
690 (package
691 (name "octave")
692 (version "4.0.2")
693 (source
694 (origin
695 (method url-fetch)
696 (uri (string-append "mirror://gnu/octave/octave-"
697 version ".tar.gz"))
698 (sha256
699 (base32
700 "1hdxap3j88rpqjimnfhinym6z73wdi5dfa6fv85c13r1dk9qzk9r"))))
701 (build-system gnu-build-system)
702 (inputs
703 `(("lapack" ,lapack)
704 ("readline" ,readline)
705 ("glpk" ,glpk)
706 ("fftw" ,fftw)
707 ("fftwf" ,fftwf)
708 ("arpack" ,arpack-ng)
709 ("curl" ,curl)
710 ("pcre" ,pcre)
711 ("cyrus-sasl" ,cyrus-sasl)
712 ("fltk" ,fltk)
713 ("fontconfig" ,fontconfig)
714 ("freetype" ,freetype)
715 ("hdf5" ,hdf5)
716 ("libxft" ,libxft)
717 ("mesa" ,mesa)
718 ("glu" ,glu)
719 ("openssl" ,openssl)
720 ("zlib" ,zlib)))
721 (native-inputs
722 `(("gfortran" ,gfortran)
723 ("pkg-config" ,pkg-config)
724 ("perl" ,perl)
725 ;; The following inputs are not actually used in the build process.
726 ;; However, the ./configure gratuitously tests for their existence and
727 ;; assumes that programs not present at build time are also not, and
728 ;; can never be, available at run time! If these inputs are therefore
729 ;; not present, support for them will be built out. However, Octave
730 ;; will still run without them, albeit without the features they
731 ;; provide.
732 ("less" ,less)
733 ("texinfo" ,texinfo)
734 ("ghostscript" ,ghostscript)
735 ("gnuplot" ,gnuplot)))
736 (arguments
737 `(#:configure-flags
738 (list (string-append "--with-shell="
739 (assoc-ref %build-inputs "bash")
740 "/bin/sh"))))
741 (home-page "http://www.gnu.org/software/octave/")
742 (synopsis "High-level language for numerical computation")
743 (description "GNU Octave is a high-level interpreted language that is
744 specialized for numerical computations. It can be used for both linear and
745 non-linear applications and it provides great support for visualizing results.
746 Work may be performed both at the interactive command-line as well as via
747 script files.")
748 (license license:gpl3+)))
749
750 (define-public gmsh
751 (package
752 (name "gmsh")
753 (version "2.11.0")
754 (source
755 (origin
756 (method url-fetch)
757 (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
758 version "-source.tgz"))
759 (sha256
760 (base32 "1ilplibvjgf7a905grpnclrvkmqy9fgrpl7xyp3w4yl1qc682v9b"))
761 (modules '((guix build utils)))
762 (snippet
763 ;; Remove non-free METIS code
764 '(delete-file-recursively "contrib/Metis"))))
765 (build-system cmake-build-system)
766 (propagated-inputs
767 `(("fltk" ,fltk)
768 ("gfortran" ,gfortran)
769 ("gmp" ,gmp)
770 ("hdf5" ,hdf5)
771 ("lapack" ,lapack)
772 ("mesa" ,mesa)
773 ("glu" ,glu)
774 ("libx11" ,libx11)
775 ("libxext" ,libxext)))
776 (inputs
777 `(("fontconfig" ,fontconfig)
778 ("libxft" ,libxft)))
779 (arguments
780 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
781 "-DENABLE_BUILD_SHARED:BOOL=ON"
782 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")
783 #:phases (modify-phases %standard-phases
784 (replace
785 'check
786 (lambda _
787 (zero? (system* "make" "test"
788 ;; Disable this test. See
789 ;; https://geuz.org/trac/gmsh/ticket/271
790 "ARGS=-E component8_in_a_box")))))))
791 (home-page "http://www.geuz.org/gmsh/")
792 (synopsis "3D finite element grid generator")
793 (description "Gmsh is a 3D finite element grid generator with a built-in
794 CAD engine and post-processor. Its design goal is to provide a fast, light
795 and user-friendly meshing tool with parametric input and advanced
796 visualization capabilities. Gmsh is built around four modules: geometry,
797 mesh, solver and post-processing. The specification of any input to these
798 modules is done either interactively using the graphical user interface or in
799 ASCII text files using Gmsh's own scripting language.")
800 (license license:gpl2+)))
801
802 (define-public petsc
803 (package
804 (name "petsc")
805 (version "3.7.2")
806 (source
807 (origin
808 (method url-fetch)
809 ;; The *-lite-* tarball does not contain the *large* documentation
810 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
811 "petsc-lite-" version ".tar.gz"))
812 (sha256
813 (base32 "0jfrq6rd4zagw1iimz05m2w91k0jvz3qbik1lk8pqcxw3rvdqk5d"))))
814 (build-system gnu-build-system)
815 (native-inputs
816 `(("python" ,python-2)
817 ("perl" ,perl)))
818 (inputs
819 `(("gfortran" ,gfortran)
820 ("lapack" ,lapack)
821 ("superlu" ,superlu)
822 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
823 ;; leaving out opengl, as configuration seems to only be for mac
824 ))
825 (arguments
826 `(#:test-target "test"
827 #:parallel-build? #f ;build is parallel by default
828 #:configure-flags
829 `("--with-mpi=0"
830 "--with-openmp=1"
831 "--with-superlu=1"
832 ,(string-append "--with-superlu-include="
833 (assoc-ref %build-inputs "superlu") "/include")
834 ,(string-append "--with-superlu-lib="
835 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
836 #:phases
837 (modify-phases %standard-phases
838 (replace 'configure
839 ;; PETSc's configure script is actually a python script, so we can't
840 ;; run it with bash.
841 (lambda* (#:key outputs (configure-flags '())
842 #:allow-other-keys)
843 (let* ((prefix (assoc-ref outputs "out"))
844 (flags `(,(string-append "--prefix=" prefix)
845 ,@configure-flags)))
846 (format #t "build directory: ~s~%" (getcwd))
847 (format #t "configure flags: ~s~%" flags)
848 (zero? (apply system* "./configure" flags)))))
849 (add-after 'configure 'clean-local-references
850 (lambda* (#:key inputs outputs #:allow-other-keys)
851 (let ((out (assoc-ref outputs "out")))
852 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
853 ;; Prevent build directory from leaking into compiled code
854 (((getcwd)) out)
855 ;; Scrub timestamp for reproducibility
856 ((".*Libraries compiled on.*") ""))
857 #t)))
858 (add-after 'install 'clean-install
859 ;; Try to keep installed files from leaking build directory names.
860 (lambda* (#:key inputs outputs #:allow-other-keys)
861 (let ((out (assoc-ref outputs "out")))
862 (substitute* (map (lambda (file)
863 (string-append out "/lib/petsc/conf/" file))
864 '("petscvariables"))
865 (((getcwd)) out))
866 ;; Make compiler references point to the store
867 (substitute* (string-append out "/lib/petsc/conf/petscvariables")
868 (("= (gcc|g\\+\\+|gfortran)" _ compiler)
869 (string-append "= " (which compiler))))
870 ;; PETSc installs some build logs, which aren't necessary.
871 (for-each (lambda (file)
872 (let ((f (string-append out "/lib/petsc/conf/" file)))
873 (when (file-exists? f)
874 (delete-file f))))
875 '("configure.log" "make.log" "gmake.log"
876 "test.log" "error.log" "RDict.db"
877 "PETScBuildInternal.cmake"
878 ;; Once installed, should uninstall with Guix
879 "uninstall.py"))
880 #t))))))
881 (home-page "http://www.mcs.anl.gov/petsc")
882 (synopsis "Library to solve PDEs")
883 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
884 data structures and routines for the scalable (parallel) solution of
885 scientific applications modeled by partial differential equations.")
886 (license (license:non-copyleft
887 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
888
889 (define-public petsc-complex
890 (package (inherit petsc)
891 (name "petsc-complex")
892 (arguments
893 (substitute-keyword-arguments (package-arguments petsc)
894 ((#:configure-flags cf)
895 `(cons "--with-scalar-type=complex" ,cf))))
896 (synopsis "Library to solve PDEs (with complex scalars)")))
897
898 (define-public petsc-openmpi
899 (package (inherit petsc)
900 (name "petsc-openmpi")
901 (inputs
902 `(("openmpi" ,openmpi)
903 ,@(package-inputs petsc)))
904 (arguments
905 (substitute-keyword-arguments (package-arguments petsc)
906 ((#:configure-flags cf)
907 ``("--with-mpiexec=mpirun"
908 ,(string-append "--with-mpi-dir="
909 (assoc-ref %build-inputs "openmpi"))
910 ,@(delete "--with-mpi=0" ,cf)))))
911 (synopsis "Library to solve PDEs (with MPI support)")))
912
913 (define-public petsc-complex-openmpi
914 (package (inherit petsc-complex)
915 (name "petsc-complex-openmpi")
916 (inputs
917 `(("openmpi" ,openmpi)
918 ,@(package-inputs petsc-complex)))
919 (arguments
920 (substitute-keyword-arguments (package-arguments petsc-complex)
921 ((#:configure-flags cf)
922 ``("--with-mpiexec=mpirun"
923 ,(string-append "--with-mpi-dir="
924 (assoc-ref %build-inputs "openmpi"))
925 ,@(delete "--with-mpi=0" ,cf)))))
926 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
927
928 (define-public slepc
929 (package
930 (name "slepc")
931 (version "3.7.1")
932 (source
933 (origin
934 (method url-fetch)
935 (uri (string-append "http://slepc.upv.es/download/download.php?"
936 "filename=slepc-" version ".tar.gz"))
937 (file-name (string-append name "-" version ".tar.gz"))
938 (sha256
939 (base32
940 "1hijlmrvxvfqslnx8yydzw5xqbsn1yy02g32w0hln1z3cgr1c0k7"))))
941 (build-system gnu-build-system)
942 (native-inputs
943 `(("python" ,python-2)))
944 (inputs
945 `(("arpack" ,arpack-ng)
946 ("gfortran" ,gfortran)))
947 (propagated-inputs
948 `(("petsc" ,petsc)))
949 (arguments
950 `(#:parallel-build? #f ;build is parallel by default
951 #:configure-flags
952 `(,(string-append "--with-arpack-dir="
953 (assoc-ref %build-inputs "arpack") "/lib"))
954 #:phases
955 (modify-phases %standard-phases
956 (replace 'configure
957 ;; configure is a python script, so we can't run it with bash.
958 (lambda* (#:key inputs outputs (configure-flags '())
959 #:allow-other-keys)
960 (let* ((prefix (assoc-ref outputs "out"))
961 (flags `(,(string-append "--prefix=" prefix)
962 ,@configure-flags)))
963 (format #t "build directory: ~s~%" (getcwd))
964 (format #t "configure flags: ~s~%" flags)
965 (setenv "SLEPC_DIR" (getcwd))
966 (setenv "PETSC_DIR" (assoc-ref inputs "petsc"))
967 (zero? (apply system* "./configure" flags)))))
968 (add-after 'install 'delete-doc
969 ;; TODO: SLEPc installs HTML documentation alongside headers in
970 ;; $out/include. We'd like to move them to share/doc, but delete
971 ;; them for now, as they are incomplete and installing the complete
972 ;; documentation is difficult.
973 (lambda* (#:key outputs #:allow-other-keys)
974 (let* ((out (assoc-ref outputs "out")))
975 (for-each delete-file (find-files out "\\.html$")))))
976 (add-after 'install 'clean-install
977 ;; Clean up unnecessary build logs from installation.
978 (lambda* (#:key outputs #:allow-other-keys)
979 (let ((out (assoc-ref outputs "out")))
980 (for-each (lambda (file)
981 (let ((f (string-append out "/lib/slepc/conf/" file)))
982 (when (file-exists? f)
983 (delete-file f))))
984 '("configure.log" "make.log" "gmake.log"
985 "test.log" "error.log" "RDict.db"
986 "uninstall.py"))))))))
987 (home-page "http://slepc.upv.es")
988 (synopsis "Scalable library for eigenproblems")
989 (description "SLEPc is a software library for the solution of large sparse
990 eigenproblems on parallel computers. It can be used for the solution of
991 linear eigenvalue problems formulated in either standard or generalized form,
992 as well as other related problems such as the singular value decomposition.
993 The emphasis of the software is on methods and techniques appropriate for
994 problems in which the associated matrices are sparse, for example, those
995 arising after the discretization of partial differential equations.")
996 (license license:lgpl3)))
997
998 (define-public slepc-complex
999 (package (inherit slepc)
1000 (name "slepc-complex")
1001 (propagated-inputs
1002 `(("petsc" ,petsc-complex)
1003 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
1004 (synopsis "Scalable library for eigenproblems (with complex scalars)")))
1005
1006 (define-public slepc-openmpi
1007 (package (inherit slepc)
1008 (name "slepc-openmpi")
1009 (inputs
1010 `(("mpi" ,openmpi)
1011 ("arpack" ,arpack-ng-openmpi)
1012 ,@(alist-delete "arpack" (package-inputs slepc))))
1013 (propagated-inputs
1014 `(("petsc" ,petsc-openmpi)
1015 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
1016 (synopsis "Scalable library for eigenproblems (with MPI support)")))
1017
1018 (define-public slepc-complex-openmpi
1019 (package (inherit slepc-openmpi)
1020 (name "slepc-complex-openmpi")
1021 (propagated-inputs
1022 `(("petsc" ,petsc-complex-openmpi)
1023 ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
1024 (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
1025
1026 (define-public mumps
1027 (package
1028 (name "mumps")
1029 (version "5.0.1")
1030 (source
1031 (origin
1032 (method url-fetch)
1033 (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
1034 version ".tar.gz"))
1035 (sha256
1036 (base32
1037 "1820jfp3mbl7n85765v5mp6p0gzqpgr4d2lrnhwj4gl7cwp5ndah"))
1038 (patches (search-patches "mumps-build-parallelism.patch"))))
1039 (build-system gnu-build-system)
1040 (inputs
1041 `(("fortran" ,gfortran)
1042 ;; These are required for linking against mumps, but we let the user
1043 ;; declare the dependency.
1044 ("blas" ,openblas)
1045 ("metis" ,metis)
1046 ("scotch" ,scotch)))
1047 (arguments
1048 `(#:modules ((ice-9 match)
1049 (ice-9 popen)
1050 (srfi srfi-1)
1051 ,@%gnu-build-system-modules)
1052 #:phases
1053 (modify-phases %standard-phases
1054 (replace
1055 'configure
1056 (lambda* (#:key inputs #:allow-other-keys)
1057 (call-with-output-file "Makefile.inc"
1058 (lambda (port)
1059 (format port "
1060 PLAT =
1061 LIBEXT = .a
1062 OUTC = -o
1063 OUTF = -o
1064 RM = rm -f~:[
1065 CC = gcc
1066 FC = gfortran
1067 FL = gfortran
1068 INCSEQ = -I$(topdir)/libseq
1069 LIBSEQ = -L$(topdir)/libseq -lmpiseq
1070 LIBSEQNEEDED = libseqneeded~;
1071 CC = mpicc
1072 FC = mpifort
1073 FL = mpifort~]
1074 AR = ar vr # rules require trailing space, ugh...
1075 RANLIB = ranlib
1076 LIBBLAS = -L~a -lopenblas~@[
1077 SCALAP = -L~a -lscalapack~]
1078 LIBOTHERS = -pthread
1079 CDEFS = -DAdd_
1080 PIC = -fPIC
1081 OPTF = -O2 -DALLOW_NON_INIT $(PIC)
1082 OPTL = -O2 $(PIC)
1083 OPTC = -O2 $(PIC)
1084 INCS = $(INCSEQ)
1085 LIBS = $(SCALAP) $(LIBSEQ)
1086 LPORDDIR = $(topdir)/PORD/lib
1087 IPORD = -I$(topdir)/PORD/include
1088 LPORD = -L$(LPORDDIR) -lpord
1089 ORDERINGSF = -Dpord~@[
1090 METISDIR = ~a
1091 IMETIS = -I$(METISDIR)/include
1092 LMETIS = -L$(METISDIR)/lib -lmetis
1093 ORDERINGSF += -Dmetis~]~@[~:{
1094 SCOTCHDIR = ~a
1095 ISCOTCH = -I$(SCOTCHDIR)/include
1096 LSCOTCH = -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
1097 ORDERINGSF += ~a~}~]
1098 ORDERINGSC = $(ORDERINGSF)
1099 LORDERINGS = $(LPORD) $(LMETIS) $(LSCOTCH)
1100 IORDERINGSF = $(ISCOTCH)
1101 IORDERINGSC = $(IPORD) $(IMETIS) $(ISCOTCH)"
1102 (assoc-ref inputs "mpi")
1103 (assoc-ref inputs "blas")
1104 (assoc-ref inputs "scalapack")
1105 (assoc-ref inputs "metis")
1106 (match (list (assoc-ref inputs "pt-scotch")
1107 (assoc-ref inputs "scotch"))
1108 ((#f #f)
1109 #f)
1110 ((#f scotch)
1111 `((,scotch "" "-Dscotch")))
1112 ((ptscotch _)
1113 `((,ptscotch
1114 "-lptesmumps -lptscotch -lptscotcherr "
1115 "-Dptscotch")))))))))
1116 (replace
1117 'build
1118 ;; By default only the d-precision library is built. Make with "all"
1119 ;; target so that all precision libraries and examples are built.
1120 (lambda _
1121 (zero? (system* "make" "all"
1122 (format #f "-j~a" (parallel-job-count))))))
1123 (replace
1124 'check
1125 ;; Run the simple test drivers, which read test input from stdin:
1126 ;; from the "real" input for the single- and double-precision
1127 ;; testers, and from the "cmplx" input for complex-precision
1128 ;; testers. The EXEC-PREFIX key is used by the mumps-openmpi
1129 ;; package to prefix execution with "mpirun".
1130 (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
1131 (with-directory-excursion "examples"
1132 (every
1133 (lambda (prec type)
1134 (let ((tester (apply open-pipe*
1135 `(,OPEN_WRITE
1136 ,@exec-prefix
1137 ,(string-append "./" prec
1138 "simpletest"))))
1139 (input (open-input-file
1140 (string-append "input_simpletest_" type))))
1141 (begin
1142 (dump-port input tester)
1143 (close-port input)
1144 (zero? (close-pipe tester)))))
1145 '("s" "d" "c" "z")
1146 '("real" "real" "cmplx" "cmplx")))))
1147 (replace
1148 'install
1149 (lambda* (#:key outputs #:allow-other-keys)
1150 (let ((out (assoc-ref outputs "out")))
1151 (copy-recursively "lib" (string-append out "/lib"))
1152 (copy-recursively "include" (string-append out "/include"))
1153 (when (file-exists? "libseq/libmpiseq.a")
1154 (copy-file "libseq/libmpiseq.a"
1155 (string-append out "/lib/libmpiseq.a")))))))))
1156 (home-page "http://mumps.enseeiht.fr")
1157 (synopsis "Multifrontal sparse direct solver")
1158 (description
1159 "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
1160 sparse system of linear equations A x = b using Guassian elimination.")
1161 (license license:cecill-c)))
1162
1163 (define-public mumps-metis
1164 (package (inherit mumps)
1165 (name "mumps-metis")
1166 (inputs
1167 (alist-delete "scotch" (package-inputs mumps)))))
1168
1169 (define-public mumps-openmpi
1170 (package (inherit mumps)
1171 (name "mumps-openmpi")
1172 (inputs
1173 `(("mpi" ,openmpi)
1174 ("scalapack" ,scalapack)
1175 ("pt-scotch" ,pt-scotch)
1176 ,@(alist-delete "scotch" (package-inputs mumps))))
1177 (arguments
1178 (substitute-keyword-arguments (package-arguments mumps)
1179 ((#:phases phases)
1180 `(modify-phases ,phases
1181 (replace
1182 'check
1183 (lambda _
1184 ((assoc-ref ,phases 'check)
1185 #:exec-prefix '("mpirun" "-n" "2"))))))))
1186 (synopsis "Multifrontal sparse direct solver (with MPI)")))
1187
1188 (define-public mumps-metis-openmpi
1189 (package (inherit mumps-openmpi)
1190 (name "mumps-metis-openmpi")
1191 (inputs
1192 (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
1193
1194 (define-public r-pracma
1195 (package
1196 (name "r-pracma")
1197 (version "1.8.8")
1198 (source (origin
1199 (method url-fetch)
1200 (uri (cran-uri "pracma" version))
1201 (sha256
1202 (base32 "0ans9l5rrb7a38gyi4qx4258sd5r5668vyrk02yzjpg9k3h8l165"))))
1203 (build-system r-build-system)
1204 (home-page "http://cran.r-project.org/web/packages/pracma")
1205 (synopsis "Practical numerical math functions")
1206 (description "This package provides functions for numerical analysis and
1207 linear algebra, numerical optimization, differential equations, plus some
1208 special functions. It uses Matlab function names where appropriate to simplify
1209 porting.")
1210 (license license:gpl3+)))
1211
1212 (define-public superlu
1213 (package
1214 (name "superlu")
1215 (version "5.2.1")
1216 (source
1217 (origin
1218 (method url-fetch)
1219 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
1220 "superlu_" version ".tar.gz"))
1221 (sha256
1222 (base32 "0qzlb7cd608q62kyppd0a8c65l03vrwqql6gsm465rky23b6dyr8"))
1223 (modules '((guix build utils)))
1224 (snippet
1225 ;; Replace the non-free implementation of MC64 with a stub adapted
1226 ;; from Debian
1227 '(begin
1228 (use-modules (ice-9 regex)
1229 (ice-9 rdelim))
1230 (call-with-output-file "SRC/mc64ad.c"
1231 (lambda (port)
1232 (display "
1233 #include <stdio.h>
1234 #include <stdlib.h>
1235 void mc64id_(int *a) {
1236 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
1237 abort ();
1238 }
1239 void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
1240 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
1241 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
1242 abort ();
1243 }\n" port)))
1244 ;; Remove the corresponding license verbiage. MC64 license follows
1245 ;; a "------" line separator.
1246 (with-atomic-file-replacement "License.txt"
1247 (let ((rx (make-regexp "-{8}")))
1248 (lambda (in out)
1249 (let loop ()
1250 (let ((line (read-line in 'concat)))
1251 (unless (regexp-exec rx line)
1252 (display line out)
1253 (loop)))))))))))
1254 (build-system cmake-build-system)
1255 (native-inputs
1256 `(("tcsh" ,tcsh)))
1257 (inputs
1258 `(("blas" ,openblas)
1259 ("gfortran" ,gfortran)))
1260 (arguments
1261 `(#:configure-flags '("-Denable_blaslib:BOOL=NO" ;do not use internal cblas
1262 "-DTPL_BLAS_LIBRARIES=openblas"
1263 "-DBUILD_SHARED_LIBS:BOOL=YES"
1264 "-DCMAKE_INSTALL_LIBDIR=lib")))
1265 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
1266 (synopsis "Supernodal direct solver for sparse linear systems")
1267 (description
1268 "SuperLU is a general purpose library for the direct solution of large,
1269 sparse, nonsymmetric systems of linear equations on high performance machines.
1270 The library is written in C and is callable from either C or Fortran. The
1271 library routines perform an LU decomposition with partial pivoting and
1272 triangular system solves through forward and back substitution. The library
1273 also provides threshold-based ILU factorization preconditioners.")
1274 (license (list license:bsd-3
1275 license:gpl2+ ;EXAMPLE/*fgmr.c
1276 (license:fsf-free "file://SRC/colamd.h")))))
1277
1278 (define-public superlu-dist
1279 (package
1280 (name "superlu-dist")
1281 (version "3.3")
1282 (source
1283 (origin
1284 (method url-fetch)
1285 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
1286 "superlu_dist_" version ".tar.gz"))
1287 (sha256
1288 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
1289 (modules '((guix build utils)))
1290 (snippet
1291 ;; Replace the non-free implementation of MC64 with a stub
1292 '(begin
1293 (use-modules (ice-9 regex)
1294 (ice-9 rdelim))
1295 (call-with-output-file "SRC/mc64ad.c"
1296 (lambda (port)
1297 (display "
1298 #include <stdio.h>
1299 #include <stdlib.h>
1300 void mc64id_(int *a) {
1301 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
1302 abort ();
1303 }
1304 void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
1305 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
1306 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
1307 abort ();
1308 }\n" port)))
1309 (delete-file "SRC/mc64ad.f.bak")
1310 (substitute* "SRC/util.c" ;adjust default algorithm
1311 (("RowPerm[[:blank:]]*=[[:blank:]]*LargeDiag")
1312 "RowPerm = NOROWPERM"))))
1313 (patches (search-patches "superlu-dist-scotchmetis.patch"))))
1314 (build-system gnu-build-system)
1315 (native-inputs
1316 `(("tcsh" ,tcsh)))
1317 (inputs
1318 `(("gfortran" ,gfortran)))
1319 (propagated-inputs
1320 `(("openmpi" ,openmpi) ;headers include MPI heades
1321 ("lapack" ,lapack) ;required to link with output library
1322 ("pt-scotch" ,pt-scotch))) ;same
1323 (arguments
1324 `(#:parallel-build? #f ;race conditions using ar
1325 #:phases
1326 (alist-replace
1327 'configure
1328 (lambda* (#:key inputs outputs #:allow-other-keys)
1329 (call-with-output-file "make.inc"
1330 (lambda (port)
1331 (format port "
1332 PLAT =
1333 DSuperLUroot = ~a
1334 DSUPERLULIB = ~a/lib/libsuperlu_dist.a
1335 BLASDEF = -DUSE_VENDOR_BLAS
1336 BLASLIB = -L~a/lib -lblas
1337 PARMETISLIB = -L~a/lib \
1338 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
1339 -lscotch -lscotcherr -lscotcherrexit
1340 METISLIB = -L~:*~a/lib \
1341 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
1342 LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
1343 ARCH = ar
1344 ARCHFLAGS = cr
1345 RANLIB = ranlib
1346 CC = mpicc
1347 PIC = -fPIC
1348 CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
1349 NOOPTS = -O0 -g $(PIC)
1350 FORTRAN = mpifort
1351 FFLAGS = -O2 -g $(PIC)
1352 LOADER = $(CC)
1353 CDEFS = -DAdd_"
1354 (getcwd)
1355 (assoc-ref outputs "out")
1356 (assoc-ref inputs "lapack")
1357 (assoc-ref inputs "pt-scotch")))))
1358 (alist-cons-after
1359 'unpack 'remove-broken-symlinks
1360 (lambda _
1361 (for-each delete-file
1362 (find-files "MAKE_INC" "\\.#make\\..*")))
1363 (alist-cons-before
1364 'build 'create-install-directories
1365 (lambda* (#:key outputs #:allow-other-keys)
1366 (for-each
1367 (lambda (dir)
1368 (mkdir-p (string-append (assoc-ref outputs "out")
1369 "/" dir)))
1370 '("lib" "include")))
1371 (alist-replace
1372 'check
1373 (lambda _
1374 (with-directory-excursion "EXAMPLE"
1375 (and
1376 (zero? (system* "mpirun" "-n" "2"
1377 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
1378 (zero? (system* "mpirun" "-n" "2"
1379 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
1380 (alist-replace
1381 'install
1382 (lambda* (#:key outputs #:allow-other-keys)
1383 ;; Library is placed in lib during the build phase. Copy over
1384 ;; headers to include.
1385 (let* ((out (assoc-ref outputs "out"))
1386 (incdir (string-append out "/include")))
1387 (for-each (lambda (file)
1388 (let ((base (basename file)))
1389 (format #t "installing `~a' to `~a'~%"
1390 base incdir)
1391 (copy-file file
1392 (string-append incdir "/" base))))
1393 (find-files "SRC" ".*\\.h$"))))
1394 %standard-phases)))))))
1395 (home-page (package-home-page superlu))
1396 (synopsis "Parallel supernodal direct solver")
1397 (description
1398 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
1399 It is targeted for distributed memory parallel machines. SuperLU_DIST is
1400 implemented in ANSI C, and MPI for communications.")
1401 (license license:bsd-3)))
1402
1403 (define-public scotch
1404 (package
1405 (name "scotch")
1406 (version "6.0.4")
1407 (source
1408 (origin
1409 (method url-fetch)
1410 (uri (string-append "https://gforge.inria.fr/frs/download.php/34618/"
1411 "scotch_" version ".tar.gz"))
1412 (sha256
1413 (base32 "1ir088mvrqggyqdkx9qfynmiaffqbyih5qfl5mga2nrlm1qlsgzm"))
1414 (patches (search-patches "scotch-test-threading.patch"
1415 "pt-scotch-build-parallelism.patch"))))
1416 (build-system gnu-build-system)
1417 (inputs
1418 `(("zlib" ,zlib)
1419 ("flex" ,flex)
1420 ("bison" ,bison)))
1421 (arguments
1422 `(#:phases
1423 (modify-phases %standard-phases
1424 (add-after
1425 'unpack 'chdir-to-src
1426 (lambda _ (chdir "src")))
1427 (replace
1428 'configure
1429 (lambda _
1430 (call-with-output-file "Makefile.inc"
1431 (lambda (port)
1432 (format port "
1433 EXE =
1434 LIB = .a
1435 OBJ = .o
1436 MAKE = make
1437 AR = ar
1438 ARFLAGS = -ruv
1439 CAT = cat
1440 CCS = gcc
1441 CCP = mpicc
1442 CCD = gcc
1443 CPPFLAGS =~{ -D~a~}
1444 CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
1445 LDFLAGS = -lz -lm -lrt -lpthread
1446 CP = cp
1447 LEX = flex -Pscotchyy -olex.yy.c
1448 LN = ln
1449 MKDIR = mkdir
1450 MV = mv
1451 RANLIB = ranlib
1452 YACC = bison -pscotchyy -y -b y
1453 "
1454 '("COMMON_FILE_COMPRESS_GZ"
1455 "COMMON_PTHREAD"
1456 "COMMON_RANDOM_FIXED_SEED"
1457 ;; Prevents symbolc clashes with libesmumps
1458 "SCOTCH_RENAME"
1459 ;; XXX: Causes invalid frees in superlu-dist tests
1460 ;; "SCOTCH_PTHREAD"
1461 ;; "SCOTCH_PTHREAD_NUMBER=2"
1462 "restrict=__restrict"))))))
1463 (add-after
1464 'build 'build-esmumps
1465 (lambda _
1466 (zero? (system* "make"
1467 (format #f "-j~a" (parallel-job-count))
1468 "esmumps"))))
1469 (replace
1470 'install
1471 (lambda* (#:key outputs #:allow-other-keys)
1472 (let ((out (assoc-ref outputs "out")))
1473 (mkdir out)
1474 (zero? (system* "make"
1475 (string-append "prefix=" out)
1476 "install"))
1477 ;; esmumps files are not installed with the above
1478 (for-each (lambda (f)
1479 (copy-file f (string-append out "/include/" f)))
1480 (find-files "../include" ".*esmumps.h$"))
1481 (for-each (lambda (f)
1482 (copy-file f (string-append out "/lib/" f)))
1483 (find-files "../lib" "^lib.*esmumps.*"))))))))
1484 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
1485 (synopsis "Programs and libraries for graph algorithms")
1486 (description "SCOTCH is a set of programs and libraries which implement
1487 the static mapping and sparse matrix reordering algorithms developed within
1488 the SCOTCH project. Its purpose is to apply graph theory, with a divide and
1489 conquer approach, to scientific computing problems such as graph and mesh
1490 partitioning, static mapping, and sparse matrix ordering, in application
1491 domains ranging from structural mechanics to operating systems or
1492 bio-chemistry.")
1493 ;; See LICENSE_en.txt
1494 (license license:cecill-c)))
1495
1496 (define-public pt-scotch
1497 (package (inherit scotch)
1498 (name "pt-scotch")
1499 (propagated-inputs
1500 `(("openmpi" ,openmpi))) ;Headers include MPI headers
1501 (arguments
1502 (substitute-keyword-arguments (package-arguments scotch)
1503 ((#:phases scotch-phases)
1504 `(modify-phases ,scotch-phases
1505 (replace
1506 'build
1507 (lambda _
1508 (and
1509 (zero? (system* "make"
1510 (format #f "-j~a" (parallel-job-count))
1511 "ptscotch" "ptesmumps"))
1512 ;; Install the serial metis compatibility library
1513 (zero? (system* "make" "-C" "libscotchmetis" "install")))))
1514 (replace
1515 'check
1516 (lambda _ (zero? (system* "make" "ptcheck"))))))))
1517 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
1518
1519 (define-public metis
1520 (package
1521 (name "metis")
1522 (version "5.1.0")
1523 (source
1524 (origin
1525 (method url-fetch)
1526 (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
1527 "metis-" version ".tar.gz"))
1528 (sha256
1529 (base32
1530 "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
1531 (build-system cmake-build-system)
1532 (inputs
1533 `(("blas" ,openblas)))
1534 (arguments
1535 `(#:tests? #f ;no tests
1536 #:configure-flags `("-DSHARED=ON"
1537 ,(string-append "-DGKLIB_PATH=" (getcwd)
1538 "/metis-" ,version "/GKlib"))))
1539 (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
1540 (synopsis "Graph partitioning and fill-reducing matrix ordering library")
1541 (description
1542 "METIS is a set of serial programs for partitioning graphs, partitioning
1543 finite element meshes, and producing fill-reducing orderings for sparse
1544 matrices. The algorithms implemented in METIS are based on the multilevel
1545 recursive-bisection, multilevel k-way, and multi-constraint partitioning
1546 schemes.")
1547 (license license:asl2.0))) ;As of version 5.0.3
1548
1549 (define-public p4est
1550 (package
1551 (name "p4est")
1552 (version "1.1")
1553 (source
1554 (origin
1555 (method url-fetch)
1556 (uri (string-append "http://p4est.github.io/release/p4est-"
1557 version ".tar.gz"))
1558 (sha256
1559 (base32
1560 "0faina2h5qsx3m2izbzaj9bbakma1krbbjmq43wrp1hcbyijflqb"))))
1561 (build-system gnu-build-system)
1562 (inputs
1563 `(("fortran" ,gfortran)
1564 ("blas" ,openblas)
1565 ("lapack" ,lapack)
1566 ("zlib" ,zlib)))
1567 (arguments
1568 `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
1569 (assoc-ref %build-inputs "blas")
1570 " -lopenblas")
1571 ,(string-append "LAPACK_LIBS=-L"
1572 (assoc-ref %build-inputs "lapack")
1573 " -llapack"))))
1574 (home-page "http://www.p4est.org")
1575 (synopsis "Adaptive mesh refinement on forests of octrees")
1576 (description
1577 "The p4est software library enables the dynamic management of a
1578 collection of adaptive octrees, conveniently called a forest of octrees.
1579 p4est is designed to work in parallel and scales to hundreds of thousands of
1580 processor cores.")
1581 (license license:gpl2+)))
1582
1583 (define-public p4est-openmpi
1584 (package (inherit p4est)
1585 (name "p4est-openmpi")
1586 (inputs
1587 `(("mpi" ,openmpi)
1588 ,@(package-inputs p4est)))
1589 (arguments
1590 (substitute-keyword-arguments (package-arguments p4est)
1591 ((#:configure-flags cf)
1592 ``("--enable-mpi" ,@,cf))))
1593 (synopsis "Parallel adaptive mesh refinement on forests of octrees")))
1594
1595 (define-public gsegrafix
1596 (package
1597 (name "gsegrafix")
1598 (version "1.0.6")
1599 (source
1600 (origin
1601 (method url-fetch)
1602 (uri (string-append "mirror://gnu/" name "/" name "-"
1603 version ".tar.gz"))
1604 (sha256
1605 (base32
1606 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
1607 (build-system gnu-build-system)
1608 (arguments
1609 `(#:configure-flags '("LDFLAGS=-lm")))
1610 (inputs
1611 `(("libgnomecanvas" ,libgnomecanvas)
1612 ("libbonoboui" ,libbonoboui)
1613 ("libgnomeui" ,libgnomeui)
1614 ("libgnomeprintui" ,libgnomeprintui)
1615 ("popt" ,popt)))
1616 (native-inputs
1617 `(("pkg-config" ,pkg-config)))
1618 (home-page "http://www.gnu.org/software/gsegrafix/")
1619 (synopsis "GNOME application to create scientific and engineering plots")
1620 (description "GSEGrafix is an application which produces high-quality graphical
1621 plots for science and engineering. Plots are specified via simple ASCII
1622 parameter files and data files and are presented in an anti-aliased GNOME
1623 canvas. The program supports rectangular two-dimensional plots, histograms,
1624 polar-axis plots and three-dimensional plots. Plots can be printed or saved
1625 to BMP, JPEG or PNG image formats.")
1626 (license license:gpl3+)))
1627
1628 (define-public maxima
1629 (package
1630 (name "maxima")
1631 (version "5.36.1")
1632 (source
1633 (origin
1634 (method url-fetch)
1635 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
1636 version "-source/" name "-" version ".tar.gz"))
1637 (sha256
1638 (base32
1639 "0x1rk659sn3cq0n5c90848ilzr1gb1wf0072fl6jhkdq00qgh2s0"))
1640 (patches (search-patches "maxima-defsystem-mkdir.patch"))))
1641 (build-system gnu-build-system)
1642 (inputs
1643 `(("gcl" ,gcl)
1644 ("gnuplot" ,gnuplot) ;for plots
1645 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
1646 (native-inputs
1647 `(("texinfo" ,texinfo)
1648 ("perl" ,perl)))
1649 (arguments
1650 `(#:configure-flags
1651 (list "--enable-gcl"
1652 (string-append "--with-posix-shell="
1653 (assoc-ref %build-inputs "bash")
1654 "/bin/sh")
1655 (string-append "--with-wish="
1656 (assoc-ref %build-inputs "tk")
1657 "/bin/wish"
1658 (let ((v ,(package-version tk)))
1659 (string-take v (string-index-right v #\.)))))
1660 ;; By default Maxima attempts to write temporary files to
1661 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
1662 ;; Work around that.
1663 #:make-flags (list "TMPDIR=/tmp")
1664 #:phases (alist-cons-before
1665 'check 'pre-check
1666 (lambda _
1667 (chmod "src/maxima" #o555))
1668 ;; Make sure the doc and emacs files are found in the
1669 ;; standard location. Also configure maxima to find gnuplot
1670 ;; without having it on the PATH.
1671 (alist-cons-after
1672 'install 'post-install
1673 (lambda* (#:key outputs inputs #:allow-other-keys)
1674 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
1675 (out (assoc-ref outputs "out"))
1676 (datadir (string-append out "/share/maxima/" ,version)))
1677 (with-directory-excursion out
1678 (mkdir-p "share/emacs")
1679 (mkdir-p "share/doc")
1680 (symlink
1681 (string-append datadir "/emacs/")
1682 (string-append out "/share/emacs/site-lisp"))
1683 (symlink
1684 (string-append datadir "/doc/")
1685 (string-append out "/share/doc/maxima"))
1686 (with-atomic-file-replacement
1687 (string-append datadir "/share/maxima-init.lisp")
1688 (lambda (in out)
1689 (format out "~a ~s~a~%"
1690 "(setf $gnuplot_command "
1691 (string-append gnuplot "/bin/gnuplot") ")")
1692 (dump-port in out))))))
1693 %standard-phases))))
1694 (home-page "http://maxima.sourceforge.net")
1695 (synopsis "Numeric and symbolic expression manipulation")
1696 (description "Maxima is a system for the manipulation of symbolic and
1697 numerical expressions. It yields high precision numeric results by using
1698 exact fractions, arbitrary precision integers, and variable precision floating
1699 point numbers.")
1700 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
1701 ;; Others simply say "GNU General Public License" without stating a
1702 ;; version (which implicitly means gpl1+).
1703 ;; At least one file (src/maxima.asd) says "version 2."
1704 ;; GPLv2 only is therefore the smallest subset.
1705 (license license:gpl2)))
1706
1707 (define-public wxmaxima
1708 (package
1709 (name "wxmaxima")
1710 (version "16.04.2")
1711 (source
1712 (origin
1713 (method url-fetch)
1714 (uri (string-append "mirror://sourceforge/wxmaxima/wxMaxima/"
1715 version "/" name "-" version ".tar.gz"))
1716 (sha256
1717 (base32
1718 "1fpqzk1921isiqrpgpf433ldq41924qs9sy99fl1zn5661b2l73n"))))
1719 (build-system gnu-build-system)
1720 (inputs
1721 `(("wxwidgets" ,wxwidgets)
1722 ("maxima" ,maxima)
1723 ;; Runtime support.
1724 ("adwaita-icon-theme" ,adwaita-icon-theme)
1725 ("gtk+" ,gtk+)
1726 ("shared-mime-info" ,shared-mime-info)))
1727 (arguments
1728 `(#:phases (modify-phases %standard-phases
1729 (add-after
1730 'install 'wrap-program
1731 (lambda* (#:key inputs outputs #:allow-other-keys)
1732 (wrap-program (string-append (assoc-ref outputs "out")
1733 "/bin/wxmaxima")
1734 `("PATH" ":" prefix
1735 (,(string-append (assoc-ref inputs "maxima")
1736 "/bin")))
1737 ;; For GtkFileChooserDialog.
1738 `("GSETTINGS_SCHEMA_DIR" =
1739 (,(string-append (assoc-ref inputs "gtk+")
1740 "/share/glib-2.0/schemas")))
1741 `("XDG_DATA_DIRS" ":" prefix
1742 (;; Needed by gdk-pixbuf to know supported icon formats.
1743 ,(string-append
1744 (assoc-ref inputs "shared-mime-info") "/share")
1745 ;; The default icon theme of GTK+.
1746 ,(string-append
1747 (assoc-ref inputs "adwaita-icon-theme") "/share"))))
1748 #t)))))
1749 (home-page "https://andrejv.github.io/wxmaxima/")
1750 (synopsis "Graphical user interface for the Maxima computer algebra system")
1751 (description
1752 "wxMaxima is a graphical user interface for the Maxima computer algebra
1753 system. It eases the use of Maxima by making most of its commands available
1754 through a menu system and by providing input dialogs for commands that require
1755 more than one argument. It also implements its own display engine that
1756 outputs mathematical symbols directly instead of depicting them with ASCII
1757 characters.
1758
1759 wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
1760 text and mathematical calculations to create documents, exporting of input and
1761 output to TeX, and a browser for Maxima's manual including command index and
1762 full text searching.")
1763 (license license:gpl2+)))
1764
1765 (define-public armadillo
1766 (package
1767 (name "armadillo")
1768 (version "6.700.7")
1769 (source (origin
1770 (method url-fetch)
1771 (uri (string-append "mirror://sourceforge/arma/armadillo-"
1772 version ".tar.gz"))
1773 (sha256
1774 (base32
1775 "0xbidcxrvbq33xf7iysg2nic2ai9a043psl33kiv6ifkk7p8hcra"))))
1776 (build-system cmake-build-system)
1777 (arguments `(#:tests? #f)) ;no test target
1778 (inputs
1779 `(("openblas" ,openblas)
1780 ("lapack" ,lapack)
1781 ("arpack" ,arpack-ng)))
1782 (home-page "http://arma.sourceforge.net/")
1783 (synopsis "C++ linear algebra library")
1784 (description
1785 "Armadillo is a C++ linear algebra library, aiming towards a good balance
1786 between speed and ease of use. It is useful for algorithm development
1787 directly in C++, or quick conversion of research code into production
1788 environments. It can be used for machine learning, pattern recognition,
1789 signal processing, bioinformatics, statistics, econometrics, etc. The library
1790 provides efficient classes for vectors, matrices and cubes, as well as 150+
1791 associated functions (eg. contiguous and non-contiguous submatrix views).")
1792 (license license:mpl2.0)))
1793
1794 (define-public armadillo-for-rcpparmadillo
1795 (package (inherit armadillo)
1796 (version "6.700.6")
1797 (source (origin
1798 (method url-fetch)
1799 (uri (string-append "mirror://sourceforge/arma/armadillo-"
1800 version ".tar.gz"))
1801 (sha256
1802 (base32
1803 "1cdpjxb0fz5f28y5qrqgpw53s7qi8s2v3al9lfdldqxngb21vpx8"))))))
1804
1805 (define-public muparser
1806 ;; When switching download sites, muparser re-issued a 2.2.5 release with a
1807 ;; different hash. In order to make `guix package --upgrade` work correctly,
1808 ;; we set a Guix packaging revision.
1809 ;; When the next version of muparser is released, we can remove
1810 ;; UPSTREAM-VERSION and REVISION and use the plain VERSION.
1811 (let ((upstream-version "2.2.5")
1812 (revision "2"))
1813 (package
1814 (name "muparser")
1815 (version (string-append upstream-version "-" revision))
1816 (source
1817 (origin
1818 (method url-fetch)
1819 (uri (string-append "https://github.com/beltoforion/muparser/archive/v"
1820 upstream-version ".tar.gz"))
1821 (file-name (string-append name "-" version ".tar.gz"))
1822 (sha256
1823 (base32
1824 "0277qsi5l23jsck1vhn383bmvc2n9l4a1dl5r9bf7hvjv9ayyrh6"))))
1825 (build-system gnu-build-system)
1826 (arguments
1827 `(#:configure-flags '("--enable-samples=no")
1828 #:tests? #f)) ;no "check" target
1829 (home-page "http://muparser.beltoforion.de/")
1830 (synopsis "Fast parser library for mathematical expressions")
1831 (description
1832 "muParser is an extensible high performance math parser library. It is
1833 based on transforming an expression into a bytecode and precalculating constant
1834 parts of it.")
1835 (license license:expat))))
1836
1837 (define-public openblas
1838 (package
1839 (name "openblas")
1840 (version "0.2.15")
1841 (source
1842 (origin
1843 (method url-fetch)
1844 (uri (string-append "https://github.com/xianyi/OpenBLAS/tarball/v"
1845 version))
1846 (file-name (string-append name "-" version ".tar.gz"))
1847 (sha256
1848 (base32
1849 "1k5f6vjlk54qlplk5m7xkbaw6g2y7dl50lwwdv6xsbcsgsbxfcpy"))))
1850 (build-system gnu-build-system)
1851 (arguments
1852 `(#:tests? #f ;no "check" target
1853 ;; DYNAMIC_ARCH is only supported on x86. When it is disabled and no
1854 ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
1855 ;; we need to disable substitutions.
1856 #:substitutable?
1857 ,(let ((system (or (%current-target-system) (%current-system))))
1858 (or (string-prefix? "x86_64" system)
1859 (string-prefix? "i686" system)
1860 (string-prefix? "mips" system)))
1861 #:make-flags
1862 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1863 "SHELL=bash"
1864 "NO_LAPACK=1"
1865 ;; Build the library for all supported CPUs. This allows
1866 ;; switching CPU targets at runtime with the environment variable
1867 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
1868 ;; Unfortunately, this is not supported on non-x86 architectures,
1869 ;; where it leads to failed builds.
1870 ,@(let ((system (or (%current-target-system) (%current-system))))
1871 (cond
1872 ((or (string-prefix? "x86_64" system)
1873 (string-prefix? "i686" system))
1874 '("DYNAMIC_ARCH=1"))
1875 ;; On MIPS we force the "SICORTEX" TARGET, as for the other
1876 ;; two available MIPS targets special extended instructions
1877 ;; for Loongson cores are used.
1878 ((string-prefix? "mips" system)
1879 '("TARGET=SICORTEX"))
1880 (else '()))))
1881 ;; no configure script
1882 #:phases (alist-delete 'configure %standard-phases)))
1883 (inputs
1884 `(("fortran" ,gfortran)))
1885 (native-inputs
1886 `(("cunit" ,cunit)
1887 ("perl" ,perl)))
1888 (home-page "http://www.openblas.net/")
1889 (synopsis "Optimized BLAS library based on GotoBLAS")
1890 (description
1891 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
1892 (license license:bsd-3)))
1893
1894 (define-public openlibm
1895 (package
1896 (name "openlibm")
1897 (version "0.5.1")
1898 (source
1899 (origin
1900 (method url-fetch)
1901 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
1902 version ".tar.gz"))
1903 (file-name (string-append name "-" version ".tar.gz"))
1904 (sha256
1905 (base32
1906 "11czx2z7nh6dfpz45s3xl7v38hw36jxzxfvny454bk3if14pfakq"))))
1907 (build-system gnu-build-system)
1908 (arguments
1909 `(#:make-flags
1910 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1911 #:phases
1912 ;; no configure script
1913 (alist-delete 'configure %standard-phases)
1914 #:tests? #f)) ;the tests are part of the default target
1915 (home-page "http://openlibm.org/")
1916 (synopsis "Portable C mathematical library (libm)")
1917 (description
1918 "OpenLibm is an effort to have a high quality, portable, standalone C
1919 mathematical library (libm). It can be used standalone in applications and
1920 programming language implementations. The project was born out of a need to
1921 have a good libm for the Julia programming language that worked consistently
1922 across compilers and operating systems, and in 32-bit and 64-bit
1923 environments.")
1924 ;; See LICENSE.md for details.
1925 (license (list license:expat
1926 license:isc
1927 license:bsd-2
1928 license:public-domain
1929 license:lgpl2.1+))))
1930
1931 (define-public openspecfun
1932 (package
1933 (name "openspecfun")
1934 (version "0.5.2")
1935 (source
1936 (origin
1937 (method url-fetch)
1938 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
1939 version ".tar.gz"))
1940 (file-name (string-append name "-" version ".tar.gz"))
1941 (sha256
1942 (base32
1943 "1y5b2h6f2k72536kym3vzy3li3bhpd23x463g7hdmjdi3cncavz1"))))
1944 (build-system gnu-build-system)
1945 (arguments
1946 '(#:tests? #f ;no "check" target
1947 #:make-flags
1948 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1949 ;; no configure script
1950 #:phases (alist-delete 'configure %standard-phases)))
1951 (inputs
1952 `(("fortran" ,gfortran)))
1953 (home-page "https://github.com/JuliaLang/openspecfun")
1954 (synopsis "Collection of special mathematical functions")
1955 (description
1956 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
1957 portable package for Bessel Functions of a Complex Argument and Nonnegative
1958 Order; it contains subroutines for computing Bessel functions and Airy
1959 functions. Faddeeva allows computing the various error functions of arbitrary
1960 complex arguments (Faddeeva function, error function, complementary error
1961 function, scaled complementary error function, imaginary error function, and
1962 Dawson function); given these, one can also easily compute Voigt functions,
1963 Fresnel integrals, and similar related functions as well.")
1964 ;; Faddeeva is released under the Expat license; AMOS is included as
1965 ;; public domain software.
1966 (license (list license:expat license:public-domain))))
1967
1968 (define-public suitesparse
1969 (package
1970 (name "suitesparse")
1971 (version "4.4.3")
1972 (source
1973 (origin
1974 (method url-fetch)
1975 (uri (string-append
1976 "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-"
1977 version ".tar.gz"))
1978 (sha256
1979 (base32
1980 "100hdzr0mf4mzlwnqpmwpfw4pymgsf9n3g0ywb1yps2nk1zbkdy5"))))
1981 (build-system gnu-build-system)
1982 (arguments
1983 '(#:parallel-build? #f ;cholmod build fails otherwise
1984 #:tests? #f ;no "check" target
1985 #:make-flags
1986 (list "CC=gcc"
1987 "BLAS=-lblas"
1988 "TBB=-ltbb"
1989 "CHOLMOD_CONFIG=-DNPARTITION" ;required when METIS is not used
1990 (string-append "INSTALL_LIB="
1991 (assoc-ref %outputs "out") "/lib")
1992 (string-append "INSTALL_INCLUDE="
1993 (assoc-ref %outputs "out") "/include"))
1994 #:phases
1995 (alist-cons-before
1996 'install 'prepare-out
1997 ;; README.txt states that the target directories must exist prior to
1998 ;; running "make install".
1999 (lambda _
2000 (mkdir-p (string-append (assoc-ref %outputs "out") "/lib"))
2001 (mkdir-p (string-append (assoc-ref %outputs "out") "/include")))
2002 ;; no configure script
2003 (alist-delete 'configure %standard-phases))))
2004 (inputs
2005 `(("tbb" ,tbb)
2006 ("lapack" ,lapack)))
2007 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
2008 (synopsis "Suite of sparse matrix software")
2009 (description
2010 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
2011 multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
2012 multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
2013 simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
2014 CXSparse, a concise sparse Cholesky factorization package; and many other
2015 packages.")
2016 ;; LGPLv2.1+:
2017 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
2018 ;; GPLv2+:
2019 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
2020 (license (list license:gpl2+ license:lgpl2.1+))))
2021
2022 (define-public atlas
2023 (package
2024 (name "atlas")
2025 (version "3.10.2")
2026 (source (origin
2027 (method url-fetch)
2028 (uri (string-append "mirror://sourceforge/math-atlas/Stable/"
2029 version "/atlas" version ".tar.bz2"))
2030 (sha256
2031 (base32
2032 "0bqh4bdnjdyww4mcpg6kn0x7338mfqbdgysn97dzrwwb26di7ars"))))
2033 (build-system gnu-build-system)
2034 (home-page "http://math-atlas.sourceforge.net/")
2035 (inputs `(("gfortran" ,gfortran)
2036 ("lapack-tar" ,(package-source lapack))))
2037 (outputs '("out" "doc"))
2038 ;; For the moment we drop support for MIPS at it fails to compile. See
2039 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
2040 (supported-systems (delete "mips64el-linux" %supported-systems))
2041 (arguments
2042 `(#:parallel-build? #f
2043 #:parallel-tests? #f
2044
2045 ;; ATLAS tunes itself for the machine it is built on, as explained at
2046 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
2047 ;; For this reason, we want users to build it locally instead of using
2048 ;; substitutes.
2049 #:substitutable? #f
2050
2051 #:modules ((srfi srfi-26)
2052 (srfi srfi-1)
2053 (guix build gnu-build-system)
2054 (guix build utils))
2055 #:configure-flags
2056 `(;; Generate position independent code suitable for dynamic libraries
2057 ;; and use WALL timer to get more accurate timing.
2058 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
2059 ;; Set word width.
2060 "-b"
2061 ,,(if (string-match "64" (%current-system))
2062 "64"
2063 "32")
2064 ;; Disable parallel build as it gives errors: atlas_pthread.h is
2065 ;; needed to compile C files before it is generated.
2066 "-Ss" "pmake" "make -j 1"
2067 ;; Probe is failing for MIPS. We therefore define the system
2068 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
2069 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
2070 ,,@(if (string-prefix? "mips" (%current-system))
2071 (list "-A" "49" "-V" "1")
2072 (list))
2073 ;; Generate shared libraries.
2074 "--shared"
2075 ;; Build a full LAPACK library.
2076 ,(string-append "--with-netlib-lapack-tarfile="
2077 (assoc-ref %build-inputs "lapack-tar")))
2078 #:phases
2079 (alist-cons-after
2080 'install 'install-doc
2081 (lambda* (#:key outputs inputs #:allow-other-keys)
2082 (let ((doc (string-append (assoc-ref outputs "doc")
2083 "/share/doc/atlas")))
2084 (mkdir-p doc)
2085 (fold (lambda (file previous)
2086 (and previous (zero? (system* "cp" file doc))))
2087 #t (find-files "../ATLAS/doc" ".*"))))
2088 (alist-cons-after
2089 'check 'check-pt
2090 (lambda _ (zero? (system* "make" "ptcheck")))
2091 ;; Fix files required to run configure.
2092 (alist-cons-before
2093 'configure 'fix-/bin/sh
2094 (lambda _
2095 ;; Use `sh', not `/bin/sh'.
2096 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
2097 (("/bin/sh")
2098 "sh")))
2099 ;; Fix /bin/sh in generated make files.
2100 (alist-cons-after
2101 'configure 'fix-/bin/sh-in-generated-files
2102 (lambda _
2103 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
2104 (("/bin/sh")
2105 "sh")))
2106 ;; ATLAS configure program does not accepts the default flags
2107 ;; passed by the 'gnu-build-system'.
2108 (alist-replace
2109 'configure
2110 (lambda* (#:key native-inputs inputs outputs
2111 (configure-flags '())
2112 #:allow-other-keys #:rest args)
2113 (let* ((prefix (assoc-ref outputs "out"))
2114 (bash (or (and=> (assoc-ref
2115 (or native-inputs inputs) "bash")
2116 (cut string-append <> "/bin/bash"))
2117 "/bin/sh"))
2118 (flags `(,(string-append "--prefix=" prefix)
2119 ,@configure-flags))
2120 (abs-srcdir (getcwd))
2121 (srcdir (string-append "../" (basename abs-srcdir))))
2122 (format #t "source directory: ~s (relative from build: ~s)~%"
2123 abs-srcdir srcdir)
2124 (mkdir "../build")
2125 (chdir "../build")
2126 (format #t "build directory: ~s~%" (getcwd))
2127 (format #t "configure flags: ~s~%" flags)
2128 (zero? (apply system* bash
2129 (string-append srcdir "/configure")
2130 flags))))
2131 %standard-phases)))))))
2132 (synopsis "Automatically Tuned Linear Algebra Software")
2133 (description
2134 "ATLAS is an automatically tuned linear algebra software library
2135 providing C and Fortran77 interfaces to a portably efficient BLAS
2136 implementation, as well as a few routines from LAPACK.
2137
2138 Optimization occurs at build time. For this reason, the library is built on
2139 the machine where it is installed, without resorting to pre-built substitutes.
2140
2141 Before building the library, CPU throttling should be disabled. This can be
2142 done in the BIOS, or, on GNU/Linux, with the following command:
2143
2144 @example
2145 # cpupower --governor performance
2146 @end example
2147
2148 Failure to do so will result in a library with poor performance.")
2149 (license license:bsd-3)))
2150
2151 (define-public glm
2152 (package
2153 (name "glm")
2154 (version "0.9.6.3")
2155 (source
2156 (origin
2157 (method url-fetch)
2158 (uri (string-append "mirror://sourceforge/ogl-math/glm-" version
2159 "/glm-" version ".zip"))
2160 (sha256
2161 (base32
2162 "1cnjmi033a16a95v6xfkr1bvfmkd26hzdjka8j1819hgn5b1nr8l"))))
2163 (build-system cmake-build-system)
2164 (native-inputs
2165 `(("unzip" ,unzip)))
2166 (home-page "http://glm.g-truc.net")
2167 (synopsis "OpenGL Mathematics library")
2168 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
2169 library for graphics software based on the OpenGL Shading Language (GLSL)
2170 specifications.")
2171 (license license:expat)))
2172
2173 (define-public lpsolve
2174 (package
2175 (name "lpsolve")
2176 (version "5.5.2.0")
2177 (source
2178 (origin
2179 (method url-fetch)
2180 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
2181 "/lp_solve_" version "_source.tar.gz"))
2182 (sha256
2183 (base32
2184 "176c7f023mb6b8bfmv4rfqnrlw88lsg422ca74zjh19i2h5s69sq"))
2185 (modules '((guix build utils)))
2186 (snippet
2187 '(substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
2188 (("^c=cc") "c=gcc")
2189 ;; Pretend to be on a 64 bit platform to obtain a common directory
2190 ;; name for the build results on all architectures; nothing else
2191 ;; seems to depend on it.
2192 (("^PLATFORM=.*$") "PLATFORM=ux64\n")))))
2193 (build-system gnu-build-system)
2194 (arguments
2195 `(#:tests? #f ; no check target
2196 #:phases
2197 (modify-phases %standard-phases
2198 (delete 'configure)
2199 (replace 'build
2200 (lambda _
2201 (and (with-directory-excursion "lpsolve55"
2202 (zero? (system* "bash" "ccc")))
2203 (with-directory-excursion "lp_solve"
2204 (zero? (system* "bash" "ccc"))))))
2205 (replace 'install
2206 (lambda* (#:key outputs #:allow-other-keys)
2207 (let* ((out (assoc-ref outputs "out"))
2208 (bin (string-append out "/bin"))
2209 (lib (string-append out "/lib"))
2210 ;; This is where LibreOffice expects to find the header
2211 ;; files, and where they are installed by Debian.
2212 (include (string-append out "/include/lpsolve")))
2213 (mkdir-p lib)
2214 (copy-file "lpsolve55/bin/ux64/liblpsolve55.a"
2215 (string-append lib "/liblpsolve55.a"))
2216 (copy-file "lpsolve55/bin/ux64/liblpsolve55.so"
2217 (string-append lib "/liblpsolve55.so"))
2218 (install-file "lp_solve/bin/ux64/lp_solve" bin)
2219
2220 ;; Install a subset of the header files as on Debian
2221 ;; (plus lp_bit.h, which matches the regular expression).
2222 (for-each (lambda (name)
2223 (install-file name include))
2224 (find-files "." "lp_[HMSa-z].*\\.h$"))
2225 (with-directory-excursion "shared"
2226 (for-each (lambda (name)
2227 (install-file name include))
2228 (find-files "." "\\.h$")))
2229 #t))))))
2230 (home-page "http://lpsolve.sourceforge.net/")
2231 (synopsis "Mixed integer linear programming (MILP) solver")
2232 (description
2233 "lp_solve is a mixed integer linear programming solver based on the
2234 revised simplex and the branch-and-bound methods.")
2235 (license license:lgpl2.1+)))
2236
2237 (define-public dealii
2238 (package
2239 (name "dealii")
2240 (version "8.2.1")
2241 (source
2242 (origin
2243 (method url-fetch)
2244 (uri (string-append "https://github.com/dealii/dealii/releases/"
2245 "download/v" version "/dealii-" version ".tar.gz"))
2246 (sha256
2247 (base32
2248 "185jych0gdnpkjwxni7pd0dda149492zwq2457xdjg76bzj78mnp"))
2249 (patches (search-patches "dealii-p4est-interface.patch"))
2250 (modules '((guix build utils)))
2251 (snippet
2252 ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
2253 '(delete-file-recursively "bundled"))))
2254 (build-system cmake-build-system)
2255 (inputs
2256 `(("tbb" ,tbb)
2257 ("zlib" ,zlib)
2258 ("boost" ,boost)
2259 ("p4est" ,p4est)
2260 ("blas" ,openblas)
2261 ("lapack" ,lapack)
2262 ("arpack" ,arpack-ng)
2263 ("muparser" ,muparser)
2264 ("gfortran" ,gfortran)
2265 ("suitesparse" ,suitesparse))) ;for UMFPACK
2266 (arguments
2267 `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease
2268 #:configure-flags '("-DCOMPAT_FILES=OFF") ;Follow new directory structure
2269 #:phases (modify-phases %standard-phases
2270 (add-after
2271 'install 'hint-example-prefix
2272 ;; Set Cmake hints in examples so that they can find this
2273 ;; deal.II when configuring.
2274 (lambda* (#:key outputs #:allow-other-keys)
2275 (let* ((out (assoc-ref %outputs "out"))
2276 (exmpl (string-append out "/share/doc"
2277 "/dealii/examples")))
2278 (substitute* (find-files exmpl "CMakeLists.txt")
2279 (("([[:space:]]*HINTS.*)\n" _ line)
2280 (string-append line " $ENV{HOME}/.guix-profile "
2281 out "\n")))
2282 #t))))))
2283 (home-page "https://www.dealii.org")
2284 (synopsis "Finite element library")
2285 (description
2286 "Deal.II is a C++ program library targeted at the computational solution
2287 of partial differential equations using adaptive finite elements. The main
2288 aim of deal.II is to enable rapid development of modern finite element codes,
2289 using among other aspects adaptive meshes and a wide array of tools often used
2290 in finite element programs.")
2291 (license license:lgpl2.1+)))
2292
2293 (define-public dealii-openmpi
2294 (package (inherit dealii)
2295 (name "dealii-openmpi")
2296 (inputs
2297 `(("mpi" ,openmpi)
2298 ;;Supported only with MPI:
2299 ("p4est" ,p4est-openmpi)
2300 ("petsc" ,petsc-openmpi)
2301 ("slepc" ,slepc-openmpi)
2302 ("metis" ,metis) ;for MUMPS
2303 ("scalapack" ,scalapack) ;for MUMPS
2304 ("mumps" ,mumps-metis-openmpi) ;configure supports only metis orderings
2305 ("arpack" ,arpack-ng-openmpi)
2306 ,@(fold alist-delete (package-inputs dealii)
2307 '("p4est" "arpack"))))
2308 (arguments
2309 (substitute-keyword-arguments (package-arguments dealii)
2310 ((#:configure-flags cf)
2311 ``("-DMPI_C_COMPILER=mpicc"
2312 "-DMPI_CXX_COMPILER=mpicxx"
2313 "-DMPI_Fortran_COMPILER=mpifort"
2314 ,@,cf))))
2315 (synopsis "Finite element library (with MPI support)")))
2316
2317 (define-public flann
2318 (package
2319 (name "flann")
2320 (version "1.8.4")
2321 (source
2322 (origin
2323 (method url-fetch)
2324 (uri
2325 (string-append
2326 "http://www.cs.ubc.ca/research/flann/uploads/FLANN/flann-"
2327 version "-src.zip"))
2328 (sha256
2329 (base32
2330 "022w8hph7bli5zbpnk3z1qh1c2sl5hm8fw2ccim651ynn0hr7fyz"))))
2331 (build-system cmake-build-system)
2332 (native-inputs
2333 `(("unzip" ,unzip)))
2334 (inputs
2335 `(("hdf5" ,hdf5)
2336 ("octave" ,octave)
2337 ("python" ,python-2) ; print syntax
2338 ;; ("python2-numpy" ,python2-numpy) ; only required for the tests
2339 ("zlib" ,zlib)))
2340 (arguments
2341 `(;; The 'share/flann/octave' contains a .mex file, which is an ELF file
2342 ;; taken 46 MiB unstripped, and 6 MiB stripped.
2343 #:strip-directories '("lib" "lib64" "libexec"
2344 "bin" "sbin" "share/flann/octave")
2345
2346 ;; Save 12 MiB by not installing .a files. Passing
2347 ;; '-DBUILD_STATIC_LIBS=OFF' has no effect.
2348 #:phases (modify-phases %standard-phases
2349 (add-after 'install 'remove-static-libraries
2350 (lambda* (#:key outputs #:allow-other-keys)
2351 (let* ((out (assoc-ref outputs "out"))
2352 (lib (string-append out "/lib")))
2353 (for-each delete-file
2354 (find-files lib "\\.a$"))
2355 #t))))
2356
2357 #:tests? #f)) ; The test data are downloaded from the Internet.
2358 (home-page "http://www.cs.ubc.ca/research/flann/")
2359 (synopsis "Library for approximate nearest neighbors computation")
2360 (description "FLANN is a library for performing fast approximate
2361 nearest neighbor searches in high dimensional spaces. It implements a
2362 collection of algorithms and a system for automatically choosing the best
2363 algorithm and optimum parameters depending on the dataset.
2364
2365 FLANN is written in C++ and contains bindings for C, Octave and Python.")
2366 (license (license:non-copyleft "file://COPYING"
2367 "See COPYING in the distribution."))))
2368
2369 (define-public wcalc
2370 (package
2371 (name "wcalc")
2372 (version "2.5")
2373 (source
2374 (origin
2375 (method url-fetch)
2376 (uri (string-append "mirror://sourceforge/w-calc/Wcalc/" version "/"
2377 "wcalc-" version ".tar.bz2"))
2378 (sha256
2379 (base32
2380 "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
2381 (build-system gnu-build-system)
2382 (inputs
2383 `(("mpfr" ,mpfr)
2384 ("readline" ,readline)))
2385 (home-page "http://w-calc.sourceforge.net/index.php")
2386 (synopsis "Flexible command-line scientific calculator")
2387 (description "Wcalc is a very capable calculator. It has standard functions
2388 (sin, asin, and sinh for example, in either radians or degrees), many
2389 pre-defined constants (pi, e, c, etc.), support for using variables, \"active\"
2390 variables, a command history, hex/octal/binary input and output, unit
2391 conversions, embedded comments, and an expandable expression entry field. It
2392 evaluates expressions using the standard order of operations.")
2393 (license license:gpl2+)))
2394
2395 (define-public xaos
2396 (package
2397 (name "xaos")
2398 (version "3.6")
2399 (source (origin
2400 (method url-fetch)
2401 (uri (string-append "mirror://sourceforge/xaos/XaoS/" version
2402 "/xaos-" version ".tar.gz"))
2403 (sha256
2404 (base32
2405 "15cd1cx1dyygw6g2nhjqq3bsfdj8sj8m4va9n75i0f3ryww3x7wq"))))
2406 (build-system gnu-build-system)
2407 (native-inputs `(("gettext" ,gnu-gettext)))
2408 (inputs `(("libx11" ,libx11)
2409 ("zlib" ,zlib)
2410 ("libpng" ,libpng)
2411 ("gsl" ,gsl)))
2412 (arguments
2413 `(#:tests? #f ;no "check" target
2414 #:make-flags '("LOCALEDIR=$DATAROOTDIR/locale")))
2415 (synopsis "Real-time fractal zoomer")
2416 (description "GNU XaoS is a graphical program that generates fractal
2417 patterns and allows you to zoom in and out of them infinitely in a fluid,
2418 continuous manner. It also includes tutorials that help to explain how fractals
2419 are built. It can generate many different fractal types such as the Mandelbrot
2420 set.")
2421 (home-page "http://www.gnu.org/software/xaos/")
2422 (license license:gpl2+)))
2423
2424 (define-public hypre
2425 (package
2426 (name "hypre")
2427 (version "2.11.0")
2428 (source (origin
2429 (method url-fetch)
2430 (uri (string-append "https://github.com/LLNL/hypre/archive/"
2431 "v" version ".tar.gz"))
2432 (file-name (string-append name "-" version ".tar.gz"))
2433 (sha256
2434 (base32
2435 "0q69ia0jivzcr8p049dn3mg8yjpn6nwq4sw9iqac8vr63vi54l6m"))
2436 (modules '((guix build utils)))
2437 (snippet
2438 '(begin
2439 ;; Remove use of __DATE__ and __TIME__ for reproducibility;
2440 ;; substitute the tarball creation time.
2441 (substitute* "src/utilities/HYPRE_utilities.h"
2442 (("Date Compiled: .*$")
2443 "Date Compiled: Mar 28 2016 20:19:59 +0000\"\n"))
2444 #t))))
2445 (build-system gnu-build-system)
2446 (outputs '("out" ;6.1 MiB of headers and libraries
2447 "doc")) ;4.8 MiB of documentation
2448 (native-inputs
2449 `(("doc++" ,doc++)
2450 ("netpbm" ,netpbm)
2451 ("texlive" ,texlive) ;full package required for fonts
2452 ("ghostscript" ,ghostscript)))
2453 (inputs
2454 `(("blas" ,openblas)
2455 ("lapack" ,lapack)))
2456 (arguments
2457 `(#:modules ((srfi srfi-1)
2458 ,@%gnu-build-system-modules)
2459 #:configure-flags '("--enable-shared"
2460 "--disable-fortran"
2461 "--without-MPI"
2462 "--with-openmp"
2463 "--with-fei"
2464 "--with-lapack"
2465 "--with-blas")
2466 #:phases
2467 (modify-phases %standard-phases
2468 (add-before 'configure 'chdir-src
2469 (lambda _ (chdir "src")))
2470 (replace 'configure
2471 (lambda* (#:key build target configure-flags
2472 #:allow-other-keys #:rest args)
2473 (let* ((configure (assoc-ref %standard-phases 'configure)))
2474 (apply configure
2475 (append args
2476 (list #:configure-flags
2477 (cons (string-append
2478 "--host=" (or target build))
2479 configure-flags)))))))
2480 (add-after 'build 'build-docs
2481 (lambda _
2482 (zero? (system* "make" "-Cdocs" "pdf" "html"))))
2483 (replace 'check
2484 (lambda _
2485 (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/hypre/lib"))
2486 (setenv "PATH" (string-append "." ":" (getenv "PATH")))
2487 (and (system* "make" "check" "CHECKRUN=")
2488 (fold (lambda (filename result)
2489 (and result
2490 (let ((size (stat:size (stat filename))))
2491 (when (not (zero? size))
2492 (format #t "~a size ~d; error indication~%"
2493 filename size))
2494 (zero? size))))
2495 #t
2496 (find-files "test" ".*\\.err$")))))
2497 (add-after 'install 'install-docs
2498 (lambda* (#:key outputs #:allow-other-keys)
2499 ;; Custom install because docs/Makefile doesn't honor ${docdir}.
2500 (let* ((doc (assoc-ref outputs "doc"))
2501 (docdir (string-append doc "/share/doc/hypre-" ,version)))
2502 (mkdir-p docdir)
2503 (with-directory-excursion "docs"
2504 (for-each (lambda (base)
2505 (install-file (string-append base ".pdf") docdir)
2506 (copy-recursively base docdir)) ;html docs
2507 '("HYPRE_usr_manual"
2508 "HYPRE_ref_manual")))
2509 #t))))))
2510 (home-page "http://www.llnl.gov/casc/hypre/")
2511 (synopsis "Library of solvers and preconditioners for linear equations")
2512 (description
2513 "HYPRE is a software library of high performance preconditioners and
2514 solvers for the solution of large, sparse linear systems of equations. It
2515 features multigrid solvers for both structured and unstructured grid
2516 problems.")
2517 (license license:lgpl2.1)))
2518
2519 (define-public hypre-openmpi
2520 (package (inherit hypre)
2521 (name "hypre-openmpi")
2522 (inputs
2523 `(("mpi" ,openmpi)
2524 ,@(package-inputs hypre)))
2525 (arguments
2526 (substitute-keyword-arguments (package-arguments hypre)
2527 ((#:configure-flags flags)
2528 ``("--with-MPI"
2529 ,@(delete "--without-MPI" ,flags)))))
2530 (synopsis "Parallel solvers and preconditioners for linear equations")
2531 (description
2532 "HYPRE is a software library of high performance preconditioners and
2533 solvers for the solution of large, sparse linear systems of equations on
2534 parallel computers. It features parallel multigrid solvers for both
2535 structured and unstructured grid problems.")))
2536
2537 (define-public matio
2538 (package
2539 (name "matio")
2540 (version "1.5.6")
2541 (source
2542 (origin
2543 (method url-fetch)
2544 (uri (string-append "mirror://sourceforge/matio/matio/" version "/"
2545 "matio-" version ".tar.gz"))
2546 (sha256
2547 (base32
2548 "0y2qymgxank8wdiwc68ap8bxdzrhvyw86i29yh3xgn4z1njfd9ir"))))
2549 (build-system gnu-build-system)
2550 (inputs
2551 `(("zlib" ,zlib)
2552 ("hdf5" ,hdf5)))
2553 (home-page "http://matio.sourceforge.net/")
2554 (synopsis "Library for reading and writing MAT files")
2555 (description "Matio is a library for reading and writing MAT files. It
2556 supports compressed MAT files, as well as newer (version 7.3) MAT files.")
2557 (license license:bsd-2)))
2558
2559 (define-public libhilbert
2560 (package
2561 (name "libhilbert")
2562 (version "0.2-1")
2563 (source
2564 (origin
2565 (method url-fetch)
2566 (uri (string-append "http://web.cs.dal.ca/~chamilto/hilbert/"
2567 "libhilbert-" version ".tar.gz"))
2568 (sha256
2569 (base32
2570 "0v48x8405dj95gjn2saja4bzhw86d6zl6d3dg8h7dzac2qr97s34"))))
2571 (build-system gnu-build-system)
2572 (home-page "http://web.cs.dal.ca/~chamilto/hilbert")
2573 (synopsis "Hilbert indices for multidimensional data")
2574 (description "The libhilbert library can efficiently calculate Hilbert
2575 curves and order-preserving representations of Hilbert curve indices that use
2576 the same amount of space as the original point representation. This is useful
2577 when using the Gilbert curve as a space filling curve through a
2578 high-dimensional space where not all demensions have the same cardinality.")
2579 (license license:lgpl2.1+)))