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