gnu: bluez: Remove leftover patch.
[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>
a53d6719 4;;; Copyright © 2014, 2016, 2017 John Darrington <jmd@gnu.org>
41a46a50 5;;; Copyright © 2014, 2015, 2016, 2017 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>
612a387f 8;;; Copyright © 2015, 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
32158110 9;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
9aafbc0c 10;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
83a34647 11;;; Copyright © 2015, 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
45147b0c 12;;; Copyright © 2015 Fabian Harfert <fhmgufs@web.de>
ec8c7e47 13;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
3c8ba11a 14;;; Copyright © 2016 Kei Kebreau <kkebreau@posteo.net>
5d4bd4cc 15;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
d7cff656 16;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
0f43f835 17;;; Copyright © 2016 Thomas Danckaert <post@thomasdanckaert.be>
5d4bd4cc 18;;; Copyright © 2017 Paul Garlick <pgarlick@tourbillion-technology.com>
54052a54 19;;; Copyright © 2017 ng0 <contact.ng0@cryptolab.net>
ba1be533 20;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
313844d9 21;;; Copyright © 2017 Theodoros Foradis <theodoros.for@openmailbox.org>
8f8b2451
AE
22;;;
23;;; This file is part of GNU Guix.
24;;;
25;;; GNU Guix is free software; you can redistribute it and/or modify it
26;;; under the terms of the GNU General Public License as published by
27;;; the Free Software Foundation; either version 3 of the License, or (at
28;;; your option) any later version.
29;;;
30;;; GNU Guix is distributed in the hope that it will be useful, but
31;;; WITHOUT ANY WARRANTY; without even the implied warranty of
32;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33;;; GNU General Public License for more details.
34;;;
35;;; You should have received a copy of the GNU General Public License
36;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
37
38(define-module (gnu packages maths)
ec322be2 39 #:use-module (ice-9 regex)
8f8b2451 40 #:use-module (gnu packages)
b5b73a82 41 #:use-module ((guix licenses) #:prefix license:)
8f8b2451
AE
42 #:use-module (guix packages)
43 #:use-module (guix download)
54052a54 44 #:use-module (guix git-download)
0e2672ae 45 #:use-module (guix utils)
cec86422 46 #:use-module (guix build utils)
da95c817 47 #:use-module (guix build-system cmake)
c9dfa3c7 48 #:use-module (guix build-system gnu)
ba1be533 49 #:use-module (guix build-system ocaml)
ec8c7e47 50 #:use-module (guix build-system r)
3de01d3f 51 #:use-module (gnu packages algebra)
5143517c 52 #:use-module (gnu packages autotools)
3de01d3f 53 #:use-module (gnu packages bison)
a17d4564 54 #:use-module (gnu packages boost)
e73b49fb 55 #:use-module (gnu packages check)
3de01d3f 56 #:use-module (gnu packages cmake)
c9dfa3c7 57 #:use-module (gnu packages compression)
668c06ac 58 #:use-module (gnu packages curl)
b7b27a8f 59 #:use-module (gnu packages cyrus-sasl)
528bb464 60 #:use-module (gnu packages documentation)
57e544e8 61 #:use-module (gnu packages elf)
3de01d3f 62 #:use-module (gnu packages flex)
668c06ac 63 #:use-module (gnu packages fltk)
f3929800 64 #:use-module (gnu packages fontutils)
1dba6407 65 #:use-module (gnu packages gettext)
da95c817 66 #:use-module (gnu packages gcc)
73fed4f8 67 #:use-module (gnu packages gd)
668c06ac 68 #:use-module (gnu packages ghostscript)
889187a4 69 #:use-module (gnu packages graphviz)
f3929800 70 #:use-module (gnu packages gtk)
45147b0c 71 #:use-module (gnu packages image)
668c06ac 72 #:use-module (gnu packages less)
8731e527 73 #:use-module (gnu packages lisp)
bc3a2e35 74 #:use-module (gnu packages logging)
6e64766a 75 #:use-module (gnu packages lua)
5698b8b8 76 #:use-module (gnu packages gnome)
1b39a196 77 #:use-module (gnu packages guile)
668c06ac
JD
78 #:use-module (gnu packages xorg)
79 #:use-module (gnu packages gl)
9f913401 80 #:use-module (gnu packages imagemagick)
8731e527 81 #:use-module (gnu packages m4)
d8c7eeb9 82 #:use-module (gnu packages mpi)
b92eee75 83 #:use-module (gnu packages multiprecision)
528bb464 84 #:use-module (gnu packages netpbm)
ba1be533 85 #:use-module (gnu packages ocaml)
668c06ac 86 #:use-module (gnu packages pcre)
5698b8b8 87 #:use-module (gnu packages popt)
c9dfa3c7
AE
88 #:use-module (gnu packages perl)
89 #:use-module (gnu packages pkg-config)
da95c817 90 #:use-module (gnu packages python)
c9dfa3c7 91 #:use-module (gnu packages readline)
2742f87e 92 #:use-module (gnu packages tbb)
479c4273 93 #:use-module (gnu packages scheme)
b7194849 94 #:use-module (gnu packages shells)
df354a77 95 #:use-module (gnu packages tcl)
668c06ac 96 #:use-module (gnu packages texinfo)
8f9ac901 97 #:use-module (gnu packages tex)
b7b27a8f 98 #:use-module (gnu packages tls)
9aafbc0c 99 #:use-module (gnu packages wxwidgets)
c12efc72 100 #:use-module (gnu packages xml)
a17d4564 101 #:use-module (srfi srfi-1))
8f8b2451 102
193abc82
JD
103(define-public aris
104 (package
1f45f18a
JD
105 (name "aris")
106 (version "2.2")
107 (source (origin
108 (method url-fetch)
109 (uri (string-append "mirror://gnu/" name "/" name "-" version ".tar.gz"))
110 (sha256 (base32
111 "1q1887ryqdr9sn0522hc7p16kqwlxxyz5dkmma8ar2nxplhgll7q"))))
112 (build-system gnu-build-system)
113 (inputs `(("gtk+" ,gtk+)
114 ("libxml2" ,libxml2)))
115 (native-inputs `(("pkg-config" ,pkg-config)))
116 (synopsis "Natural deduction first-order logic interface")
117 (description "Aris is a program for performing logical proofs. It supports
118propositional and predicate logic, as well as Boolean algebra and
119arithmetical logic. In addition to its predefined inference and equivalence
120rules, Aris also supports references to older proofs. Its use of standard
121logical symbols and its natural deduction interface make it easy to use for
122beginners.")
123 (license license:gpl3+)
6fd52309 124 (home-page "https://www.gnu.org/software/aris/")))
193abc82 125
9c45c519
JD
126(define-public c-graph
127 (package
128 (name "c-graph")
129 (version "2.0")
130 (source (origin
131 (method url-fetch)
132 (uri (string-append "mirror://gnu/c-graph/c-graph-" version
133 ".tar.gz"))
134 (sha256 (base32
135 "1hlvpzrh7hzzf533diyfiabzskddi8zx92av9hwkjw3l46z7qv01"))))
136 (build-system gnu-build-system)
137 (inputs
138 `(("fortran" ,gfortran)))
a3947cb1 139 (synopsis "Visualizing and demonstrating convolution")
9c45c519 140 (description
a3947cb1
LC
141 "GNU C-Graph is a tool for demonstrating the theory of convolution.
142Thus, it can serve as an excellent aid to students of signal and systems
143theory in visualizing the convolution process. Rather than forcing the
144student to write code, the program offers an intuitive interface with
145interactive dialogs to guide them.")
9c45c519 146 (license license:gpl3+)
6fd52309 147 (home-page "https://www.gnu.org/software/c-graph/")))
9c45c519 148
d91025e3
TD
149(define-public coda
150 (package
151 (name "coda")
e0fbf373 152 (version "2.18.2")
d91025e3
TD
153 (source
154 (origin
155 (method url-fetch)
156 (uri (string-append "https://github.com/stcorp/coda/releases/download/"
157 version "/coda-" version ".tar.gz"))
158 (sha256
e0fbf373 159 (base32 "01fnqcby9jijvf3jxr1fk4bny059lvvq5wbqm7ns60ilykfdnm6a"))
4b12fe5c
TD
160 (patches (search-patches "coda-use-system-libs.patch"))
161 (modules '((guix build utils)))
162 (snippet
163 ;; Make sure we don't use the bundled software.
164 '(for-each (lambda (d)
165 (delete-file-recursively (string-append "libcoda/" d)))
166 '("zlib" "pcre" "expat")))))
d91025e3
TD
167 (native-inputs
168 `(("fortran" ,gfortran)
169 ("python" ,python)
170 ("python-numpy" ,python-numpy)))
171 (inputs
172 `(("zlib" ,zlib)
4b12fe5c
TD
173 ("pcre" ,pcre)
174 ("expat" ,expat)
d91025e3
TD
175 ("hdf4" ,hdf4-alt)
176 ("hdf5" ,hdf5)))
177 (build-system gnu-build-system)
178 (arguments
4b12fe5c
TD
179 '(#:configure-flags '("--with-hdf4" "--with-hdf5" "--enable-python"
180 "LIBS= -lz -lpcre -lexpat")))
d91025e3
TD
181 (synopsis "A common interface to various earth observation data formats")
182 (description
183 "The Common Data Access toolbox (CODA) provides a set of interfaces for
184reading remote sensing data from earth observation data files. It consists of
185command line applications and interfaces to the C, Fortran, Python, and Java
186programming languages.")
187 (home-page "https://stcorp.nl/coda")
188 (license license:gpl2+)))
189
8f8b2451
AE
190(define-public units
191 (package
192 (name "units")
cf8d0687 193 (version "2.14")
8f8b2451
AE
194 (source (origin
195 (method url-fetch)
196 (uri (string-append "mirror://gnu/units/units-" version
197 ".tar.gz"))
198 (sha256 (base32
cf8d0687 199 "1s421bxm36akjsy3qzg6da1d1g20gh094ac2slqxipgkh8yqjcwx"))))
8f8b2451
AE
200 (build-system gnu-build-system)
201 (synopsis "Conversion between thousands of scales")
202 (description
574e86f9 203 "GNU Units converts numeric quantities between units of measure. It
7c125ce0
AK
204can handle scale changes through adaptive usage of standard scale
205prefixes (micro-, kilo-, etc.). It can also handle nonlinear
206conversions such as Fahrenheit to Celsius. Its interpreter is powerful
207enough to be used effectively as a scientific calculator.")
8f8b2451 208 (license license:gpl3+)
6fd52309 209 (home-page "https://www.gnu.org/software/units/")))
c9dfa3c7 210
61a529b4
RW
211(define-public double-conversion
212 (package
213 (name "double-conversion")
214 (version "1.1.5")
215 (source (origin
216 (method url-fetch)
217 (uri (string-append
218 "https://github.com/floitsch/double-conversion/archive/v"
219 version ".tar.gz"))
220 (file-name (string-append name "-" version ".tar.gz"))
221 (sha256
222 (base32
223 "0cnr8xhyjfxijay8ymkqcph3672wp2lj23qhdmr3m4kia5kpdf83"))))
224 (build-system cmake-build-system)
225 (arguments
226 '(#:test-target "test"
227 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
228 "-DBUILD_TESTING=ON")))
229 (home-page "https://github.com/floitsch/double-conversion")
230 (synopsis "Conversion routines for IEEE doubles")
231 (description
232 "The double-conversion library provides binary-decimal and decimal-binary
233routines for IEEE doubles. The library consists of efficient conversion
234routines that have been extracted from the V8 JavaScript engine.")
235 (license license:bsd-3)))
236
182d6311
ML
237(define-public dionysus
238 (package
239 (name "dionysus")
240 (version "1.3.0")
241 (source (origin
242 (method url-fetch)
243 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
244 ".tar.gz"))
245 (sha256
246 (base32
247 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
248 (build-system gnu-build-system)
249 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
250 (synopsis "Local search for universal constants and scientific values")
251 (description
252 "GNU Dionysus is a convenient system for quickly retrieving the values of
253mathematical constants used in science and engineering. Values can be
254searched using a simple command-line tool, choosing from three databases:
255universal constants, atomic numbers, and constants related to
256semiconductors.")
257 (license license:gpl3+)
6fd52309 258 (home-page "https://www.gnu.org/software/dionysus/")))
182d6311 259
88bd1804
AE
260(define-public gsl
261 (package
262 (name "gsl")
f885fc05 263 (version "2.4")
ab2cc5cd
LC
264 (source (origin
265 (method url-fetch)
266 (uri (string-append "mirror://gnu/gsl/gsl-"
267 version ".tar.gz"))
268 (sha256
269 (base32
f885fc05 270 "16yfs5n444s03np1naj6yp1fsysd42kdscxzkg0k2yvfjixx0ijd"))
ab2cc5cd 271 (patches (search-patches "gsl-test-i686.patch"))))
88bd1804 272 (build-system gnu-build-system)
71e0f288 273 (arguments
f885fc05 274 `(;; Currently there are numerous tests that fail on "exotic"
6f766069
EF
275 ;; architectures such as aarch64 and ppc64le.
276 ,@(if (string-prefix? "aarch64-linux"
277 (or (%current-target-system) (%current-system)))
278 '(#:tests? #f)
279 '())))
280 (home-page "https://www.gnu.org/software/gsl/")
88bd1804
AE
281 (synopsis "Numerical library for C and C++")
282 (description
a22dc0c4
LC
283 "The GNU Scientific Library is a library for numerical analysis in C
284and C++. It includes a wide range of mathematical routines, with over 1000
285functions in total. Subject areas covered by the library include:
286differential equations, linear algebra, Fast Fourier Transforms and random
287numbers.")
88bd1804
AE
288 (license license:gpl3+)))
289
ba1be533
BW
290(define-public ocaml-gsl
291 (package
292 (name "ocaml-gsl")
293 (version "1.19.3")
294 (source
295 (origin
296 (method url-fetch)
297 (uri
298 (string-append
299 "https://github.com/mmottl/gsl-ocaml/releases/download/v"
300 version"/gsl-ocaml-" version ".tar.gz"))
301 (sha256
302 (base32
303 "0nzp43hp8pbjqkrxnwp5lgjrabxayf61h18fjaydi0s5faq6f3xh"))))
304 (build-system ocaml-build-system)
305 (inputs
306 `(("gsl" ,gsl)))
307 (home-page "https://mmottl.github.io/gsl-ocaml")
308 (synopsis "Bindings to the GNU Scientific Library")
309 (description
310 "GSL-OCaml is an interface to the @dfn{GNU scientific library} (GSL) for
311the OCaml language.")
312 (license license:gpl3+)))
313
7adaab9f
BW
314(define-public ocaml4.01-gsl
315 (package-with-ocaml4.01 ocaml-gsl))
316
b92eee75
AE
317(define-public glpk
318 (package
319 (name "glpk")
1cae188e 320 (version "4.63")
b92eee75
AE
321 (source
322 (origin
323 (method url-fetch)
324 (uri (string-append "mirror://gnu/glpk/glpk-"
325 version ".tar.gz"))
326 (sha256
327 (base32
1cae188e 328 "1xp7nclmp8inp20968bvvfcwmz3mz03sbm0v3yjz8aqwlpqjfkci"))))
b92eee75
AE
329 (build-system gnu-build-system)
330 (inputs
331 `(("gmp" ,gmp)))
332 (arguments
333 `(#:configure-flags '("--with-gmp")))
82110ef6 334 (home-page "https://www.gnu.org/software/glpk/")
79c311b8 335 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
b92eee75
AE
336 (description
337 "GLPK is a C library for solving large-scale linear programming (LP),
338mixed integer programming (MIP), and other related problems. It supports the
339GNU MathProg modeling language, a subset of the AMPL language, and features a
340translator for the language. In addition to the C library, a stand-alone
341LP/MIP solver is included in the package.")
342 (license license:gpl3+)))
343
b146763a
AE
344(define-public 4ti2
345 (package
346 (name "4ti2")
347 (version "1.6.7")
348 (source
349 (origin
350 (method url-fetch)
351 (uri (string-append "http://www.4ti2.de/version_" version
352 "/4ti2-" version ".tar.gz"))
353 (sha256
354 (base32
355 "1frix3rnm9ffr93alqzw4cavxbfpf524l8rfbmcpyhwd3n1km0yl"))))
356 (build-system gnu-build-system)
357 (native-inputs
358 `(("which" ,(@ (gnu packages base) which)))) ; for the tests
359 (inputs
360 `(("glpk" ,glpk)
361 ("gmp" ,gmp)))
362 (home-page "http://www.4ti2.de/")
363 (synopsis "Mathematical tool suite for problems on linear spaces")
364 (description
365 "4ti2 implements algorithms for solving algebraic, geometric and
366combinatorial problems on linear spaces. Among others, it solves systems
367of linear equations, computes extreme rays of polyhedral cones, solves
368integer programming problems and computes Markov bases for statistics.")
369 (license license:gpl2+)))
370
53696f10
AE
371(define-public cddlib
372 (package
373 (name "cddlib")
374 (version "0.94h")
375 (source
376 (origin
377 (method url-fetch)
182dde82 378 (uri (string-append "ftp://ftp.math.ethz.ch/users/fukudak/cdd/cddlib-"
53696f10
AE
379 (string-delete #\. version) ".tar.gz"))
380 (sha256
381 (base32
382 "1dasasscwfg793q8fwzgwf64xwj7w62yfvszpr8x8g38jka08vgy"))))
383 (build-system gnu-build-system)
384 (inputs
385 `(("gmp" ,gmp)))
386 (home-page "https://www.inf.ethz.ch/personal/fukudak/cdd_home/index.html")
387 (synopsis "Library for convex hulls and extreme rays of polyhedra")
388 (description
389 "The C-library cddlib implements the Double Description Method of
390Motzkin et al. for generating all vertices (i.e. extreme points) and extreme
391rays of a general convex polyhedron given by a system of linear inequalities
392in arbitrary dimension. It can also be used for the converse operation of
393computing convex hulls.")
394 (license license:gpl2+)))
395
865a69dd
RW
396(define-public arpack-ng
397 (package
398 (name "arpack-ng")
399 (version "3.2.0")
400 (source
401 (origin
402 (method url-fetch)
403 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
404 version ".tar.gz"))
f586c877 405 (file-name (string-append name "-" version ".tar.gz"))
865a69dd
RW
406 (sha256
407 (base32
408 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
409 (build-system gnu-build-system)
410 (home-page "https://github.com/opencollab/arpack-ng")
411 (inputs
412 `(("lapack" ,lapack)
19afbea1 413 ("fortran" ,gfortran)))
865a69dd
RW
414 (synopsis "Fortran subroutines for solving eigenvalue problems")
415 (description
416 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
417large scale eigenvalue problems.")
166191b3 418 (license (license:non-copyleft "file://COPYING"
865a69dd
RW
419 "See COPYING in the distribution."))))
420
8c94c886
EB
421(define-public arpack-ng-openmpi
422 (package (inherit arpack-ng)
423 (name "arpack-ng-openmpi")
424 (inputs
425 `(("mpi" ,openmpi)
426 ,@(package-inputs arpack-ng)))
427 (arguments `(#:configure-flags '("--enable-mpi")))
428 (synopsis "Fortran subroutines for solving eigenvalue problems with MPI")))
429
da95c817
NK
430(define-public lapack
431 (package
432 (name "lapack")
ef39a177 433 (version "3.7.1")
da95c817
NK
434 (source
435 (origin
436 (method url-fetch)
437 (uri (string-append "http://www.netlib.org/lapack/lapack-"
438 version ".tgz"))
439 (sha256
440 (base32
7c0d4c3a 441 "1j51r7n5w4k7r3lrvy7710xrpkg40wf4rqnmngfz6ck9ypckzign"))))
da95c817
NK
442 (build-system cmake-build-system)
443 (home-page "http://www.netlib.org/lapack/")
19afbea1 444 (inputs `(("fortran" ,gfortran)
da95c817
NK
445 ("python" ,python-2)))
446 (arguments
3ab869b6
LC
447 `(#:configure-flags (list
448 ;; Install to PREFIX/lib (the default is
449 ;; PREFIX/lib64).
450 (string-append "-DCMAKE_INSTALL_LIBDIR="
451 (assoc-ref %outputs "out")
452 "/lib")
11f0c4e8 453
3ab869b6
LC
454 "-DBUILD_SHARED_LIBS:BOOL=YES"
455 "-DLAPACKE=ON"
456
457 ;; Build the 'LAPACKE_clatms' functions.
458 "-DLAPACKE_WITH_TMG=ON")
da95c817 459 #:phases (alist-cons-before
6a995754
LC
460 'check 'patch-python
461 (lambda* (#:key inputs #:allow-other-keys)
462 (let ((python (assoc-ref inputs "python")))
463 (substitute* "lapack_testing.py"
464 (("/usr/bin/env python") python))))
06ed5982 465 %standard-phases)))
da95c817
NK
466 (synopsis "Library for numerical linear algebra")
467 (description
468 "LAPACK is a Fortran 90 library for solving the most commonly occurring
469problems in numerical linear algebra.")
166191b3 470 (license (license:non-copyleft "file://LICENSE"
da95c817 471 "See LICENSE in the distribution."))))
73fed4f8 472
e1ff597a
EB
473(define-public scalapack
474 (package
475 (name "scalapack")
476 (version "2.0.2")
477 (source
478 (origin
479 (method url-fetch)
480 (uri (string-append "http://www.netlib.org/scalapack/scalapack-"
481 version ".tgz"))
482 (sha256
483 (base32
484 "0p1r61ss1fq0bs8ynnx7xq4wwsdvs32ljvwjnx6yxr8gd6pawx0c"))))
485 (build-system cmake-build-system)
486 (inputs
487 `(("mpi" ,openmpi)
488 ("fortran" ,gfortran)
489 ("lapack" ,lapack))) ;for testing only
490 (arguments
491 `(#:configure-flags `("-DBUILD_SHARED_LIBS:BOOL=YES")))
492 (home-page "http://www.netlib.org/scalapack/")
493 (synopsis "Library for scalable numerical linear algebra")
494 (description
495 "ScaLAPACK is a Fortran 90 library of high-performance linear algebra
496routines on parallel distributed memory machines. ScaLAPACK solves dense and
497banded linear systems, least squares problems, eigenvalue problems, and
498singular value problems.")
499 (license (license:bsd-style "file://LICENSE"
500 "See LICENSE in the distribution."))))
501
73fed4f8 502(define-public gnuplot
5f800540
KK
503 (package
504 (name "gnuplot")
7d873e0c 505 (version "5.0.6")
5f800540
KK
506 (source (origin
507 (method url-fetch)
508 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
509 version "/gnuplot-"
510 version ".tar.gz"))
511 (sha256
512 (base32
7d873e0c 513 "0q5lr6nala3ln6f3yp6g17ziymb9r9gx9zylnw1y3hjmwl9lggjv"))))
5f800540
KK
514 (build-system gnu-build-system)
515 (inputs `(("readline" ,readline)
516 ("cairo" ,cairo)
517 ("pango" ,pango)
6e64766a
DM
518 ("gd" ,gd)
519 ("lua" ,lua)))
612a387f
RW
520 (native-inputs
521 `(("pkg-config" ,pkg-config)
522 ("texlive" ,texlive-tiny)))
5f800540
KK
523 (home-page "http://www.gnuplot.info")
524 (synopsis "Command-line driven graphing utility")
525 (description "Gnuplot is a portable command-line driven graphing
35b9e423 526utility. It was originally created to allow scientists and students to
73fed4f8 527visualize mathematical functions and data interactively, but has grown to
35b9e423 528support many non-interactive uses such as web scripting. It is also used as a
73fed4f8 529plotting engine by third-party applications like Octave.")
5f800540
KK
530 ;; X11 Style with the additional restriction that derived works may only be
531 ;; distributed as patches to the original.
532 (license (license:fsf-free
533 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
668c06ac 534
32f70e1f
TD
535(define-public gctp
536 (package
537 (name "gctp")
538 (version "2.0.0")
539 (source
540 (origin
541 (method url-fetch)
542 (uri (string-append "https://github.com/OkoSanto/GCTP/archive/v"
543 version ".tar.gz"))
544 (file-name (string-append name "-" version ".tar.gz"))
545 (sha256
546 (base32
547 "0l9aqnqynh9laicn5dxf3rsb1n14xiks79wbyqccirzmjqd1c1x4"))))
548 (native-inputs
549 `(("fortran" ,gfortran)))
550 (build-system gnu-build-system)
551 (synopsis "General Cartographic Transformation Package (GCTP)")
552 (description
553 "The General Cartographic Transformation Package (GCTP) is a system of
554software routines designed to permit the transformation of coordinate pairs
555from one map projection to another. The GCTP is the standard computer
556software used by the National Mapping Division for map projection
557computations.")
558 (home-page "https://github.com/OkoSanto/GCTP")
0f7cd95b 559 (license license:public-domain))) ;https://www2.usgs.gov/laws/info_policies.html
32f70e1f 560
becbbefc
TD
561(define-public hdf4
562 (package
563 (name "hdf4")
0abf5264 564 (version "4.2.13")
becbbefc
TD
565 (source
566 (origin
567 (method url-fetch)
568 (uri (string-append "https://support.hdfgroup.org/ftp/HDF/releases/HDF"
569 version "/src/hdf-" version ".tar.bz2"))
570 (sha256
0abf5264 571 (base32 "1wz0586zh91pqb95wvr0pbh71a8rz358fdj6n2ksp85x2cis9lsm"))
15ca49b2
AE
572 (patches (search-patches "hdf4-architectures.patch"
573 "hdf4-reproducibility.patch"
becbbefc 574 "hdf4-shared-fortran.patch"))))
becbbefc
TD
575 (build-system gnu-build-system)
576 (native-inputs
577 `(("gfortran" ,gfortran)
578 ("bison" ,bison)
579 ("flex" ,flex)))
580 (inputs
581 `(("zlib" ,zlib)
582 ("libjpeg" ,libjpeg)))
583 (arguments
584 `(#:parallel-tests? #f
585 #:configure-flags '("--enable-shared")
586 #:phases
587 (modify-phases %standard-phases
953a12fa
EF
588 ;; This is inspired by two of Debian's patches.
589 (add-before 'configure 'add-more-aarch64-support
590 (lambda _
591 (substitute* '("mfhdf/ncgen/ncgen.l"
592 "mfhdf/ncgen/ncgenyy.c"
593 "mfhdf/libsrc/netcdf.h.in")
594 (("AIX5L64") "__aarch64__"))
595 #t))
becbbefc
TD
596 (add-before 'configure 'patchbuild
597 (lambda _
598 (substitute*
599 '("mfhdf/hdfimport/testutil.sh.in" "hdf/util/testutil.sh.in")
600 (("/bin/rm") "rm")
601 (("/bin/mkdir") "mkdir"))
602 (substitute* (find-files "." "^Makefile\\.in$")
603 (("@HDF_BUILD_XDR_TRUE@XDR_ADD = \
604-R\\$\\(abs_top_builddir\\)/mfhdf/xdr/\\.libs") "")
605 (("@HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = \
606-R\\$\\(abs_top_builddir\\)/mfhdf/libsrc/\\.libs \
953a12fa 607-R\\$\\(abs_top_builddir\\)/hdf/src/\\.libs \\$\\(XDR_ADD\\)") ""))
e464b455
TD
608 #t))
609 (add-after 'configure 'patch-settings
610 (lambda _
611 ;; libhdf4.settings contains the full path of the
612 ;; compilers used, and its contents are included in
613 ;; .so-files. We truncate the hashes to avoid
614 ;; unnecessary store references to those compilers:
615 (substitute* "libhdf4.settings"
616 (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
617 (string-append prefix (string-take hash 10) "...")))
618 #t))
619 )))
becbbefc
TD
620 (home-page "https://www.hdfgroup.org/products/hdf4/")
621 (synopsis
622 "Library and multi-object file format for storing and managing data")
623 (description "HDF4 is a library and multi-object file format for storing
624and managing data between machines. HDF4 is an older hierarchical data format,
625incompatible with HDF5.")
626 (license
627 (license:non-copyleft
628 "https://www.hdfgroup.org/ftp/HDF/HDF_Current/src/unpacked/COPYING"))))
629
630(define-public hdf4-alt
631 (package
632 (inherit hdf4)
633 (name "hdf4-alt")
634 (arguments
635 (substitute-keyword-arguments (package-arguments hdf4)
636 ((#:configure-flags flags) `(cons* "--disable-netcdf" ,flags))))
637 (synopsis
638 "HDF4 without netCDF API, can be combined with the regular netCDF library")))
639
7ee3f1a2
JD
640(define-public hdf5
641 (package
642 (name "hdf5")
2da63064 643 (version "1.8.19")
7ee3f1a2
JD
644 (source
645 (origin
646 (method url-fetch)
2da63064
TD
647 (uri (list (string-append "https://support.hdfgroup.org/ftp/HDF5/releases/"
648 "hdf5-" (version-major+minor version)
649 "/hdf5-" version "/src/hdf5-"
dcd9d163
LF
650 version ".tar.bz2")
651 (string-append "https://support.hdfgroup.org/ftp/HDF5/"
652 "current"
653 (apply string-append
654 (take (string-split version #\.) 2))
655 "/src/hdf5-" version ".tar.bz2")))
7ee3f1a2 656 (sha256
2da63064 657 (base32 "0f3jfbqpaaq21ighi40qzs52nb52kc2d2yjk541rjmsx20b3ih2r"))
b8d9c93b 658 (patches (list (search-patch "hdf5-config-date.patch")))))
7ee3f1a2 659 (build-system gnu-build-system)
12ed1216
AE
660 (inputs
661 `(("zlib" ,zlib)))
e3a1a1de
TD
662 (native-inputs
663 `(("gfortran" ,gfortran)))
664 (outputs '("out" ; core library
665 "fortran")) ; fortran interface
7ee3f1a2 666 (arguments
62126576 667 `(;; Some of the users, notably Flann, need the C++ interface.
e3a1a1de
TD
668 #:configure-flags '("--enable-cxx"
669 "--enable-fortran"
670 "--enable-fortran2003")
62126576
LC
671
672 #:phases
f622e212
EB
673 (modify-phases %standard-phases
674 (add-before 'configure 'patch-configure
e3a1a1de 675 (lambda* (#:key outputs #:allow-other-keys)
f622e212 676 (substitute* "configure"
b8d9c93b 677 (("/bin/mv") "mv"))
e3a1a1de
TD
678 (substitute* "fortran/src/Makefile.in"
679 (("libhdf5_fortran_la_LDFLAGS =")
680 (string-append "libhdf5_fortran_la_LDFLAGS = -Wl-rpath="
681 (assoc-ref outputs "fortran") "/lib")))
682 (substitute* "hl/fortran/src/Makefile.in"
683 (("libhdf5hl_fortran_la_LDFLAGS =")
684 (string-append "libhdf5hl_fortran_la_LDFLAGS = -Wl,-rpath="
685 (assoc-ref outputs "fortran") "/lib")))
b8d9c93b 686 #t))
fd0378a1
TD
687 (add-after 'configure 'patch-settings
688 (lambda _
689 ;; libhdf5.settings contains the full path of the
690 ;; compilers used, and its contents are included in
691 ;; libhdf5.so. We truncate the hashes to avoid
692 ;; unnecessary store references to those compilers:
693 (substitute* "src/libhdf5.settings"
694 (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
695 (string-append prefix (string-take hash 10) "...")))
696 #t))
f622e212
EB
697 (add-after 'install 'patch-references
698 (lambda* (#:key inputs outputs #:allow-other-keys)
699 (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
700 (zlib (assoc-ref inputs "zlib")))
701 (substitute* (find-files bin "h5p?cc")
702 (("-lz" lib)
703 (string-append "-L" zlib "/lib " lib)))
e3a1a1de
TD
704 #t)))
705 (add-after 'install 'split
706 (lambda* (#:key inputs outputs #:allow-other-keys)
707 ;; Move all fortran-related files
708 (let* ((out (assoc-ref outputs "out"))
709 (bin (string-append out "/bin"))
710 (lib (string-append out "/lib"))
711 (inc (string-append out "/include"))
712 (ex (string-append out "/share/hdf5_examples/fortran"))
713 (fort (assoc-ref outputs "fortran"))
714 (fbin (string-append fort "/bin"))
715 (flib (string-append fort "/lib"))
716 (finc (string-append fort "/include"))
717 (fex (string-append fort "/share/hdf5_examples/fortran")))
718 (mkdir-p fbin)
719 (mkdir-p flib)
720 (mkdir-p finc)
721 (mkdir-p fex)
722 (rename-file (string-append bin "/h5fc")
723 (string-append fbin "/h5fc"))
724 (for-each (lambda (file)
725 (rename-file file
726 (string-append flib "/" (basename file))))
727 (find-files lib ".*fortran.*"))
728 (for-each (lambda (file)
729 (rename-file file
730 (string-append finc "/" (basename file))))
731 (find-files inc ".*mod"))
732 (for-each (lambda (file)
733 (rename-file file
734 (string-append fex "/" (basename file))))
735 (find-files ex ".*"))
736 (delete-file-recursively ex))
737 #t)))))
7ee3f1a2 738 (home-page "http://www.hdfgroup.org")
516e93f8 739 (synopsis "Management suite for extremely large and complex data")
7ee3f1a2
JD
740 (description "HDF5 is a suite that makes possible the management of
741extremely large and complex data collections.")
d4bf49b1
EB
742 (license (license:x11-style
743 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
7ee3f1a2 744
d3c4f3bb
TD
745(define-public hdf-eos2
746 (package
747 (name "hdf-eos2")
748 (version "19.1.0")
749 (source
750 (origin
751 (method url-fetch)
752 (uri "ftp://edhs1.gsfc.nasa.gov\
753/edhs/hdfeos/latest_release/HDF-EOS2.19v1.00.tar.Z")
754 (sha256
755 (base32 "0c9fcz25s292ldap12wxmlrvnyz99z24p63d8fwx51bf8s0s1zrz"))
756 (patches (search-patches "hdf-eos2-remove-gctp.patch"
757 "hdf-eos2-build-shared.patch"
758 "hdf-eos2-fortrantests.patch"))))
759 (build-system gnu-build-system)
760 (native-inputs
761 `(("gfortran" ,gfortran)))
762 (inputs
763 `(("hdf4" ,hdf4-alt) ; assume most HDF-EOS2 users won't use the HDF4 netCDF API
764 ("zlib" ,zlib)
765 ("libjpeg" ,libjpeg)
766 ("gctp" ,gctp)))
767 (arguments
768 `( #:configure-flags '("--enable-install-include" "--enable-shared"
769 "CC=h4cc -Df2cFortran" "LIBS=-lgctp")
770 #:parallel-tests? #f))
771 (home-page "http://hdfeos.org/software/library.php#HDF-EOS2")
772 (synopsis "HDF4-based data format for NASA's Earth Observing System")
773 (description "HDF-EOS2 is a software library built on HDF4 which supports
774the construction of data structures used in NASA's Earth Observing
775System (Grid, Point and Swath).")
776
777 ;; Source files carry a permissive license header.
778 (license (license:non-copyleft home-page))))
779
0f43f835
TD
780(define-public hdf-eos5
781 (package
782 (name "hdf-eos5")
783 (version "1.15")
784 (source (origin
785 (method url-fetch)
786 (uri (string-append "ftp://edhs1.gsfc.nasa.gov\
787/edhs/hdfeos5/latest_release/HDF-EOS5." version ".tar.Z"))
788 (sha256
789 (base32
790 "1p83333nzzy8rn5chxlm0hrkjjnhh2w1ji8ac0f9q4xzg838i58i"))
791 (patches (search-patches "hdf-eos5-build-shared.patch"
792 "hdf-eos5-remove-gctp.patch"
793 "hdf-eos5-fix-szip.patch"
794 "hdf-eos5-fortrantests.patch"))))
795 (native-inputs
796 `(("gfortran" ,gfortran)))
797 (build-system gnu-build-system)
798 (inputs
799 `(("hdf5" ,hdf5)
800 ("zlib" ,zlib)
801 ("gctp" ,gctp)))
802 (arguments
803 `(#:configure-flags '("--enable-install-include" "--enable-shared"
804 "CC=h5cc -Df2cFortran" "LIBS=-lgctp")
805 #:parallel-tests? #f))
806 (synopsis "HDF5-based data format for NASA's Earth Observing System")
807 (description
808 "HDF-EOS5 is a software library built on HDF5 to support the construction
809of data structures used in NASA's Earth Observing System (Grid, Point and
810Swath).")
811 (home-page "http://www.hdfeos.org/software/library.php#HDF-EOS5")
812
813 ;; Source files carry a permissive license header.
814 (license (license:non-copyleft home-page))))
815
c8378eea
EB
816(define-public hdf5-parallel-openmpi
817 (package (inherit hdf5)
818 (name "hdf5-parallel-openmpi")
819 (inputs
820 `(("mpi" ,openmpi)
821 ,@(package-inputs hdf5)))
822 (arguments
823 (substitute-keyword-arguments `(#:configure-flags '("--enable-parallel")
824 ,@(package-arguments hdf5))
825 ((#:phases phases)
826 `(modify-phases ,phases
827 (add-before 'check 'patch-tests
828 (lambda _
829 ;; OpenMPI's mpirun will exit with non-zero status if it
830 ;; detects an "abnormal termination", i.e. any process not
831 ;; calling MPI_Finalize(). Since the test is explicitely
832 ;; avoiding MPI_Finalize so as not to have at_exit and thus
833 ;; H5C_flush_cache from being called, mpirun will always
834 ;; complain, so turn this test off.
835 (substitute* "testpar/Makefile"
836 (("(^TEST_PROG_PARA.*)t_pflush1(.*)" front back)
837 (string-append front back "\n")))
838 (substitute* "tools/h5diff/testph5diff.sh"
839 (("/bin/sh") (which "sh")))
840 #t))))))
841 (synopsis "Management suite for data with parallel IO support")))
842
00775104
EB
843(define-public h5check
844 (package
845 (name "h5check")
846 (version "2.0.1")
847 (source
848 (origin
849 (method url-fetch)
850 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/tools/"
851 "h5check/src/h5check-" version ".tar.gz"))
852 (sha256
853 (base32
854 "1gm76jbwhz9adbxgn14zx8cj33dmjdr2g5xcy0m9c2gakp8w59kj"))))
855 (build-system gnu-build-system)
856 (inputs `(("hdf5" ,hdf5))) ;h5cc for tests
857 (home-page "https://www.hdfgroup.org/products/hdf5_tools/h5check.html")
858 (synopsis "HDF5 format checker")
859 (description "@code{h5check} is a validation tool for verifying that an
860HDF5 file is encoded according to the HDF File Format Specification.")
861 (license (license:x11-style "file://COPYING"))))
862
a53d6719
JD
863(define-public itpp
864 (package
865 (name "itpp")
866 (version "4.3.1")
867 (source (origin
868 (method url-fetch)
869 (uri (string-append "mirror://sourceforge/itpp/itpp/"
870 version "/itpp-"
871 version ".tar.gz"))
872 (sha256
873 (base32
874 "14ddy2xnb6sgp4hiax9v5sv4pr4l4dd4ps76nfha3nrpr1ikhcqm"))))
875 (build-system cmake-build-system)
876 (arguments `(#:tests? #f)) ; Tests require googletest *sources*
877 (inputs `(("lapack" ,lapack)
878 ("fftw" ,fftw)))
3a4d5df2
RW
879 ;; FIXME: Even though the fonts are available dvips complains:
880 ;; "Font cmmi10 not found; characters will be left blank."
881 (native-inputs
882 `(("texlive" ,texlive-tiny)
883 ("ghostscript" ,ghostscript)
884 ("doxygen" ,doxygen)))
a53d6719
JD
885 (home-page "http://itpp.sourceforge.net")
886 (synopsis "C++ library of maths, signal processing and communication classes")
887 (description "IT++ is a C++ library of mathematical, signal processing and
888communication classes and functions. Its main use is in simulation of
889communication systems and for performing research in the area of
890communications. The kernel of the library consists of generic vector and
891matrix classes, and a set of accompanying routines. Such a kernel makes IT++
892similar to MATLAB, GNU Octave or SciPy.")
893 (license license:gpl3+)))
894
889187a4
EB
895(define-public netcdf
896 (package
897 (name "netcdf")
a4b0bfb1 898 (version "4.4.1.1")
889187a4
EB
899 (source
900 (origin
901 (method url-fetch)
902 (uri (string-append "ftp://ftp.unidata.ucar.edu/pub/netcdf/"
903 "netcdf-" version ".tar.gz"))
904 (sha256
905 (base32
a4b0bfb1
EB
906 "1blc7ik5yin7i0ls2kag0a9xjk12m0dzx6v1x88az3ras3scci2d"))
907 (patches (search-patches "netcdf-date-time.patch"
908 "netcdf-tst_h_par.patch"))))
889187a4
EB
909 (build-system gnu-build-system)
910 (native-inputs
911 `(("m4" ,m4)
912 ("doxygen" ,doxygen)
913 ("graphviz" ,graphviz)))
914 (inputs
db825570
TD
915 `(("hdf4" ,hdf4-alt)
916 ("hdf5" ,hdf5)
917 ("zlib" ,zlib)
918 ("libjpeg" ,libjpeg)))
889187a4 919 (arguments
db825570 920 `(#:configure-flags '("--enable-doxygen" "--enable-dot" "--enable-hdf4")
43d01672
TD
921
922 #:phases (modify-phases %standard-phases
923 (add-before 'configure 'fix-source-date
924 (lambda _
925 ;; As we ${SOURCE_DATE_EPOCH} evaluates to "1" in the build
926 ;; environment, `date -u -d ${SOURCE_DATE_EPOCH}` will evaluate
927 ;; to '1st hour of the current day', and therefore makes the
928 ;; package not reproducible.
929 (substitute* "./configure"
930 (("date -u -d \"\\$\\{SOURCE_DATE_EPOCH\\}\"")
931 "date --date='@0'"))
932 #t))
933 (add-after 'configure 'patch-settings
934 (lambda _
935 ;; libnetcdf.settings contains the full filename of the compilers
936 ;; used to build the library. We truncate the hashes of those
937 ;; filenames to avoid unnecessary references to the corresponding
938 ;; store items.
939 (substitute* "libnetcdf.settings"
940 (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
941 (string-append prefix (string-take hash 10) "...")))
942 #t)))
943
889187a4
EB
944 #:parallel-tests? #f)) ;various race conditions
945 (home-page "http://www.unidata.ucar.edu/software/netcdf/")
946 (synopsis "Library for scientific data")
947 (description "NetCDF is an interface for scientific data access and a
948software library that provides an implementation of the interface. The netCDF
949library defines a machine-independent format for representing scientific data.
950Together, the interface, library, and format support the creation, access, and
951sharing of scientific data.")
952 (license (license:x11-style "file://COPYRIGHT"))))
953
954(define-public netcdf-parallel-openmpi
955 (package (inherit netcdf)
956 (name "netcdf-parallel-openmpi")
957 (inputs
958 `(("mpi" ,openmpi)
959 ,@(alist-replace "hdf5" (list hdf5-parallel-openmpi)
960 (package-inputs netcdf))))
961 ;; TODO: Replace pkg-config references in nc-config with absolute references
962 (arguments
963 (substitute-keyword-arguments (package-arguments netcdf)
964 ((#:configure-flags flags)
965 `(cons* "CC=mpicc" "CXX=mpicxx"
966 "--enable-parallel-tests"
967 ;; Shared libraries not supported with parallel IO.
968 "--disable-shared" "--with-pic"
969 ,flags))))))
970
300200b6
TD
971(define-public netcdf-fortran
972 (package
973 (name "netcdf-fortran")
974 (version "4.4.4")
975 (source (origin
976 (method url-fetch)
977 (uri (string-append
978 "ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-fortran-"
979 version ".tar.gz"))
980 (sha256
981 (base32
982 "0xaxdcg1p83zmypwml3swsnr3ccn38inwldyr1l3wa4dbwbrblxj"))))
983 (build-system gnu-build-system)
984 (arguments
985 `(#:parallel-tests? #f))
986 (inputs
987 `(("netcdf" ,netcdf)))
988 (native-inputs
989 `(("gfortran" ,gfortran)))
990 (synopsis "Fortran interface for the netCDF library")
991 (description (package-description netcdf))
992 (home-page (package-home-page netcdf))
993 (license (package-license netcdf))))
994
1b39a196
RJ
995(define-public nlopt
996 (package
997 (name "nlopt")
998 (version "2.4.2")
999 (source (origin
1000 (method url-fetch)
1001 (uri (string-append "http://ab-initio.mit.edu/nlopt/nlopt-"
1002 version ".tar.gz"))
1003 (sha256
1004 (base32 "12cfkkhcdf4zmb6h7y6qvvdvqjs2xf9sjpa3rl3bq76px4yn76c0"))))
1005 (build-system gnu-build-system)
1006 (arguments
1007 `(;; Shared libraries are not built by default. They are required to
1008 ;; build the Guile, Octave, and Python bindings.
1009 #:configure-flags '("--enable-shared")
1010
1011 #:phases
1012 (modify-phases %standard-phases
1013 (add-before 'configure 'set-libnlopt-file-name
1014 (lambda* (#:key outputs #:allow-other-keys)
1015 ;; Make sure the Scheme module refers to the library by its
1016 ;; absolute file name (we cannot do that from a snippet
1017 ;; because the expansion of @libdir@ contains
1018 ;; ${exec_prefix}.)
1019 (let ((out (assoc-ref outputs "out")))
1020 (substitute* "swig/nlopt.scm.in"
1021 (("libnlopt")
1022 (string-append out "/lib/libnlopt")))
1023 #t))))))
1024 (inputs `(("guile" ,guile-2.0)))
1025 (native-inputs `(("pkg-config" ,pkg-config)))
1026 (home-page "http://ab-initio.mit.edu/wiki/")
1027 (synopsis "Library for nonlinear optimization")
1028 (description "NLopt is a library for nonlinear optimization, providing a
1029common interface for a number of different free optimization routines available
1030online as well as original implementations of various other algorithms.")
1031 (license license:lgpl2.1+)))
1032
005c787d
LC
1033(define-public ipopt
1034 (package
1035 (name "ipopt")
1036 (version "3.12.5")
1037 (source (origin
1038 (method url-fetch)
1039 (uri (string-append
1040 "http://www.coin-or.org/download/source/Ipopt/Ipopt-"
1041 version".tgz"))
1042 (sha256
1043 (base32
1044 "09bk2hqy2vgi4yi76xng9zxakddwqy3wij9nx7wf2vfbxxpazrsk"))
1045 (modules '((guix build utils)))
1046 (snippet
1047 ;; Make sure we don't use the bundled software.
1048 '(delete-file-recursively "ThirdParty"))))
1049 (build-system gnu-build-system)
ad1c4537
LC
1050 (arguments
1051 '(#:phases (modify-phases %standard-phases
1052 (add-after 'install 'add--L-flags-in-ipopt.pc
1053 (lambda* (#:key inputs outputs #:allow-other-keys)
1054 ;; The '.pc' file lists '-llapack -lblas' in "Libs";
1055 ;; move it to "Libs.private" where it belongs, and add a
1056 ;; '-L' flag for LAPACK.
1057 (let ((out (assoc-ref outputs "out"))
1058 (lapack (assoc-ref inputs "lapack")))
1059 (substitute* (string-append out "/lib/pkgconfig/"
1060 "ipopt.pc")
1061 (("Libs: (.*)-llapack -lblas(.*)$" _ before after)
1062 (string-append "Libs: " before " " after "\n"
1063 "Libs.private: " before
1064 "-L" lapack "/lib -llapack -lblas "
1065 after "\n")))
1066 #t))))))
005c787d
LC
1067 (native-inputs
1068 `(("gfortran" ,gfortran)))
1069 (inputs
1070 ;; TODO: Maybe add dependency on COIN-MUMPS, ASL, and HSL.
ad1c4537 1071 `(("lapack" ,lapack))) ;for both libblas and liblapack
005c787d
LC
1072 (home-page "http://www.coin-or.org")
1073 (synopsis "Large-scale nonlinear optimizer")
1074 (description
1075 "The Interior Point Optimizer (IPOPT) is a software package for
1076large-scale nonlinear optimization. It provides C++, C, and Fortran
1077interfaces.")
1078 (license license:epl1.0)))
1079
f9940ef1
LC
1080(define-public ceres
1081 (package
1082 (name "ceres-solver")
1083 (version "1.11.0")
1084 (home-page "http://ceres-solver.org/")
1085 (source (origin
1086 (method url-fetch)
1087 (uri (string-append home-page "ceres-solver-"
1088 version ".tar.gz"))
1089 (sha256
1090 (base32
1091 "0i7qkbf8g6pd8arxzldppga26ckv93y8zldsfz6wbd4n6b1nqrjd"))))
1092 (build-system cmake-build-system)
1093 (arguments
1094 ;; TODO: Build HTML user documentation and install separately.
bc3a2e35 1095 '(#:configure-flags '("-DBUILD_EXAMPLES=OFF"
f9940ef1
LC
1096 "-DBUILD_SHARED_LIBS=ON")
1097
1098 #:phases (modify-phases %standard-phases
1099 (add-before 'configure 'set-library-directory
1100 (lambda _
1101 ;; Install libraries to lib/, not lib64/.
1102 (substitute* "internal/ceres/CMakeLists.txt"
1103 (("set\\(LIB_SUFFIX \"64\"\\)")
1104 "set(LIB_SUFFIX \"\")"))
1105 #t)))))
1106 (native-inputs
1107 `(("pkg-config" ,pkg-config)))
468e0b18
LC
1108 (propagated-inputs
1109 `(("glog" ,glog))) ;for #include <glog/glog.h>
f9940ef1
LC
1110 (inputs
1111 `(("eigen" ,eigen)
1112 ("blas" ,openblas)
1113 ("lapack" ,lapack)
1114 ("suitesparse" ,suitesparse)
1115 ("gflags" ,gflags)))
1116 (synopsis "C++ library for solving large optimization problems")
1117 (description
1118 "Ceres Solver is a C++ library for modeling and solving large,
1119complicated optimization problems. It is a feature rich, mature and
1120performant library which has been used in production since 2010. Ceres Solver
1121can solve two kinds of problems:
1122@enumerate
1123@item non-linear least squares problems with bounds constraints;
1124@item general unconstrained optimization problems.
1125@end enumerate\n")
1126 (license license:bsd-3)))
1127
668c06ac
JD
1128;; For a fully featured Octave, users are strongly recommended also to install
1129;; the following packages: texinfo, less, ghostscript, gnuplot.
1130(define-public octave
1131 (package
1132 (name "octave")
e9d60eba 1133 (version "4.2.1")
668c06ac
JD
1134 (source
1135 (origin
1136 (method url-fetch)
1137 (uri (string-append "mirror://gnu/octave/octave-"
f5a077b1 1138 version ".tar.lz"))
668c06ac
JD
1139 (sha256
1140 (base32
e9d60eba 1141 "09zhhch79jw3ynw39vizx0i2cbd2bjz3sp38pjdzraqrbivpwp92"))))
668c06ac
JD
1142 (build-system gnu-build-system)
1143 (inputs
1144 `(("lapack" ,lapack)
1145 ("readline" ,readline)
181170c6 1146 ("gl2ps" ,gl2ps)
668c06ac 1147 ("glpk" ,glpk)
1ec78e9d
EB
1148 ("fftw" ,fftw)
1149 ("fftwf" ,fftwf)
1150 ("arpack" ,arpack-ng)
668c06ac
JD
1151 ("pcre" ,pcre)
1152 ("fltk" ,fltk)
1153 ("fontconfig" ,fontconfig)
1154 ("freetype" ,freetype)
40029cbe 1155 ("hdf5" ,hdf5)
668c06ac
JD
1156 ("libxft" ,libxft)
1157 ("mesa" ,mesa)
1ec78e9d 1158 ("glu" ,glu)
9f913401
AI
1159 ("zlib" ,zlib)
1160 ("curl" ,curl)
1161 ("graphicsmagick" ,graphicsmagick)))
668c06ac 1162 (native-inputs
f5a077b1
EF
1163 `(("lzip" ,lzip)
1164 ("gfortran" ,gfortran)
668c06ac
JD
1165 ("pkg-config" ,pkg-config)
1166 ("perl" ,perl)
1ec78e9d
EB
1167 ;; The following inputs are not actually used in the build process.
1168 ;; However, the ./configure gratuitously tests for their existence and
1169 ;; assumes that programs not present at build time are also not, and
1170 ;; can never be, available at run time! If these inputs are therefore
1171 ;; not present, support for them will be built out. However, Octave
1172 ;; will still run without them, albeit without the features they
668c06ac
JD
1173 ;; provide.
1174 ("less" ,less)
1175 ("texinfo" ,texinfo)
1176 ("ghostscript" ,ghostscript)
1177 ("gnuplot" ,gnuplot)))
1178 (arguments
b7b27a8f
KY
1179 `(#:configure-flags
1180 (list (string-append "--with-shell="
1181 (assoc-ref %build-inputs "bash")
1182 "/bin/sh"))))
f5a077b1 1183 (home-page "https://www.gnu.org/software/octave/")
668c06ac 1184 (synopsis "High-level language for numerical computation")
1ec78e9d
EB
1185 (description "GNU Octave is a high-level interpreted language that is
1186specialized for numerical computations. It can be used for both linear and
1187non-linear applications and it provides great support for visualizing results.
1188Work may be performed both at the interactive command-line as well as via
1189script files.")
668c06ac 1190 (license license:gpl3+)))
3de01d3f 1191
5d4bd4cc
PG
1192(define-public opencascade-oce
1193 (package
1194 (name "opencascade-oce")
1195 (version "0.17.2")
1196 (source
1197 (origin
1198 (method url-fetch)
1199 (uri (string-append
1200 "https://github.com/tpaviot/oce/archive/OCE-"
1201 version
1202 ".tar.gz"))
1203 (sha256
1204 (base32
1205 "0vpmnb0k5y2f7lpmwx9pg9yfq24zjvnsak5alzacncfm1hv9b6cd"))))
1206 (build-system cmake-build-system)
1207 (arguments
1208 '(#:configure-flags
1209 (list "-DOCE_TESTING:BOOL=ON"
1210 "-DOCE_USE_TCL_TEST_FRAMEWORK:BOOL=ON"
1211 "-DOCE_DRAW:BOOL=ON"
1212 (string-append "-DOCE_INSTALL_PREFIX:PATH="
1213 (assoc-ref %outputs "out"))
1214 "-UCMAKE_INSTALL_RPATH")))
1215 (inputs
1216 `(("freetype" ,freetype)
1217 ("glu" ,glu)
1218 ("libxmu" ,libxmu)
1219 ("mesa" ,mesa)
1220 ("tcl" ,tcl)
1221 ("tk" ,tk)))
1222 (native-inputs
1223 `(("python" ,python-wrapper)))
1224 (home-page "https://github.com/tpaviot/oce")
1225 (synopsis "Libraries for 3D modeling and numerical simulation")
1226 (description
1227 "Open CASCADE is a set of libraries for the development of applications
1228dealing with 3D CAD data or requiring industrial 3D capabilities. It includes
1229C++ class libraries providing services for 3D surface and solid modeling, CAD
1230data exchange, and visualization. It is used for development of specialized
1231software dealing with 3D models in design (CAD), manufacturing (CAM),
1232numerical simulation (CAE), measurement equipment (CMM), and quality
1233control (CAQ) domains.
1234
1235This is the ``Community Edition'' (OCE) of Open CASCADE, which gathers
1236patches, improvements, and experiments contributed by users over the official
1237Open CASCADE library.")
1238 (license (list license:lgpl2.1; OCE libraries, with an exception for the
1239 ; use of header files; see
1240 ; OCCT_LGPL_EXCEPTION.txt
1241 license:public-domain; files
1242 ; src/Standard/Standard_StdAllocator.hxx and
1243 ; src/NCollection/NCollection_StdAllocator.hxx
1244 license:expat; file src/OpenGl/OpenGl_glext.h
1245 license:bsd-3)))); test framework gtest
1246
3de01d3f
EB
1247(define-public gmsh
1248 (package
1249 (name "gmsh")
8a4d14fa 1250 (version "2.16.0")
3de01d3f
EB
1251 (source
1252 (origin
1253 (method url-fetch)
1c79e086 1254 (uri (string-append "http://gmsh.info/src/gmsh-"
3de01d3f
EB
1255 version "-source.tgz"))
1256 (sha256
8a4d14fa 1257 (base32 "1slf0bfkwrcgn6296wb4qhbk4ahz6i4wfb10hnim08x05vrylag8"))
3de01d3f
EB
1258 (modules '((guix build utils)))
1259 (snippet
1260 ;; Remove non-free METIS code
1261 '(delete-file-recursively "contrib/Metis"))))
1262 (build-system cmake-build-system)
3de01d3f
EB
1263 (propagated-inputs
1264 `(("fltk" ,fltk)
19afbea1 1265 ("gfortran" ,gfortran)
3de01d3f 1266 ("gmp" ,gmp)
40029cbe 1267 ("hdf5" ,hdf5)
3de01d3f
EB
1268 ("lapack" ,lapack)
1269 ("mesa" ,mesa)
85f41902 1270 ("glu" ,glu)
45548139 1271 ("opencascade-oce" ,opencascade-oce)
3de01d3f
EB
1272 ("libx11" ,libx11)
1273 ("libxext" ,libxext)))
66395a61
EF
1274 (inputs
1275 `(("fontconfig" ,fontconfig)
1276 ("libxft" ,libxft)))
3de01d3f
EB
1277 (arguments
1278 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
1279 "-DENABLE_BUILD_SHARED:BOOL=ON"
45548139 1280 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")))
3de01d3f
EB
1281 (home-page "http://www.geuz.org/gmsh/")
1282 (synopsis "3D finite element grid generator")
edf684ef
EB
1283 (description "Gmsh is a 3D finite element grid generator with a built-in
1284CAD engine and post-processor. Its design goal is to provide a fast, light
1285and user-friendly meshing tool with parametric input and advanced
1286visualization capabilities. Gmsh is built around four modules: geometry,
1287mesh, solver and post-processing. The specification of any input to these
1288modules is done either interactively using the graphical user interface or in
1289ASCII text files using Gmsh's own scripting language.")
3de01d3f 1290 (license license:gpl2+)))
b9100e2f 1291
6d5f63b6
JD
1292(define-public maxflow
1293 (package
1294 (name "maxflow")
1295 (version "3.04")
1296 (source (origin
1297 (method git-fetch)
1298 (uri (git-reference
1299 (url "https://github.com/gerddie/maxflow.git")
1300 (commit "42401fa54823d16b9da47716f04e5d9ef1605875")))
1301 (file-name (string-append name "-" version "-checkout"))
1302 (sha256
1303 (base32
1304 "0rll38whw55h0vcjrrwdnh9ascvxby0ph7n1l0d12z17cg215kkb"))))
1305 (build-system cmake-build-system)
1306 (home-page "http://pub.ist.ac.at/~vnk/software.html")
1307 (synopsis "Library implementing Maxflow algorithm")
1308 (description "An implementation of the maxflow algorithm described in
1309@cite{An Experimental Comparison of Min-Cut/Max-Flow Algorithms for
1310Energy Minimization in Computer Vision.\n
1311Yuri Boykov and Vladimir Kolmogorov.\n
1312In IEEE Transactions on Pattern Analysis and Machine Intelligence,\n
1313September 2004}")
1314 (license license:gpl3+)))
1315
b9100e2f
EB
1316(define-public petsc
1317 (package
1318 (name "petsc")
41a46a50 1319 (version "3.7.6")
b9100e2f
EB
1320 (source
1321 (origin
1322 (method url-fetch)
1323 ;; The *-lite-* tarball does not contain the *large* documentation
1324 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
1325 "petsc-lite-" version ".tar.gz"))
1326 (sha256
41a46a50 1327 (base32 "1y3f5jjq0v5b62i3sabp4kp5mgfyp3vnk0dxhwkrhpypax77nzxh"))))
b9100e2f
EB
1328 (build-system gnu-build-system)
1329 (native-inputs
1330 `(("python" ,python-2)
1331 ("perl" ,perl)))
1332 (inputs
19afbea1 1333 `(("gfortran" ,gfortran)
b9100e2f 1334 ("lapack" ,lapack)
f258212d 1335 ("superlu" ,superlu)
b9100e2f
EB
1336 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
1337 ;; leaving out opengl, as configuration seems to only be for mac
1338 ))
1339 (arguments
1340 `(#:test-target "test"
9a899cce 1341 #:parallel-build? #f ;build is parallel by default
b9100e2f
EB
1342 #:configure-flags
1343 `("--with-mpi=0"
f258212d
EB
1344 "--with-openmp=1"
1345 "--with-superlu=1"
1346 ,(string-append "--with-superlu-include="
1347 (assoc-ref %build-inputs "superlu") "/include")
1348 ,(string-append "--with-superlu-lib="
1349 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
9731c412
EB
1350 #:make-flags
1351 ;; Honor (parallel-job-count) for build. Do not use --with-make-np,
1352 ;; whose value is dumped to $out/lib/petsc/conf/petscvariables.
1353 (list (format #f "MAKE_NP=~a" (parallel-job-count)))
b9100e2f 1354 #:phases
64dcc289
EB
1355 (modify-phases %standard-phases
1356 (replace 'configure
1357 ;; PETSc's configure script is actually a python script, so we can't
1358 ;; run it with bash.
1359 (lambda* (#:key outputs (configure-flags '())
1360 #:allow-other-keys)
1361 (let* ((prefix (assoc-ref outputs "out"))
1362 (flags `(,(string-append "--prefix=" prefix)
1363 ,@configure-flags)))
1364 (format #t "build directory: ~s~%" (getcwd))
1365 (format #t "configure flags: ~s~%" flags)
1366 (zero? (apply system* "./configure" flags)))))
1367 (add-after 'configure 'clean-local-references
9731c412 1368 (lambda* (#:key outputs #:allow-other-keys)
64dcc289
EB
1369 (let ((out (assoc-ref outputs "out")))
1370 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
b730b437
EB
1371 ;; Prevent build directory from leaking into compiled code
1372 (((getcwd)) out)
1373 ;; Scrub timestamp for reproducibility
fafd623e 1374 ((".*Libraries compiled on.*") ""))
9731c412
EB
1375 (substitute* (find-files "." "petscvariables")
1376 ;; Do not expose build machine characteristics, set to defaults.
1377 (("MAKE_NP = [:digit:]+") "MAKE_NP = 2")
1378 (("NPMAX = [:digit:]+") "NPMAX = 2"))
fafd623e 1379 #t)))
64dcc289 1380 (add-after 'install 'clean-install
10b11968
EB
1381 ;; Try to keep installed files from leaking build directory names.
1382 (lambda* (#:key inputs outputs #:allow-other-keys)
64dcc289 1383 (let ((out (assoc-ref outputs "out")))
10b11968 1384 (substitute* (map (lambda (file)
9a899cce 1385 (string-append out "/lib/petsc/conf/" file))
fafd623e 1386 '("petscvariables"))
10b11968
EB
1387 (((getcwd)) out))
1388 ;; Make compiler references point to the store
9a899cce 1389 (substitute* (string-append out "/lib/petsc/conf/petscvariables")
dfdf5716
EB
1390 (("= (gcc|g\\+\\+|gfortran)" _ compiler)
1391 (string-append "= " (which compiler))))
10b11968
EB
1392 ;; PETSc installs some build logs, which aren't necessary.
1393 (for-each (lambda (file)
9a899cce 1394 (let ((f (string-append out "/lib/petsc/conf/" file)))
10b11968
EB
1395 (when (file-exists? f)
1396 (delete-file f))))
9a899cce
EB
1397 '("configure.log" "make.log" "gmake.log"
1398 "test.log" "error.log" "RDict.db"
fafd623e 1399 "PETScBuildInternal.cmake"
10b11968 1400 ;; Once installed, should uninstall with Guix
fafd623e
EB
1401 "uninstall.py"))
1402 #t))))))
b9100e2f 1403 (home-page "http://www.mcs.anl.gov/petsc")
16ecf3ff 1404 (synopsis "Library to solve PDEs")
b9100e2f
EB
1405 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
1406data structures and routines for the scalable (parallel) solution of
1407scientific applications modeled by partial differential equations.")
166191b3 1408 (license (license:non-copyleft
b9100e2f
EB
1409 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
1410
1411(define-public petsc-complex
1412 (package (inherit petsc)
1413 (name "petsc-complex")
1414 (arguments
1415 (substitute-keyword-arguments (package-arguments petsc)
1416 ((#:configure-flags cf)
1417 `(cons "--with-scalar-type=complex" ,cf))))
16ecf3ff 1418 (synopsis "Library to solve PDEs (with complex scalars)")))
183e44ae 1419
d8c7eeb9
EB
1420(define-public petsc-openmpi
1421 (package (inherit petsc)
1422 (name "petsc-openmpi")
1423 (inputs
1424 `(("openmpi" ,openmpi)
1425 ,@(package-inputs petsc)))
1426 (arguments
1427 (substitute-keyword-arguments (package-arguments petsc)
1428 ((#:configure-flags cf)
1429 ``("--with-mpiexec=mpirun"
1430 ,(string-append "--with-mpi-dir="
1431 (assoc-ref %build-inputs "openmpi"))
1432 ,@(delete "--with-mpi=0" ,cf)))))
16ecf3ff 1433 (synopsis "Library to solve PDEs (with MPI support)")))
d8c7eeb9
EB
1434
1435(define-public petsc-complex-openmpi
1436 (package (inherit petsc-complex)
1437 (name "petsc-complex-openmpi")
1438 (inputs
1439 `(("openmpi" ,openmpi)
1440 ,@(package-inputs petsc-complex)))
1441 (arguments
1442 (substitute-keyword-arguments (package-arguments petsc-complex)
1443 ((#:configure-flags cf)
1444 ``("--with-mpiexec=mpirun"
1445 ,(string-append "--with-mpi-dir="
1446 (assoc-ref %build-inputs "openmpi"))
1447 ,@(delete "--with-mpi=0" ,cf)))))
16ecf3ff 1448 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
d8c7eeb9 1449
a7f01414
EB
1450(define-public slepc
1451 (package
1452 (name "slepc")
baeaf882 1453 (version "3.7.4")
a7f01414
EB
1454 (source
1455 (origin
1456 (method url-fetch)
baeaf882
EB
1457 (uri (string-append "http://slepc.upv.es/download/distrib/slepc-"
1458 version ".tar.gz"))
a7f01414
EB
1459 (sha256
1460 (base32
baeaf882 1461 "12pbl8yd6r8k9xjlr1qw25rs0k1acgic7hw1s6l6bhiv9s285drg"))))
a7f01414
EB
1462 (build-system gnu-build-system)
1463 (native-inputs
1464 `(("python" ,python-2)))
1465 (inputs
1466 `(("arpack" ,arpack-ng)
1467 ("gfortran" ,gfortran)))
1468 (propagated-inputs
1469 `(("petsc" ,petsc)))
1470 (arguments
1471 `(#:parallel-build? #f ;build is parallel by default
1472 #:configure-flags
1473 `(,(string-append "--with-arpack-dir="
9cf52454 1474 (assoc-ref %build-inputs "arpack") "/lib"))
9731c412
EB
1475 #:make-flags ;honor (parallel-job-count)
1476 `(,(format #f "MAKE_NP=~a" (parallel-job-count)))
a7f01414
EB
1477 #:phases
1478 (modify-phases %standard-phases
8787c555 1479 (replace 'configure
a7f01414
EB
1480 ;; configure is a python script, so we can't run it with bash.
1481 (lambda* (#:key inputs outputs (configure-flags '())
1482 #:allow-other-keys)
1483 (let* ((prefix (assoc-ref outputs "out"))
1484 (flags `(,(string-append "--prefix=" prefix)
1485 ,@configure-flags)))
1486 (format #t "build directory: ~s~%" (getcwd))
1487 (format #t "configure flags: ~s~%" flags)
1488 (setenv "SLEPC_DIR" (getcwd))
9cf52454 1489 (setenv "PETSC_DIR" (assoc-ref inputs "petsc"))
a7f01414 1490 (zero? (apply system* "./configure" flags)))))
8787c555 1491 (add-after 'install 'delete-doc
a7f01414
EB
1492 ;; TODO: SLEPc installs HTML documentation alongside headers in
1493 ;; $out/include. We'd like to move them to share/doc, but delete
1494 ;; them for now, as they are incomplete and installing the complete
1495 ;; documentation is difficult.
1496 (lambda* (#:key outputs #:allow-other-keys)
1497 (let* ((out (assoc-ref outputs "out")))
1498 (for-each delete-file (find-files out "\\.html$")))))
8787c555 1499 (add-after 'install 'clean-install
a7f01414
EB
1500 ;; Clean up unnecessary build logs from installation.
1501 (lambda* (#:key outputs #:allow-other-keys)
1502 (let ((out (assoc-ref outputs "out")))
1503 (for-each (lambda (file)
1504 (let ((f (string-append out "/lib/slepc/conf/" file)))
1505 (when (file-exists? f)
1506 (delete-file f))))
1507 '("configure.log" "make.log" "gmake.log"
1508 "test.log" "error.log" "RDict.db"
1509 "uninstall.py"))))))))
1510 (home-page "http://slepc.upv.es")
1511 (synopsis "Scalable library for eigenproblems")
1512 (description "SLEPc is a software library for the solution of large sparse
1513eigenproblems on parallel computers. It can be used for the solution of
1514linear eigenvalue problems formulated in either standard or generalized form,
1515as well as other related problems such as the singular value decomposition.
1516The emphasis of the software is on methods and techniques appropriate for
1517problems in which the associated matrices are sparse, for example, those
1518arising after the discretization of partial differential equations.")
1519 (license license:lgpl3)))
1520
1521(define-public slepc-complex
1522 (package (inherit slepc)
1523 (name "slepc-complex")
1524 (propagated-inputs
1525 `(("petsc" ,petsc-complex)
1526 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
1527 (synopsis "Scalable library for eigenproblems (with complex scalars)")))
1528
1529(define-public slepc-openmpi
1530 (package (inherit slepc)
1531 (name "slepc-openmpi")
1532 (inputs
1533 `(("mpi" ,openmpi)
1534 ("arpack" ,arpack-ng-openmpi)
1535 ,@(alist-delete "arpack" (package-inputs slepc))))
1536 (propagated-inputs
1537 `(("petsc" ,petsc-openmpi)
1538 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
1539 (synopsis "Scalable library for eigenproblems (with MPI support)")))
1540
1541(define-public slepc-complex-openmpi
1542 (package (inherit slepc-openmpi)
1543 (name "slepc-complex-openmpi")
1544 (propagated-inputs
1545 `(("petsc" ,petsc-complex-openmpi)
1546 ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
1547 (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
1548
cec86422
EB
1549(define-public mumps
1550 (package
1551 (name "mumps")
fba78d18 1552 (version "5.0.2")
cec86422
EB
1553 (source
1554 (origin
1555 (method url-fetch)
1556 (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
1557 version ".tar.gz"))
1558 (sha256
1559 (base32
fba78d18 1560 "0igyc1pfzxdhpbad3v3lb86ixkdbqa1a8gbs15b04r2294h2nabp"))
fc1adab1 1561 (patches (search-patches "mumps-build-parallelism.patch"))))
cec86422
EB
1562 (build-system gnu-build-system)
1563 (inputs
1564 `(("fortran" ,gfortran)
1565 ;; These are required for linking against mumps, but we let the user
1566 ;; declare the dependency.
1567 ("blas" ,openblas)
1568 ("metis" ,metis)
1569 ("scotch" ,scotch)))
1570 (arguments
1571 `(#:modules ((ice-9 match)
1572 (ice-9 popen)
1573 (srfi srfi-1)
1574 ,@%gnu-build-system-modules)
1575 #:phases
1576 (modify-phases %standard-phases
fba78d18 1577 (replace 'configure
cec86422
EB
1578 (lambda* (#:key inputs #:allow-other-keys)
1579 (call-with-output-file "Makefile.inc"
1580 (lambda (port)
1581 (format port "
1582PLAT =
1583LIBEXT = .a
1584OUTC = -o
1585OUTF = -o
1586RM = rm -f~:[
1587CC = gcc
1588FC = gfortran
1589FL = gfortran
1590INCSEQ = -I$(topdir)/libseq
1591LIBSEQ = -L$(topdir)/libseq -lmpiseq
1592LIBSEQNEEDED = libseqneeded~;
1593CC = mpicc
1594FC = mpifort
1595FL = mpifort~]
1596AR = ar vr # rules require trailing space, ugh...
1597RANLIB = ranlib
1598LIBBLAS = -L~a -lopenblas~@[
1599SCALAP = -L~a -lscalapack~]
1600LIBOTHERS = -pthread
1601CDEFS = -DAdd_
1602PIC = -fPIC
1603OPTF = -O2 -DALLOW_NON_INIT $(PIC)
1604OPTL = -O2 $(PIC)
1605OPTC = -O2 $(PIC)
1606INCS = $(INCSEQ)
1607LIBS = $(SCALAP) $(LIBSEQ)
1608LPORDDIR = $(topdir)/PORD/lib
1609IPORD = -I$(topdir)/PORD/include
1610LPORD = -L$(LPORDDIR) -lpord
1611ORDERINGSF = -Dpord~@[
1612METISDIR = ~a
1613IMETIS = -I$(METISDIR)/include
1614LMETIS = -L$(METISDIR)/lib -lmetis
1615ORDERINGSF += -Dmetis~]~@[~:{
1616SCOTCHDIR = ~a
1617ISCOTCH = -I$(SCOTCHDIR)/include
1618LSCOTCH = -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
1619ORDERINGSF += ~a~}~]
1620ORDERINGSC = $(ORDERINGSF)
1621LORDERINGS = $(LPORD) $(LMETIS) $(LSCOTCH)
1622IORDERINGSF = $(ISCOTCH)
1623IORDERINGSC = $(IPORD) $(IMETIS) $(ISCOTCH)"
1624 (assoc-ref inputs "mpi")
1625 (assoc-ref inputs "blas")
1626 (assoc-ref inputs "scalapack")
1627 (assoc-ref inputs "metis")
1628 (match (list (assoc-ref inputs "pt-scotch")
1629 (assoc-ref inputs "scotch"))
1630 ((#f #f)
1631 #f)
1632 ((#f scotch)
1633 `((,scotch "" "-Dscotch")))
1634 ((ptscotch _)
1635 `((,ptscotch
1636 "-lptesmumps -lptscotch -lptscotcherr "
1637 "-Dptscotch")))))))))
fba78d18 1638 (replace 'build
cec86422
EB
1639 ;; By default only the d-precision library is built. Make with "all"
1640 ;; target so that all precision libraries and examples are built.
1641 (lambda _
1642 (zero? (system* "make" "all"
1643 (format #f "-j~a" (parallel-job-count))))))
fba78d18 1644 (replace 'check
cec86422
EB
1645 ;; Run the simple test drivers, which read test input from stdin:
1646 ;; from the "real" input for the single- and double-precision
1647 ;; testers, and from the "cmplx" input for complex-precision
1648 ;; testers. The EXEC-PREFIX key is used by the mumps-openmpi
1649 ;; package to prefix execution with "mpirun".
1650 (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
1651 (with-directory-excursion "examples"
1652 (every
1653 (lambda (prec type)
1654 (let ((tester (apply open-pipe*
1655 `(,OPEN_WRITE
1656 ,@exec-prefix
1657 ,(string-append "./" prec
1658 "simpletest"))))
1659 (input (open-input-file
1660 (string-append "input_simpletest_" type))))
1661 (begin
1662 (dump-port input tester)
1663 (close-port input)
1664 (zero? (close-pipe tester)))))
1665 '("s" "d" "c" "z")
1666 '("real" "real" "cmplx" "cmplx")))))
fba78d18
EB
1667 (replace 'install
1668 (lambda* (#:key outputs #:allow-other-keys)
1669 (let* ((out (assoc-ref outputs "out"))
1670 (libdir (string-append out "/lib")))
1671 (copy-recursively "lib" libdir)
1672 (copy-recursively "include" (string-append out "/include"))
1673 (when (file-exists? "libseq/libmpiseq.a")
1674 (install-file "libseq/libmpiseq.a" libdir))
1675 #t))))))
cec86422
EB
1676 (home-page "http://mumps.enseeiht.fr")
1677 (synopsis "Multifrontal sparse direct solver")
1678 (description
1679 "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
1680sparse system of linear equations A x = b using Guassian elimination.")
1681 (license license:cecill-c)))
1682
1683(define-public mumps-metis
1684 (package (inherit mumps)
1685 (name "mumps-metis")
1686 (inputs
1687 (alist-delete "scotch" (package-inputs mumps)))))
1688
1689(define-public mumps-openmpi
1690 (package (inherit mumps)
1691 (name "mumps-openmpi")
1692 (inputs
1693 `(("mpi" ,openmpi)
1694 ("scalapack" ,scalapack)
1695 ("pt-scotch" ,pt-scotch)
1696 ,@(alist-delete "scotch" (package-inputs mumps))))
1697 (arguments
1698 (substitute-keyword-arguments (package-arguments mumps)
1699 ((#:phases phases)
1700 `(modify-phases ,phases
1701 (replace
1702 'check
1703 (lambda _
1704 ((assoc-ref ,phases 'check)
1705 #:exec-prefix '("mpirun" "-n" "2"))))))))
1706 (synopsis "Multifrontal sparse direct solver (with MPI)")))
1707
1708(define-public mumps-metis-openmpi
1709 (package (inherit mumps-openmpi)
1710 (name "mumps-metis-openmpi")
1711 (inputs
1712 (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
1713
2d047896
RW
1714(define-public r-quadprog
1715 (package
1716 (name "r-quadprog")
1717 (version "1.5-5")
1718 (source
1719 (origin
1720 (method url-fetch)
1721 (uri (cran-uri "quadprog" version))
1722 (sha256
1723 (base32
1724 "0jg3r6abmhp8r9vkbhpx9ldjfw6vyl1m4c5vwlyjhk1mi03656fr"))))
1725 (build-system r-build-system)
1726 (native-inputs
1727 `(("gfortran" ,gfortran)))
1728 (home-page "http://cran.r-project.org/web/packages/quadprog")
1729 (synopsis "Functions to solve quadratic programming problems")
1730 (description
1731 "This package contains routines and documentation for solving quadratic
1732programming problems.")
1733 (license license:gpl3+)))
1734
ec8c7e47
RJ
1735(define-public r-pracma
1736 (package
1737 (name "r-pracma")
0f2eee0d 1738 (version "2.0.7")
ec8c7e47
RJ
1739 (source (origin
1740 (method url-fetch)
1741 (uri (cran-uri "pracma" version))
1742 (sha256
0f2eee0d 1743 (base32 "0hxa0rbbp54j0c05qj7vfwhqfdmiz5ax8vhqxd09g33x7c0hqbc5"))))
ec8c7e47 1744 (build-system r-build-system)
ccd9b151
RW
1745 (propagated-inputs
1746 `(("r-quadprog" ,r-quadprog)))
ec8c7e47
RJ
1747 (home-page "http://cran.r-project.org/web/packages/pracma")
1748 (synopsis "Practical numerical math functions")
1749 (description "This package provides functions for numerical analysis and
1750linear algebra, numerical optimization, differential equations, plus some
1751special functions. It uses Matlab function names where appropriate to simplify
1752porting.")
1753 (license license:gpl3+)))
1754
183e44ae
EB
1755(define-public superlu
1756 (package
1757 (name "superlu")
995a09e0 1758 (version "5.2.1")
183e44ae
EB
1759 (source
1760 (origin
1761 (method url-fetch)
1762 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
1763 "superlu_" version ".tar.gz"))
1764 (sha256
995a09e0
EB
1765 (base32 "0qzlb7cd608q62kyppd0a8c65l03vrwqql6gsm465rky23b6dyr8"))
1766 (modules '((guix build utils)))
1767 (snippet
1768 ;; Replace the non-free implementation of MC64 with a stub adapted
1769 ;; from Debian
1770 '(begin
1771 (use-modules (ice-9 regex)
1772 (ice-9 rdelim))
1773 (call-with-output-file "SRC/mc64ad.c"
1774 (lambda (port)
1775 (display "
1776#include <stdio.h>
1777#include <stdlib.h>
1778void mc64id_(int *a) {
1779 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
1780 abort ();
1781}
1782void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
1783 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
1784 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
1785 abort ();
1786}\n" port)))
1787 ;; Remove the corresponding license verbiage. MC64 license follows
1788 ;; a "------" line separator.
1789 (with-atomic-file-replacement "License.txt"
1790 (let ((rx (make-regexp "-{8}")))
1791 (lambda (in out)
1792 (let loop ()
1793 (let ((line (read-line in 'concat)))
1794 (unless (regexp-exec rx line)
1795 (display line out)
1796 (loop)))))))))))
1797 (build-system cmake-build-system)
183e44ae
EB
1798 (native-inputs
1799 `(("tcsh" ,tcsh)))
1800 (inputs
995a09e0 1801 `(("blas" ,openblas)
19afbea1 1802 ("gfortran" ,gfortran)))
183e44ae 1803 (arguments
995a09e0
EB
1804 `(#:configure-flags '("-Denable_blaslib:BOOL=NO" ;do not use internal cblas
1805 "-DTPL_BLAS_LIBRARIES=openblas"
1806 "-DBUILD_SHARED_LIBS:BOOL=YES"
1807 "-DCMAKE_INSTALL_LIBDIR=lib")))
183e44ae
EB
1808 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
1809 (synopsis "Supernodal direct solver for sparse linear systems")
1810 (description
1811 "SuperLU is a general purpose library for the direct solution of large,
1812sparse, nonsymmetric systems of linear equations on high performance machines.
1813The library is written in C and is callable from either C or Fortran. The
1814library routines perform an LU decomposition with partial pivoting and
1815triangular system solves through forward and back substitution. The library
1816also provides threshold-based ILU factorization preconditioners.")
995a09e0
EB
1817 (license (list license:bsd-3
1818 license:gpl2+ ;EXAMPLE/*fgmr.c
1819 (license:fsf-free "file://SRC/colamd.h")))))
f8ed036a 1820
a54aefea
EB
1821(define-public superlu-dist
1822 (package
1823 (name "superlu-dist")
1824 (version "3.3")
1825 (source
1826 (origin
1827 (method url-fetch)
1828 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
1829 "superlu_dist_" version ".tar.gz"))
1830 (sha256
1831 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
29080870
EB
1832 (modules '((guix build utils)))
1833 (snippet
1834 ;; Replace the non-free implementation of MC64 with a stub
1835 '(begin
1836 (use-modules (ice-9 regex)
1837 (ice-9 rdelim))
1838 (call-with-output-file "SRC/mc64ad.c"
1839 (lambda (port)
1840 (display "
1841#include <stdio.h>
1842#include <stdlib.h>
1843void mc64id_(int *a) {
1844 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
1845 abort ();
1846}
1847void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
1848 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
1849 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
1850 abort ();
1851}\n" port)))
1852 (delete-file "SRC/mc64ad.f.bak")
1853 (substitute* "SRC/util.c" ;adjust default algorithm
1854 (("RowPerm[[:blank:]]*=[[:blank:]]*LargeDiag")
1855 "RowPerm = NOROWPERM"))))
fc1adab1 1856 (patches (search-patches "superlu-dist-scotchmetis.patch"))))
a54aefea
EB
1857 (build-system gnu-build-system)
1858 (native-inputs
1859 `(("tcsh" ,tcsh)))
1860 (inputs
19afbea1 1861 `(("gfortran" ,gfortran)))
a54aefea
EB
1862 (propagated-inputs
1863 `(("openmpi" ,openmpi) ;headers include MPI heades
1864 ("lapack" ,lapack) ;required to link with output library
1865 ("pt-scotch" ,pt-scotch))) ;same
1866 (arguments
1867 `(#:parallel-build? #f ;race conditions using ar
1868 #:phases
1869 (alist-replace
1870 'configure
1871 (lambda* (#:key inputs outputs #:allow-other-keys)
1872 (call-with-output-file "make.inc"
1873 (lambda (port)
1874 (format port "
1875PLAT =
1876DSuperLUroot = ~a
1877DSUPERLULIB = ~a/lib/libsuperlu_dist.a
1878BLASDEF = -DUSE_VENDOR_BLAS
1879BLASLIB = -L~a/lib -lblas
1880PARMETISLIB = -L~a/lib \
1881 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
1882 -lscotch -lscotcherr -lscotcherrexit
1883METISLIB = -L~:*~a/lib \
1884 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
1885LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
1886ARCH = ar
1887ARCHFLAGS = cr
1888RANLIB = ranlib
1889CC = mpicc
1890PIC = -fPIC
1891CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
1892NOOPTS = -O0 -g $(PIC)
1893FORTRAN = mpifort
1894FFLAGS = -O2 -g $(PIC)
1895LOADER = $(CC)
1896CDEFS = -DAdd_"
1897 (getcwd)
1898 (assoc-ref outputs "out")
1899 (assoc-ref inputs "lapack")
1900 (assoc-ref inputs "pt-scotch")))))
1901 (alist-cons-after
1902 'unpack 'remove-broken-symlinks
1903 (lambda _
1904 (for-each delete-file
1905 (find-files "MAKE_INC" "\\.#make\\..*")))
1906 (alist-cons-before
1907 'build 'create-install-directories
1908 (lambda* (#:key outputs #:allow-other-keys)
1909 (for-each
1910 (lambda (dir)
1911 (mkdir-p (string-append (assoc-ref outputs "out")
1912 "/" dir)))
1913 '("lib" "include")))
1914 (alist-replace
1915 'check
1916 (lambda _
1917 (with-directory-excursion "EXAMPLE"
1918 (and
1919 (zero? (system* "mpirun" "-n" "2"
1920 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
1921 (zero? (system* "mpirun" "-n" "2"
1922 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
1923 (alist-replace
1924 'install
1925 (lambda* (#:key outputs #:allow-other-keys)
1926 ;; Library is placed in lib during the build phase. Copy over
1927 ;; headers to include.
1928 (let* ((out (assoc-ref outputs "out"))
1929 (incdir (string-append out "/include")))
1930 (for-each (lambda (file)
1931 (let ((base (basename file)))
1932 (format #t "installing `~a' to `~a'~%"
1933 base incdir)
1934 (copy-file file
1935 (string-append incdir "/" base))))
1936 (find-files "SRC" ".*\\.h$"))))
1937 %standard-phases)))))))
1938 (home-page (package-home-page superlu))
1939 (synopsis "Parallel supernodal direct solver")
1940 (description
1941 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
1942It is targeted for distributed memory parallel machines. SuperLU_DIST is
1943implemented in ANSI C, and MPI for communications.")
1944 (license license:bsd-3)))
1945
f8ed036a
EB
1946(define-public scotch
1947 (package
1948 (name "scotch")
6c798540 1949 (version "6.0.4")
f8ed036a
EB
1950 (source
1951 (origin
1952 (method url-fetch)
6c798540 1953 (uri (string-append "https://gforge.inria.fr/frs/download.php/34618/"
f8ed036a
EB
1954 "scotch_" version ".tar.gz"))
1955 (sha256
6c798540 1956 (base32 "1ir088mvrqggyqdkx9qfynmiaffqbyih5qfl5mga2nrlm1qlsgzm"))
fc1adab1
AK
1957 (patches (search-patches "scotch-test-threading.patch"
1958 "pt-scotch-build-parallelism.patch"))))
f8ed036a
EB
1959 (build-system gnu-build-system)
1960 (inputs
1961 `(("zlib" ,zlib)
5e54f4ad 1962 ("flex" ,flex)
f8ed036a
EB
1963 ("bison" ,bison)))
1964 (arguments
1965 `(#:phases
d6602ee9
EB
1966 (modify-phases %standard-phases
1967 (add-after
1968 'unpack 'chdir-to-src
1969 (lambda _ (chdir "src")))
1970 (replace
1971 'configure
1972 (lambda _
1973 (call-with-output-file "Makefile.inc"
1974 (lambda (port)
1975 (format port "
f8ed036a
EB
1976EXE =
1977LIB = .a
1978OBJ = .o
1979MAKE = make
1980AR = ar
1981ARFLAGS = -ruv
cf0ec6c4 1982CAT = cat
f8ed036a
EB
1983CCS = gcc
1984CCP = mpicc
1985CCD = gcc
1986CPPFLAGS =~{ -D~a~}
6c798540 1987CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
f8ed036a
EB
1988LDFLAGS = -lz -lm -lrt -lpthread
1989CP = cp
1990LEX = flex -Pscotchyy -olex.yy.c
1991LN = ln
1992MKDIR = mkdir
1993MV = mv
1994RANLIB = ranlib
1995YACC = bison -pscotchyy -y -b y
1996"
d6602ee9
EB
1997 '("COMMON_FILE_COMPRESS_GZ"
1998 "COMMON_PTHREAD"
1999 "COMMON_RANDOM_FIXED_SEED"
26599d69 2000 "INTSIZE64" ;use 'long' instead of 'int'
cf0ec6c4
EB
2001 ;; Prevents symbolc clashes with libesmumps
2002 "SCOTCH_RENAME"
d6602ee9
EB
2003 ;; XXX: Causes invalid frees in superlu-dist tests
2004 ;; "SCOTCH_PTHREAD"
2005 ;; "SCOTCH_PTHREAD_NUMBER=2"
2006 "restrict=__restrict"))))))
cf0ec6c4
EB
2007 (add-after
2008 'build 'build-esmumps
2009 (lambda _
2010 (zero? (system* "make"
2011 (format #f "-j~a" (parallel-job-count))
2012 "esmumps"))))
d6602ee9 2013 (replace
f8ed036a
EB
2014 'install
2015 (lambda* (#:key outputs #:allow-other-keys)
2016 (let ((out (assoc-ref outputs "out")))
2017 (mkdir out)
2018 (zero? (system* "make"
2019 (string-append "prefix=" out)
cf0ec6c4
EB
2020 "install"))
2021 ;; esmumps files are not installed with the above
2022 (for-each (lambda (f)
2023 (copy-file f (string-append out "/include/" f)))
2024 (find-files "../include" ".*esmumps.h$"))
2025 (for-each (lambda (f)
2026 (copy-file f (string-append out "/lib/" f)))
2027 (find-files "../lib" "^lib.*esmumps.*"))))))))
f8ed036a
EB
2028 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
2029 (synopsis "Programs and libraries for graph algorithms")
2030 (description "SCOTCH is a set of programs and libraries which implement
2031the static mapping and sparse matrix reordering algorithms developed within
2032the SCOTCH project. Its purpose is to apply graph theory, with a divide and
2033conquer approach, to scientific computing problems such as graph and mesh
2034partitioning, static mapping, and sparse matrix ordering, in application
2035domains ranging from structural mechanics to operating systems or
2036bio-chemistry.")
2037 ;; See LICENSE_en.txt
2038 (license license:cecill-c)))
6acb4adb 2039
1c39f3b8
PG
2040(define-public scotch32
2041 ;; This is the 'INTSIZE32' variant, which uses 32-bit integers, as needed by
2042 ;; some applications.
2043 (package (inherit scotch)
2044 (name "scotch32")
2045 (arguments
2046 (substitute-keyword-arguments (package-arguments scotch)
2047 ((#:phases scotch-phases)
2048 `(modify-phases ,scotch-phases
2049 (replace
2050 'configure
2051 (lambda _
2052 (call-with-output-file "Makefile.inc"
2053 (lambda (port)
2054 (format port "
2055EXE =
2056LIB = .a
2057OBJ = .o
2058MAKE = make
2059AR = ar
2060ARFLAGS = -ruv
2061CAT = cat
2062CCS = gcc
2063CCP = mpicc
2064CCD = gcc
2065CPPFLAGS =~{ -D~a~}
2066CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
2067LDFLAGS = -lz -lm -lrt -lpthread
2068CP = cp
2069LEX = flex -Pscotchyy -olex.yy.c
2070LN = ln
2071MKDIR = mkdir
2072MV = mv
2073RANLIB = ranlib
2074YACC = bison -pscotchyy -y -b y
2075"
2076 '("COMMON_FILE_COMPRESS_GZ"
2077 "COMMON_PTHREAD"
2078 "COMMON_RANDOM_FIXED_SEED"
2079 "INTSIZE32" ;use 32-bit integers. See INSTALL.txt
2080 ;; Prevents symbolc clashes with libesmumps
2081 "SCOTCH_RENAME"
2082 ;; XXX: Causes invalid frees in superlu-dist tests
2083 ;; "SCOTCH_PTHREAD"
2084 ;; "SCOTCH_PTHREAD_NUMBER=2"
2085 "restrict=__restrict"))))))))))
2086 (synopsis
2087 "Programs and libraries for graph algorithms (32-bit integers)")))
2088
6acb4adb
EB
2089(define-public pt-scotch
2090 (package (inherit scotch)
2091 (name "pt-scotch")
2092 (propagated-inputs
2093 `(("openmpi" ,openmpi))) ;Headers include MPI headers
2094 (arguments
2095 (substitute-keyword-arguments (package-arguments scotch)
2096 ((#:phases scotch-phases)
d6602ee9
EB
2097 `(modify-phases ,scotch-phases
2098 (replace
2099 'build
d6602ee9
EB
2100 (lambda _
2101 (and
cf0ec6c4
EB
2102 (zero? (system* "make"
2103 (format #f "-j~a" (parallel-job-count))
2104 "ptscotch" "ptesmumps"))
d6602ee9
EB
2105 ;; Install the serial metis compatibility library
2106 (zero? (system* "make" "-C" "libscotchmetis" "install")))))
2107 (replace
2108 'check
2109 (lambda _ (zero? (system* "make" "ptcheck"))))))))
6acb4adb 2110 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
5698b8b8 2111
1c25a52c
PG
2112(define-public pt-scotch32
2113 (package (inherit scotch32)
2114 (name "pt-scotch32")
2115 (propagated-inputs
2116 `(("openmpi" ,openmpi))) ;headers include MPI headers
2117 (arguments
c4d4a779
PG
2118 (substitute-keyword-arguments (package-arguments scotch32)
2119 ((#:phases scotch32-phases)
2120 `(modify-phases ,scotch32-phases
1c25a52c
PG
2121 (replace 'build
2122 (lambda _
2123 (and
2124 (zero? (system* "make"
2125 (format #f "-j~a" (parallel-job-count))
2126 "ptscotch" "ptesmumps"))
2127 ;; Install the serial metis compatibility library
2128 (zero? (system* "make" "-C" "libscotchmetis" "install")))))
2129 (replace 'check
2130 (lambda _
2131 (zero? (system* "make" "ptcheck"))))))))
2132 (synopsis
2133 "Programs and libraries for graph algorithms (with MPI and 32-bit integers)")))
2134
aa75ad00
EB
2135(define-public metis
2136 (package
2137 (name "metis")
2138 (version "5.1.0")
2139 (source
2140 (origin
2141 (method url-fetch)
2142 (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
2143 "metis-" version ".tar.gz"))
2144 (sha256
2145 (base32
2146 "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
2147 (build-system cmake-build-system)
2148 (inputs
2149 `(("blas" ,openblas)))
2150 (arguments
2151 `(#:tests? #f ;no tests
2152 #:configure-flags `("-DSHARED=ON"
2153 ,(string-append "-DGKLIB_PATH=" (getcwd)
2154 "/metis-" ,version "/GKlib"))))
2155 (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
2156 (synopsis "Graph partitioning and fill-reducing matrix ordering library")
2157 (description
2158 "METIS is a set of serial programs for partitioning graphs, partitioning
2159finite element meshes, and producing fill-reducing orderings for sparse
2160matrices. The algorithms implemented in METIS are based on the multilevel
2161recursive-bisection, multilevel k-way, and multi-constraint partitioning
2162schemes.")
2163 (license license:asl2.0))) ;As of version 5.0.3
2164
700ff222
EB
2165(define-public p4est
2166 (package
2167 (name "p4est")
2168 (version "1.1")
2169 (source
2170 (origin
2171 (method url-fetch)
2172 (uri (string-append "http://p4est.github.io/release/p4est-"
2173 version ".tar.gz"))
2174 (sha256
2175 (base32
2176 "0faina2h5qsx3m2izbzaj9bbakma1krbbjmq43wrp1hcbyijflqb"))))
2177 (build-system gnu-build-system)
2178 (inputs
2179 `(("fortran" ,gfortran)
2180 ("blas" ,openblas)
2181 ("lapack" ,lapack)
2182 ("zlib" ,zlib)))
2183 (arguments
2184 `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
2185 (assoc-ref %build-inputs "blas")
2186 " -lopenblas")
2187 ,(string-append "LAPACK_LIBS=-L"
2188 (assoc-ref %build-inputs "lapack")
2189 " -llapack"))))
2190 (home-page "http://www.p4est.org")
2191 (synopsis "Adaptive mesh refinement on forests of octrees")
2192 (description
2193 "The p4est software library enables the dynamic management of a
2194collection of adaptive octrees, conveniently called a forest of octrees.
2195p4est is designed to work in parallel and scales to hundreds of thousands of
2196processor cores.")
2197 (license license:gpl2+)))
2198
2199(define-public p4est-openmpi
2200 (package (inherit p4est)
2201 (name "p4est-openmpi")
2202 (inputs
2203 `(("mpi" ,openmpi)
2204 ,@(package-inputs p4est)))
2205 (arguments
2206 (substitute-keyword-arguments (package-arguments p4est)
2207 ((#:configure-flags cf)
2208 ``("--enable-mpi" ,@,cf))))
2209 (synopsis "Parallel adaptive mesh refinement on forests of octrees")))
2210
5698b8b8
JD
2211(define-public gsegrafix
2212 (package
2213 (name "gsegrafix")
2214 (version "1.0.6")
2215 (source
2216 (origin
2217 (method url-fetch)
2218 (uri (string-append "mirror://gnu/" name "/" name "-"
2219 version ".tar.gz"))
2220 (sha256
2221 (base32
2222 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
2223 (build-system gnu-build-system)
2224 (arguments
2225 `(#:configure-flags '("LDFLAGS=-lm")))
2226 (inputs
2227 `(("libgnomecanvas" ,libgnomecanvas)
2228 ("libbonoboui" ,libbonoboui)
2229 ("libgnomeui" ,libgnomeui)
2230 ("libgnomeprintui" ,libgnomeprintui)
2231 ("popt" ,popt)))
2232 (native-inputs
2233 `(("pkg-config" ,pkg-config)))
6fd52309 2234 (home-page "https://www.gnu.org/software/gsegrafix/")
5698b8b8
JD
2235 (synopsis "GNOME application to create scientific and engineering plots")
2236 (description "GSEGrafix is an application which produces high-quality graphical
2237plots for science and engineering. Plots are specified via simple ASCII
2238parameter files and data files and are presented in an anti-aliased GNOME
2239canvas. The program supports rectangular two-dimensional plots, histograms,
2240polar-axis plots and three-dimensional plots. Plots can be printed or saved
2241to BMP, JPEG or PNG image formats.")
2242 (license license:gpl3+)))
8731e527
JD
2243
2244(define-public maxima
2245 (package
2246 (name "maxima")
89b8df97 2247 (version "5.40.0")
8731e527
JD
2248 (source
2249 (origin
2250 (method url-fetch)
2251 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
2252 version "-source/" name "-" version ".tar.gz"))
2253 (sha256
2254 (base32
89b8df97 2255 "15pp35ayglv723bjbqc60gcdv2bm54s6pywsm4i4cwbjsf64dzkl"))
fc1adab1 2256 (patches (search-patches "maxima-defsystem-mkdir.patch"))))
8731e527 2257 (build-system gnu-build-system)
df354a77 2258 (inputs
6b2eafaa 2259 `(("gcl" ,gcl)
df354a77 2260 ("gnuplot" ,gnuplot) ;for plots
f36afe4d 2261 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
df354a77
FB
2262 (native-inputs
2263 `(("texinfo" ,texinfo)
ccbc5758
KK
2264 ("perl" ,perl)
2265 ("python" ,python)))
8731e527 2266 (arguments
df354a77
FB
2267 `(#:configure-flags
2268 (list "--enable-gcl"
2269 (string-append "--with-posix-shell="
2270 (assoc-ref %build-inputs "bash")
2271 "/bin/sh")
2272 (string-append "--with-wish="
2273 (assoc-ref %build-inputs "tk")
2274 "/bin/wish"
2275 (let ((v ,(package-version tk)))
2276 (string-take v (string-index-right v #\.)))))
df354a77 2277 ;; By default Maxima attempts to write temporary files to
77af7b24
MW
2278 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
2279 ;; Work around that.
df354a77 2280 #:make-flags (list "TMPDIR=/tmp")
0093b126
KK
2281 #:phases
2282 (modify-phases %standard-phases
2283 (add-before 'check 'pre-check
2284 (lambda _
2285 (chmod "src/maxima" #o555)
2286 #t))
2287 ;; Make sure the doc and emacs files are found in the
2288 ;; standard location. Also configure maxima to find gnuplot
2289 ;; without having it on the PATH.
2290 (add-after 'install 'post-install
2291 (lambda* (#:key outputs inputs #:allow-other-keys)
2292 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
2293 (out (assoc-ref outputs "out"))
2294 (datadir (string-append out "/share/maxima/" ,version))
2295 (binutils (string-append (assoc-ref inputs "binutils")
2296 "/bin")))
2297 (with-directory-excursion out
2298 (mkdir-p "share/emacs")
2299 (mkdir-p "share/doc")
2300 (symlink
2301 (string-append datadir "/emacs/")
2302 (string-append out "/share/emacs/site-lisp"))
2303 (symlink
2304 (string-append datadir "/doc/")
2305 (string-append out "/share/doc/maxima"))
2306 (with-atomic-file-replacement
2307 (string-append datadir "/share/maxima-init.lisp")
2308 (lambda (in out)
2309 (format out "~a ~s~a~%"
2310 "(setf $gnuplot_command "
2311 (string-append gnuplot "/bin/gnuplot") ")")
2312 (dump-port in out))))
2313 ;; Ensure that Maxima will have access to the GNU binutils
2314 ;; components at runtime.
2315 (wrap-program (string-append out "/bin/maxima")
2316 `("PATH" prefix (,binutils))))
2317 #t)))))
8731e527
JD
2318 (home-page "http://maxima.sourceforge.net")
2319 (synopsis "Numeric and symbolic expression manipulation")
2320 (description "Maxima is a system for the manipulation of symbolic and
2321numerical expressions. It yields high precision numeric results by using
2322exact fractions, arbitrary precision integers, and variable precision floating
e881752c 2323point numbers.")
8731e527
JD
2324 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
2325 ;; Others simply say "GNU General Public License" without stating a
2326 ;; version (which implicitly means gpl1+).
2327 ;; At least one file (src/maxima.asd) says "version 2."
2328 ;; GPLv2 only is therefore the smallest subset.
f36afe4d 2329 (license license:gpl2)))
ec322be2 2330
9aafbc0c
MW
2331(define-public wxmaxima
2332 (package
2333 (name "wxmaxima")
ac2ddcc6 2334 (version "17.05.1")
9aafbc0c
MW
2335 (source
2336 (origin
2337 (method url-fetch)
5143517c
KK
2338 (uri (string-append "https://github.com/andrejv/" name "/archive"
2339 "/Version-" version ".tar.gz"))
2340 (file-name (string-append name "-" version ".tar.gz"))
9aafbc0c
MW
2341 (sha256
2342 (base32
ac2ddcc6 2343 "0dv0cy0cf46v0cbw32izscpkdmpxg1qhwq1f4cz46kkqd8k4yfbj"))))
9aafbc0c 2344 (build-system gnu-build-system)
5143517c
KK
2345 (native-inputs
2346 `(("autoconf" ,autoconf)
2347 ("automake" ,automake)
2348 ("gettext" ,gettext-minimal)))
9aafbc0c
MW
2349 (inputs
2350 `(("wxwidgets" ,wxwidgets)
de477809
SB
2351 ("maxima" ,maxima)
2352 ;; Runtime support.
2353 ("adwaita-icon-theme" ,adwaita-icon-theme)
2354 ("gtk+" ,gtk+)
2355 ("shared-mime-info" ,shared-mime-info)))
9aafbc0c 2356 (arguments
ac2ddcc6
KK
2357 `(#:phases
2358 (modify-phases %standard-phases
2359 (add-after 'unpack 'autoconf
2360 (lambda _
2361 (zero? (system* "sh" "bootstrap"))))
2362 (add-after 'install 'wrap-program
2363 (lambda* (#:key inputs outputs #:allow-other-keys)
2364 (wrap-program (string-append (assoc-ref outputs "out")
2365 "/bin/wxmaxima")
2366 `("PATH" ":" prefix
2367 (,(string-append (assoc-ref inputs "maxima")
2368 "/bin")))
2369 ;; For GtkFileChooserDialog.
2370 `("GSETTINGS_SCHEMA_DIR" =
2371 (,(string-append (assoc-ref inputs "gtk+")
2372 "/share/glib-2.0/schemas")))
2373 `("XDG_DATA_DIRS" ":" prefix
2374 (;; Needed by gdk-pixbuf to know supported icon formats.
2375 ,(string-append
2376 (assoc-ref inputs "shared-mime-info") "/share")
2377 ;; The default icon theme of GTK+.
2378 ,(string-append
2379 (assoc-ref inputs "adwaita-icon-theme") "/share"))))
2380 #t)))))
9aafbc0c
MW
2381 (home-page "https://andrejv.github.io/wxmaxima/")
2382 (synopsis "Graphical user interface for the Maxima computer algebra system")
2383 (description
2384 "wxMaxima is a graphical user interface for the Maxima computer algebra
2385system. It eases the use of Maxima by making most of its commands available
2386through a menu system and by providing input dialogs for commands that require
2387more than one argument. It also implements its own display engine that
2388outputs mathematical symbols directly instead of depicting them with ASCII
2389characters.
2390
2391wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
2392text and mathematical calculations to create documents, exporting of input and
2393output to TeX, and a browser for Maxima's manual including command index and
2394full text searching.")
2395 (license license:gpl2+)))
2396
b15e47f9
RW
2397(define-public armadillo
2398 (package
2399 (name "armadillo")
133cba8c 2400 (version "7.800.2")
b15e47f9
RW
2401 (source (origin
2402 (method url-fetch)
2403 (uri (string-append "mirror://sourceforge/arma/armadillo-"
7397cd9e 2404 version ".tar.xz"))
b15e47f9
RW
2405 (sha256
2406 (base32
133cba8c 2407 "1qqzy7dp891j9v7062mv1599hdwr97vqzrd3j2fl8c3gmc00dmzg"))))
b15e47f9
RW
2408 (build-system cmake-build-system)
2409 (arguments `(#:tests? #f)) ;no test target
2410 (inputs
2411 `(("openblas" ,openblas)
2412 ("lapack" ,lapack)
2413 ("arpack" ,arpack-ng)))
2414 (home-page "http://arma.sourceforge.net/")
2415 (synopsis "C++ linear algebra library")
2416 (description
2417 "Armadillo is a C++ linear algebra library, aiming towards a good balance
2418between speed and ease of use. It is useful for algorithm development
2419directly in C++, or quick conversion of research code into production
2420environments. It can be used for machine learning, pattern recognition,
2421signal processing, bioinformatics, statistics, econometrics, etc. The library
2422provides efficient classes for vectors, matrices and cubes, as well as 150+
2423associated functions (eg. contiguous and non-contiguous submatrix views).")
fe418cc5 2424 (license license:asl2.0)))
b15e47f9 2425
279663ef 2426(define-public muparser
d7cff656
LF
2427 ;; When switching download sites, muparser re-issued a 2.2.5 release with a
2428 ;; different hash. In order to make `guix package --upgrade` work correctly,
2429 ;; we set a Guix packaging revision.
2430 ;; When the next version of muparser is released, we can remove
2431 ;; UPSTREAM-VERSION and REVISION and use the plain VERSION.
2432 (let ((upstream-version "2.2.5")
2433 (revision "2"))
2434 (package
2435 (name "muparser")
2436 (version (string-append upstream-version "-" revision))
2437 (source
2438 (origin
2439 (method url-fetch)
2440 (uri (string-append "https://github.com/beltoforion/muparser/archive/v"
2441 upstream-version ".tar.gz"))
2442 (file-name (string-append name "-" version ".tar.gz"))
2443 (sha256
2444 (base32
2445 "0277qsi5l23jsck1vhn383bmvc2n9l4a1dl5r9bf7hvjv9ayyrh6"))))
2446 (build-system gnu-build-system)
2447 (arguments
2448 `(#:configure-flags '("--enable-samples=no")
2449 #:tests? #f)) ;no "check" target
2450 (home-page "http://muparser.beltoforion.de/")
2451 (synopsis "Fast parser library for mathematical expressions")
2452 (description
2453 "muParser is an extensible high performance math parser library. It is
2454based on transforming an expression into a bytecode and precalculating constant
2455parts of it.")
2456 (license license:expat))))
279663ef 2457
e73b49fb
RW
2458(define-public openblas
2459 (package
2460 (name "openblas")
883d0a7d 2461 (version "0.2.19")
e73b49fb
RW
2462 (source
2463 (origin
2464 (method url-fetch)
2465 (uri (string-append "https://github.com/xianyi/OpenBLAS/tarball/v"
2466 version))
2467 (file-name (string-append name "-" version ".tar.gz"))
2468 (sha256
2469 (base32
883d0a7d 2470 "071zqnmnxhh0c9phzyn3f198yxa0hjxda7016azdbq2056sm70w7"))))
e73b49fb
RW
2471 (build-system gnu-build-system)
2472 (arguments
5b5ea159 2473 `(#:tests? #f ;no "check" target
bd0b4379
RW
2474 ;; DYNAMIC_ARCH is only supported on x86. When it is disabled and no
2475 ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
2476 ;; we need to disable substitutions.
71923a91
AE
2477 #:substitutable?
2478 ,(let ((system (or (%current-target-system) (%current-system))))
2479 (or (string-prefix? "x86_64" system)
bd0b4379 2480 (string-prefix? "i686" system)
83a34647
EF
2481 (string-prefix? "mips" system)
2482 (string-prefix? "aarch64" system)))
e73b49fb
RW
2483 #:make-flags
2484 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
2485 "SHELL=bash"
af5b817e
RW
2486 "NO_LAPACK=1"
2487 ;; Build the library for all supported CPUs. This allows
2488 ;; switching CPU targets at runtime with the environment variable
2489 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
71923a91
AE
2490 ;; Unfortunately, this is not supported on non-x86 architectures,
2491 ;; where it leads to failed builds.
2492 ,@(let ((system (or (%current-target-system) (%current-system))))
8a637e79
RW
2493 (cond
2494 ((or (string-prefix? "x86_64" system)
71923a91 2495 (string-prefix? "i686" system))
8a637e79
RW
2496 '("DYNAMIC_ARCH=1"))
2497 ;; On MIPS we force the "SICORTEX" TARGET, as for the other
2498 ;; two available MIPS targets special extended instructions
2499 ;; for Loongson cores are used.
2500 ((string-prefix? "mips" system)
2501 '("TARGET=SICORTEX"))
83a34647
EF
2502 ;; On aarch64 force the generic 'armv8-a' target
2503 ((string-prefix? "aarch64" system)
2504 '("TARGET=ARMV8"))
8a637e79 2505 (else '()))))
e73b49fb
RW
2506 ;; no configure script
2507 #:phases (alist-delete 'configure %standard-phases)))
2508 (inputs
19afbea1 2509 `(("fortran" ,gfortran)))
e73b49fb
RW
2510 (native-inputs
2511 `(("cunit" ,cunit)
2512 ("perl" ,perl)))
2513 (home-page "http://www.openblas.net/")
2514 (synopsis "Optimized BLAS library based on GotoBLAS")
2515 (description
2516 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
2517 (license license:bsd-3)))
2518
5a7deb11
LC
2519(define* (make-blis implementation #:optional substitutable?)
2520 "Return a BLIS package with the given IMPLEMENTATION (see config/ in the
2521source tree for a list of implementations.)
2522
2523SUBSTITUTABLE? determines whether the package is made available as a
2524substitute.
2525
2526Currently the specialization must be selected at configure-time, but work is
2527underway to allow BLIS to select the right optimized kernels at run time:
2528<https://github.com/flame/blis/issues/129>."
2529 (package
2530 (name (if (string=? implementation "reference")
2531 "blis"
2532 (string-append "blis-" implementation)))
2533 (version "0.2.2")
2534 (home-page "https://github.com/flame/blis")
2535 (source (origin
2536 (method git-fetch)
2537 (uri (git-reference (url home-page) (commit version)))
2538 (sha256
2539 (base32
2540 "1wr79a50nm4abhw8w3sn96nmwp5mrzifcigk7khw9qcgyyyqayfh"))
2541 (file-name (git-file-name "blis" version))))
2542 (build-system gnu-build-system)
2543 (arguments
2544 `(#:test-target "test"
2545
2546 #:substitutable? ,substitutable?
2547
2548 #:phases (modify-phases %standard-phases
2549 (replace 'configure
2550 (lambda* (#:key outputs #:allow-other-keys)
2551 ;; This is a home-made 'configure' script.
2552 (let ((out (assoc-ref outputs "out")))
2553 (zero? (system* "./configure" "-p" out
2554 "-d" "opt"
2555 "--disable-static"
2556 "--enable-shared"
2557 "--enable-threading=openmp"
2558
2559 ,implementation)))))
2560 (add-before 'check 'show-test-output
2561 (lambda _
2562 ;; By default "make check" is silent. Make it verbose.
2563 (system "tail -F output.testsuite &")
2564 #t)))))
2565 (synopsis "High-performance basic linear algebra (BLAS) routines")
2566 (description
2567 "BLIS is a portable software framework for instantiating high-performance
2568BLAS-like dense linear algebra libraries. The framework was designed to
2569isolate essential kernels of computation that, when optimized, immediately
2570enable optimized implementations of most of its commonly used and
2571computationally intensive operations. While BLIS exports a new BLAS-like API,
2572it also includes a BLAS compatibility layer which gives application developers
2573access to BLIS implementations via traditional BLAS routine calls.")
2574 (license license:bsd-3)))
2575
2576(define-public blis
2577 ;; This is the "reference" implementation, which is the non-optimized but
2578 ;; portable variant (no assembly).
2579 (make-blis "reference" #t))
2580
2581(define ignorance blis)
2582
2583(define-syntax-rule (blis/x86_64 processor)
2584 "Expand to a package specialized for PROCESSOR."
2585 (package
2586 (inherit (make-blis processor))
2587 (supported-systems '("x86_64-linux"))))
2588
2589(define-public blis-sandybridge
2590 ;; BLIS specialized for Sandy Bridge processors (launched 2011):
2591 ;; <http://ark.intel.com/products/codename/29900/Sandy-Bridge>.
2592 (blis/x86_64 "sandybridge"))
2593
2594(define-public blis-haswell
2595 ;; BLIS specialized for Haswell processors (launched 2013):
2596 ;; <http://ark.intel.com/products/codename/42174/Haswell>.
2597 (blis/x86_64 "haswell"))
2598
2599(define-public blis-knl
2600 ;; BLIS specialized for Knights Landing processor (launched 2016):
2601 ;; <http://ark.intel.com/products/series/92650/Intel-Xeon-Phi-x200-Product-Family>.
2602 (blis/x86_64 "knl"))
2603
2604
e1605e36
RW
2605(define-public openlibm
2606 (package
2607 (name "openlibm")
26f6e565 2608 (version "0.5.1")
e1605e36
RW
2609 (source
2610 (origin
2611 (method url-fetch)
2612 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
2613 version ".tar.gz"))
2614 (file-name (string-append name "-" version ".tar.gz"))
2615 (sha256
2616 (base32
26f6e565 2617 "11czx2z7nh6dfpz45s3xl7v38hw36jxzxfvny454bk3if14pfakq"))))
e1605e36
RW
2618 (build-system gnu-build-system)
2619 (arguments
2620 `(#:make-flags
2621 (list (string-append "prefix=" (assoc-ref %outputs "out")))
2622 #:phases
2623 ;; no configure script
2624 (alist-delete 'configure %standard-phases)
2625 #:tests? #f)) ;the tests are part of the default target
2626 (home-page "http://openlibm.org/")
2627 (synopsis "Portable C mathematical library (libm)")
2628 (description
2629 "OpenLibm is an effort to have a high quality, portable, standalone C
2630mathematical library (libm). It can be used standalone in applications and
2631programming language implementations. The project was born out of a need to
e881752c 2632have a good libm for the Julia programming language that worked consistently
e1605e36
RW
2633across compilers and operating systems, and in 32-bit and 64-bit
2634environments.")
538c0e3b
EF
2635 ;; Each architecture has its own make target, and there is none for mips.
2636 (supported-systems (delete "mips64el-linux" %supported-systems))
e1605e36
RW
2637 ;; See LICENSE.md for details.
2638 (license (list license:expat
2639 license:isc
2640 license:bsd-2
2641 license:public-domain
2642 license:lgpl2.1+))))
2643
e62be58f
RW
2644(define-public openspecfun
2645 (package
2646 (name "openspecfun")
49f54a74 2647 (version "0.5.2")
e62be58f
RW
2648 (source
2649 (origin
2650 (method url-fetch)
2651 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
2652 version ".tar.gz"))
2653 (file-name (string-append name "-" version ".tar.gz"))
2654 (sha256
2655 (base32
49f54a74 2656 "1y5b2h6f2k72536kym3vzy3li3bhpd23x463g7hdmjdi3cncavz1"))))
e62be58f
RW
2657 (build-system gnu-build-system)
2658 (arguments
2659 '(#:tests? #f ;no "check" target
2660 #:make-flags
2661 (list (string-append "prefix=" (assoc-ref %outputs "out")))
2662 ;; no configure script
2663 #:phases (alist-delete 'configure %standard-phases)))
2664 (inputs
19afbea1 2665 `(("fortran" ,gfortran)))
e62be58f
RW
2666 (home-page "https://github.com/JuliaLang/openspecfun")
2667 (synopsis "Collection of special mathematical functions")
2668 (description
2669 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
2670portable package for Bessel Functions of a Complex Argument and Nonnegative
2671Order; it contains subroutines for computing Bessel functions and Airy
2672functions. Faddeeva allows computing the various error functions of arbitrary
2673complex arguments (Faddeeva function, error function, complementary error
2674function, scaled complementary error function, imaginary error function, and
2675Dawson function); given these, one can also easily compute Voigt functions,
2676Fresnel integrals, and similar related functions as well.")
2677 ;; Faddeeva is released under the Expat license; AMOS is included as
2678 ;; public domain software.
2679 (license (list license:expat license:public-domain))))
2680
2742f87e
RW
2681(define-public suitesparse
2682 (package
2683 (name "suitesparse")
bd5b5ac0 2684 (version "4.5.5")
2742f87e
RW
2685 (source
2686 (origin
2687 (method url-fetch)
2688 (uri (string-append
2689 "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-"
2690 version ".tar.gz"))
2691 (sha256
2692 (base32
bd5b5ac0
EB
2693 "1dnr6pmjzc2qmbkmb4shigx1l74ilf6abn7svyd6brxgvph8vadr"))
2694 (modules '((guix build utils)))
2695 (snippet
2696 ;; Remove bundled metis source
2697 '(delete-file-recursively "metis-5.1.0"))))
2742f87e
RW
2698 (build-system gnu-build-system)
2699 (arguments
bd5b5ac0 2700 '(#:tests? #f ;no "check" target
2742f87e
RW
2701 #:make-flags
2702 (list "CC=gcc"
2703 "BLAS=-lblas"
2704 "TBB=-ltbb"
bd5b5ac0 2705 "MY_METIS_LIB=-lmetis"
2742f87e
RW
2706 (string-append "INSTALL_LIB="
2707 (assoc-ref %outputs "out") "/lib")
2708 (string-append "INSTALL_INCLUDE="
bd5b5ac0
EB
2709 (assoc-ref %outputs "out") "/include")
2710 "library")
2742f87e 2711 #:phases
2509522c 2712 (modify-phases %standard-phases
bd5b5ac0 2713 (delete 'configure)))) ;no configure script
2742f87e
RW
2714 (inputs
2715 `(("tbb" ,tbb)
bd5b5ac0
EB
2716 ("lapack" ,lapack)
2717 ("metis" ,metis)))
2742f87e
RW
2718 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
2719 (synopsis "Suite of sparse matrix software")
2720 (description
2721 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
2722multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
2723multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
2724simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
2725CXSparse, a concise sparse Cholesky factorization package; and many other
2726packages.")
2727 ;; LGPLv2.1+:
2728 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
2729 ;; GPLv2+:
2730 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
2731 (license (list license:gpl2+ license:lgpl2.1+))))
2732
ec322be2
FB
2733(define-public atlas
2734 (package
2735 (name "atlas")
3c98ac02 2736 (version "3.10.3")
ec322be2
FB
2737 (source (origin
2738 (method url-fetch)
de67e922
LF
2739 (uri (string-append "mirror://sourceforge/math-atlas/Stable/"
2740 version "/atlas" version ".tar.bz2"))
ec322be2
FB
2741 (sha256
2742 (base32
3c98ac02 2743 "1dyjlq3fiparvm8ypwk6rsmjzmnwk81l88gkishphpvc79ryp216"))))
ec322be2
FB
2744 (build-system gnu-build-system)
2745 (home-page "http://math-atlas.sourceforge.net/")
19afbea1 2746 (inputs `(("gfortran" ,gfortran)
ec322be2
FB
2747 ("lapack-tar" ,(package-source lapack))))
2748 (outputs '("out" "doc"))
01480b9e
FB
2749 ;; For the moment we drop support for MIPS at it fails to compile. See
2750 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
2751 (supported-systems (delete "mips64el-linux" %supported-systems))
ec322be2
FB
2752 (arguments
2753 `(#:parallel-build? #f
2754 #:parallel-tests? #f
f15615b1
LC
2755
2756 ;; ATLAS tunes itself for the machine it is built on, as explained at
2757 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
2758 ;; For this reason, we want users to build it locally instead of using
2759 ;; substitutes.
2760 #:substitutable? #f
2761
ec322be2
FB
2762 #:modules ((srfi srfi-26)
2763 (srfi srfi-1)
2764 (guix build gnu-build-system)
2765 (guix build utils))
40029cbe 2766 #:configure-flags
ec322be2
FB
2767 `(;; Generate position independent code suitable for dynamic libraries
2768 ;; and use WALL timer to get more accurate timing.
2769 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
2770 ;; Set word width.
2771 "-b"
2772 ,,(if (string-match "64" (%current-system))
2773 "64"
2774 "32")
2775 ;; Disable parallel build as it gives errors: atlas_pthread.h is
2776 ;; needed to compile C files before it is generated.
2777 "-Ss" "pmake" "make -j 1"
af89a667
FB
2778 ;; Probe is failing for MIPS. We therefore define the system
2779 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
2780 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
2781 ,,@(if (string-prefix? "mips" (%current-system))
2782 (list "-A" "49" "-V" "1")
2783 (list))
ec322be2
FB
2784 ;; Generate shared libraries.
2785 "--shared"
2786 ;; Build a full LAPACK library.
2787 ,(string-append "--with-netlib-lapack-tarfile="
2788 (assoc-ref %build-inputs "lapack-tar")))
2789 #:phases
e5b4b96b
EF
2790 (modify-phases %standard-phases
2791 (add-after 'install 'install-doc
2792 (lambda* (#:key outputs inputs #:allow-other-keys)
2793 (let ((doc (string-append (assoc-ref outputs "doc")
2794 "/share/doc/atlas")))
2795 (mkdir-p doc)
2796 (fold (lambda (file previous)
2797 (and previous (zero? (system* "cp" file doc))))
2798 #t (find-files "../ATLAS/doc" ".*")))))
2799 (add-after 'check 'check-pt
2800 (lambda _ (zero? (system* "make" "ptcheck"))))
2801 ;; Fix files required to run configure.
2802 (add-before 'configure 'fix-/bin/sh
ec322be2
FB
2803 (lambda _
2804 ;; Use `sh', not `/bin/sh'.
2805 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
2806 (("/bin/sh")
e5b4b96b
EF
2807 "sh"))))
2808 ;; Fix /bin/sh in generated make files.
2809 (add-after 'configure 'fix-/bin/sh-in-generated-files
2810 (lambda _
2811 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
2812 (("/bin/sh")
2813 "sh"))))
2814 ;; ATLAS configure program does not accepts the default flags
2815 ;; passed by the 'gnu-build-system'.
2816 (replace 'configure
2817 (lambda* (#:key native-inputs inputs outputs
2818 (configure-flags '())
2819 #:allow-other-keys #:rest args)
2820 (let* ((prefix (assoc-ref outputs "out"))
2821 (bash (or (and=> (assoc-ref
2822 (or native-inputs inputs) "bash")
2823 (cut string-append <> "/bin/bash"))
2824 "/bin/sh"))
2825 (flags `(,(string-append "--prefix=" prefix)
2826 ,@configure-flags))
2827 (abs-srcdir (getcwd))
2828 (srcdir (string-append "../" (basename abs-srcdir))))
2829 (format #t "source directory: ~s (relative from build: ~s)~%"
2830 abs-srcdir srcdir)
2831 (mkdir "../build")
2832 (chdir "../build")
2833 (format #t "build directory: ~s~%" (getcwd))
2834 (format #t "configure flags: ~s~%" flags)
2835 (zero? (apply system* bash
2836 (string-append srcdir "/configure")
2837 flags))))))))
ec322be2
FB
2838 (synopsis "Automatically Tuned Linear Algebra Software")
2839 (description
2840 "ATLAS is an automatically tuned linear algebra software library
2841providing C and Fortran77 interfaces to a portably efficient BLAS
2842implementation, as well as a few routines from LAPACK.
2843
f15615b1
LC
2844Optimization occurs at build time. For this reason, the library is built on
2845the machine where it is installed, without resorting to pre-built substitutes.
ec322be2 2846
f15615b1 2847Before building the library, CPU throttling should be disabled. This can be
d97c429a 2848done in the BIOS, or, on GNU/Linux, with the following command:
ec322be2 2849
8e9ba611 2850@example
d97c429a 2851# cpupower --governor performance
8e9ba611 2852@end example
ec322be2 2853
d97c429a 2854Failure to do so will result in a library with poor performance.")
ec322be2 2855 (license license:bsd-3)))
c12efc72
AE
2856
2857(define-public glm
2858 (package
2859 (name "glm")
2860 (version "0.9.6.3")
2861 (source
2862 (origin
2863 (method url-fetch)
de67e922
LF
2864 (uri (string-append "mirror://sourceforge/ogl-math/glm-" version
2865 "/glm-" version ".zip"))
c12efc72
AE
2866 (sha256
2867 (base32
2868 "1cnjmi033a16a95v6xfkr1bvfmkd26hzdjka8j1819hgn5b1nr8l"))))
2869 (build-system cmake-build-system)
2870 (native-inputs
2871 `(("unzip" ,unzip)))
2872 (home-page "http://glm.g-truc.net")
2873 (synopsis "OpenGL Mathematics library")
2874 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
2875library for graphics software based on the OpenGL Shading Language (GLSL)
2876specifications.")
2877 (license license:expat)))
7f18257b
AE
2878
2879(define-public lpsolve
2880 (package
2881 (name "lpsolve")
2882 (version "5.5.2.0")
2883 (source
2884 (origin
2885 (method url-fetch)
2886 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
2887 "/lp_solve_" version "_source.tar.gz"))
2888 (sha256
2889 (base32
2890 "176c7f023mb6b8bfmv4rfqnrlw88lsg422ca74zjh19i2h5s69sq"))
2891 (modules '((guix build utils)))
2892 (snippet
2893 '(substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
2894 (("^c=cc") "c=gcc")
2895 ;; Pretend to be on a 64 bit platform to obtain a common directory
2896 ;; name for the build results on all architectures; nothing else
2897 ;; seems to depend on it.
5dbfbef7
LC
2898 (("^PLATFORM=.*$") "PLATFORM=ux64\n")
2899
2900 ;; The check for 'isnan' as it is written fails with
2901 ;; "non-floating-point argument in call to function
2902 ;; ‘__builtin_isnan’", which leads to the 'NOISNAN' cpp macro
2903 ;; definition, which in turn leads to bad things. Fix the feature
2904 ;; test.
2905 (("isnan\\(0\\)") "isnan(0.)")))))
7f18257b
AE
2906 (build-system gnu-build-system)
2907 (arguments
2908 `(#:tests? #f ; no check target
2909 #:phases
2910 (modify-phases %standard-phases
2911 (delete 'configure)
2912 (replace 'build
2913 (lambda _
6689d094
LC
2914 (and (with-directory-excursion "lpsolve55"
2915 (zero? (system* "bash" "ccc")))
2916 (with-directory-excursion "lp_solve"
2917 (zero? (system* "bash" "ccc"))))))
7f18257b
AE
2918 (replace 'install
2919 (lambda* (#:key outputs #:allow-other-keys)
2920 (let* ((out (assoc-ref outputs "out"))
2921 (bin (string-append out "/bin"))
2922 (lib (string-append out "/lib"))
2923 ;; This is where LibreOffice expects to find the header
2924 ;; files, and where they are installed by Debian.
2925 (include (string-append out "/include/lpsolve")))
2926 (mkdir-p lib)
2927 (copy-file "lpsolve55/bin/ux64/liblpsolve55.a"
2928 (string-append lib "/liblpsolve55.a"))
2929 (copy-file "lpsolve55/bin/ux64/liblpsolve55.so"
2930 (string-append lib "/liblpsolve55.so"))
96c46210
LC
2931 (install-file "lp_solve/bin/ux64/lp_solve" bin)
2932
7f18257b
AE
2933 ;; Install a subset of the header files as on Debian
2934 ;; (plus lp_bit.h, which matches the regular expression).
96c46210
LC
2935 (for-each (lambda (name)
2936 (install-file name include))
2937 (find-files "." "lp_[HMSa-z].*\\.h$"))
7f18257b 2938 (with-directory-excursion "shared"
96c46210
LC
2939 (for-each (lambda (name)
2940 (install-file name include))
2941 (find-files "." "\\.h$")))
7f18257b
AE
2942 #t))))))
2943 (home-page "http://lpsolve.sourceforge.net/")
2944 (synopsis "Mixed integer linear programming (MILP) solver")
2945 (description
2946 "lp_solve is a mixed integer linear programming solver based on the
2947revised simplex and the branch-and-bound methods.")
2948 (license license:lgpl2.1+)))
a17d4564
EB
2949
2950(define-public dealii
2951 (package
2952 (name "dealii")
d84b09e9 2953 (version "8.5.0")
a17d4564
EB
2954 (source
2955 (origin
2956 (method url-fetch)
2957 (uri (string-append "https://github.com/dealii/dealii/releases/"
2958 "download/v" version "/dealii-" version ".tar.gz"))
2959 (sha256
2960 (base32
d84b09e9 2961 "0yfpy4zh8j7hmqakw17zdlmvfdcmhwgs66wcb716plc4y7v3z4g6"))
a17d4564
EB
2962 (modules '((guix build utils)))
2963 (snippet
2964 ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
2965 '(delete-file-recursively "bundled"))))
2966 (build-system cmake-build-system)
2967 (inputs
2968 `(("tbb" ,tbb)
2969 ("zlib" ,zlib)
2970 ("boost" ,boost)
2971 ("p4est" ,p4est)
2972 ("blas" ,openblas)
2973 ("lapack" ,lapack)
2974 ("arpack" ,arpack-ng)
2975 ("muparser" ,muparser)
2976 ("gfortran" ,gfortran)
2977 ("suitesparse" ,suitesparse))) ;for UMFPACK
2978 (arguments
2979 `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease
d84b09e9
EB
2980 #:configure-flags
2981 ;; Work around a bug in libsuitesparseconfig linking
2982 ;; see https://github.com/dealii/dealii/issues/4745
2983 '("-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON")))
a17d4564
EB
2984 (home-page "https://www.dealii.org")
2985 (synopsis "Finite element library")
2986 (description
2987 "Deal.II is a C++ program library targeted at the computational solution
2988of partial differential equations using adaptive finite elements. The main
2989aim of deal.II is to enable rapid development of modern finite element codes,
2990using among other aspects adaptive meshes and a wide array of tools often used
2991in finite element programs.")
2992 (license license:lgpl2.1+)))
2993
2994(define-public dealii-openmpi
2995 (package (inherit dealii)
2996 (name "dealii-openmpi")
2997 (inputs
2998 `(("mpi" ,openmpi)
2999 ;;Supported only with MPI:
3000 ("p4est" ,p4est-openmpi)
3001 ("petsc" ,petsc-openmpi)
3002 ("slepc" ,slepc-openmpi)
3003 ("metis" ,metis) ;for MUMPS
3004 ("scalapack" ,scalapack) ;for MUMPS
3005 ("mumps" ,mumps-metis-openmpi) ;configure supports only metis orderings
3006 ("arpack" ,arpack-ng-openmpi)
3007 ,@(fold alist-delete (package-inputs dealii)
3008 '("p4est" "arpack"))))
3009 (arguments
3010 (substitute-keyword-arguments (package-arguments dealii)
3011 ((#:configure-flags cf)
3012 ``("-DMPI_C_COMPILER=mpicc"
3013 "-DMPI_CXX_COMPILER=mpicxx"
3014 "-DMPI_Fortran_COMPILER=mpifort"
3015 ,@,cf))))
3016 (synopsis "Finite element library (with MPI support)")))
194c7f95
AE
3017
3018(define-public flann
3019 (package
3020 (name "flann")
3021 (version "1.8.4")
3022 (source
3023 (origin
3024 (method url-fetch)
3025 (uri
3026 (string-append
3027 "http://www.cs.ubc.ca/research/flann/uploads/FLANN/flann-"
3028 version "-src.zip"))
3029 (sha256
3030 (base32
3031 "022w8hph7bli5zbpnk3z1qh1c2sl5hm8fw2ccim651ynn0hr7fyz"))))
3032 (build-system cmake-build-system)
6b6aca9b
LC
3033 (outputs '("out"
3034 "octave")) ;46 MiB .mex file that pulls Octave
194c7f95
AE
3035 (native-inputs
3036 `(("unzip" ,unzip)))
3037 (inputs
3038 `(("hdf5" ,hdf5)
3039 ("octave" ,octave)
3040 ("python" ,python-2) ; print syntax
3041 ;; ("python2-numpy" ,python2-numpy) ; only required for the tests
3042 ("zlib" ,zlib)))
3043 (arguments
39b30337
LC
3044 `(;; The 'share/flann/octave' contains a .mex file, which is an ELF file
3045 ;; taken 46 MiB unstripped, and 6 MiB stripped.
3046 #:strip-directories '("lib" "lib64" "libexec"
3047 "bin" "sbin" "share/flann/octave")
3048
9684e30b
LC
3049 ;; Save 12 MiB by not installing .a files. Passing
3050 ;; '-DBUILD_STATIC_LIBS=OFF' has no effect.
3051 #:phases (modify-phases %standard-phases
6b6aca9b
LC
3052 (add-before 'configure 'set-octave-directory
3053 (lambda* (#:key outputs #:allow-other-keys)
3054 ;; Install the .mex file in the "octave" output.
3055 (let ((out (assoc-ref outputs "octave")))
3056 (substitute* "src/matlab/CMakeLists.txt"
3057 (("share/flann/octave")
3058 (string-append out "/share/flann/octave")))
3059 #t)))
9684e30b
LC
3060 (add-after 'install 'remove-static-libraries
3061 (lambda* (#:key outputs #:allow-other-keys)
3062 (let* ((out (assoc-ref outputs "out"))
3063 (lib (string-append out "/lib")))
3064 (for-each delete-file
3065 (find-files lib "\\.a$"))
3066 #t))))
3067
39b30337 3068 #:tests? #f)) ; The test data are downloaded from the Internet.
194c7f95
AE
3069 (home-page "http://www.cs.ubc.ca/research/flann/")
3070 (synopsis "Library for approximate nearest neighbors computation")
3071 (description "FLANN is a library for performing fast approximate
3072nearest neighbor searches in high dimensional spaces. It implements a
3073collection of algorithms and a system for automatically choosing the best
3074algorithm and optimum parameters depending on the dataset.
3075
3076FLANN is written in C++ and contains bindings for C, Octave and Python.")
3077 (license (license:non-copyleft "file://COPYING"
3078 "See COPYING in the distribution."))))
d8c97beb
EF
3079
3080(define-public wcalc
3081 (package
3082 (name "wcalc")
3083 (version "2.5")
3084 (source
3085 (origin
3086 (method url-fetch)
de67e922
LF
3087 (uri (string-append "mirror://sourceforge/w-calc/Wcalc/" version "/"
3088 "wcalc-" version ".tar.bz2"))
d8c97beb
EF
3089 (sha256
3090 (base32
3091 "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
3092 (build-system gnu-build-system)
3093 (inputs
3094 `(("mpfr" ,mpfr)
3095 ("readline" ,readline)))
3096 (home-page "http://w-calc.sourceforge.net/index.php")
3097 (synopsis "Flexible command-line scientific calculator")
3098 (description "Wcalc is a very capable calculator. It has standard functions
3099(sin, asin, and sinh for example, in either radians or degrees), many
3100pre-defined constants (pi, e, c, etc.), support for using variables, \"active\"
3101variables, a command history, hex/octal/binary input and output, unit
3102conversions, embedded comments, and an expandable expression entry field. It
3103evaluates expressions using the standard order of operations.")
3104 (license license:gpl2+)))
45147b0c
FH
3105
3106(define-public xaos
3107 (package
3108 (name "xaos")
3109 (version "3.6")
3110 (source (origin
3111 (method url-fetch)
de67e922
LF
3112 (uri (string-append "mirror://sourceforge/xaos/XaoS/" version
3113 "/xaos-" version ".tar.gz"))
45147b0c
FH
3114 (sha256
3115 (base32
3116 "15cd1cx1dyygw6g2nhjqq3bsfdj8sj8m4va9n75i0f3ryww3x7wq"))))
3117 (build-system gnu-build-system)
b94a6ca0 3118 (native-inputs `(("gettext" ,gettext-minimal)))
45147b0c
FH
3119 (inputs `(("libx11" ,libx11)
3120 ("zlib" ,zlib)
3121 ("libpng" ,libpng)
3122 ("gsl" ,gsl)))
3123 (arguments
3124 `(#:tests? #f ;no "check" target
3125 #:make-flags '("LOCALEDIR=$DATAROOTDIR/locale")))
3126 (synopsis "Real-time fractal zoomer")
3127 (description "GNU XaoS is a graphical program that generates fractal
3128patterns and allows you to zoom in and out of them infinitely in a fluid,
3129continuous manner. It also includes tutorials that help to explain how fractals
3130are built. It can generate many different fractal types such as the Mandelbrot
3131set.")
6fd52309 3132 (home-page "https://www.gnu.org/software/xaos/")
45147b0c 3133 (license license:gpl2+)))
528bb464
EB
3134
3135(define-public hypre
3136 (package
3137 (name "hypre")
3138 (version "2.11.0")
3139 (source (origin
3140 (method url-fetch)
3141 (uri (string-append "https://github.com/LLNL/hypre/archive/"
3142 "v" version ".tar.gz"))
3143 (file-name (string-append name "-" version ".tar.gz"))
3144 (sha256
3145 (base32
3146 "0q69ia0jivzcr8p049dn3mg8yjpn6nwq4sw9iqac8vr63vi54l6m"))
3147 (modules '((guix build utils)))
3148 (snippet
3149 '(begin
3150 ;; Remove use of __DATE__ and __TIME__ for reproducibility;
3151 ;; substitute the tarball creation time.
3152 (substitute* "src/utilities/HYPRE_utilities.h"
3153 (("Date Compiled: .*$")
3154 "Date Compiled: Mar 28 2016 20:19:59 +0000\"\n"))
3155 #t))))
3156 (build-system gnu-build-system)
3157 (outputs '("out" ;6.1 MiB of headers and libraries
3158 "doc")) ;4.8 MiB of documentation
3159 (native-inputs
3160 `(("doc++" ,doc++)
3161 ("netpbm" ,netpbm)
3162 ("texlive" ,texlive) ;full package required for fonts
3163 ("ghostscript" ,ghostscript)))
3164 (inputs
3165 `(("blas" ,openblas)
3166 ("lapack" ,lapack)))
3167 (arguments
3168 `(#:modules ((srfi srfi-1)
3169 ,@%gnu-build-system-modules)
3170 #:configure-flags '("--enable-shared"
3171 "--disable-fortran"
3172 "--without-MPI"
3173 "--with-openmp"
3174 "--with-fei"
3175 "--with-lapack"
3176 "--with-blas")
3177 #:phases
3178 (modify-phases %standard-phases
3179 (add-before 'configure 'chdir-src
3180 (lambda _ (chdir "src")))
3181 (replace 'configure
3182 (lambda* (#:key build target configure-flags
3183 #:allow-other-keys #:rest args)
3184 (let* ((configure (assoc-ref %standard-phases 'configure)))
3185 (apply configure
3186 (append args
3187 (list #:configure-flags
3188 (cons (string-append
3189 "--host=" (or target build))
3190 configure-flags)))))))
3191 (add-after 'build 'build-docs
3192 (lambda _
3193 (zero? (system* "make" "-Cdocs" "pdf" "html"))))
3194 (replace 'check
3195 (lambda _
3196 (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/hypre/lib"))
3197 (setenv "PATH" (string-append "." ":" (getenv "PATH")))
3198 (and (system* "make" "check" "CHECKRUN=")
3199 (fold (lambda (filename result)
3200 (and result
3201 (let ((size (stat:size (stat filename))))
3202 (when (not (zero? size))
3203 (format #t "~a size ~d; error indication~%"
3204 filename size))
3205 (zero? size))))
3206 #t
3207 (find-files "test" ".*\\.err$")))))
3208 (add-after 'install 'install-docs
3209 (lambda* (#:key outputs #:allow-other-keys)
3210 ;; Custom install because docs/Makefile doesn't honor ${docdir}.
3211 (let* ((doc (assoc-ref outputs "doc"))
3212 (docdir (string-append doc "/share/doc/hypre-" ,version)))
528bb464
EB
3213 (with-directory-excursion "docs"
3214 (for-each (lambda (base)
3215 (install-file (string-append base ".pdf") docdir)
3216 (copy-recursively base docdir)) ;html docs
3217 '("HYPRE_usr_manual"
3218 "HYPRE_ref_manual")))
3219 #t))))))
3220 (home-page "http://www.llnl.gov/casc/hypre/")
3221 (synopsis "Library of solvers and preconditioners for linear equations")
3222 (description
3223 "HYPRE is a software library of high performance preconditioners and
3224solvers for the solution of large, sparse linear systems of equations. It
3225features multigrid solvers for both structured and unstructured grid
3226problems.")
3227 (license license:lgpl2.1)))
3228
3229(define-public hypre-openmpi
3230 (package (inherit hypre)
3231 (name "hypre-openmpi")
3232 (inputs
3233 `(("mpi" ,openmpi)
3234 ,@(package-inputs hypre)))
3235 (arguments
3236 (substitute-keyword-arguments (package-arguments hypre)
3237 ((#:configure-flags flags)
3238 ``("--with-MPI"
3239 ,@(delete "--without-MPI" ,flags)))))
3240 (synopsis "Parallel solvers and preconditioners for linear equations")
3241 (description
3242 "HYPRE is a software library of high performance preconditioners and
3243solvers for the solution of large, sparse linear systems of equations on
3244parallel computers. It features parallel multigrid solvers for both
3245structured and unstructured grid problems.")))
6c90e183
EB
3246
3247(define-public matio
3248 (package
3249 (name "matio")
3250 (version "1.5.6")
3251 (source
3252 (origin
3253 (method url-fetch)
de67e922 3254 (uri (string-append "mirror://sourceforge/matio/matio/" version "/"
6c90e183
EB
3255 "matio-" version ".tar.gz"))
3256 (sha256
3257 (base32
3258 "0y2qymgxank8wdiwc68ap8bxdzrhvyw86i29yh3xgn4z1njfd9ir"))))
3259 (build-system gnu-build-system)
3260 (inputs
3261 `(("zlib" ,zlib)
3262 ("hdf5" ,hdf5)))
3263 (home-page "http://matio.sourceforge.net/")
3264 (synopsis "Library for reading and writing MAT files")
3265 (description "Matio is a library for reading and writing MAT files. It
3266supports compressed MAT files, as well as newer (version 7.3) MAT files.")
3267 (license license:bsd-2)))
d721c83a
EB
3268
3269(define-public libhilbert
3270 (package
3271 (name "libhilbert")
3272 (version "0.2-1")
3273 (source
3274 (origin
3275 (method url-fetch)
3276 (uri (string-append "http://web.cs.dal.ca/~chamilto/hilbert/"
3277 "libhilbert-" version ".tar.gz"))
3278 (sha256
3279 (base32
3280 "0v48x8405dj95gjn2saja4bzhw86d6zl6d3dg8h7dzac2qr97s34"))))
3281 (build-system gnu-build-system)
3282 (home-page "http://web.cs.dal.ca/~chamilto/hilbert")
3283 (synopsis "Hilbert indices for multidimensional data")
3284 (description "The libhilbert library can efficiently calculate Hilbert
3285curves and order-preserving representations of Hilbert curve indices that use
3286the same amount of space as the original point representation. This is useful
3287when using the Gilbert curve as a space filling curve through a
3288high-dimensional space where not all demensions have the same cardinality.")
3289 (license license:lgpl2.1+)))
517318ad
LF
3290
3291(define-public vc
3292 (package
3293 (name "vc")
3294 (version "1.2.0")
3295 (source
3296 (origin (method url-fetch)
3297 (uri (string-append "https://github.com/VcDevel/Vc/releases/"
3298 "download/" version "/Vc-" version ".tar.gz"))
3299 (sha256
3300 (base32
3301 "1rh6dhqar3y07n4xqyml0sa0v48qv3ch9dc3yc2in855hlh4vnqi"))))
3302 (build-system cmake-build-system)
3303 (arguments
3304 '(#:configure-flags
3305 '("-DBUILD_TESTING=ON")))
3306 (synopsis "SIMD vector classes for C++")
3307 (description "Vc provides portable, zero-overhead C++ types for explicitly
3308data-parallel programming. It is a library designed to ease explicit
3309vectorization of C++ code. Its types enable explicitly stating data-parallel
3310operations on multiple values. The parallelism is therefore added via the type
3311system. Vc has an intuitive API and provides portability between different
3312compilers and compiler versions as well as portability between different vector
3313instruction sets. Thus, an application written with Vc can be compiled for:
3314@enumerate
3315@item AVX and AVX2
d1e4ad1b 3316@item SSE2 up to SSE4.2 or SSE4a
517318ad
LF
3317@item Scalar
3318@item MIC
3319@item NEON (in development)
3320@item NVIDIA GPUs / CUDA (in development)
3321@end enumerate\n")
3322 (home-page "https://github.com/VcDevel/Vc")
a8ead6f9
EF
3323 ;; "No support_???.cpp file exists for this architecture."
3324 (supported-systems '("x86_64-linux" "i686-linux"))
517318ad 3325 (license license:bsd-3)))
54052a54 3326
3327(define-public reducelcs
3328 ;; This is the last commit which is available upstream, no
3329 ;; release happened since 2010.
3330 (let ((commit "474f88deb968061abe8cf11c959e02319b8ae5c0")
3331 (revision "1"))
3332 (package
3333 (name "reducelcs")
3334 (version (string-append "1.0-" revision "." (string-take commit 7)))
3335 (source
3336 (origin
3337 (method git-fetch)
3338 (uri (git-reference
3339 (url "https://github.com/gdv/Reduce-Expand-for-LCS")
3340 (commit commit)))
3341 (file-name (string-append name "-" version "-checkout"))
3342 (sha256
3343 (base32
3344 "1rllzcfwc042c336mhq262a8ha90x6afq30kvk60r7i4761j4yjm"))))
3345 (build-system gnu-build-system)
3346 (inputs
3347 `(("openlibm" ,openlibm)))
3348 (arguments
3349 `(#:tests? #f ; no tests
3350 #:phases
3351 (modify-phases %standard-phases
3352 (delete 'configure) ; No configure script exists.
3353 (replace 'install ; No install phase exists.
3354 (lambda* (#:key outputs #:allow-other-keys)
3355 (let* ((out (assoc-ref outputs "out"))
3356 (bin (string-append out "/bin")))
3357 (install-file "Approximation" bin)
3358 (install-file "CollectResults" bin)
3359 (install-file "GenerateInstances" bin)
3360 #t))))))
3361 (synopsis "Approximate Longest Commons Subsequence computation tool")
3362 (description
3363 "@code{reduceLCS} is an implementation of the Reduce-Expand
3364algorithm for LCS. It is a fast program to compute the approximate
3365Longest Commons Subsequence of a set of strings.")
3366 (home-page "https://github.com/gdv/Reduce-Expand-for-LCS")
c000b6b1 3367 (license license:gpl3+))))
479c4273
JD
3368
3369(define-public jacal
3370 (package
3371 (name "jacal")
3372 (version "1c4")
3373 (source (origin
3374 (method url-fetch)
3375 (uri (string-append
3376 "http://groups.csail.mit.edu/mac/ftpdir/scm/jacal-"
3377 version ".zip"))
3378 (sha256 (base32
3379 "055zrn12a1dmy0dqkwrkq3fklbhg3yir6vn0lacp4mvbg8573a3q"))
3380 (patches (search-patches "jacal-fix-texinfo.patch"))))
3381 (build-system gnu-build-system)
3382 (arguments
3383 `(#:phases
3384 (modify-phases %standard-phases
3385 (add-before 'build 'pre-build
3386 ;; Don't use upstream's script - it really doesn't fit into
3387 ;; Guix's functional paradigm.
3388 (lambda* (#:key inputs outputs #:allow-other-keys)
3389 (substitute* "Makefile"
3390 (("^install: install-script") "install: "))))
3391 (add-after 'install 'post-install
3392 ;; Instead, we provide our own simplified script.
3393 (lambda* (#:key inputs outputs #:allow-other-keys)
3394 (let ((wrapper (string-append (assoc-ref outputs "out")
3395 "/bin/jacal")))
3396 (format (open wrapper (logior O_WRONLY O_CREAT))
3397 (string-append "#!~a\nexec ~a/bin/scm -ip1 "
3398 "-e '(slib:load \"~a/lib/jacal/math\") "
3399 "(math)' \"$@\"\n")
3400 (which "bash")
3401 (assoc-ref inputs "scm")
3402 (assoc-ref outputs "out"))
3403 (chmod wrapper #o555))))
3404 (replace 'configure
3405 (lambda* (#:key inputs outputs #:allow-other-keys)
3406 (zero? (system* "./configure"
3407 (string-append "--prefix="
3408 (assoc-ref outputs "out")))))))))
3409 (inputs `(("scm" ,scm)))
3410 (native-inputs `(("unzip" ,unzip)
3411 ("texinfo" ,texinfo)))
3412 (synopsis "Symbolic mathematics system")
3413 (description "GNU JACAL is an interactive symbolic mathematics program based on
3414Scheme. It manipulate and simplify a range of mathematical expressions such
3415as equations, scalars, vectors, and matrices.")
6fd52309 3416 (home-page "https://www.gnu.org/software/jacal/")
479c4273
JD
3417 (license license:gpl3+)))
3418
313844d9
TF
3419(define-public z3
3420 (package
3421 (name "z3")
3422 (version "4.5.0")
3423 (source (origin
3424 (method url-fetch)
3425 (uri (string-append
3426 "https://github.com/Z3Prover/z3/archive/z3-"
3427 version ".tar.gz"))
3428 (sha256
3429 (base32
3430 "032a5lvji2liwmc25jv52bdrhimqflvqbpg77ccaq1jykhiivbmf"))))
cf684d87 3431 (build-system cmake-build-system)
313844d9 3432 (arguments
cf684d87
TF
3433 `(#:configure-flags
3434 (list "-DBUILD_PYTHON_BINDINGS=true"
3435 "-DINSTALL_PYTHON_BINDINGS=true"
3436 (string-append "-DCMAKE_INSTALL_PYTHON_PKG_DIR="
3437 %output
3438 "/lib/python2.7/site-packages")
3439 (string-append "-DCMAKE_INSTALL_LIBDIR="
3440 %output
3441 "/lib"))
3442
313844d9
TF
3443 #:phases
3444 (modify-phases %standard-phases
cf684d87
TF
3445 (add-before 'configure 'bootstrap
3446 (lambda _
313844d9 3447 (zero?
cf684d87
TF
3448 (system* "python" "contrib/cmake/bootstrap.py" "create"))))
3449 (add-before 'check 'make-test-z3
313844d9 3450 (lambda _
cf684d87
TF
3451 ;; Build the test suite executable.
3452 (zero? (system* "make" "test-z3" "-j"
3453 (number->string (parallel-job-count))))))
3454 (replace 'check
3455 (lambda _
3456 ;; Run all the tests that don't require arguments.
3457 (zero? (system* "./test-z3" "/a")))))))
313844d9
TF
3458 (native-inputs
3459 `(("python" ,python-2)))
3460 (synopsis "Theorem prover")
3461 (description "Z3 is a theorem prover and @dfn{satisfiability modulo
cf684d87 3462theories} (SMT) solver. It provides a C/C++ API, as well as Python bindings.")
313844d9
TF
3463 (home-page "https://github.com/Z3Prover/z3")
3464 (license license:expat)))
3d5d87a3
JL
3465
3466(define-public cubicle
3467 (package
3468 (name "cubicle")
3469 (version "1.1.1")
3470 (source (origin
3471 (method url-fetch)
3472 (uri (string-append "http://cubicle.lri.fr/cubicle-"
3473 version ".tar.gz"))
3474 (sha256
3475 (base32
3476 "1sny9c4fm14k014pk62ibpwbrjjirkx8xmhs9jg7q1hk7y7x3q2h"))))
3477 (build-system gnu-build-system)
3478 (native-inputs
3479 `(("ocaml" ,ocaml)
83fef82b 3480 ("which" ,(@@ (gnu packages base) which))))
3d5d87a3
JL
3481 (propagated-inputs
3482 `(("z3" ,z3)))
3483 (arguments
3484 `(#:configure-flags (list "--with-z3")
3485 #:tests? #f
3486 #:phases
3487 (modify-phases %standard-phases
3488 (add-before 'configure 'configure-for-release
3489 (lambda _
3490 (substitute* "Makefile.in"
3491 (("SVNREV=") "#SVNREV="))))
3492 (add-before 'configure 'fix-/bin/sh
3493 (lambda _
3494 (substitute* "configure"
3495 (("/bin/sh") (which "sh")))))
3496 (add-before 'configure 'fix-smt-z3wrapper.ml
3497 (lambda _
3498 (substitute* "Makefile.in"
3499 (("\\\\n") "")))))))
3500 (home-page "http://cubicle.lri.fr/")
3501 (synopsis "Model checker for array-based systems")
3502 (description "Cubicle is an open source model checker for verifying safety
3503properties of array-based systems. This is a syntactically restricted class of
3504parametrized transition systems with states represented as arrays indexed by an
3505arbitrary number of processes. Cache coherence protocols and mutual exclusion
3506algorithms are typical examples of such systems.")
3507 (license license:asl2.0)))