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