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