gnu: gzochi: Update to 0.10.
[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")
0534dd93 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
0534dd93 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")
b7b27a8f 695 (version "4.0.2")
668c06ac
JD
696 (source
697 (origin
698 (method url-fetch)
699 (uri (string-append "mirror://gnu/octave/octave-"
a124bbd2 700 version ".tar.gz"))
668c06ac
JD
701 (sha256
702 (base32
b7b27a8f 703 "1hdxap3j88rpqjimnfhinym6z73wdi5dfa6fv85c13r1dk9qzk9r"))))
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 ("curl" ,curl)
713 ("pcre" ,pcre)
b7b27a8f 714 ("cyrus-sasl" ,cyrus-sasl)
668c06ac
JD
715 ("fltk" ,fltk)
716 ("fontconfig" ,fontconfig)
717 ("freetype" ,freetype)
40029cbe 718 ("hdf5" ,hdf5)
668c06ac
JD
719 ("libxft" ,libxft)
720 ("mesa" ,mesa)
1ec78e9d 721 ("glu" ,glu)
b7b27a8f 722 ("openssl" ,openssl)
668c06ac
JD
723 ("zlib" ,zlib)))
724 (native-inputs
19afbea1 725 `(("gfortran" ,gfortran)
668c06ac
JD
726 ("pkg-config" ,pkg-config)
727 ("perl" ,perl)
1ec78e9d
EB
728 ;; The following inputs are not actually used in the build process.
729 ;; However, the ./configure gratuitously tests for their existence and
730 ;; assumes that programs not present at build time are also not, and
731 ;; can never be, available at run time! If these inputs are therefore
732 ;; not present, support for them will be built out. However, Octave
733 ;; will still run without them, albeit without the features they
668c06ac
JD
734 ;; provide.
735 ("less" ,less)
736 ("texinfo" ,texinfo)
737 ("ghostscript" ,ghostscript)
738 ("gnuplot" ,gnuplot)))
739 (arguments
b7b27a8f
KY
740 `(#:configure-flags
741 (list (string-append "--with-shell="
742 (assoc-ref %build-inputs "bash")
743 "/bin/sh"))))
668c06ac
JD
744 (home-page "http://www.gnu.org/software/octave/")
745 (synopsis "High-level language for numerical computation")
1ec78e9d
EB
746 (description "GNU Octave is a high-level interpreted language that is
747specialized for numerical computations. It can be used for both linear and
748non-linear applications and it provides great support for visualizing results.
749Work may be performed both at the interactive command-line as well as via
750script files.")
668c06ac 751 (license license:gpl3+)))
3de01d3f
EB
752
753(define-public gmsh
754 (package
755 (name "gmsh")
c7b08410 756 (version "2.11.0")
3de01d3f
EB
757 (source
758 (origin
759 (method url-fetch)
760 (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
761 version "-source.tgz"))
762 (sha256
c7b08410 763 (base32 "1ilplibvjgf7a905grpnclrvkmqy9fgrpl7xyp3w4yl1qc682v9b"))
3de01d3f
EB
764 (modules '((guix build utils)))
765 (snippet
766 ;; Remove non-free METIS code
767 '(delete-file-recursively "contrib/Metis"))))
768 (build-system cmake-build-system)
3de01d3f
EB
769 (propagated-inputs
770 `(("fltk" ,fltk)
19afbea1 771 ("gfortran" ,gfortran)
3de01d3f 772 ("gmp" ,gmp)
40029cbe 773 ("hdf5" ,hdf5)
3de01d3f
EB
774 ("lapack" ,lapack)
775 ("mesa" ,mesa)
85f41902 776 ("glu" ,glu)
3de01d3f
EB
777 ("libx11" ,libx11)
778 ("libxext" ,libxext)))
66395a61
EF
779 (inputs
780 `(("fontconfig" ,fontconfig)
781 ("libxft" ,libxft)))
3de01d3f
EB
782 (arguments
783 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
784 "-DENABLE_BUILD_SHARED:BOOL=ON"
c7b08410
EB
785 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")
786 #:phases (modify-phases %standard-phases
787 (replace
788 'check
789 (lambda _
790 (zero? (system* "make" "test"
791 ;; Disable this test. See
792 ;; https://geuz.org/trac/gmsh/ticket/271
793 "ARGS=-E component8_in_a_box")))))))
3de01d3f
EB
794 (home-page "http://www.geuz.org/gmsh/")
795 (synopsis "3D finite element grid generator")
edf684ef
EB
796 (description "Gmsh is a 3D finite element grid generator with a built-in
797CAD engine and post-processor. Its design goal is to provide a fast, light
798and user-friendly meshing tool with parametric input and advanced
799visualization capabilities. Gmsh is built around four modules: geometry,
800mesh, solver and post-processing. The specification of any input to these
801modules is done either interactively using the graphical user interface or in
802ASCII text files using Gmsh's own scripting language.")
3de01d3f 803 (license license:gpl2+)))
b9100e2f
EB
804
805(define-public petsc
806 (package
807 (name "petsc")
fafd623e 808 (version "3.7.2")
b9100e2f
EB
809 (source
810 (origin
811 (method url-fetch)
812 ;; The *-lite-* tarball does not contain the *large* documentation
813 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
814 "petsc-lite-" version ".tar.gz"))
815 (sha256
fafd623e 816 (base32 "0jfrq6rd4zagw1iimz05m2w91k0jvz3qbik1lk8pqcxw3rvdqk5d"))))
b9100e2f
EB
817 (build-system gnu-build-system)
818 (native-inputs
819 `(("python" ,python-2)
820 ("perl" ,perl)))
821 (inputs
19afbea1 822 `(("gfortran" ,gfortran)
b9100e2f 823 ("lapack" ,lapack)
f258212d 824 ("superlu" ,superlu)
b9100e2f
EB
825 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
826 ;; leaving out opengl, as configuration seems to only be for mac
827 ))
828 (arguments
829 `(#:test-target "test"
9a899cce 830 #:parallel-build? #f ;build is parallel by default
b9100e2f
EB
831 #:configure-flags
832 `("--with-mpi=0"
f258212d
EB
833 "--with-openmp=1"
834 "--with-superlu=1"
835 ,(string-append "--with-superlu-include="
836 (assoc-ref %build-inputs "superlu") "/include")
837 ,(string-append "--with-superlu-lib="
838 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
b9100e2f 839 #:phases
64dcc289
EB
840 (modify-phases %standard-phases
841 (replace 'configure
842 ;; PETSc's configure script is actually a python script, so we can't
843 ;; run it with bash.
844 (lambda* (#:key outputs (configure-flags '())
845 #:allow-other-keys)
846 (let* ((prefix (assoc-ref outputs "out"))
847 (flags `(,(string-append "--prefix=" prefix)
848 ,@configure-flags)))
849 (format #t "build directory: ~s~%" (getcwd))
850 (format #t "configure flags: ~s~%" flags)
851 (zero? (apply system* "./configure" flags)))))
852 (add-after 'configure 'clean-local-references
64dcc289
EB
853 (lambda* (#:key inputs outputs #:allow-other-keys)
854 (let ((out (assoc-ref outputs "out")))
855 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
b730b437
EB
856 ;; Prevent build directory from leaking into compiled code
857 (((getcwd)) out)
858 ;; Scrub timestamp for reproducibility
fafd623e
EB
859 ((".*Libraries compiled on.*") ""))
860 #t)))
64dcc289 861 (add-after 'install 'clean-install
10b11968
EB
862 ;; Try to keep installed files from leaking build directory names.
863 (lambda* (#:key inputs outputs #:allow-other-keys)
64dcc289 864 (let ((out (assoc-ref outputs "out")))
10b11968 865 (substitute* (map (lambda (file)
9a899cce 866 (string-append out "/lib/petsc/conf/" file))
fafd623e 867 '("petscvariables"))
10b11968
EB
868 (((getcwd)) out))
869 ;; Make compiler references point to the store
9a899cce 870 (substitute* (string-append out "/lib/petsc/conf/petscvariables")
dfdf5716
EB
871 (("= (gcc|g\\+\\+|gfortran)" _ compiler)
872 (string-append "= " (which compiler))))
10b11968
EB
873 ;; PETSc installs some build logs, which aren't necessary.
874 (for-each (lambda (file)
9a899cce 875 (let ((f (string-append out "/lib/petsc/conf/" file)))
10b11968
EB
876 (when (file-exists? f)
877 (delete-file f))))
9a899cce
EB
878 '("configure.log" "make.log" "gmake.log"
879 "test.log" "error.log" "RDict.db"
fafd623e 880 "PETScBuildInternal.cmake"
10b11968 881 ;; Once installed, should uninstall with Guix
fafd623e
EB
882 "uninstall.py"))
883 #t))))))
b9100e2f 884 (home-page "http://www.mcs.anl.gov/petsc")
16ecf3ff 885 (synopsis "Library to solve PDEs")
b9100e2f
EB
886 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
887data structures and routines for the scalable (parallel) solution of
888scientific applications modeled by partial differential equations.")
166191b3 889 (license (license:non-copyleft
b9100e2f
EB
890 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
891
892(define-public petsc-complex
893 (package (inherit petsc)
894 (name "petsc-complex")
895 (arguments
896 (substitute-keyword-arguments (package-arguments petsc)
897 ((#:configure-flags cf)
898 `(cons "--with-scalar-type=complex" ,cf))))
16ecf3ff 899 (synopsis "Library to solve PDEs (with complex scalars)")))
183e44ae 900
d8c7eeb9
EB
901(define-public petsc-openmpi
902 (package (inherit petsc)
903 (name "petsc-openmpi")
904 (inputs
905 `(("openmpi" ,openmpi)
906 ,@(package-inputs petsc)))
907 (arguments
908 (substitute-keyword-arguments (package-arguments petsc)
909 ((#:configure-flags cf)
910 ``("--with-mpiexec=mpirun"
911 ,(string-append "--with-mpi-dir="
912 (assoc-ref %build-inputs "openmpi"))
913 ,@(delete "--with-mpi=0" ,cf)))))
16ecf3ff 914 (synopsis "Library to solve PDEs (with MPI support)")))
d8c7eeb9
EB
915
916(define-public petsc-complex-openmpi
917 (package (inherit petsc-complex)
918 (name "petsc-complex-openmpi")
919 (inputs
920 `(("openmpi" ,openmpi)
921 ,@(package-inputs petsc-complex)))
922 (arguments
923 (substitute-keyword-arguments (package-arguments petsc-complex)
924 ((#:configure-flags cf)
925 ``("--with-mpiexec=mpirun"
926 ,(string-append "--with-mpi-dir="
927 (assoc-ref %build-inputs "openmpi"))
928 ,@(delete "--with-mpi=0" ,cf)))))
16ecf3ff 929 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
d8c7eeb9 930
a7f01414
EB
931(define-public slepc
932 (package
933 (name "slepc")
8787c555 934 (version "3.7.1")
a7f01414
EB
935 (source
936 (origin
937 (method url-fetch)
938 (uri (string-append "http://slepc.upv.es/download/download.php?"
939 "filename=slepc-" version ".tar.gz"))
d588422e 940 (file-name (string-append name "-" version ".tar.gz"))
a7f01414
EB
941 (sha256
942 (base32
8787c555 943 "1hijlmrvxvfqslnx8yydzw5xqbsn1yy02g32w0hln1z3cgr1c0k7"))))
a7f01414
EB
944 (build-system gnu-build-system)
945 (native-inputs
946 `(("python" ,python-2)))
947 (inputs
948 `(("arpack" ,arpack-ng)
949 ("gfortran" ,gfortran)))
950 (propagated-inputs
951 `(("petsc" ,petsc)))
952 (arguments
953 `(#:parallel-build? #f ;build is parallel by default
954 #:configure-flags
955 `(,(string-append "--with-arpack-dir="
9cf52454 956 (assoc-ref %build-inputs "arpack") "/lib"))
a7f01414
EB
957 #:phases
958 (modify-phases %standard-phases
8787c555 959 (replace 'configure
a7f01414
EB
960 ;; configure is a python script, so we can't run it with bash.
961 (lambda* (#:key inputs outputs (configure-flags '())
962 #:allow-other-keys)
963 (let* ((prefix (assoc-ref outputs "out"))
964 (flags `(,(string-append "--prefix=" prefix)
965 ,@configure-flags)))
966 (format #t "build directory: ~s~%" (getcwd))
967 (format #t "configure flags: ~s~%" flags)
968 (setenv "SLEPC_DIR" (getcwd))
9cf52454 969 (setenv "PETSC_DIR" (assoc-ref inputs "petsc"))
a7f01414 970 (zero? (apply system* "./configure" flags)))))
8787c555 971 (add-after 'install 'delete-doc
a7f01414
EB
972 ;; TODO: SLEPc installs HTML documentation alongside headers in
973 ;; $out/include. We'd like to move them to share/doc, but delete
974 ;; them for now, as they are incomplete and installing the complete
975 ;; documentation is difficult.
976 (lambda* (#:key outputs #:allow-other-keys)
977 (let* ((out (assoc-ref outputs "out")))
978 (for-each delete-file (find-files out "\\.html$")))))
8787c555 979 (add-after 'install 'clean-install
a7f01414
EB
980 ;; Clean up unnecessary build logs from installation.
981 (lambda* (#:key outputs #:allow-other-keys)
982 (let ((out (assoc-ref outputs "out")))
983 (for-each (lambda (file)
984 (let ((f (string-append out "/lib/slepc/conf/" file)))
985 (when (file-exists? f)
986 (delete-file f))))
987 '("configure.log" "make.log" "gmake.log"
988 "test.log" "error.log" "RDict.db"
989 "uninstall.py"))))))))
990 (home-page "http://slepc.upv.es")
991 (synopsis "Scalable library for eigenproblems")
992 (description "SLEPc is a software library for the solution of large sparse
993eigenproblems on parallel computers. It can be used for the solution of
994linear eigenvalue problems formulated in either standard or generalized form,
995as well as other related problems such as the singular value decomposition.
996The emphasis of the software is on methods and techniques appropriate for
997problems in which the associated matrices are sparse, for example, those
998arising after the discretization of partial differential equations.")
999 (license license:lgpl3)))
1000
1001(define-public slepc-complex
1002 (package (inherit slepc)
1003 (name "slepc-complex")
1004 (propagated-inputs
1005 `(("petsc" ,petsc-complex)
1006 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
1007 (synopsis "Scalable library for eigenproblems (with complex scalars)")))
1008
1009(define-public slepc-openmpi
1010 (package (inherit slepc)
1011 (name "slepc-openmpi")
1012 (inputs
1013 `(("mpi" ,openmpi)
1014 ("arpack" ,arpack-ng-openmpi)
1015 ,@(alist-delete "arpack" (package-inputs slepc))))
1016 (propagated-inputs
1017 `(("petsc" ,petsc-openmpi)
1018 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
1019 (synopsis "Scalable library for eigenproblems (with MPI support)")))
1020
1021(define-public slepc-complex-openmpi
1022 (package (inherit slepc-openmpi)
1023 (name "slepc-complex-openmpi")
1024 (propagated-inputs
1025 `(("petsc" ,petsc-complex-openmpi)
1026 ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
1027 (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
1028
cec86422
EB
1029(define-public mumps
1030 (package
1031 (name "mumps")
c69fa438 1032 (version "5.0.1")
cec86422
EB
1033 (source
1034 (origin
1035 (method url-fetch)
1036 (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
1037 version ".tar.gz"))
1038 (sha256
1039 (base32
c69fa438 1040 "1820jfp3mbl7n85765v5mp6p0gzqpgr4d2lrnhwj4gl7cwp5ndah"))
fc1adab1 1041 (patches (search-patches "mumps-build-parallelism.patch"))))
cec86422
EB
1042 (build-system gnu-build-system)
1043 (inputs
1044 `(("fortran" ,gfortran)
1045 ;; These are required for linking against mumps, but we let the user
1046 ;; declare the dependency.
1047 ("blas" ,openblas)
1048 ("metis" ,metis)
1049 ("scotch" ,scotch)))
1050 (arguments
1051 `(#:modules ((ice-9 match)
1052 (ice-9 popen)
1053 (srfi srfi-1)
1054 ,@%gnu-build-system-modules)
1055 #:phases
1056 (modify-phases %standard-phases
1057 (replace
1058 'configure
1059 (lambda* (#:key inputs #:allow-other-keys)
1060 (call-with-output-file "Makefile.inc"
1061 (lambda (port)
1062 (format port "
1063PLAT =
1064LIBEXT = .a
1065OUTC = -o
1066OUTF = -o
1067RM = rm -f~:[
1068CC = gcc
1069FC = gfortran
1070FL = gfortran
1071INCSEQ = -I$(topdir)/libseq
1072LIBSEQ = -L$(topdir)/libseq -lmpiseq
1073LIBSEQNEEDED = libseqneeded~;
1074CC = mpicc
1075FC = mpifort
1076FL = mpifort~]
1077AR = ar vr # rules require trailing space, ugh...
1078RANLIB = ranlib
1079LIBBLAS = -L~a -lopenblas~@[
1080SCALAP = -L~a -lscalapack~]
1081LIBOTHERS = -pthread
1082CDEFS = -DAdd_
1083PIC = -fPIC
1084OPTF = -O2 -DALLOW_NON_INIT $(PIC)
1085OPTL = -O2 $(PIC)
1086OPTC = -O2 $(PIC)
1087INCS = $(INCSEQ)
1088LIBS = $(SCALAP) $(LIBSEQ)
1089LPORDDIR = $(topdir)/PORD/lib
1090IPORD = -I$(topdir)/PORD/include
1091LPORD = -L$(LPORDDIR) -lpord
1092ORDERINGSF = -Dpord~@[
1093METISDIR = ~a
1094IMETIS = -I$(METISDIR)/include
1095LMETIS = -L$(METISDIR)/lib -lmetis
1096ORDERINGSF += -Dmetis~]~@[~:{
1097SCOTCHDIR = ~a
1098ISCOTCH = -I$(SCOTCHDIR)/include
1099LSCOTCH = -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
1100ORDERINGSF += ~a~}~]
1101ORDERINGSC = $(ORDERINGSF)
1102LORDERINGS = $(LPORD) $(LMETIS) $(LSCOTCH)
1103IORDERINGSF = $(ISCOTCH)
1104IORDERINGSC = $(IPORD) $(IMETIS) $(ISCOTCH)"
1105 (assoc-ref inputs "mpi")
1106 (assoc-ref inputs "blas")
1107 (assoc-ref inputs "scalapack")
1108 (assoc-ref inputs "metis")
1109 (match (list (assoc-ref inputs "pt-scotch")
1110 (assoc-ref inputs "scotch"))
1111 ((#f #f)
1112 #f)
1113 ((#f scotch)
1114 `((,scotch "" "-Dscotch")))
1115 ((ptscotch _)
1116 `((,ptscotch
1117 "-lptesmumps -lptscotch -lptscotcherr "
1118 "-Dptscotch")))))))))
1119 (replace
1120 'build
1121 ;; By default only the d-precision library is built. Make with "all"
1122 ;; target so that all precision libraries and examples are built.
1123 (lambda _
1124 (zero? (system* "make" "all"
1125 (format #f "-j~a" (parallel-job-count))))))
1126 (replace
1127 'check
1128 ;; Run the simple test drivers, which read test input from stdin:
1129 ;; from the "real" input for the single- and double-precision
1130 ;; testers, and from the "cmplx" input for complex-precision
1131 ;; testers. The EXEC-PREFIX key is used by the mumps-openmpi
1132 ;; package to prefix execution with "mpirun".
1133 (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
1134 (with-directory-excursion "examples"
1135 (every
1136 (lambda (prec type)
1137 (let ((tester (apply open-pipe*
1138 `(,OPEN_WRITE
1139 ,@exec-prefix
1140 ,(string-append "./" prec
1141 "simpletest"))))
1142 (input (open-input-file
1143 (string-append "input_simpletest_" type))))
1144 (begin
1145 (dump-port input tester)
1146 (close-port input)
1147 (zero? (close-pipe tester)))))
1148 '("s" "d" "c" "z")
1149 '("real" "real" "cmplx" "cmplx")))))
1150 (replace
1151 'install
1152 (lambda* (#:key outputs #:allow-other-keys)
1153 (let ((out (assoc-ref outputs "out")))
1154 (copy-recursively "lib" (string-append out "/lib"))
1155 (copy-recursively "include" (string-append out "/include"))
1156 (when (file-exists? "libseq/libmpiseq.a")
1157 (copy-file "libseq/libmpiseq.a"
1158 (string-append out "/lib/libmpiseq.a")))))))))
1159 (home-page "http://mumps.enseeiht.fr")
1160 (synopsis "Multifrontal sparse direct solver")
1161 (description
1162 "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
1163sparse system of linear equations A x = b using Guassian elimination.")
1164 (license license:cecill-c)))
1165
1166(define-public mumps-metis
1167 (package (inherit mumps)
1168 (name "mumps-metis")
1169 (inputs
1170 (alist-delete "scotch" (package-inputs mumps)))))
1171
1172(define-public mumps-openmpi
1173 (package (inherit mumps)
1174 (name "mumps-openmpi")
1175 (inputs
1176 `(("mpi" ,openmpi)
1177 ("scalapack" ,scalapack)
1178 ("pt-scotch" ,pt-scotch)
1179 ,@(alist-delete "scotch" (package-inputs mumps))))
1180 (arguments
1181 (substitute-keyword-arguments (package-arguments mumps)
1182 ((#:phases phases)
1183 `(modify-phases ,phases
1184 (replace
1185 'check
1186 (lambda _
1187 ((assoc-ref ,phases 'check)
1188 #:exec-prefix '("mpirun" "-n" "2"))))))))
1189 (synopsis "Multifrontal sparse direct solver (with MPI)")))
1190
1191(define-public mumps-metis-openmpi
1192 (package (inherit mumps-openmpi)
1193 (name "mumps-metis-openmpi")
1194 (inputs
1195 (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
1196
ec8c7e47
RJ
1197(define-public r-pracma
1198 (package
1199 (name "r-pracma")
1200 (version "1.8.8")
1201 (source (origin
1202 (method url-fetch)
1203 (uri (cran-uri "pracma" version))
1204 (sha256
1205 (base32 "0ans9l5rrb7a38gyi4qx4258sd5r5668vyrk02yzjpg9k3h8l165"))))
1206 (build-system r-build-system)
1207 (home-page "http://cran.r-project.org/web/packages/pracma")
1208 (synopsis "Practical numerical math functions")
1209 (description "This package provides functions for numerical analysis and
1210linear algebra, numerical optimization, differential equations, plus some
1211special functions. It uses Matlab function names where appropriate to simplify
1212porting.")
1213 (license license:gpl3+)))
1214
183e44ae
EB
1215(define-public superlu
1216 (package
1217 (name "superlu")
995a09e0 1218 (version "5.2.1")
183e44ae
EB
1219 (source
1220 (origin
1221 (method url-fetch)
1222 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
1223 "superlu_" version ".tar.gz"))
1224 (sha256
995a09e0
EB
1225 (base32 "0qzlb7cd608q62kyppd0a8c65l03vrwqql6gsm465rky23b6dyr8"))
1226 (modules '((guix build utils)))
1227 (snippet
1228 ;; Replace the non-free implementation of MC64 with a stub adapted
1229 ;; from Debian
1230 '(begin
1231 (use-modules (ice-9 regex)
1232 (ice-9 rdelim))
1233 (call-with-output-file "SRC/mc64ad.c"
1234 (lambda (port)
1235 (display "
1236#include <stdio.h>
1237#include <stdlib.h>
1238void mc64id_(int *a) {
1239 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
1240 abort ();
1241}
1242void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
1243 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
1244 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
1245 abort ();
1246}\n" port)))
1247 ;; Remove the corresponding license verbiage. MC64 license follows
1248 ;; a "------" line separator.
1249 (with-atomic-file-replacement "License.txt"
1250 (let ((rx (make-regexp "-{8}")))
1251 (lambda (in out)
1252 (let loop ()
1253 (let ((line (read-line in 'concat)))
1254 (unless (regexp-exec rx line)
1255 (display line out)
1256 (loop)))))))))))
1257 (build-system cmake-build-system)
183e44ae
EB
1258 (native-inputs
1259 `(("tcsh" ,tcsh)))
1260 (inputs
995a09e0 1261 `(("blas" ,openblas)
19afbea1 1262 ("gfortran" ,gfortran)))
183e44ae 1263 (arguments
995a09e0
EB
1264 `(#:configure-flags '("-Denable_blaslib:BOOL=NO" ;do not use internal cblas
1265 "-DTPL_BLAS_LIBRARIES=openblas"
1266 "-DBUILD_SHARED_LIBS:BOOL=YES"
1267 "-DCMAKE_INSTALL_LIBDIR=lib")))
183e44ae
EB
1268 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
1269 (synopsis "Supernodal direct solver for sparse linear systems")
1270 (description
1271 "SuperLU is a general purpose library for the direct solution of large,
1272sparse, nonsymmetric systems of linear equations on high performance machines.
1273The library is written in C and is callable from either C or Fortran. The
1274library routines perform an LU decomposition with partial pivoting and
1275triangular system solves through forward and back substitution. The library
1276also provides threshold-based ILU factorization preconditioners.")
995a09e0
EB
1277 (license (list license:bsd-3
1278 license:gpl2+ ;EXAMPLE/*fgmr.c
1279 (license:fsf-free "file://SRC/colamd.h")))))
f8ed036a 1280
a54aefea
EB
1281(define-public superlu-dist
1282 (package
1283 (name "superlu-dist")
1284 (version "3.3")
1285 (source
1286 (origin
1287 (method url-fetch)
1288 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
1289 "superlu_dist_" version ".tar.gz"))
1290 (sha256
1291 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
29080870
EB
1292 (modules '((guix build utils)))
1293 (snippet
1294 ;; Replace the non-free implementation of MC64 with a stub
1295 '(begin
1296 (use-modules (ice-9 regex)
1297 (ice-9 rdelim))
1298 (call-with-output-file "SRC/mc64ad.c"
1299 (lambda (port)
1300 (display "
1301#include <stdio.h>
1302#include <stdlib.h>
1303void mc64id_(int *a) {
1304 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
1305 abort ();
1306}
1307void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
1308 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
1309 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
1310 abort ();
1311}\n" port)))
1312 (delete-file "SRC/mc64ad.f.bak")
1313 (substitute* "SRC/util.c" ;adjust default algorithm
1314 (("RowPerm[[:blank:]]*=[[:blank:]]*LargeDiag")
1315 "RowPerm = NOROWPERM"))))
fc1adab1 1316 (patches (search-patches "superlu-dist-scotchmetis.patch"))))
a54aefea
EB
1317 (build-system gnu-build-system)
1318 (native-inputs
1319 `(("tcsh" ,tcsh)))
1320 (inputs
19afbea1 1321 `(("gfortran" ,gfortran)))
a54aefea
EB
1322 (propagated-inputs
1323 `(("openmpi" ,openmpi) ;headers include MPI heades
1324 ("lapack" ,lapack) ;required to link with output library
1325 ("pt-scotch" ,pt-scotch))) ;same
1326 (arguments
1327 `(#:parallel-build? #f ;race conditions using ar
1328 #:phases
1329 (alist-replace
1330 'configure
1331 (lambda* (#:key inputs outputs #:allow-other-keys)
1332 (call-with-output-file "make.inc"
1333 (lambda (port)
1334 (format port "
1335PLAT =
1336DSuperLUroot = ~a
1337DSUPERLULIB = ~a/lib/libsuperlu_dist.a
1338BLASDEF = -DUSE_VENDOR_BLAS
1339BLASLIB = -L~a/lib -lblas
1340PARMETISLIB = -L~a/lib \
1341 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
1342 -lscotch -lscotcherr -lscotcherrexit
1343METISLIB = -L~:*~a/lib \
1344 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
1345LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
1346ARCH = ar
1347ARCHFLAGS = cr
1348RANLIB = ranlib
1349CC = mpicc
1350PIC = -fPIC
1351CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
1352NOOPTS = -O0 -g $(PIC)
1353FORTRAN = mpifort
1354FFLAGS = -O2 -g $(PIC)
1355LOADER = $(CC)
1356CDEFS = -DAdd_"
1357 (getcwd)
1358 (assoc-ref outputs "out")
1359 (assoc-ref inputs "lapack")
1360 (assoc-ref inputs "pt-scotch")))))
1361 (alist-cons-after
1362 'unpack 'remove-broken-symlinks
1363 (lambda _
1364 (for-each delete-file
1365 (find-files "MAKE_INC" "\\.#make\\..*")))
1366 (alist-cons-before
1367 'build 'create-install-directories
1368 (lambda* (#:key outputs #:allow-other-keys)
1369 (for-each
1370 (lambda (dir)
1371 (mkdir-p (string-append (assoc-ref outputs "out")
1372 "/" dir)))
1373 '("lib" "include")))
1374 (alist-replace
1375 'check
1376 (lambda _
1377 (with-directory-excursion "EXAMPLE"
1378 (and
1379 (zero? (system* "mpirun" "-n" "2"
1380 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
1381 (zero? (system* "mpirun" "-n" "2"
1382 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
1383 (alist-replace
1384 'install
1385 (lambda* (#:key outputs #:allow-other-keys)
1386 ;; Library is placed in lib during the build phase. Copy over
1387 ;; headers to include.
1388 (let* ((out (assoc-ref outputs "out"))
1389 (incdir (string-append out "/include")))
1390 (for-each (lambda (file)
1391 (let ((base (basename file)))
1392 (format #t "installing `~a' to `~a'~%"
1393 base incdir)
1394 (copy-file file
1395 (string-append incdir "/" base))))
1396 (find-files "SRC" ".*\\.h$"))))
1397 %standard-phases)))))))
1398 (home-page (package-home-page superlu))
1399 (synopsis "Parallel supernodal direct solver")
1400 (description
1401 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
1402It is targeted for distributed memory parallel machines. SuperLU_DIST is
1403implemented in ANSI C, and MPI for communications.")
1404 (license license:bsd-3)))
1405
f8ed036a
EB
1406(define-public scotch
1407 (package
1408 (name "scotch")
6c798540 1409 (version "6.0.4")
f8ed036a
EB
1410 (source
1411 (origin
1412 (method url-fetch)
6c798540 1413 (uri (string-append "https://gforge.inria.fr/frs/download.php/34618/"
f8ed036a
EB
1414 "scotch_" version ".tar.gz"))
1415 (sha256
6c798540 1416 (base32 "1ir088mvrqggyqdkx9qfynmiaffqbyih5qfl5mga2nrlm1qlsgzm"))
fc1adab1
AK
1417 (patches (search-patches "scotch-test-threading.patch"
1418 "pt-scotch-build-parallelism.patch"))))
f8ed036a
EB
1419 (build-system gnu-build-system)
1420 (inputs
1421 `(("zlib" ,zlib)
1422 ("flex" ,flex)
1423 ("bison" ,bison)))
1424 (arguments
1425 `(#:phases
d6602ee9
EB
1426 (modify-phases %standard-phases
1427 (add-after
1428 'unpack 'chdir-to-src
1429 (lambda _ (chdir "src")))
1430 (replace
1431 'configure
1432 (lambda _
1433 (call-with-output-file "Makefile.inc"
1434 (lambda (port)
1435 (format port "
f8ed036a
EB
1436EXE =
1437LIB = .a
1438OBJ = .o
1439MAKE = make
1440AR = ar
1441ARFLAGS = -ruv
cf0ec6c4 1442CAT = cat
f8ed036a
EB
1443CCS = gcc
1444CCP = mpicc
1445CCD = gcc
1446CPPFLAGS =~{ -D~a~}
6c798540 1447CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
f8ed036a
EB
1448LDFLAGS = -lz -lm -lrt -lpthread
1449CP = cp
1450LEX = flex -Pscotchyy -olex.yy.c
1451LN = ln
1452MKDIR = mkdir
1453MV = mv
1454RANLIB = ranlib
1455YACC = bison -pscotchyy -y -b y
1456"
d6602ee9
EB
1457 '("COMMON_FILE_COMPRESS_GZ"
1458 "COMMON_PTHREAD"
1459 "COMMON_RANDOM_FIXED_SEED"
cf0ec6c4
EB
1460 ;; Prevents symbolc clashes with libesmumps
1461 "SCOTCH_RENAME"
d6602ee9
EB
1462 ;; XXX: Causes invalid frees in superlu-dist tests
1463 ;; "SCOTCH_PTHREAD"
1464 ;; "SCOTCH_PTHREAD_NUMBER=2"
1465 "restrict=__restrict"))))))
cf0ec6c4
EB
1466 (add-after
1467 'build 'build-esmumps
1468 (lambda _
1469 (zero? (system* "make"
1470 (format #f "-j~a" (parallel-job-count))
1471 "esmumps"))))
d6602ee9 1472 (replace
f8ed036a
EB
1473 'install
1474 (lambda* (#:key outputs #:allow-other-keys)
1475 (let ((out (assoc-ref outputs "out")))
1476 (mkdir out)
1477 (zero? (system* "make"
1478 (string-append "prefix=" out)
cf0ec6c4
EB
1479 "install"))
1480 ;; esmumps files are not installed with the above
1481 (for-each (lambda (f)
1482 (copy-file f (string-append out "/include/" f)))
1483 (find-files "../include" ".*esmumps.h$"))
1484 (for-each (lambda (f)
1485 (copy-file f (string-append out "/lib/" f)))
1486 (find-files "../lib" "^lib.*esmumps.*"))))))))
f8ed036a
EB
1487 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
1488 (synopsis "Programs and libraries for graph algorithms")
1489 (description "SCOTCH is a set of programs and libraries which implement
1490the static mapping and sparse matrix reordering algorithms developed within
1491the SCOTCH project. Its purpose is to apply graph theory, with a divide and
1492conquer approach, to scientific computing problems such as graph and mesh
1493partitioning, static mapping, and sparse matrix ordering, in application
1494domains ranging from structural mechanics to operating systems or
1495bio-chemistry.")
1496 ;; See LICENSE_en.txt
1497 (license license:cecill-c)))
6acb4adb
EB
1498
1499(define-public pt-scotch
1500 (package (inherit scotch)
1501 (name "pt-scotch")
1502 (propagated-inputs
1503 `(("openmpi" ,openmpi))) ;Headers include MPI headers
1504 (arguments
1505 (substitute-keyword-arguments (package-arguments scotch)
1506 ((#:phases scotch-phases)
d6602ee9
EB
1507 `(modify-phases ,scotch-phases
1508 (replace
1509 'build
d6602ee9
EB
1510 (lambda _
1511 (and
cf0ec6c4
EB
1512 (zero? (system* "make"
1513 (format #f "-j~a" (parallel-job-count))
1514 "ptscotch" "ptesmumps"))
d6602ee9
EB
1515 ;; Install the serial metis compatibility library
1516 (zero? (system* "make" "-C" "libscotchmetis" "install")))))
1517 (replace
1518 'check
1519 (lambda _ (zero? (system* "make" "ptcheck"))))))))
6acb4adb 1520 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
5698b8b8 1521
aa75ad00
EB
1522(define-public metis
1523 (package
1524 (name "metis")
1525 (version "5.1.0")
1526 (source
1527 (origin
1528 (method url-fetch)
1529 (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
1530 "metis-" version ".tar.gz"))
1531 (sha256
1532 (base32
1533 "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
1534 (build-system cmake-build-system)
1535 (inputs
1536 `(("blas" ,openblas)))
1537 (arguments
1538 `(#:tests? #f ;no tests
1539 #:configure-flags `("-DSHARED=ON"
1540 ,(string-append "-DGKLIB_PATH=" (getcwd)
1541 "/metis-" ,version "/GKlib"))))
1542 (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
1543 (synopsis "Graph partitioning and fill-reducing matrix ordering library")
1544 (description
1545 "METIS is a set of serial programs for partitioning graphs, partitioning
1546finite element meshes, and producing fill-reducing orderings for sparse
1547matrices. The algorithms implemented in METIS are based on the multilevel
1548recursive-bisection, multilevel k-way, and multi-constraint partitioning
1549schemes.")
1550 (license license:asl2.0))) ;As of version 5.0.3
1551
700ff222
EB
1552(define-public p4est
1553 (package
1554 (name "p4est")
1555 (version "1.1")
1556 (source
1557 (origin
1558 (method url-fetch)
1559 (uri (string-append "http://p4est.github.io/release/p4est-"
1560 version ".tar.gz"))
1561 (sha256
1562 (base32
1563 "0faina2h5qsx3m2izbzaj9bbakma1krbbjmq43wrp1hcbyijflqb"))))
1564 (build-system gnu-build-system)
1565 (inputs
1566 `(("fortran" ,gfortran)
1567 ("blas" ,openblas)
1568 ("lapack" ,lapack)
1569 ("zlib" ,zlib)))
1570 (arguments
1571 `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
1572 (assoc-ref %build-inputs "blas")
1573 " -lopenblas")
1574 ,(string-append "LAPACK_LIBS=-L"
1575 (assoc-ref %build-inputs "lapack")
1576 " -llapack"))))
1577 (home-page "http://www.p4est.org")
1578 (synopsis "Adaptive mesh refinement on forests of octrees")
1579 (description
1580 "The p4est software library enables the dynamic management of a
1581collection of adaptive octrees, conveniently called a forest of octrees.
1582p4est is designed to work in parallel and scales to hundreds of thousands of
1583processor cores.")
1584 (license license:gpl2+)))
1585
1586(define-public p4est-openmpi
1587 (package (inherit p4est)
1588 (name "p4est-openmpi")
1589 (inputs
1590 `(("mpi" ,openmpi)
1591 ,@(package-inputs p4est)))
1592 (arguments
1593 (substitute-keyword-arguments (package-arguments p4est)
1594 ((#:configure-flags cf)
1595 ``("--enable-mpi" ,@,cf))))
1596 (synopsis "Parallel adaptive mesh refinement on forests of octrees")))
1597
5698b8b8
JD
1598(define-public gsegrafix
1599 (package
1600 (name "gsegrafix")
1601 (version "1.0.6")
1602 (source
1603 (origin
1604 (method url-fetch)
1605 (uri (string-append "mirror://gnu/" name "/" name "-"
1606 version ".tar.gz"))
1607 (sha256
1608 (base32
1609 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
1610 (build-system gnu-build-system)
1611 (arguments
1612 `(#:configure-flags '("LDFLAGS=-lm")))
1613 (inputs
1614 `(("libgnomecanvas" ,libgnomecanvas)
1615 ("libbonoboui" ,libbonoboui)
1616 ("libgnomeui" ,libgnomeui)
1617 ("libgnomeprintui" ,libgnomeprintui)
1618 ("popt" ,popt)))
1619 (native-inputs
1620 `(("pkg-config" ,pkg-config)))
1621 (home-page "http://www.gnu.org/software/gsegrafix/")
1622 (synopsis "GNOME application to create scientific and engineering plots")
1623 (description "GSEGrafix is an application which produces high-quality graphical
1624plots for science and engineering. Plots are specified via simple ASCII
1625parameter files and data files and are presented in an anti-aliased GNOME
1626canvas. The program supports rectangular two-dimensional plots, histograms,
1627polar-axis plots and three-dimensional plots. Plots can be printed or saved
1628to BMP, JPEG or PNG image formats.")
1629 (license license:gpl3+)))
8731e527
JD
1630
1631(define-public maxima
1632 (package
1633 (name "maxima")
77af7b24 1634 (version "5.36.1")
8731e527
JD
1635 (source
1636 (origin
1637 (method url-fetch)
1638 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
1639 version "-source/" name "-" version ".tar.gz"))
1640 (sha256
1641 (base32
77af7b24 1642 "0x1rk659sn3cq0n5c90848ilzr1gb1wf0072fl6jhkdq00qgh2s0"))
fc1adab1 1643 (patches (search-patches "maxima-defsystem-mkdir.patch"))))
8731e527 1644 (build-system gnu-build-system)
df354a77
FB
1645 (inputs
1646 `(("gcl" ,gcl)
1647 ("gnuplot" ,gnuplot) ;for plots
f36afe4d 1648 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
df354a77
FB
1649 (native-inputs
1650 `(("texinfo" ,texinfo)
1651 ("perl" ,perl)))
8731e527 1652 (arguments
df354a77
FB
1653 `(#:configure-flags
1654 (list "--enable-gcl"
1655 (string-append "--with-posix-shell="
1656 (assoc-ref %build-inputs "bash")
1657 "/bin/sh")
1658 (string-append "--with-wish="
1659 (assoc-ref %build-inputs "tk")
1660 "/bin/wish"
1661 (let ((v ,(package-version tk)))
1662 (string-take v (string-index-right v #\.)))))
df354a77 1663 ;; By default Maxima attempts to write temporary files to
77af7b24
MW
1664 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
1665 ;; Work around that.
df354a77 1666 #:make-flags (list "TMPDIR=/tmp")
df354a77 1667 #:phases (alist-cons-before
8731e527 1668 'check 'pre-check
df354a77 1669 (lambda _
8731e527 1670 (chmod "src/maxima" #o555))
f36afe4d
FB
1671 ;; Make sure the doc and emacs files are found in the
1672 ;; standard location. Also configure maxima to find gnuplot
1673 ;; without having it on the PATH.
1674 (alist-cons-after
1675 'install 'post-install
1676 (lambda* (#:key outputs inputs #:allow-other-keys)
1677 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
1678 (out (assoc-ref outputs "out"))
1679 (datadir (string-append out "/share/maxima/" ,version)))
1680 (with-directory-excursion out
1681 (mkdir-p "share/emacs")
1682 (mkdir-p "share/doc")
1683 (symlink
1684 (string-append datadir "/emacs/")
1685 (string-append out "/share/emacs/site-lisp"))
1686 (symlink
1687 (string-append datadir "/doc/")
1688 (string-append out "/share/doc/maxima"))
1689 (with-atomic-file-replacement
1690 (string-append datadir "/share/maxima-init.lisp")
1691 (lambda (in out)
1692 (format out "~a ~s~a~%"
1693 "(setf $gnuplot_command "
1694 (string-append gnuplot "/bin/gnuplot") ")")
1695 (dump-port in out))))))
1696 %standard-phases))))
8731e527
JD
1697 (home-page "http://maxima.sourceforge.net")
1698 (synopsis "Numeric and symbolic expression manipulation")
1699 (description "Maxima is a system for the manipulation of symbolic and
1700numerical expressions. It yields high precision numeric results by using
1701exact fractions, arbitrary precision integers, and variable precision floating
e881752c 1702point numbers.")
8731e527
JD
1703 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
1704 ;; Others simply say "GNU General Public License" without stating a
1705 ;; version (which implicitly means gpl1+).
1706 ;; At least one file (src/maxima.asd) says "version 2."
1707 ;; GPLv2 only is therefore the smallest subset.
f36afe4d 1708 (license license:gpl2)))
ec322be2 1709
9aafbc0c
MW
1710(define-public wxmaxima
1711 (package
1712 (name "wxmaxima")
e6a90507 1713 (version "16.04.2")
9aafbc0c
MW
1714 (source
1715 (origin
1716 (method url-fetch)
1717 (uri (string-append "mirror://sourceforge/wxmaxima/wxMaxima/"
1718 version "/" name "-" version ".tar.gz"))
1719 (sha256
1720 (base32
e6a90507 1721 "1fpqzk1921isiqrpgpf433ldq41924qs9sy99fl1zn5661b2l73n"))))
9aafbc0c
MW
1722 (build-system gnu-build-system)
1723 (inputs
1724 `(("wxwidgets" ,wxwidgets)
de477809
SB
1725 ("maxima" ,maxima)
1726 ;; Runtime support.
1727 ("adwaita-icon-theme" ,adwaita-icon-theme)
1728 ("gtk+" ,gtk+)
1729 ("shared-mime-info" ,shared-mime-info)))
9aafbc0c
MW
1730 (arguments
1731 `(#:phases (modify-phases %standard-phases
1732 (add-after
1733 'install 'wrap-program
1734 (lambda* (#:key inputs outputs #:allow-other-keys)
1735 (wrap-program (string-append (assoc-ref outputs "out")
1736 "/bin/wxmaxima")
1737 `("PATH" ":" prefix
1738 (,(string-append (assoc-ref inputs "maxima")
de477809
SB
1739 "/bin")))
1740 ;; For GtkFileChooserDialog.
1741 `("GSETTINGS_SCHEMA_DIR" =
1742 (,(string-append (assoc-ref inputs "gtk+")
1743 "/share/glib-2.0/schemas")))
1744 `("XDG_DATA_DIRS" ":" prefix
1745 (;; Needed by gdk-pixbuf to know supported icon formats.
1746 ,(string-append
1747 (assoc-ref inputs "shared-mime-info") "/share")
1748 ;; The default icon theme of GTK+.
1749 ,(string-append
1750 (assoc-ref inputs "adwaita-icon-theme") "/share"))))
9aafbc0c
MW
1751 #t)))))
1752 (home-page "https://andrejv.github.io/wxmaxima/")
1753 (synopsis "Graphical user interface for the Maxima computer algebra system")
1754 (description
1755 "wxMaxima is a graphical user interface for the Maxima computer algebra
1756system. It eases the use of Maxima by making most of its commands available
1757through a menu system and by providing input dialogs for commands that require
1758more than one argument. It also implements its own display engine that
1759outputs mathematical symbols directly instead of depicting them with ASCII
1760characters.
1761
1762wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
1763text and mathematical calculations to create documents, exporting of input and
1764output to TeX, and a browser for Maxima's manual including command index and
1765full text searching.")
1766 (license license:gpl2+)))
1767
b15e47f9
RW
1768(define-public armadillo
1769 (package
1770 (name "armadillo")
945eef85 1771 (version "6.700.7")
b15e47f9
RW
1772 (source (origin
1773 (method url-fetch)
1774 (uri (string-append "mirror://sourceforge/arma/armadillo-"
1775 version ".tar.gz"))
1776 (sha256
1777 (base32
945eef85 1778 "0xbidcxrvbq33xf7iysg2nic2ai9a043psl33kiv6ifkk7p8hcra"))))
b15e47f9
RW
1779 (build-system cmake-build-system)
1780 (arguments `(#:tests? #f)) ;no test target
1781 (inputs
1782 `(("openblas" ,openblas)
1783 ("lapack" ,lapack)
1784 ("arpack" ,arpack-ng)))
1785 (home-page "http://arma.sourceforge.net/")
1786 (synopsis "C++ linear algebra library")
1787 (description
1788 "Armadillo is a C++ linear algebra library, aiming towards a good balance
1789between speed and ease of use. It is useful for algorithm development
1790directly in C++, or quick conversion of research code into production
1791environments. It can be used for machine learning, pattern recognition,
1792signal processing, bioinformatics, statistics, econometrics, etc. The library
1793provides efficient classes for vectors, matrices and cubes, as well as 150+
1794associated functions (eg. contiguous and non-contiguous submatrix views).")
1795 (license license:mpl2.0)))
1796
e22d4ca4
RW
1797(define-public armadillo-for-rcpparmadillo
1798 (package (inherit armadillo)
813efdde 1799 (version "6.700.6")
e22d4ca4
RW
1800 (source (origin
1801 (method url-fetch)
1802 (uri (string-append "mirror://sourceforge/arma/armadillo-"
1803 version ".tar.gz"))
1804 (sha256
1805 (base32
813efdde 1806 "1cdpjxb0fz5f28y5qrqgpw53s7qi8s2v3al9lfdldqxngb21vpx8"))))))
e22d4ca4 1807
279663ef 1808(define-public muparser
d7cff656
LF
1809 ;; When switching download sites, muparser re-issued a 2.2.5 release with a
1810 ;; different hash. In order to make `guix package --upgrade` work correctly,
1811 ;; we set a Guix packaging revision.
1812 ;; When the next version of muparser is released, we can remove
1813 ;; UPSTREAM-VERSION and REVISION and use the plain VERSION.
1814 (let ((upstream-version "2.2.5")
1815 (revision "2"))
1816 (package
1817 (name "muparser")
1818 (version (string-append upstream-version "-" revision))
1819 (source
1820 (origin
1821 (method url-fetch)
1822 (uri (string-append "https://github.com/beltoforion/muparser/archive/v"
1823 upstream-version ".tar.gz"))
1824 (file-name (string-append name "-" version ".tar.gz"))
1825 (sha256
1826 (base32
1827 "0277qsi5l23jsck1vhn383bmvc2n9l4a1dl5r9bf7hvjv9ayyrh6"))))
1828 (build-system gnu-build-system)
1829 (arguments
1830 `(#:configure-flags '("--enable-samples=no")
1831 #:tests? #f)) ;no "check" target
1832 (home-page "http://muparser.beltoforion.de/")
1833 (synopsis "Fast parser library for mathematical expressions")
1834 (description
1835 "muParser is an extensible high performance math parser library. It is
1836based on transforming an expression into a bytecode and precalculating constant
1837parts of it.")
1838 (license license:expat))))
279663ef 1839
e73b49fb
RW
1840(define-public openblas
1841 (package
1842 (name "openblas")
69851c59 1843 (version "0.2.15")
e73b49fb
RW
1844 (source
1845 (origin
1846 (method url-fetch)
1847 (uri (string-append "https://github.com/xianyi/OpenBLAS/tarball/v"
1848 version))
1849 (file-name (string-append name "-" version ".tar.gz"))
1850 (sha256
1851 (base32
69851c59 1852 "1k5f6vjlk54qlplk5m7xkbaw6g2y7dl50lwwdv6xsbcsgsbxfcpy"))))
e73b49fb
RW
1853 (build-system gnu-build-system)
1854 (arguments
5b5ea159 1855 `(#:tests? #f ;no "check" target
bd0b4379
RW
1856 ;; DYNAMIC_ARCH is only supported on x86. When it is disabled and no
1857 ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
1858 ;; we need to disable substitutions.
71923a91
AE
1859 #:substitutable?
1860 ,(let ((system (or (%current-target-system) (%current-system))))
1861 (or (string-prefix? "x86_64" system)
bd0b4379
RW
1862 (string-prefix? "i686" system)
1863 (string-prefix? "mips" system)))
e73b49fb
RW
1864 #:make-flags
1865 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1866 "SHELL=bash"
af5b817e
RW
1867 "NO_LAPACK=1"
1868 ;; Build the library for all supported CPUs. This allows
1869 ;; switching CPU targets at runtime with the environment variable
1870 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
71923a91
AE
1871 ;; Unfortunately, this is not supported on non-x86 architectures,
1872 ;; where it leads to failed builds.
1873 ,@(let ((system (or (%current-target-system) (%current-system))))
8a637e79
RW
1874 (cond
1875 ((or (string-prefix? "x86_64" system)
71923a91 1876 (string-prefix? "i686" system))
8a637e79
RW
1877 '("DYNAMIC_ARCH=1"))
1878 ;; On MIPS we force the "SICORTEX" TARGET, as for the other
1879 ;; two available MIPS targets special extended instructions
1880 ;; for Loongson cores are used.
1881 ((string-prefix? "mips" system)
1882 '("TARGET=SICORTEX"))
1883 (else '()))))
e73b49fb
RW
1884 ;; no configure script
1885 #:phases (alist-delete 'configure %standard-phases)))
1886 (inputs
19afbea1 1887 `(("fortran" ,gfortran)))
e73b49fb
RW
1888 (native-inputs
1889 `(("cunit" ,cunit)
1890 ("perl" ,perl)))
1891 (home-page "http://www.openblas.net/")
1892 (synopsis "Optimized BLAS library based on GotoBLAS")
1893 (description
1894 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
1895 (license license:bsd-3)))
1896
e1605e36
RW
1897(define-public openlibm
1898 (package
1899 (name "openlibm")
26f6e565 1900 (version "0.5.1")
e1605e36
RW
1901 (source
1902 (origin
1903 (method url-fetch)
1904 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
1905 version ".tar.gz"))
1906 (file-name (string-append name "-" version ".tar.gz"))
1907 (sha256
1908 (base32
26f6e565 1909 "11czx2z7nh6dfpz45s3xl7v38hw36jxzxfvny454bk3if14pfakq"))))
e1605e36
RW
1910 (build-system gnu-build-system)
1911 (arguments
1912 `(#:make-flags
1913 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1914 #:phases
1915 ;; no configure script
1916 (alist-delete 'configure %standard-phases)
1917 #:tests? #f)) ;the tests are part of the default target
1918 (home-page "http://openlibm.org/")
1919 (synopsis "Portable C mathematical library (libm)")
1920 (description
1921 "OpenLibm is an effort to have a high quality, portable, standalone C
1922mathematical library (libm). It can be used standalone in applications and
1923programming language implementations. The project was born out of a need to
e881752c 1924have a good libm for the Julia programming language that worked consistently
e1605e36
RW
1925across compilers and operating systems, and in 32-bit and 64-bit
1926environments.")
1927 ;; See LICENSE.md for details.
1928 (license (list license:expat
1929 license:isc
1930 license:bsd-2
1931 license:public-domain
1932 license:lgpl2.1+))))
1933
e62be58f
RW
1934(define-public openspecfun
1935 (package
1936 (name "openspecfun")
49f54a74 1937 (version "0.5.2")
e62be58f
RW
1938 (source
1939 (origin
1940 (method url-fetch)
1941 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
1942 version ".tar.gz"))
1943 (file-name (string-append name "-" version ".tar.gz"))
1944 (sha256
1945 (base32
49f54a74 1946 "1y5b2h6f2k72536kym3vzy3li3bhpd23x463g7hdmjdi3cncavz1"))))
e62be58f
RW
1947 (build-system gnu-build-system)
1948 (arguments
1949 '(#:tests? #f ;no "check" target
1950 #:make-flags
1951 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1952 ;; no configure script
1953 #:phases (alist-delete 'configure %standard-phases)))
1954 (inputs
19afbea1 1955 `(("fortran" ,gfortran)))
e62be58f
RW
1956 (home-page "https://github.com/JuliaLang/openspecfun")
1957 (synopsis "Collection of special mathematical functions")
1958 (description
1959 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
1960portable package for Bessel Functions of a Complex Argument and Nonnegative
1961Order; it contains subroutines for computing Bessel functions and Airy
1962functions. Faddeeva allows computing the various error functions of arbitrary
1963complex arguments (Faddeeva function, error function, complementary error
1964function, scaled complementary error function, imaginary error function, and
1965Dawson function); given these, one can also easily compute Voigt functions,
1966Fresnel integrals, and similar related functions as well.")
1967 ;; Faddeeva is released under the Expat license; AMOS is included as
1968 ;; public domain software.
1969 (license (list license:expat license:public-domain))))
1970
2742f87e
RW
1971(define-public suitesparse
1972 (package
1973 (name "suitesparse")
1974 (version "4.4.3")
1975 (source
1976 (origin
1977 (method url-fetch)
1978 (uri (string-append
1979 "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-"
1980 version ".tar.gz"))
1981 (sha256
1982 (base32
1983 "100hdzr0mf4mzlwnqpmwpfw4pymgsf9n3g0ywb1yps2nk1zbkdy5"))))
1984 (build-system gnu-build-system)
1985 (arguments
1986 '(#:parallel-build? #f ;cholmod build fails otherwise
1987 #:tests? #f ;no "check" target
1988 #:make-flags
1989 (list "CC=gcc"
1990 "BLAS=-lblas"
1991 "TBB=-ltbb"
1992 "CHOLMOD_CONFIG=-DNPARTITION" ;required when METIS is not used
1993 (string-append "INSTALL_LIB="
1994 (assoc-ref %outputs "out") "/lib")
1995 (string-append "INSTALL_INCLUDE="
1996 (assoc-ref %outputs "out") "/include"))
1997 #:phases
1998 (alist-cons-before
1999 'install 'prepare-out
2000 ;; README.txt states that the target directories must exist prior to
2001 ;; running "make install".
2002 (lambda _
2003 (mkdir-p (string-append (assoc-ref %outputs "out") "/lib"))
2004 (mkdir-p (string-append (assoc-ref %outputs "out") "/include")))
2005 ;; no configure script
2006 (alist-delete 'configure %standard-phases))))
2007 (inputs
2008 `(("tbb" ,tbb)
2009 ("lapack" ,lapack)))
2010 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
2011 (synopsis "Suite of sparse matrix software")
2012 (description
2013 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
2014multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
2015multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
2016simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
2017CXSparse, a concise sparse Cholesky factorization package; and many other
2018packages.")
2019 ;; LGPLv2.1+:
2020 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
2021 ;; GPLv2+:
2022 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
2023 (license (list license:gpl2+ license:lgpl2.1+))))
2024
ec322be2
FB
2025(define-public atlas
2026 (package
2027 (name "atlas")
2028 (version "3.10.2")
2029 (source (origin
2030 (method url-fetch)
de67e922
LF
2031 (uri (string-append "mirror://sourceforge/math-atlas/Stable/"
2032 version "/atlas" version ".tar.bz2"))
ec322be2
FB
2033 (sha256
2034 (base32
2035 "0bqh4bdnjdyww4mcpg6kn0x7338mfqbdgysn97dzrwwb26di7ars"))))
2036 (build-system gnu-build-system)
2037 (home-page "http://math-atlas.sourceforge.net/")
19afbea1 2038 (inputs `(("gfortran" ,gfortran)
ec322be2
FB
2039 ("lapack-tar" ,(package-source lapack))))
2040 (outputs '("out" "doc"))
01480b9e
FB
2041 ;; For the moment we drop support for MIPS at it fails to compile. See
2042 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
2043 (supported-systems (delete "mips64el-linux" %supported-systems))
ec322be2
FB
2044 (arguments
2045 `(#:parallel-build? #f
2046 #:parallel-tests? #f
f15615b1
LC
2047
2048 ;; ATLAS tunes itself for the machine it is built on, as explained at
2049 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
2050 ;; For this reason, we want users to build it locally instead of using
2051 ;; substitutes.
2052 #:substitutable? #f
2053
ec322be2
FB
2054 #:modules ((srfi srfi-26)
2055 (srfi srfi-1)
2056 (guix build gnu-build-system)
2057 (guix build utils))
40029cbe 2058 #:configure-flags
ec322be2
FB
2059 `(;; Generate position independent code suitable for dynamic libraries
2060 ;; and use WALL timer to get more accurate timing.
2061 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
2062 ;; Set word width.
2063 "-b"
2064 ,,(if (string-match "64" (%current-system))
2065 "64"
2066 "32")
2067 ;; Disable parallel build as it gives errors: atlas_pthread.h is
2068 ;; needed to compile C files before it is generated.
2069 "-Ss" "pmake" "make -j 1"
af89a667
FB
2070 ;; Probe is failing for MIPS. We therefore define the system
2071 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
2072 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
2073 ,,@(if (string-prefix? "mips" (%current-system))
2074 (list "-A" "49" "-V" "1")
2075 (list))
ec322be2
FB
2076 ;; Generate shared libraries.
2077 "--shared"
2078 ;; Build a full LAPACK library.
2079 ,(string-append "--with-netlib-lapack-tarfile="
2080 (assoc-ref %build-inputs "lapack-tar")))
2081 #:phases
e5b4b96b
EF
2082 (modify-phases %standard-phases
2083 (add-after 'install 'install-doc
2084 (lambda* (#:key outputs inputs #:allow-other-keys)
2085 (let ((doc (string-append (assoc-ref outputs "doc")
2086 "/share/doc/atlas")))
2087 (mkdir-p doc)
2088 (fold (lambda (file previous)
2089 (and previous (zero? (system* "cp" file doc))))
2090 #t (find-files "../ATLAS/doc" ".*")))))
2091 (add-after 'check 'check-pt
2092 (lambda _ (zero? (system* "make" "ptcheck"))))
2093 ;; Fix files required to run configure.
2094 (add-before 'configure 'fix-/bin/sh
ec322be2
FB
2095 (lambda _
2096 ;; Use `sh', not `/bin/sh'.
2097 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
2098 (("/bin/sh")
e5b4b96b
EF
2099 "sh"))))
2100 ;; Fix /bin/sh in generated make files.
2101 (add-after 'configure 'fix-/bin/sh-in-generated-files
2102 (lambda _
2103 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
2104 (("/bin/sh")
2105 "sh"))))
2106 ;; ATLAS configure program does not accepts the default flags
2107 ;; passed by the 'gnu-build-system'.
2108 (replace 'configure
2109 (lambda* (#:key native-inputs inputs outputs
2110 (configure-flags '())
2111 #:allow-other-keys #:rest args)
2112 (let* ((prefix (assoc-ref outputs "out"))
2113 (bash (or (and=> (assoc-ref
2114 (or native-inputs inputs) "bash")
2115 (cut string-append <> "/bin/bash"))
2116 "/bin/sh"))
2117 (flags `(,(string-append "--prefix=" prefix)
2118 ,@configure-flags))
2119 (abs-srcdir (getcwd))
2120 (srcdir (string-append "../" (basename abs-srcdir))))
2121 (format #t "source directory: ~s (relative from build: ~s)~%"
2122 abs-srcdir srcdir)
2123 (mkdir "../build")
2124 (chdir "../build")
2125 (format #t "build directory: ~s~%" (getcwd))
2126 (format #t "configure flags: ~s~%" flags)
2127 (zero? (apply system* bash
2128 (string-append srcdir "/configure")
2129 flags))))))))
ec322be2
FB
2130 (synopsis "Automatically Tuned Linear Algebra Software")
2131 (description
2132 "ATLAS is an automatically tuned linear algebra software library
2133providing C and Fortran77 interfaces to a portably efficient BLAS
2134implementation, as well as a few routines from LAPACK.
2135
f15615b1
LC
2136Optimization occurs at build time. For this reason, the library is built on
2137the machine where it is installed, without resorting to pre-built substitutes.
ec322be2 2138
f15615b1 2139Before building the library, CPU throttling should be disabled. This can be
d97c429a 2140done in the BIOS, or, on GNU/Linux, with the following command:
ec322be2 2141
8e9ba611 2142@example
d97c429a 2143# cpupower --governor performance
8e9ba611 2144@end example
ec322be2 2145
d97c429a 2146Failure to do so will result in a library with poor performance.")
ec322be2 2147 (license license:bsd-3)))
c12efc72
AE
2148
2149(define-public glm
2150 (package
2151 (name "glm")
2152 (version "0.9.6.3")
2153 (source
2154 (origin
2155 (method url-fetch)
de67e922
LF
2156 (uri (string-append "mirror://sourceforge/ogl-math/glm-" version
2157 "/glm-" version ".zip"))
c12efc72
AE
2158 (sha256
2159 (base32
2160 "1cnjmi033a16a95v6xfkr1bvfmkd26hzdjka8j1819hgn5b1nr8l"))))
2161 (build-system cmake-build-system)
2162 (native-inputs
2163 `(("unzip" ,unzip)))
2164 (home-page "http://glm.g-truc.net")
2165 (synopsis "OpenGL Mathematics library")
2166 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
2167library for graphics software based on the OpenGL Shading Language (GLSL)
2168specifications.")
2169 (license license:expat)))
7f18257b
AE
2170
2171(define-public lpsolve
2172 (package
2173 (name "lpsolve")
2174 (version "5.5.2.0")
2175 (source
2176 (origin
2177 (method url-fetch)
2178 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
2179 "/lp_solve_" version "_source.tar.gz"))
2180 (sha256
2181 (base32
2182 "176c7f023mb6b8bfmv4rfqnrlw88lsg422ca74zjh19i2h5s69sq"))
2183 (modules '((guix build utils)))
2184 (snippet
2185 '(substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
2186 (("^c=cc") "c=gcc")
2187 ;; Pretend to be on a 64 bit platform to obtain a common directory
2188 ;; name for the build results on all architectures; nothing else
2189 ;; seems to depend on it.
5dbfbef7
LC
2190 (("^PLATFORM=.*$") "PLATFORM=ux64\n")
2191
2192 ;; The check for 'isnan' as it is written fails with
2193 ;; "non-floating-point argument in call to function
2194 ;; ‘__builtin_isnan’", which leads to the 'NOISNAN' cpp macro
2195 ;; definition, which in turn leads to bad things. Fix the feature
2196 ;; test.
2197 (("isnan\\(0\\)") "isnan(0.)")))))
7f18257b
AE
2198 (build-system gnu-build-system)
2199 (arguments
2200 `(#:tests? #f ; no check target
2201 #:phases
2202 (modify-phases %standard-phases
2203 (delete 'configure)
2204 (replace 'build
2205 (lambda _
6689d094
LC
2206 (and (with-directory-excursion "lpsolve55"
2207 (zero? (system* "bash" "ccc")))
2208 (with-directory-excursion "lp_solve"
2209 (zero? (system* "bash" "ccc"))))))
7f18257b
AE
2210 (replace 'install
2211 (lambda* (#:key outputs #:allow-other-keys)
2212 (let* ((out (assoc-ref outputs "out"))
2213 (bin (string-append out "/bin"))
2214 (lib (string-append out "/lib"))
2215 ;; This is where LibreOffice expects to find the header
2216 ;; files, and where they are installed by Debian.
2217 (include (string-append out "/include/lpsolve")))
2218 (mkdir-p lib)
2219 (copy-file "lpsolve55/bin/ux64/liblpsolve55.a"
2220 (string-append lib "/liblpsolve55.a"))
2221 (copy-file "lpsolve55/bin/ux64/liblpsolve55.so"
2222 (string-append lib "/liblpsolve55.so"))
96c46210
LC
2223 (install-file "lp_solve/bin/ux64/lp_solve" bin)
2224
7f18257b
AE
2225 ;; Install a subset of the header files as on Debian
2226 ;; (plus lp_bit.h, which matches the regular expression).
96c46210
LC
2227 (for-each (lambda (name)
2228 (install-file name include))
2229 (find-files "." "lp_[HMSa-z].*\\.h$"))
7f18257b 2230 (with-directory-excursion "shared"
96c46210
LC
2231 (for-each (lambda (name)
2232 (install-file name include))
2233 (find-files "." "\\.h$")))
7f18257b
AE
2234 #t))))))
2235 (home-page "http://lpsolve.sourceforge.net/")
2236 (synopsis "Mixed integer linear programming (MILP) solver")
2237 (description
2238 "lp_solve is a mixed integer linear programming solver based on the
2239revised simplex and the branch-and-bound methods.")
2240 (license license:lgpl2.1+)))
a17d4564
EB
2241
2242(define-public dealii
2243 (package
2244 (name "dealii")
101e8472 2245 (version "8.4.1")
a17d4564
EB
2246 (source
2247 (origin
2248 (method url-fetch)
2249 (uri (string-append "https://github.com/dealii/dealii/releases/"
2250 "download/v" version "/dealii-" version ".tar.gz"))
2251 (sha256
2252 (base32
101e8472 2253 "1bdksvvyp1rj37df1ndh8j3x9nzpc3sazw8nd0hzvnlw0qnyk800"))
a17d4564
EB
2254 (modules '((guix build utils)))
2255 (snippet
2256 ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
2257 '(delete-file-recursively "bundled"))))
2258 (build-system cmake-build-system)
2259 (inputs
2260 `(("tbb" ,tbb)
2261 ("zlib" ,zlib)
2262 ("boost" ,boost)
2263 ("p4est" ,p4est)
2264 ("blas" ,openblas)
2265 ("lapack" ,lapack)
2266 ("arpack" ,arpack-ng)
2267 ("muparser" ,muparser)
2268 ("gfortran" ,gfortran)
2269 ("suitesparse" ,suitesparse))) ;for UMFPACK
2270 (arguments
2271 `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease
2272 #:configure-flags '("-DCOMPAT_FILES=OFF") ;Follow new directory structure
2273 #:phases (modify-phases %standard-phases
2274 (add-after
2275 'install 'hint-example-prefix
2276 ;; Set Cmake hints in examples so that they can find this
2277 ;; deal.II when configuring.
2278 (lambda* (#:key outputs #:allow-other-keys)
2279 (let* ((out (assoc-ref %outputs "out"))
2280 (exmpl (string-append out "/share/doc"
2281 "/dealii/examples")))
2282 (substitute* (find-files exmpl "CMakeLists.txt")
2283 (("([[:space:]]*HINTS.*)\n" _ line)
2284 (string-append line " $ENV{HOME}/.guix-profile "
2285 out "\n")))
2286 #t))))))
2287 (home-page "https://www.dealii.org")
2288 (synopsis "Finite element library")
2289 (description
2290 "Deal.II is a C++ program library targeted at the computational solution
2291of partial differential equations using adaptive finite elements. The main
2292aim of deal.II is to enable rapid development of modern finite element codes,
2293using among other aspects adaptive meshes and a wide array of tools often used
2294in finite element programs.")
2295 (license license:lgpl2.1+)))
2296
2297(define-public dealii-openmpi
2298 (package (inherit dealii)
2299 (name "dealii-openmpi")
2300 (inputs
2301 `(("mpi" ,openmpi)
2302 ;;Supported only with MPI:
2303 ("p4est" ,p4est-openmpi)
2304 ("petsc" ,petsc-openmpi)
2305 ("slepc" ,slepc-openmpi)
2306 ("metis" ,metis) ;for MUMPS
2307 ("scalapack" ,scalapack) ;for MUMPS
2308 ("mumps" ,mumps-metis-openmpi) ;configure supports only metis orderings
2309 ("arpack" ,arpack-ng-openmpi)
2310 ,@(fold alist-delete (package-inputs dealii)
2311 '("p4est" "arpack"))))
2312 (arguments
2313 (substitute-keyword-arguments (package-arguments dealii)
2314 ((#:configure-flags cf)
2315 ``("-DMPI_C_COMPILER=mpicc"
2316 "-DMPI_CXX_COMPILER=mpicxx"
2317 "-DMPI_Fortran_COMPILER=mpifort"
2318 ,@,cf))))
2319 (synopsis "Finite element library (with MPI support)")))
194c7f95
AE
2320
2321(define-public flann
2322 (package
2323 (name "flann")
2324 (version "1.8.4")
2325 (source
2326 (origin
2327 (method url-fetch)
2328 (uri
2329 (string-append
2330 "http://www.cs.ubc.ca/research/flann/uploads/FLANN/flann-"
2331 version "-src.zip"))
2332 (sha256
2333 (base32
2334 "022w8hph7bli5zbpnk3z1qh1c2sl5hm8fw2ccim651ynn0hr7fyz"))))
2335 (build-system cmake-build-system)
2336 (native-inputs
2337 `(("unzip" ,unzip)))
2338 (inputs
2339 `(("hdf5" ,hdf5)
2340 ("octave" ,octave)
2341 ("python" ,python-2) ; print syntax
2342 ;; ("python2-numpy" ,python2-numpy) ; only required for the tests
2343 ("zlib" ,zlib)))
2344 (arguments
39b30337
LC
2345 `(;; The 'share/flann/octave' contains a .mex file, which is an ELF file
2346 ;; taken 46 MiB unstripped, and 6 MiB stripped.
2347 #:strip-directories '("lib" "lib64" "libexec"
2348 "bin" "sbin" "share/flann/octave")
2349
9684e30b
LC
2350 ;; Save 12 MiB by not installing .a files. Passing
2351 ;; '-DBUILD_STATIC_LIBS=OFF' has no effect.
2352 #:phases (modify-phases %standard-phases
2353 (add-after 'install 'remove-static-libraries
2354 (lambda* (#:key outputs #:allow-other-keys)
2355 (let* ((out (assoc-ref outputs "out"))
2356 (lib (string-append out "/lib")))
2357 (for-each delete-file
2358 (find-files lib "\\.a$"))
2359 #t))))
2360
39b30337 2361 #:tests? #f)) ; The test data are downloaded from the Internet.
194c7f95
AE
2362 (home-page "http://www.cs.ubc.ca/research/flann/")
2363 (synopsis "Library for approximate nearest neighbors computation")
2364 (description "FLANN is a library for performing fast approximate
2365nearest neighbor searches in high dimensional spaces. It implements a
2366collection of algorithms and a system for automatically choosing the best
2367algorithm and optimum parameters depending on the dataset.
2368
2369FLANN is written in C++ and contains bindings for C, Octave and Python.")
2370 (license (license:non-copyleft "file://COPYING"
2371 "See COPYING in the distribution."))))
d8c97beb
EF
2372
2373(define-public wcalc
2374 (package
2375 (name "wcalc")
2376 (version "2.5")
2377 (source
2378 (origin
2379 (method url-fetch)
de67e922
LF
2380 (uri (string-append "mirror://sourceforge/w-calc/Wcalc/" version "/"
2381 "wcalc-" version ".tar.bz2"))
d8c97beb
EF
2382 (sha256
2383 (base32
2384 "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
2385 (build-system gnu-build-system)
2386 (inputs
2387 `(("mpfr" ,mpfr)
2388 ("readline" ,readline)))
2389 (home-page "http://w-calc.sourceforge.net/index.php")
2390 (synopsis "Flexible command-line scientific calculator")
2391 (description "Wcalc is a very capable calculator. It has standard functions
2392(sin, asin, and sinh for example, in either radians or degrees), many
2393pre-defined constants (pi, e, c, etc.), support for using variables, \"active\"
2394variables, a command history, hex/octal/binary input and output, unit
2395conversions, embedded comments, and an expandable expression entry field. It
2396evaluates expressions using the standard order of operations.")
2397 (license license:gpl2+)))
45147b0c
FH
2398
2399(define-public xaos
2400 (package
2401 (name "xaos")
2402 (version "3.6")
2403 (source (origin
2404 (method url-fetch)
de67e922
LF
2405 (uri (string-append "mirror://sourceforge/xaos/XaoS/" version
2406 "/xaos-" version ".tar.gz"))
45147b0c
FH
2407 (sha256
2408 (base32
2409 "15cd1cx1dyygw6g2nhjqq3bsfdj8sj8m4va9n75i0f3ryww3x7wq"))))
2410 (build-system gnu-build-system)
2411 (native-inputs `(("gettext" ,gnu-gettext)))
2412 (inputs `(("libx11" ,libx11)
2413 ("zlib" ,zlib)
2414 ("libpng" ,libpng)
2415 ("gsl" ,gsl)))
2416 (arguments
2417 `(#:tests? #f ;no "check" target
2418 #:make-flags '("LOCALEDIR=$DATAROOTDIR/locale")))
2419 (synopsis "Real-time fractal zoomer")
2420 (description "GNU XaoS is a graphical program that generates fractal
2421patterns and allows you to zoom in and out of them infinitely in a fluid,
2422continuous manner. It also includes tutorials that help to explain how fractals
2423are built. It can generate many different fractal types such as the Mandelbrot
2424set.")
2425 (home-page "http://www.gnu.org/software/xaos/")
2426 (license license:gpl2+)))
528bb464
EB
2427
2428(define-public hypre
2429 (package
2430 (name "hypre")
2431 (version "2.11.0")
2432 (source (origin
2433 (method url-fetch)
2434 (uri (string-append "https://github.com/LLNL/hypre/archive/"
2435 "v" version ".tar.gz"))
2436 (file-name (string-append name "-" version ".tar.gz"))
2437 (sha256
2438 (base32
2439 "0q69ia0jivzcr8p049dn3mg8yjpn6nwq4sw9iqac8vr63vi54l6m"))
2440 (modules '((guix build utils)))
2441 (snippet
2442 '(begin
2443 ;; Remove use of __DATE__ and __TIME__ for reproducibility;
2444 ;; substitute the tarball creation time.
2445 (substitute* "src/utilities/HYPRE_utilities.h"
2446 (("Date Compiled: .*$")
2447 "Date Compiled: Mar 28 2016 20:19:59 +0000\"\n"))
2448 #t))))
2449 (build-system gnu-build-system)
2450 (outputs '("out" ;6.1 MiB of headers and libraries
2451 "doc")) ;4.8 MiB of documentation
2452 (native-inputs
2453 `(("doc++" ,doc++)
2454 ("netpbm" ,netpbm)
2455 ("texlive" ,texlive) ;full package required for fonts
2456 ("ghostscript" ,ghostscript)))
2457 (inputs
2458 `(("blas" ,openblas)
2459 ("lapack" ,lapack)))
2460 (arguments
2461 `(#:modules ((srfi srfi-1)
2462 ,@%gnu-build-system-modules)
2463 #:configure-flags '("--enable-shared"
2464 "--disable-fortran"
2465 "--without-MPI"
2466 "--with-openmp"
2467 "--with-fei"
2468 "--with-lapack"
2469 "--with-blas")
2470 #:phases
2471 (modify-phases %standard-phases
2472 (add-before 'configure 'chdir-src
2473 (lambda _ (chdir "src")))
2474 (replace 'configure
2475 (lambda* (#:key build target configure-flags
2476 #:allow-other-keys #:rest args)
2477 (let* ((configure (assoc-ref %standard-phases 'configure)))
2478 (apply configure
2479 (append args
2480 (list #:configure-flags
2481 (cons (string-append
2482 "--host=" (or target build))
2483 configure-flags)))))))
2484 (add-after 'build 'build-docs
2485 (lambda _
2486 (zero? (system* "make" "-Cdocs" "pdf" "html"))))
2487 (replace 'check
2488 (lambda _
2489 (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/hypre/lib"))
2490 (setenv "PATH" (string-append "." ":" (getenv "PATH")))
2491 (and (system* "make" "check" "CHECKRUN=")
2492 (fold (lambda (filename result)
2493 (and result
2494 (let ((size (stat:size (stat filename))))
2495 (when (not (zero? size))
2496 (format #t "~a size ~d; error indication~%"
2497 filename size))
2498 (zero? size))))
2499 #t
2500 (find-files "test" ".*\\.err$")))))
2501 (add-after 'install 'install-docs
2502 (lambda* (#:key outputs #:allow-other-keys)
2503 ;; Custom install because docs/Makefile doesn't honor ${docdir}.
2504 (let* ((doc (assoc-ref outputs "doc"))
2505 (docdir (string-append doc "/share/doc/hypre-" ,version)))
2506 (mkdir-p docdir)
2507 (with-directory-excursion "docs"
2508 (for-each (lambda (base)
2509 (install-file (string-append base ".pdf") docdir)
2510 (copy-recursively base docdir)) ;html docs
2511 '("HYPRE_usr_manual"
2512 "HYPRE_ref_manual")))
2513 #t))))))
2514 (home-page "http://www.llnl.gov/casc/hypre/")
2515 (synopsis "Library of solvers and preconditioners for linear equations")
2516 (description
2517 "HYPRE is a software library of high performance preconditioners and
2518solvers for the solution of large, sparse linear systems of equations. It
2519features multigrid solvers for both structured and unstructured grid
2520problems.")
2521 (license license:lgpl2.1)))
2522
2523(define-public hypre-openmpi
2524 (package (inherit hypre)
2525 (name "hypre-openmpi")
2526 (inputs
2527 `(("mpi" ,openmpi)
2528 ,@(package-inputs hypre)))
2529 (arguments
2530 (substitute-keyword-arguments (package-arguments hypre)
2531 ((#:configure-flags flags)
2532 ``("--with-MPI"
2533 ,@(delete "--without-MPI" ,flags)))))
2534 (synopsis "Parallel solvers and preconditioners for linear equations")
2535 (description
2536 "HYPRE is a software library of high performance preconditioners and
2537solvers for the solution of large, sparse linear systems of equations on
2538parallel computers. It features parallel multigrid solvers for both
2539structured and unstructured grid problems.")))
6c90e183
EB
2540
2541(define-public matio
2542 (package
2543 (name "matio")
2544 (version "1.5.6")
2545 (source
2546 (origin
2547 (method url-fetch)
de67e922 2548 (uri (string-append "mirror://sourceforge/matio/matio/" version "/"
6c90e183
EB
2549 "matio-" version ".tar.gz"))
2550 (sha256
2551 (base32
2552 "0y2qymgxank8wdiwc68ap8bxdzrhvyw86i29yh3xgn4z1njfd9ir"))))
2553 (build-system gnu-build-system)
2554 (inputs
2555 `(("zlib" ,zlib)
2556 ("hdf5" ,hdf5)))
2557 (home-page "http://matio.sourceforge.net/")
2558 (synopsis "Library for reading and writing MAT files")
2559 (description "Matio is a library for reading and writing MAT files. It
2560supports compressed MAT files, as well as newer (version 7.3) MAT files.")
2561 (license license:bsd-2)))
d721c83a
EB
2562
2563(define-public libhilbert
2564 (package
2565 (name "libhilbert")
2566 (version "0.2-1")
2567 (source
2568 (origin
2569 (method url-fetch)
2570 (uri (string-append "http://web.cs.dal.ca/~chamilto/hilbert/"
2571 "libhilbert-" version ".tar.gz"))
2572 (sha256
2573 (base32
2574 "0v48x8405dj95gjn2saja4bzhw86d6zl6d3dg8h7dzac2qr97s34"))))
2575 (build-system gnu-build-system)
2576 (home-page "http://web.cs.dal.ca/~chamilto/hilbert")
2577 (synopsis "Hilbert indices for multidimensional data")
2578 (description "The libhilbert library can efficiently calculate Hilbert
2579curves and order-preserving representations of Hilbert curve indices that use
2580the same amount of space as the original point representation. This is useful
2581when using the Gilbert curve as a space filling curve through a
2582high-dimensional space where not all demensions have the same cardinality.")
2583 (license license:lgpl2.1+)))