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