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