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