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