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