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