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