gnu: libidn: Update to 1.30.
[jackhill/guix/guix.git] / gnu / packages / maths.scm
CommitLineData
8f8b2451 1;;; GNU Guix --- Functional package management for GNU
12ed1216 2;;; Copyright © 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
da95c817 3;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
668c06ac 4;;; Copyright © 2014 John Darrington <jmd@gnu.org>
f5d5a346 5;;; Copyright © 2014 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>
865a69dd 8;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
32158110 9;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
8f8b2451
AE
10;;;
11;;; This file is part of GNU Guix.
12;;;
13;;; GNU Guix is free software; you can redistribute it and/or modify it
14;;; under the terms of the GNU General Public License as published by
15;;; the Free Software Foundation; either version 3 of the License, or (at
16;;; your option) any later version.
17;;;
18;;; GNU Guix is distributed in the hope that it will be useful, but
19;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;;; GNU General Public License for more details.
22;;;
23;;; You should have received a copy of the GNU General Public License
24;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26(define-module (gnu packages maths)
ec322be2 27 #:use-module (ice-9 regex)
8f8b2451 28 #:use-module (gnu packages)
b5b73a82 29 #:use-module ((guix licenses) #:prefix license:)
8f8b2451
AE
30 #:use-module (guix packages)
31 #:use-module (guix download)
279663ef 32 #:use-module (guix svn-download)
0e2672ae 33 #:use-module (guix utils)
da95c817 34 #:use-module (guix build-system cmake)
c9dfa3c7 35 #:use-module (guix build-system gnu)
3de01d3f
EB
36 #:use-module (gnu packages algebra)
37 #:use-module (gnu packages bison)
e73b49fb 38 #:use-module (gnu packages check)
3de01d3f 39 #:use-module (gnu packages cmake)
c9dfa3c7 40 #:use-module (gnu packages compression)
668c06ac 41 #:use-module (gnu packages curl)
57e544e8 42 #:use-module (gnu packages elf)
3de01d3f 43 #:use-module (gnu packages flex)
668c06ac 44 #:use-module (gnu packages fltk)
f3929800 45 #:use-module (gnu packages fontutils)
1dba6407 46 #:use-module (gnu packages gettext)
da95c817 47 #:use-module (gnu packages gcc)
73fed4f8 48 #:use-module (gnu packages gd)
668c06ac 49 #:use-module (gnu packages ghostscript)
221ed17a 50 #:use-module (gnu packages glib)
f3929800 51 #:use-module (gnu packages gtk)
668c06ac 52 #:use-module (gnu packages less)
8731e527 53 #:use-module (gnu packages lisp)
5698b8b8 54 #:use-module (gnu packages gnome)
668c06ac
JD
55 #:use-module (gnu packages xorg)
56 #:use-module (gnu packages gl)
8731e527 57 #:use-module (gnu packages m4)
d8c7eeb9 58 #:use-module (gnu packages mpi)
b92eee75 59 #:use-module (gnu packages multiprecision)
668c06ac 60 #:use-module (gnu packages pcre)
5698b8b8 61 #:use-module (gnu packages popt)
c9dfa3c7
AE
62 #:use-module (gnu packages perl)
63 #:use-module (gnu packages pkg-config)
da95c817 64 #:use-module (gnu packages python)
c9dfa3c7 65 #:use-module (gnu packages readline)
2742f87e 66 #:use-module (gnu packages tbb)
183e44ae 67 #:use-module (gnu packages tcsh)
df354a77 68 #:use-module (gnu packages tcl)
668c06ac 69 #:use-module (gnu packages texinfo)
73fed4f8 70 #:use-module (gnu packages texlive)
c12efc72
AE
71 #:use-module (gnu packages xml)
72 #:use-module (gnu packages zip))
8f8b2451
AE
73
74(define-public units
75 (package
76 (name "units")
983815c8 77 (version "2.11")
8f8b2451
AE
78 (source (origin
79 (method url-fetch)
80 (uri (string-append "mirror://gnu/units/units-" version
81 ".tar.gz"))
82 (sha256 (base32
983815c8 83 "1gjs3wc212aaiq4r76hx9nl1h3fa39n0ljwl9420d6ixl3rdmdjk"))))
8f8b2451
AE
84 (build-system gnu-build-system)
85 (synopsis "Conversion between thousands of scales")
86 (description
574e86f9
LC
87 "GNU Units converts numeric quantities between units of measure. It
88can handle scale changes through adaptive usage of standard scale prefixes
89(micro-, kilo-, etc.). It can also handle nonlinear conversions such as
90Fahrenheit to Celsius. Its interpreter is powerful enough to be used
91effectively as a scientific calculator.")
8f8b2451
AE
92 (license license:gpl3+)
93 (home-page "http://www.gnu.org/software/units/")))
c9dfa3c7 94
61a529b4
RW
95(define-public double-conversion
96 (package
97 (name "double-conversion")
98 (version "1.1.5")
99 (source (origin
100 (method url-fetch)
101 (uri (string-append
102 "https://github.com/floitsch/double-conversion/archive/v"
103 version ".tar.gz"))
104 (file-name (string-append name "-" version ".tar.gz"))
105 (sha256
106 (base32
107 "0cnr8xhyjfxijay8ymkqcph3672wp2lj23qhdmr3m4kia5kpdf83"))))
108 (build-system cmake-build-system)
109 (arguments
110 '(#:test-target "test"
111 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
112 "-DBUILD_TESTING=ON")))
113 (home-page "https://github.com/floitsch/double-conversion")
114 (synopsis "Conversion routines for IEEE doubles")
115 (description
116 "The double-conversion library provides binary-decimal and decimal-binary
117routines for IEEE doubles. The library consists of efficient conversion
118routines that have been extracted from the V8 JavaScript engine.")
119 (license license:bsd-3)))
120
182d6311
ML
121(define-public dionysus
122 (package
123 (name "dionysus")
124 (version "1.3.0")
125 (source (origin
126 (method url-fetch)
127 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
128 ".tar.gz"))
129 (sha256
130 (base32
131 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
132 (build-system gnu-build-system)
133 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
134 (synopsis "Local search for universal constants and scientific values")
135 (description
136 "GNU Dionysus is a convenient system for quickly retrieving the values of
137mathematical constants used in science and engineering. Values can be
138searched using a simple command-line tool, choosing from three databases:
139universal constants, atomic numbers, and constants related to
140semiconductors.")
141 (license license:gpl3+)
142 (home-page "http://www.gnu.org/software/dionysus/")))
143
88bd1804
AE
144(define-public gsl
145 (package
146 (name "gsl")
487da565 147 (version "1.16")
88bd1804
AE
148 (source
149 (origin
150 (method url-fetch)
151 (uri (string-append "mirror://gnu/gsl/gsl-"
152 version ".tar.gz"))
153 (sha256
154 (base32
487da565 155 "0lrgipi0z6559jqh82yx8n4xgnxkhzj46v96dl77hahdp58jzg3k"))))
88bd1804 156 (build-system gnu-build-system)
71e0f288 157 (arguments
487da565
AE
158 `(#:parallel-tests? #f
159 #:phases
71e0f288
AE
160 (alist-replace
161 'configure
162 (lambda* (#:key target system outputs #:allow-other-keys #:rest args)
163 (let ((configure (assoc-ref %standard-phases 'configure)))
164 ;; disable numerically unstable test on i686, see thread at
165 ;; http://lists.gnu.org/archive/html/bug-gsl/2011-11/msg00019.html
166 (if (string=? (or target system) "i686-linux")
167 (substitute* "ode-initval2/Makefile.in"
168 (("TESTS = \\$\\(check_PROGRAMS\\)") "TESTS =")))
169 (apply configure args)))
170 %standard-phases)))
88bd1804
AE
171 (home-page "http://www.gnu.org/software/gsl/")
172 (synopsis "Numerical library for C and C++")
173 (description
a22dc0c4
LC
174 "The GNU Scientific Library is a library for numerical analysis in C
175and C++. It includes a wide range of mathematical routines, with over 1000
176functions in total. Subject areas covered by the library include:
177differential equations, linear algebra, Fast Fourier Transforms and random
178numbers.")
88bd1804
AE
179 (license license:gpl3+)))
180
b92eee75
AE
181(define-public glpk
182 (package
183 (name "glpk")
66fdf545 184 (version "4.55")
b92eee75
AE
185 (source
186 (origin
187 (method url-fetch)
188 (uri (string-append "mirror://gnu/glpk/glpk-"
189 version ".tar.gz"))
190 (sha256
191 (base32
66fdf545 192 "1rqx5fzj1mhkifilip5mkxybpj2wkniq5qcn8h1w2vkr2rzhs29p"))))
b92eee75
AE
193 (build-system gnu-build-system)
194 (inputs
195 `(("gmp" ,gmp)))
196 (arguments
197 `(#:configure-flags '("--with-gmp")))
198 (home-page "http://www.gnu.org/software/glpk/")
79c311b8 199 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
b92eee75
AE
200 (description
201 "GLPK is a C library for solving large-scale linear programming (LP),
202mixed integer programming (MIP), and other related problems. It supports the
203GNU MathProg modeling language, a subset of the AMPL language, and features a
204translator for the language. In addition to the C library, a stand-alone
205LP/MIP solver is included in the package.")
206 (license license:gpl3+)))
207
c9dfa3c7
AE
208(define-public pspp
209 (package
210 (name "pspp")
3dcd7810 211 (version "0.8.4")
c9dfa3c7
AE
212 (source
213 (origin
214 (method url-fetch)
215 (uri (string-append "mirror://gnu/pspp/pspp-"
216 version ".tar.gz"))
217 (sha256
218 (base32
3dcd7810 219 "0b65q45x05ps95pph6glbg7ymdr638nfb0rk9x5x9qm5k073pk5z"))))
c9dfa3c7
AE
220 (build-system gnu-build-system)
221 (inputs
f3929800
AE
222 `(("cairo" ,cairo)
223 ("fontconfig" ,fontconfig)
1dba6407 224 ("gettext" ,gnu-gettext)
c9dfa3c7
AE
225 ("gsl" ,gsl)
226 ("libxml2" ,libxml2)
f3929800 227 ("pango" ,pango)
c9dfa3c7 228 ("readline" ,readline)
e6a5ce8e
JD
229 ("gtk" ,gtk+-2)
230 ("gtksourceview" ,gtksourceview)
c9dfa3c7
AE
231 ("zlib" ,zlib)))
232 (native-inputs
221ed17a
EB
233 `(("glib" ,glib "bin") ;for glib-genmarshal
234 ("perl" ,perl)
c9dfa3c7 235 ("pkg-config" ,pkg-config)))
c9dfa3c7
AE
236 (home-page "http://www.gnu.org/software/pspp/")
237 (synopsis "Statistical analysis")
238 (description
79c311b8 239 "GNU PSPP is a statistical analysis program. It can perform
c5779c93
LC
240descriptive statistics, T-tests, linear regression and non-parametric tests.
241It features both a graphical interface as well as command-line input. PSPP
242is designed to interoperate with Gnumeric, LibreOffice and OpenOffice. Data
243can be imported from spreadsheets, text files and database sources and it can
244be output in text, PostScript, PDF or HTML.")
c9dfa3c7 245 (license license:gpl3+)))
da95c817 246
865a69dd
RW
247(define-public arpack-ng
248 (package
249 (name "arpack-ng")
250 (version "3.2.0")
251 (source
252 (origin
253 (method url-fetch)
254 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
255 version ".tar.gz"))
f586c877 256 (file-name (string-append name "-" version ".tar.gz"))
865a69dd
RW
257 (sha256
258 (base32
259 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
260 (build-system gnu-build-system)
261 (home-page "https://github.com/opencollab/arpack-ng")
262 (inputs
263 `(("lapack" ,lapack)
264 ("fortran" ,gfortran-4.8)))
265 (synopsis "Fortran subroutines for solving eigenvalue problems")
266 (description
267 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
268large scale eigenvalue problems.")
166191b3 269 (license (license:non-copyleft "file://COPYING"
865a69dd
RW
270 "See COPYING in the distribution."))))
271
da95c817
NK
272(define-public lapack
273 (package
274 (name "lapack")
566146ab 275 (version "3.5.0")
da95c817
NK
276 (source
277 (origin
278 (method url-fetch)
279 (uri (string-append "http://www.netlib.org/lapack/lapack-"
280 version ".tgz"))
281 (sha256
282 (base32
566146ab 283 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
da95c817
NK
284 (build-system cmake-build-system)
285 (home-page "http://www.netlib.org/lapack/")
286 (inputs `(("fortran" ,gfortran-4.8)
287 ("python" ,python-2)))
288 (arguments
06ed5982 289 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
da95c817 290 #:phases (alist-cons-before
6a995754
LC
291 'check 'patch-python
292 (lambda* (#:key inputs #:allow-other-keys)
293 (let ((python (assoc-ref inputs "python")))
294 (substitute* "lapack_testing.py"
295 (("/usr/bin/env python") python))))
06ed5982 296 %standard-phases)))
da95c817
NK
297 (synopsis "Library for numerical linear algebra")
298 (description
299 "LAPACK is a Fortran 90 library for solving the most commonly occurring
300problems in numerical linear algebra.")
166191b3 301 (license (license:non-copyleft "file://LICENSE"
da95c817 302 "See LICENSE in the distribution."))))
73fed4f8
JD
303
304(define-public gnuplot
305 (package
306 (name "gnuplot")
307 (version "4.6.3")
308 (source
309 (origin
310 (method url-fetch)
311 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
312 version "/gnuplot-" version ".tar.gz"))
313 (sha256
314 (base32
315 "1xd7gqdhlk7k1p9yyqf9vkk811nadc7m4si0q3nb6cpv4pxglpyz"))))
316 (build-system gnu-build-system)
317 (inputs `(("readline" ,readline)
318 ("cairo" ,cairo)
319 ("pango" ,pango)
320 ("gd" ,gd)))
321 (native-inputs `(("texlive" ,texlive)
322 ("pkg-config" ,pkg-config)))
323 (home-page "http://www.gnuplot.info")
324 (synopsis "Command-line driven graphing utility")
325 (description "Gnuplot is a portable command-line driven graphing
35b9e423 326utility. It was originally created to allow scientists and students to
73fed4f8 327visualize mathematical functions and data interactively, but has grown to
35b9e423 328support many non-interactive uses such as web scripting. It is also used as a
73fed4f8
JD
329plotting engine by third-party applications like Octave.")
330 ;; X11 Style with the additional restriction that derived works may only be
331 ;; distributed as patches to the original.
332 (license (license:fsf-free
668c06ac
JD
333 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
334
7ee3f1a2
JD
335(define-public hdf5
336 (package
337 (name "hdf5")
338 (version "1.8.12")
339 (source
340 (origin
341 (method url-fetch)
93c3de92
AE
342 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-"
343 version "/src/hdf5-"
7ee3f1a2
JD
344 version ".tar.bz2"))
345 (sha256
346 (base32 "0f9n0v3p3lwc7564791a39c6cn1d3dbrn7d1j3ikqsi27a8hy23d"))))
347 (build-system gnu-build-system)
12ed1216
AE
348 (inputs
349 `(("zlib" ,zlib)))
7ee3f1a2
JD
350 (arguments
351 `(#:phases
d4bf49b1
EB
352 (alist-cons-before
353 'configure 'patch-configure
354 (lambda _
355 (substitute* "configure"
356 (("/bin/mv") "mv")))
7ee3f1a2 357 %standard-phases)))
7ee3f1a2 358 (home-page "http://www.hdfgroup.org")
516e93f8 359 (synopsis "Management suite for extremely large and complex data")
7ee3f1a2
JD
360 (description "HDF5 is a suite that makes possible the management of
361extremely large and complex data collections.")
d4bf49b1
EB
362 (license (license:x11-style
363 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
7ee3f1a2
JD
364
365
668c06ac
JD
366;; For a fully featured Octave, users are strongly recommended also to install
367;; the following packages: texinfo, less, ghostscript, gnuplot.
368(define-public octave
369 (package
370 (name "octave")
32158110 371 (version "3.8.2")
668c06ac
JD
372 (source
373 (origin
374 (method url-fetch)
375 (uri (string-append "mirror://gnu/octave/octave-"
376 version ".tar.gz"))
377 (sha256
378 (base32
32158110 379 "05slz8yx8k91fqlnfr1f0vni95iq9qmchz41c7nf4isn3b2fjn7j"))))
668c06ac
JD
380 (build-system gnu-build-system)
381 (inputs
382 `(("lapack" ,lapack)
383 ("readline" ,readline)
384 ("glpk" ,glpk)
385 ("curl" ,curl)
386 ("pcre" ,pcre)
387 ("fltk" ,fltk)
388 ("fontconfig" ,fontconfig)
389 ("freetype" ,freetype)
40029cbe 390 ("hdf5" ,hdf5)
668c06ac
JD
391 ("libxft" ,libxft)
392 ("mesa" ,mesa)
393 ("zlib" ,zlib)))
394 (native-inputs
395 `(("gfortran" ,gfortran-4.8)
396 ("pkg-config" ,pkg-config)
397 ("perl" ,perl)
398 ;; The following inputs are not actually used in the build process. However, the
399 ;; ./configure gratuitously tests for their existence and assumes that programs not
400 ;; present at build time are also not, and can never be, available at run time!
401 ;; If these inputs are therefore not present, support for them will be built out.
402 ;; However, Octave will still run without them, albeit without the features they
403 ;; provide.
404 ("less" ,less)
405 ("texinfo" ,texinfo)
406 ("ghostscript" ,ghostscript)
407 ("gnuplot" ,gnuplot)))
408 (arguments
409 `(#:configure-flags (list (string-append "--with-shell="
410 (assoc-ref %build-inputs "bash")
411 "/bin/sh"))))
412 (home-page "http://www.gnu.org/software/octave/")
413 (synopsis "High-level language for numerical computation")
414 (description "GNU Octave is a high-level interpreted language that is specialized
415for numerical computations. It can be used for both linear and non-linear
416applications and it provides great support for visualizing results. Work may
417be performed both at the interactive command-line as well as via script
418files.")
419 (license license:gpl3+)))
3de01d3f
EB
420
421(define-public gmsh
422 (package
423 (name "gmsh")
424 (version "2.8.4")
425 (source
426 (origin
427 (method url-fetch)
428 (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
429 version "-source.tgz"))
430 (sha256
431 (base32 "0jv2yvk28w86rx5mvjkb0w12ff2jxih7axnpvznpd295lg5jg7hr"))
432 (modules '((guix build utils)))
433 (snippet
434 ;; Remove non-free METIS code
435 '(delete-file-recursively "contrib/Metis"))))
436 (build-system cmake-build-system)
3de01d3f
EB
437 (propagated-inputs
438 `(("fltk" ,fltk)
439 ("gfortran" ,gfortran-4.8)
440 ("gmp" ,gmp)
40029cbe 441 ("hdf5" ,hdf5)
3de01d3f
EB
442 ("lapack" ,lapack)
443 ("mesa" ,mesa)
85f41902 444 ("glu" ,glu)
3de01d3f
EB
445 ("libx11" ,libx11)
446 ("libxext" ,libxext)))
447 (arguments
448 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
449 "-DENABLE_BUILD_SHARED:BOOL=ON"
450 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")))
451 (home-page "http://www.geuz.org/gmsh/")
452 (synopsis "3D finite element grid generator")
edf684ef
EB
453 (description "Gmsh is a 3D finite element grid generator with a built-in
454CAD engine and post-processor. Its design goal is to provide a fast, light
455and user-friendly meshing tool with parametric input and advanced
456visualization capabilities. Gmsh is built around four modules: geometry,
457mesh, solver and post-processing. The specification of any input to these
458modules is done either interactively using the graphical user interface or in
459ASCII text files using Gmsh's own scripting language.")
3de01d3f 460 (license license:gpl2+)))
b9100e2f
EB
461
462(define-public petsc
463 (package
464 (name "petsc")
465 (version "3.4.4")
466 (source
467 (origin
468 (method url-fetch)
469 ;; The *-lite-* tarball does not contain the *large* documentation
470 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
471 "petsc-lite-" version ".tar.gz"))
472 (sha256
473 (base32 "0v5dg6dhdjpi5ianvd4mm6hsvxzv1bsxwnh9f9myag0a0d9xk9iv"))
474 (patches
475 (list (search-patch "petsc-fix-threadcomm.patch")))))
476 (build-system gnu-build-system)
477 (native-inputs
478 `(("python" ,python-2)
479 ("perl" ,perl)))
480 (inputs
481 `(("gfortran" ,gfortran-4.8)
482 ("lapack" ,lapack)
f258212d 483 ("superlu" ,superlu)
b9100e2f
EB
484 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
485 ;; leaving out opengl, as configuration seems to only be for mac
486 ))
487 (arguments
488 `(#:test-target "test"
489 #:parallel-build? #f
490 #:configure-flags
491 `("--with-mpi=0"
f258212d
EB
492 "--with-openmp=1"
493 "--with-superlu=1"
494 ,(string-append "--with-superlu-include="
495 (assoc-ref %build-inputs "superlu") "/include")
496 ,(string-append "--with-superlu-lib="
497 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
b9100e2f
EB
498 #:phases
499 (alist-replace
500 'configure
501 ;; PETSc's configure script is actually a python script, so we can't
502 ;; run it with bash.
503 (lambda* (#:key outputs (configure-flags '())
504 #:allow-other-keys)
505 (let* ((prefix (assoc-ref outputs "out"))
506 (flags `(,(string-append "--prefix=" prefix)
507 ,@configure-flags)))
508 (format #t "build directory: ~s~%" (getcwd))
509 (format #t "configure flags: ~s~%" flags)
510 (zero? (apply system* "./configure" flags))))
511 (alist-cons-after
10b11968
EB
512 'configure 'clean-local-references
513 ;; Try to keep build directory names from leaking into compiled code
b9100e2f 514 (lambda* (#:key inputs outputs #:allow-other-keys)
10b11968
EB
515 (let ((out (assoc-ref outputs "out")))
516 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
517 (((getcwd)) out))))
518 (alist-cons-after
519 'install 'clean-install
520 ;; Try to keep installed files from leaking build directory names.
521 (lambda* (#:key inputs outputs #:allow-other-keys)
522 (let ((out (assoc-ref outputs "out"))
523 (fortran (assoc-ref inputs "gfortran")))
524 (substitute* (map (lambda (file)
525 (string-append out "/" file))
526 '("conf/petscvariables"
527 "conf/PETScConfig.cmake"))
528 (((getcwd)) out))
529 ;; Make compiler references point to the store
530 (substitute* (string-append out "/conf/petscvariables")
531 (("= g(cc|\\+\\+|fortran)" _ suffix)
532 (string-append "= " fortran "/bin/g" suffix)))
533 ;; PETSc installs some build logs, which aren't necessary.
534 (for-each (lambda (file)
535 (let ((f (string-append out "/" file)))
536 (when (file-exists? f)
537 (delete-file f))))
538 '("conf/configure.log"
539 "conf/make.log"
540 "conf/test.log"
541 "conf/error.log"
542 "conf/RDict.db"
543 ;; Once installed, should uninstall with Guix
544 "conf/uninstall.py"))))
545 %standard-phases)))))
b9100e2f 546 (home-page "http://www.mcs.anl.gov/petsc")
16ecf3ff 547 (synopsis "Library to solve PDEs")
b9100e2f
EB
548 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
549data structures and routines for the scalable (parallel) solution of
550scientific applications modeled by partial differential equations.")
166191b3 551 (license (license:non-copyleft
b9100e2f
EB
552 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
553
554(define-public petsc-complex
555 (package (inherit petsc)
9e771e3b 556 (location (source-properties->location (current-source-location)))
b9100e2f
EB
557 (name "petsc-complex")
558 (arguments
559 (substitute-keyword-arguments (package-arguments petsc)
560 ((#:configure-flags cf)
561 `(cons "--with-scalar-type=complex" ,cf))))
16ecf3ff 562 (synopsis "Library to solve PDEs (with complex scalars)")))
183e44ae 563
d8c7eeb9
EB
564(define-public petsc-openmpi
565 (package (inherit petsc)
566 (name "petsc-openmpi")
567 (inputs
568 `(("openmpi" ,openmpi)
569 ,@(package-inputs petsc)))
570 (arguments
571 (substitute-keyword-arguments (package-arguments petsc)
572 ((#:configure-flags cf)
573 ``("--with-mpiexec=mpirun"
574 ,(string-append "--with-mpi-dir="
575 (assoc-ref %build-inputs "openmpi"))
576 ,@(delete "--with-mpi=0" ,cf)))))
16ecf3ff 577 (synopsis "Library to solve PDEs (with MPI support)")))
d8c7eeb9
EB
578
579(define-public petsc-complex-openmpi
580 (package (inherit petsc-complex)
581 (name "petsc-complex-openmpi")
582 (inputs
583 `(("openmpi" ,openmpi)
584 ,@(package-inputs petsc-complex)))
585 (arguments
586 (substitute-keyword-arguments (package-arguments petsc-complex)
587 ((#:configure-flags cf)
588 ``("--with-mpiexec=mpirun"
589 ,(string-append "--with-mpi-dir="
590 (assoc-ref %build-inputs "openmpi"))
591 ,@(delete "--with-mpi=0" ,cf)))))
16ecf3ff 592 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
d8c7eeb9 593
183e44ae
EB
594(define-public superlu
595 (package
596 (name "superlu")
597 (version "4.3")
598 (source
599 (origin
600 (method url-fetch)
601 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
602 "superlu_" version ".tar.gz"))
603 (sha256
604 (base32 "10b785s9s4x0m9q7ihap09275pq4km3k2hk76jiwdfdr5qr2168n"))))
605 (build-system gnu-build-system)
606 (native-inputs
607 `(("tcsh" ,tcsh)))
608 (inputs
609 `(("lapack" ,lapack)
610 ("gfortran" ,gfortran-4.8)))
611 (arguments
612 `(#:parallel-build? #f
613 #:tests? #f ;tests are run as part of `make all`
614 #:phases
615 (alist-replace
616 'configure
617 (lambda* (#:key inputs outputs #:allow-other-keys)
618 (call-with-output-file "make.inc"
619 (lambda (port)
620 (format port "
621PLAT =
622SuperLUroot = ~a
623SUPERLULIB = ~a/lib/libsuperlu.a
624TMGLIB = libtmglib.a
625BLASDEF = -DUSE_VENDOR_BLAS
626BLASLIB = -L~a/lib -lblas
627LIBS = $(SUPERLULIB) $(BLASLIB)
628ARCH = ar
629ARCHFLAGS = cr
630RANLIB = ranlib
631CC = gcc
632PIC = -fPIC
633CFLAGS = -O3 -DPRNTlevel=0 $(PIC)
634NOOPTS = -O0 $(PIC)
635FORTRAN = gfortran
636FFLAGS = -O2 $(PIC)
637LOADER = $(CC)
638CDEFS = -DAdd_"
639 (getcwd)
640 (assoc-ref outputs "out")
641 (assoc-ref inputs "lapack")))))
642 (alist-cons-before
643 'build 'create-install-directories
644 (lambda* (#:key outputs #:allow-other-keys)
645 (for-each
646 (lambda (dir)
647 (mkdir-p (string-append (assoc-ref outputs "out")
648 "/" dir)))
649 '("lib" "include")))
650 (alist-replace
651 'install
652 (lambda* (#:key outputs #:allow-other-keys)
653 ;; Library is placed in lib during the build phase. Copy over
654 ;; headers to include.
655 (let* ((out (assoc-ref outputs "out"))
656 (incdir (string-append out "/include")))
657 (for-each (lambda (file)
658 (let ((base (basename file)))
659 (format #t "installing `~a' to `~a'~%"
660 base incdir)
661 (copy-file file
662 (string-append incdir "/" base))))
663 (find-files "SRC" ".*\\.h$"))))
664 %standard-phases)))))
665 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
666 (synopsis "Supernodal direct solver for sparse linear systems")
667 (description
668 "SuperLU is a general purpose library for the direct solution of large,
669sparse, nonsymmetric systems of linear equations on high performance machines.
670The library is written in C and is callable from either C or Fortran. The
671library routines perform an LU decomposition with partial pivoting and
672triangular system solves through forward and back substitution. The library
673also provides threshold-based ILU factorization preconditioners.")
674 (license license:bsd-3)))
f8ed036a 675
a54aefea
EB
676(define-public superlu-dist
677 (package
678 (name "superlu-dist")
679 (version "3.3")
680 (source
681 (origin
682 (method url-fetch)
683 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
684 "superlu_dist_" version ".tar.gz"))
685 (sha256
686 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
687 (patches (list (search-patch "superlu-dist-scotchmetis.patch")))))
688 (build-system gnu-build-system)
689 (native-inputs
690 `(("tcsh" ,tcsh)))
691 (inputs
692 `(("gfortran" ,gfortran-4.8)))
693 (propagated-inputs
694 `(("openmpi" ,openmpi) ;headers include MPI heades
695 ("lapack" ,lapack) ;required to link with output library
696 ("pt-scotch" ,pt-scotch))) ;same
697 (arguments
698 `(#:parallel-build? #f ;race conditions using ar
699 #:phases
700 (alist-replace
701 'configure
702 (lambda* (#:key inputs outputs #:allow-other-keys)
703 (call-with-output-file "make.inc"
704 (lambda (port)
705 (format port "
706PLAT =
707DSuperLUroot = ~a
708DSUPERLULIB = ~a/lib/libsuperlu_dist.a
709BLASDEF = -DUSE_VENDOR_BLAS
710BLASLIB = -L~a/lib -lblas
711PARMETISLIB = -L~a/lib \
712 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
713 -lscotch -lscotcherr -lscotcherrexit
714METISLIB = -L~:*~a/lib \
715 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
716LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
717ARCH = ar
718ARCHFLAGS = cr
719RANLIB = ranlib
720CC = mpicc
721PIC = -fPIC
722CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
723NOOPTS = -O0 -g $(PIC)
724FORTRAN = mpifort
725FFLAGS = -O2 -g $(PIC)
726LOADER = $(CC)
727CDEFS = -DAdd_"
728 (getcwd)
729 (assoc-ref outputs "out")
730 (assoc-ref inputs "lapack")
731 (assoc-ref inputs "pt-scotch")))))
732 (alist-cons-after
733 'unpack 'remove-broken-symlinks
734 (lambda _
735 (for-each delete-file
736 (find-files "MAKE_INC" "\\.#make\\..*")))
737 (alist-cons-before
738 'build 'create-install-directories
739 (lambda* (#:key outputs #:allow-other-keys)
740 (for-each
741 (lambda (dir)
742 (mkdir-p (string-append (assoc-ref outputs "out")
743 "/" dir)))
744 '("lib" "include")))
745 (alist-replace
746 'check
747 (lambda _
748 (with-directory-excursion "EXAMPLE"
749 (and
750 (zero? (system* "mpirun" "-n" "2"
751 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
752 (zero? (system* "mpirun" "-n" "2"
753 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
754 (alist-replace
755 'install
756 (lambda* (#:key outputs #:allow-other-keys)
757 ;; Library is placed in lib during the build phase. Copy over
758 ;; headers to include.
759 (let* ((out (assoc-ref outputs "out"))
760 (incdir (string-append out "/include")))
761 (for-each (lambda (file)
762 (let ((base (basename file)))
763 (format #t "installing `~a' to `~a'~%"
764 base incdir)
765 (copy-file file
766 (string-append incdir "/" base))))
767 (find-files "SRC" ".*\\.h$"))))
768 %standard-phases)))))))
769 (home-page (package-home-page superlu))
770 (synopsis "Parallel supernodal direct solver")
771 (description
772 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
773It is targeted for distributed memory parallel machines. SuperLU_DIST is
774implemented in ANSI C, and MPI for communications.")
775 (license license:bsd-3)))
776
f8ed036a
EB
777(define-public scotch
778 (package
779 (name "scotch")
780 (version "6.0.0")
781 (source
782 (origin
783 (method url-fetch)
784 (uri (string-append "https://gforge.inria.fr/frs/download.php/31831/"
785 "scotch_" version ".tar.gz"))
786 (sha256
787 (base32 "0yfqf9lk7chb3h42777x42x4adx0v3n0b41q0cdqrdmscp4iczp5"))
788 (patches (list (search-patch "scotch-test-threading.patch")))))
789 (build-system gnu-build-system)
790 (inputs
791 `(("zlib" ,zlib)
792 ("flex" ,flex)
793 ("bison" ,bison)))
794 (arguments
795 `(#:phases
796 (alist-cons-after
797 'unpack 'chdir-to-src
798 (lambda _ (chdir "src"))
799 (alist-replace
800 'configure
801 (lambda _
802 (call-with-output-file "Makefile.inc"
803 (lambda (port)
804 (format port "
805EXE =
806LIB = .a
807OBJ = .o
808MAKE = make
809AR = ar
810ARFLAGS = -ruv
811CCS = gcc
812CCP = mpicc
813CCD = gcc
814CPPFLAGS =~{ -D~a~}
815CFLAGS = -O2 -g $(CPPFLAGS)
816LDFLAGS = -lz -lm -lrt -lpthread
817CP = cp
818LEX = flex -Pscotchyy -olex.yy.c
819LN = ln
820MKDIR = mkdir
821MV = mv
822RANLIB = ranlib
823YACC = bison -pscotchyy -y -b y
824"
825 '("COMMON_FILE_COMPRESS_GZ"
826 "COMMON_PTHREAD"
827 "COMMON_RANDOM_FIXED_SEED"
828 ;; TODO: Define once our MPI supports
829 ;; MPI_THREAD_MULTIPLE
830 ;; "SCOTCH_PTHREAD"
831 ;; "SCOTCH_PTHREAD_NUMBER=2"
832 "restrict=__restrict")))))
833 (alist-replace
834 'install
835 (lambda* (#:key outputs #:allow-other-keys)
836 (let ((out (assoc-ref outputs "out")))
837 (mkdir out)
838 (zero? (system* "make"
839 (string-append "prefix=" out)
840 "install"))))
841 %standard-phases)))))
842 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
843 (synopsis "Programs and libraries for graph algorithms")
844 (description "SCOTCH is a set of programs and libraries which implement
845the static mapping and sparse matrix reordering algorithms developed within
846the SCOTCH project. Its purpose is to apply graph theory, with a divide and
847conquer approach, to scientific computing problems such as graph and mesh
848partitioning, static mapping, and sparse matrix ordering, in application
849domains ranging from structural mechanics to operating systems or
850bio-chemistry.")
851 ;; See LICENSE_en.txt
852 (license license:cecill-c)))
6acb4adb
EB
853
854(define-public pt-scotch
855 (package (inherit scotch)
856 (name "pt-scotch")
857 (propagated-inputs
858 `(("openmpi" ,openmpi))) ;Headers include MPI headers
859 (arguments
860 (substitute-keyword-arguments (package-arguments scotch)
861 ((#:phases scotch-phases)
862 `(alist-replace
863 'build
864 ;; TODO: Would like to add parallelism here
865 (lambda _
866 (and
867 (zero? (system* "make" "ptscotch"))
868 ;; Install the serial metis compatibility library
869 (zero? (system* "make" "-C" "libscotchmetis" "install"))))
870 (alist-replace
871 'check
872 (lambda _ (zero? (system* "make" "ptcheck")))
873 (alist-replace
874 'install
875 (lambda* (#:key outputs #:allow-other-keys)
876 (let ((out (assoc-ref outputs "out")))
877 (mkdir out)
878 (zero? (system* "make"
879 (string-append "prefix=" out)
880 "install"))))
881 ,scotch-phases))))))
882 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
5698b8b8
JD
883
884(define-public gsegrafix
885 (package
886 (name "gsegrafix")
887 (version "1.0.6")
888 (source
889 (origin
890 (method url-fetch)
891 (uri (string-append "mirror://gnu/" name "/" name "-"
892 version ".tar.gz"))
893 (sha256
894 (base32
895 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
896 (build-system gnu-build-system)
897 (arguments
898 `(#:configure-flags '("LDFLAGS=-lm")))
899 (inputs
900 `(("libgnomecanvas" ,libgnomecanvas)
901 ("libbonoboui" ,libbonoboui)
902 ("libgnomeui" ,libgnomeui)
903 ("libgnomeprintui" ,libgnomeprintui)
904 ("popt" ,popt)))
905 (native-inputs
906 `(("pkg-config" ,pkg-config)))
907 (home-page "http://www.gnu.org/software/gsegrafix/")
908 (synopsis "GNOME application to create scientific and engineering plots")
909 (description "GSEGrafix is an application which produces high-quality graphical
910plots for science and engineering. Plots are specified via simple ASCII
911parameter files and data files and are presented in an anti-aliased GNOME
912canvas. The program supports rectangular two-dimensional plots, histograms,
913polar-axis plots and three-dimensional plots. Plots can be printed or saved
914to BMP, JPEG or PNG image formats.")
915 (license license:gpl3+)))
8731e527
JD
916
917(define-public maxima
918 (package
919 (name "maxima")
df354a77 920 (version "5.34.1")
8731e527
JD
921 (source
922 (origin
923 (method url-fetch)
924 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
925 version "-source/" name "-" version ".tar.gz"))
926 (sha256
927 (base32
df354a77 928 "1dw9vfzldpj7lv303xbw0wpyn6ra6i2yzwlrjbcx7j0jm5n43ji0"))))
8731e527 929 (build-system gnu-build-system)
df354a77
FB
930 (inputs
931 `(("gcl" ,gcl)
932 ("gnuplot" ,gnuplot) ;for plots
f36afe4d 933 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
df354a77
FB
934 (native-inputs
935 `(("texinfo" ,texinfo)
936 ("perl" ,perl)))
8731e527 937 (arguments
df354a77
FB
938 `(#:configure-flags
939 (list "--enable-gcl"
940 (string-append "--with-posix-shell="
941 (assoc-ref %build-inputs "bash")
942 "/bin/sh")
943 (string-append "--with-wish="
944 (assoc-ref %build-inputs "tk")
945 "/bin/wish"
946 (let ((v ,(package-version tk)))
947 (string-take v (string-index-right v #\.)))))
df354a77
FB
948 ;; By default Maxima attempts to write temporary files to
949 ;; '/tmp/nix-build-maxima-5.34.1', which doesn't exist. Work around
950 ;; that.
951 #:make-flags (list "TMPDIR=/tmp")
df354a77 952 #:phases (alist-cons-before
8731e527 953 'check 'pre-check
df354a77 954 (lambda _
8731e527 955 (chmod "src/maxima" #o555))
f36afe4d
FB
956 ;; Make sure the doc and emacs files are found in the
957 ;; standard location. Also configure maxima to find gnuplot
958 ;; without having it on the PATH.
959 (alist-cons-after
960 'install 'post-install
961 (lambda* (#:key outputs inputs #:allow-other-keys)
962 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
963 (out (assoc-ref outputs "out"))
964 (datadir (string-append out "/share/maxima/" ,version)))
965 (with-directory-excursion out
966 (mkdir-p "share/emacs")
967 (mkdir-p "share/doc")
968 (symlink
969 (string-append datadir "/emacs/")
970 (string-append out "/share/emacs/site-lisp"))
971 (symlink
972 (string-append datadir "/doc/")
973 (string-append out "/share/doc/maxima"))
974 (with-atomic-file-replacement
975 (string-append datadir "/share/maxima-init.lisp")
976 (lambda (in out)
977 (format out "~a ~s~a~%"
978 "(setf $gnuplot_command "
979 (string-append gnuplot "/bin/gnuplot") ")")
980 (dump-port in out))))))
981 %standard-phases))))
8731e527
JD
982 (home-page "http://maxima.sourceforge.net")
983 (synopsis "Numeric and symbolic expression manipulation")
984 (description "Maxima is a system for the manipulation of symbolic and
985numerical expressions. It yields high precision numeric results by using
986exact fractions, arbitrary precision integers, and variable precision floating
987point numbers")
988 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
989 ;; Others simply say "GNU General Public License" without stating a
990 ;; version (which implicitly means gpl1+).
991 ;; At least one file (src/maxima.asd) says "version 2."
992 ;; GPLv2 only is therefore the smallest subset.
f36afe4d 993 (license license:gpl2)))
ec322be2 994
279663ef
RW
995(define-public muparser
996 (package
997 (name "muparser")
998 (version "2.2.5")
999 (source
1000 (origin
1001 (method svn-fetch)
1002 (uri (svn-reference
1003 (url "http://muparser.googlecode.com/svn/trunk/")
1004 (revision 34)))
1005 (sha256
1006 (base32
1007 "1d6bdbhx9zj3srwj3m7c9hvr18gnx1fx43h6d25my7q85gicpcwn"))))
1008 (build-system gnu-build-system)
1009 (arguments
1010 `(#:configure-flags '("--enable-samples=no")
1011 #:tests? #f)) ;no "check" target
1012 (home-page "http://muparser.beltoforion.de/")
1013 (synopsis "Fast parser library for mathematical expressions")
1014 (description
1015 "muParser is an extensible high performance math parser library. It is
1016based on transforming an expression into a bytecode and precalculating
1017constant parts of it.")
1018 (license license:expat)))
1019
e73b49fb
RW
1020(define-public openblas
1021 (package
1022 (name "openblas")
1023 (version "0.2.13")
1024 (source
1025 (origin
1026 (method url-fetch)
1027 (uri (string-append "https://github.com/xianyi/OpenBLAS/tarball/v"
1028 version))
1029 (file-name (string-append name "-" version ".tar.gz"))
1030 (sha256
1031 (base32
1032 "1asg5mix13ipxgj5h2yj2p0r8km1di5jbcjkn5gmhb37nx7qfv6k"))))
1033 (build-system gnu-build-system)
1034 (arguments
1035 '(#:tests? #f ;no "check" target
e73b49fb
RW
1036 #:make-flags
1037 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1038 "SHELL=bash"
af5b817e
RW
1039 "NO_LAPACK=1"
1040 ;; Build the library for all supported CPUs. This allows
1041 ;; switching CPU targets at runtime with the environment variable
1042 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
1043 "DYNAMIC_ARCH=1")
e73b49fb
RW
1044 ;; no configure script
1045 #:phases (alist-delete 'configure %standard-phases)))
1046 (inputs
1047 `(("fortran" ,gfortran-4.8)))
1048 (native-inputs
1049 `(("cunit" ,cunit)
1050 ("perl" ,perl)))
1051 (home-page "http://www.openblas.net/")
1052 (synopsis "Optimized BLAS library based on GotoBLAS")
1053 (description
1054 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
1055 (license license:bsd-3)))
1056
e1605e36
RW
1057(define-public openlibm
1058 (package
1059 (name "openlibm")
1060 (version "0.4.1")
1061 (source
1062 (origin
1063 (method url-fetch)
1064 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
1065 version ".tar.gz"))
1066 (file-name (string-append name "-" version ".tar.gz"))
1067 (sha256
1068 (base32
1069 "0cwqqqlblj3kzp9aq1wnpfs1fl0qd1wp1xzm5shb09w06i4rh9nn"))))
1070 (build-system gnu-build-system)
1071 (arguments
1072 `(#:make-flags
1073 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1074 #:phases
1075 ;; no configure script
1076 (alist-delete 'configure %standard-phases)
1077 #:tests? #f)) ;the tests are part of the default target
1078 (home-page "http://openlibm.org/")
1079 (synopsis "Portable C mathematical library (libm)")
1080 (description
1081 "OpenLibm is an effort to have a high quality, portable, standalone C
1082mathematical library (libm). It can be used standalone in applications and
1083programming language implementations. The project was born out of a need to
1084have a good libm for the Julia programming langage that worked consistently
1085across compilers and operating systems, and in 32-bit and 64-bit
1086environments.")
1087 ;; See LICENSE.md for details.
1088 (license (list license:expat
1089 license:isc
1090 license:bsd-2
1091 license:public-domain
1092 license:lgpl2.1+))))
1093
e62be58f
RW
1094(define-public openspecfun
1095 (package
1096 (name "openspecfun")
1097 (version "0.4")
1098 (source
1099 (origin
1100 (method url-fetch)
1101 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
1102 version ".tar.gz"))
1103 (file-name (string-append name "-" version ".tar.gz"))
1104 (sha256
1105 (base32
1106 "0nsa3jjmlhcqkw5ba5ypbn3n0c8b6lc22zzlxnmxkxi9shhdx65z"))))
1107 (build-system gnu-build-system)
1108 (arguments
1109 '(#:tests? #f ;no "check" target
1110 #:make-flags
1111 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1112 ;; no configure script
1113 #:phases (alist-delete 'configure %standard-phases)))
1114 (inputs
1115 `(("fortran" ,gfortran-4.8)))
1116 (home-page "https://github.com/JuliaLang/openspecfun")
1117 (synopsis "Collection of special mathematical functions")
1118 (description
1119 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
1120portable package for Bessel Functions of a Complex Argument and Nonnegative
1121Order; it contains subroutines for computing Bessel functions and Airy
1122functions. Faddeeva allows computing the various error functions of arbitrary
1123complex arguments (Faddeeva function, error function, complementary error
1124function, scaled complementary error function, imaginary error function, and
1125Dawson function); given these, one can also easily compute Voigt functions,
1126Fresnel integrals, and similar related functions as well.")
1127 ;; Faddeeva is released under the Expat license; AMOS is included as
1128 ;; public domain software.
1129 (license (list license:expat license:public-domain))))
1130
2742f87e
RW
1131(define-public suitesparse
1132 (package
1133 (name "suitesparse")
1134 (version "4.4.3")
1135 (source
1136 (origin
1137 (method url-fetch)
1138 (uri (string-append
1139 "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-"
1140 version ".tar.gz"))
1141 (sha256
1142 (base32
1143 "100hdzr0mf4mzlwnqpmwpfw4pymgsf9n3g0ywb1yps2nk1zbkdy5"))))
1144 (build-system gnu-build-system)
1145 (arguments
1146 '(#:parallel-build? #f ;cholmod build fails otherwise
1147 #:tests? #f ;no "check" target
1148 #:make-flags
1149 (list "CC=gcc"
1150 "BLAS=-lblas"
1151 "TBB=-ltbb"
1152 "CHOLMOD_CONFIG=-DNPARTITION" ;required when METIS is not used
1153 (string-append "INSTALL_LIB="
1154 (assoc-ref %outputs "out") "/lib")
1155 (string-append "INSTALL_INCLUDE="
1156 (assoc-ref %outputs "out") "/include"))
1157 #:phases
1158 (alist-cons-before
1159 'install 'prepare-out
1160 ;; README.txt states that the target directories must exist prior to
1161 ;; running "make install".
1162 (lambda _
1163 (mkdir-p (string-append (assoc-ref %outputs "out") "/lib"))
1164 (mkdir-p (string-append (assoc-ref %outputs "out") "/include")))
1165 ;; no configure script
1166 (alist-delete 'configure %standard-phases))))
1167 (inputs
1168 `(("tbb" ,tbb)
1169 ("lapack" ,lapack)))
1170 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
1171 (synopsis "Suite of sparse matrix software")
1172 (description
1173 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
1174multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
1175multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
1176simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
1177CXSparse, a concise sparse Cholesky factorization package; and many other
1178packages.")
1179 ;; LGPLv2.1+:
1180 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
1181 ;; GPLv2+:
1182 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
1183 (license (list license:gpl2+ license:lgpl2.1+))))
1184
ec322be2
FB
1185(define-public atlas
1186 (package
1187 (name "atlas")
1188 (version "3.10.2")
1189 (source (origin
1190 (method url-fetch)
1191 (uri (string-append "mirror://sourceforge/math-atlas/atlas"
1192 version ".tar.bz2"))
1193 (sha256
1194 (base32
1195 "0bqh4bdnjdyww4mcpg6kn0x7338mfqbdgysn97dzrwwb26di7ars"))))
1196 (build-system gnu-build-system)
1197 (home-page "http://math-atlas.sourceforge.net/")
1198 (inputs `(("gfortran" ,gfortran-4.8)
1199 ("lapack-tar" ,(package-source lapack))))
1200 (outputs '("out" "doc"))
01480b9e
FB
1201 ;; For the moment we drop support for MIPS at it fails to compile. See
1202 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
1203 (supported-systems (delete "mips64el-linux" %supported-systems))
ec322be2
FB
1204 (arguments
1205 `(#:parallel-build? #f
1206 #:parallel-tests? #f
f15615b1
LC
1207
1208 ;; ATLAS tunes itself for the machine it is built on, as explained at
1209 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
1210 ;; For this reason, we want users to build it locally instead of using
1211 ;; substitutes.
1212 #:substitutable? #f
1213
ec322be2
FB
1214 #:modules ((srfi srfi-26)
1215 (srfi srfi-1)
1216 (guix build gnu-build-system)
1217 (guix build utils))
40029cbe 1218 #:configure-flags
ec322be2
FB
1219 `(;; Generate position independent code suitable for dynamic libraries
1220 ;; and use WALL timer to get more accurate timing.
1221 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
1222 ;; Set word width.
1223 "-b"
1224 ,,(if (string-match "64" (%current-system))
1225 "64"
1226 "32")
1227 ;; Disable parallel build as it gives errors: atlas_pthread.h is
1228 ;; needed to compile C files before it is generated.
1229 "-Ss" "pmake" "make -j 1"
af89a667
FB
1230 ;; Probe is failing for MIPS. We therefore define the system
1231 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
1232 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
1233 ,,@(if (string-prefix? "mips" (%current-system))
1234 (list "-A" "49" "-V" "1")
1235 (list))
ec322be2
FB
1236 ;; Generate shared libraries.
1237 "--shared"
1238 ;; Build a full LAPACK library.
1239 ,(string-append "--with-netlib-lapack-tarfile="
1240 (assoc-ref %build-inputs "lapack-tar")))
1241 #:phases
1242 (alist-cons-after
1243 'install 'install-doc
1244 (lambda* (#:key outputs inputs #:allow-other-keys)
40029cbe 1245 (let ((doc (string-append (assoc-ref outputs "doc")
ec322be2
FB
1246 "/share/doc/atlas")))
1247 (mkdir-p doc)
40029cbe 1248 (fold (lambda (file previous)
ec322be2
FB
1249 (and previous (zero? (system* "cp" file doc))))
1250 #t (find-files "../ATLAS/doc" ".*"))))
1251 (alist-cons-after
1252 'check 'check-pt
1253 (lambda _ (zero? (system* "make" "ptcheck")))
1254 ;; Fix files required to run configure.
1255 (alist-cons-before
1256 'configure 'fix-/bin/sh
1257 (lambda _
1258 ;; Use `sh', not `/bin/sh'.
1259 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
1260 (("/bin/sh")
1261 "sh")))
1262 ;; Fix /bin/sh in generated make files.
1263 (alist-cons-after
1264 'configure 'fix-/bin/sh-in-generated-files
1265 (lambda _
1266 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
1267 (("/bin/sh")
1268 "sh")))
1269 ;; ATLAS configure program does not accepts the default flags
1270 ;; passed by the 'gnu-build-system'.
1271 (alist-replace
1272 'configure
1273 (lambda* (#:key native-inputs inputs outputs
1274 (configure-flags '())
1275 #:allow-other-keys #:rest args)
1276 (let* ((prefix (assoc-ref outputs "out"))
1277 (bash (or (and=> (assoc-ref
1278 (or native-inputs inputs) "bash")
1279 (cut string-append <> "/bin/bash"))
1280 "/bin/sh"))
1281 (flags `(,(string-append "--prefix=" prefix)
1282 ,@configure-flags))
1283 (abs-srcdir (getcwd))
1284 (srcdir (string-append "../" (basename abs-srcdir))))
1285 (format #t "source directory: ~s (relative from build: ~s)~%"
1286 abs-srcdir srcdir)
1287 (mkdir "../build")
1288 (chdir "../build")
1289 (format #t "build directory: ~s~%" (getcwd))
1290 (format #t "configure flags: ~s~%" flags)
1291 (zero? (apply system* bash
1292 (string-append srcdir "/configure")
1293 flags))))
1294 %standard-phases)))))))
1295 (synopsis "Automatically Tuned Linear Algebra Software")
1296 (description
1297 "ATLAS is an automatically tuned linear algebra software library
1298providing C and Fortran77 interfaces to a portably efficient BLAS
1299implementation, as well as a few routines from LAPACK.
1300
f15615b1
LC
1301Optimization occurs at build time. For this reason, the library is built on
1302the machine where it is installed, without resorting to pre-built substitutes.
ec322be2 1303
f15615b1
LC
1304Before building the library, CPU throttling should be disabled. This can be
1305done in the BIOS, or, on GNU/Linux, with the following commands:
ec322be2
FB
1306
1307cpufreq-selector -g performance -c 0
1308...
1309cpufreq-selector -g performance -c N-1
1310
1311where N is the number of cores of your CPU. Failure to do so will result in a
1312library with poor performance.")
1313 (license license:bsd-3)))
c12efc72
AE
1314
1315(define-public glm
1316 (package
1317 (name "glm")
1318 (version "0.9.6.3")
1319 (source
1320 (origin
1321 (method url-fetch)
1322 (uri (string-append "mirror://sourceforge/ogl-math/glm-"
1323 version ".zip"))
1324 (sha256
1325 (base32
1326 "1cnjmi033a16a95v6xfkr1bvfmkd26hzdjka8j1819hgn5b1nr8l"))))
1327 (build-system cmake-build-system)
1328 (native-inputs
1329 `(("unzip" ,unzip)))
1330 (home-page "http://glm.g-truc.net")
1331 (synopsis "OpenGL Mathematics library")
1332 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
1333library for graphics software based on the OpenGL Shading Language (GLSL)
1334specifications.")
1335 (license license:expat)))