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