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