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