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