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