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