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