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