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