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