services: guix-service: Add 'lsof' and 'lsh' to guix-daemon's $PATH.
[jackhill/guix/guix.git] / gnu / packages / algebra.scm
CommitLineData
233e7676 1;;; GNU Guix --- Functional package management for GNU
bbea9565 2;;; Copyright © 2012, 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
8f4b1dfb 3;;; Copyright © 2013, 2015 Ludovic Courtès <ludo@gnu.org>
e2ca23c5 4;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
2ed139c4 5;;;
233e7676 6;;; This file is part of GNU Guix.
2ed139c4 7;;;
233e7676 8;;; GNU Guix is free software; you can redistribute it and/or modify it
2ed139c4
AE
9;;; under the terms of the GNU General Public License as published by
10;;; the Free Software Foundation; either version 3 of the License, or (at
11;;; your option) any later version.
12;;;
233e7676 13;;; GNU Guix is distributed in the hope that it will be useful, but
2ed139c4
AE
14;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;;; GNU General Public License for more details.
17;;;
18;;; You should have received a copy of the GNU General Public License
233e7676 19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
2ed139c4 20
1ffa7090 21(define-module (gnu packages algebra)
59a43334 22 #:use-module (gnu packages)
1ffa7090 23 #:use-module (gnu packages multiprecision)
0fc54d4b 24 #:use-module (gnu packages mpi)
1ffa7090
LC
25 #:use-module (gnu packages perl)
26 #:use-module (gnu packages readline)
27 #:use-module (gnu packages flex)
2ed139c4
AE
28 #:use-module (guix licenses)
29 #:use-module (guix packages)
30 #:use-module (guix download)
7569c5cb 31 #:use-module (guix build-system gnu)
8f4b1dfb 32 #:use-module (guix build-system cmake)
7569c5cb 33 #:use-module (guix utils))
2ed139c4
AE
34
35
36(define-public mpfrcx
37 (package
38 (name "mpfrcx")
9c68798d 39 (version "0.4.2")
2ed139c4
AE
40 (source (origin
41 (method url-fetch)
42 (uri (string-append
43 "http://www.multiprecision.org/mpfrcx/download/mpfrcx-"
44 version ".tar.gz"))
45 (sha256
46 (base32
9c68798d 47 "0grw66b255r574lvll1bqccm5myj2m8ajzsjaygcyq9zjnnbnhhy"))))
2ed139c4
AE
48 (build-system gnu-build-system)
49 (inputs `(("gmp" ,gmp)
50 ("mpfr" ,mpfr)
51 ("mpc" ,mpc)))
35b9e423 52 (synopsis "Arithmetic of polynomials over arbitrary precision numbers")
2ed139c4 53 (description
35b9e423 54 "Mpfrcx is a library for the arithmetic of univariate polynomials over
2ed139c4 55arbitrary precision real (mpfr) or complex (mpc) numbers, without control
35b9e423 56on the rounding. For the time being, only the few functions needed to
2ed139c4 57implement the floating point approach to complex multiplication are
35b9e423 58implemented. On the other hand, these comprise asymptotically fast
2ed139c4
AE
59multiplication routines such as Toom–Cook and the FFT. ")
60 (license lgpl2.1+)
61 (home-page "http://mpfrcx.multiprecision.org/")))
62
2ed139c4
AE
63(define-public fplll
64 (package
65 (name "fplll")
5a15ed50 66 (version "4.0.4")
2ed139c4
AE
67 (source (origin
68 (method url-fetch)
69 (uri (string-append
70 "http://perso.ens-lyon.fr/damien.stehle/fplll/libfplll-"
71 version ".tar.gz"))
72 (sha256 (base32
5a15ed50 73 "1cbiby7ykis4z84swclpysrljmqhfcllpkcbll1m08rzskgb1a6b"))))
2ed139c4
AE
74 (build-system gnu-build-system)
75 (inputs `(("gmp" ,gmp)
76 ("mpfr" ,mpfr)))
35b9e423 77 (synopsis "Library for LLL-reduction of euclidean lattices")
2ed139c4 78 (description
35b9e423 79 "fplll LLL-reduces euclidean lattices. Since version 3, it can also
2ed139c4
AE
80solve the shortest vector problem.")
81 (license lgpl2.1+)
82 (home-page "http://perso.ens-lyon.fr/damien.stehle/fplll/")))
4e6b699d 83
90a6d47c
AE
84(define-public pari-gp
85 (package
86 (name "pari-gp")
f78c66aa 87 (version "2.7.3")
90a6d47c
AE
88 (source (origin
89 (method url-fetch)
90 (uri (string-append
91 "http://pari.math.u-bordeaux.fr/pub/pari/unix/pari-"
92 version ".tar.gz"))
f78c66aa
AE
93 (sha256
94 (base32
95 "02k54m7p47r54lgxqanxvf7pdrss17n8if1qwk5wx0j1px22j0rq"))))
90a6d47c
AE
96 (build-system gnu-build-system)
97 (inputs `(("gmp" ,gmp)
98 ("perl" ,perl)
99 ("readline" ,readline)))
100 (arguments
12abb19d 101 '(#:make-flags '("gp")
f78c66aa
AE
102 ;; FIXME: building the documentation requires tex; once this is
103 ;; available, replace "gp" by "all"
12abb19d
LC
104 #:test-target "dobench"
105 #:phases
106 (alist-replace
107 'configure
ee172b1a
AE
108 (lambda* (#:key outputs #:allow-other-keys)
109 (let ((out (assoc-ref outputs "out")))
12abb19d 110 (zero?
ee172b1a 111 (system* "./Configure" (string-append "--prefix=" out)))))
12abb19d 112 %standard-phases)))
90a6d47c
AE
113 (synopsis "PARI/GP, a computer algebra system for number theory")
114 (description
115 "PARI/GP is a widely used computer algebra system designed for fast
116computations in number theory (factorisations, algebraic number theory,
117elliptic curves...), but it also contains a large number of other useful
118functions to compute with mathematical entities such as matrices,
119polynomials, power series, algebraic numbers, etc., and a lot of
120transcendental functions.
121PARI is also available as a C library to allow for faster computations.")
122 (license gpl2+)
123 (home-page "http://pari.math.u-bordeaux.fr/")))
ed9f9a77 124
f854a8c1
AE
125(define-public gp2c
126 (package
127 (name "gp2c")
a63ffe03 128 (version "0.0.9pl2")
f854a8c1
AE
129 (source (origin
130 (method url-fetch)
131 (uri (string-append
132 "http://pari.math.u-bordeaux.fr/pub/pari/GP2C/gp2c-"
133 version ".tar.gz"))
134 (sha256 (base32
a63ffe03 135 "02h35fwz1caicii7fj8zb9ky4hcrd8rqmzkyvhbls0r05yg5bwwb"))))
f854a8c1 136 (build-system gnu-build-system)
c67ccedd 137 (native-inputs `(("perl" ,perl)))
f854a8c1
AE
138 (inputs `(("pari-gp" ,pari-gp)))
139 (arguments
140 '(#:configure-flags
141 (list (string-append "--with-paricfg="
142 (assoc-ref %build-inputs "pari-gp")
143 "/lib/pari/pari.cfg"))))
144 (synopsis "PARI/GP, a computer algebra system for number theory")
145 (description
146 "PARI/GP is a widely used computer algebra system designed for fast
147computations in number theory (factorisations, algebraic number theory,
148elliptic curves...), but it also contains a large number of other useful
149functions to compute with mathematical entities such as matrices,
150polynomials, power series, algebraic numbers, etc., and a lot of
151transcendental functions.
152PARI is also available as a C library to allow for faster computations.
153
154GP2C, the GP to C compiler, translates GP scripts to PARI programs.")
155 (license gpl2)
156 (home-page "http://pari.math.u-bordeaux.fr/")))
157
d7ab698a
AE
158(define-public flint
159 (package
160 (name "flint")
161 (version "2.4.4")
162 (source (origin
163 (method url-fetch)
164 (uri (string-append
165 "http://flintlib.org/flint-"
166 version ".tar.gz"))
167 (sha256 (base32
168 "1isv1sfv8sg3qvf0d99apdfi3jnql95xfzszcawdf1pgjj9rwyf4"))))
169 (build-system gnu-build-system)
170 (inputs
171 `(("gmp" ,gmp)
172 ("mpfr" ,mpfr)))
173 (arguments
174 `(#:phases
175 (alist-replace
176 'configure
177 (lambda* (#:key inputs outputs #:allow-other-keys)
178 (let ((out (assoc-ref outputs "out"))
179 (gmp (assoc-ref inputs "gmp"))
180 (mpfr (assoc-ref inputs "mpfr")))
181 ;; Drop test failing with gmp-6 due to changed invertibility
182 ;; of 0 in Z/1 Z, which according to the flint authors has no
183 ;; impact on flint.
184 ;; FIXME: Drop with later version.
185 (delete-file "fmpz/test/t-invmod.c")
186 ;; do not pass "--enable-fast-install", which makes the
187 ;; homebrew configure process fail
188 (zero? (system*
189 "./configure"
190 (string-append "--prefix=" out)
191 (string-append "--with-gmp=" gmp)
192 (string-append "--with-mpfr=" mpfr)))))
193 %standard-phases)))
194 (synopsis "Fast library for number theory")
195 (description
196 "FLINT is a C library for number theory. It supports arithmetic
197with numbers, polynomials, power series and matrices over many base
198rings, including multiprecision integers and rationals, integers
199modulo n, p-adic numbers, finite fields (prime and non-prime order)
200and real and complex numbers (via the Arb extension library).
201
202Operations that can be performed include conversions, arithmetic,
203GCDs, factoring, solving linear systems, and evaluating special
204functions. In addition, FLINT provides various low-level routines for
205fast arithmetic.")
206 (license gpl2+)
207 (home-page "http://flintlib.org/")))
208
6b8e8285
AE
209(define-public arb
210 (package
211 (name "arb")
212 (version "2.2.0")
213 (source (origin
214 (method url-fetch)
215 (uri (string-append
216 "https://github.com/fredrik-johansson/arb/archive/"
217 version ".tar.gz"))
f586c877 218 (file-name (string-append name "-" version ".tar.gz"))
6b8e8285
AE
219 (sha256 (base32
220 "0a8cgzznkmr59ngj4di9a37b5h4i00gbnixnxlwd34bcbflvjzyr"))))
221 (build-system gnu-build-system)
222 (inputs
223 `(("flint" ,flint)
224 ("gmp" ,gmp)
225 ("mpfr" ,mpfr)))
226 (arguments
227 `(#:phases
228 (alist-replace
229 'configure
230 (lambda* (#:key inputs outputs #:allow-other-keys)
231 (let ((out (assoc-ref outputs "out"))
232 (flint (assoc-ref inputs "flint"))
233 (gmp (assoc-ref inputs "gmp"))
234 (mpfr (assoc-ref inputs "mpfr")))
235 ;; do not pass "--enable-fast-install", which makes the
236 ;; homebrew configure process fail
237 (zero? (system*
238 "./configure"
239 (string-append "--prefix=" out)
240 (string-append "--with-flint=" flint)
241 (string-append "--with-gmp=" gmp)
242 (string-append "--with-mpfr=" mpfr)))))
243 %standard-phases)))
244 (synopsis "Arbitrary precision floating-point ball arithmetic")
245 (description
246 "Arb is a C library for arbitrary-precision floating-point ball
247arithmetic. It supports efficient high-precision computation with
248polynomials, power series, matrices and special functions over the
249real and complex numbers, with automatic, rigorous error control.")
250 (license gpl2+)
251 (home-page "http://fredrikj.net/arb/")))
252
ed9f9a77
LC
253(define-public bc
254 (package
255 (name "bc")
256 (version "1.06")
257 (source (origin
258 (method url-fetch)
259 (uri (string-append "mirror://gnu/bc/bc-" version ".tar.gz"))
260 (sha256
261 (base32
262 "0cqf5jkwx6awgd2xc2a0mkpxilzcfmhncdcfg7c9439wgkqxkxjf"))))
263 (build-system gnu-build-system)
c4c4cc05
JD
264 (inputs `(("readline" ,readline)))
265 (native-inputs `(("flex" ,flex)))
ed9f9a77
LC
266 (arguments
267 '(#:phases
268 (alist-replace 'configure
269 (lambda* (#:key outputs #:allow-other-keys)
270 ;; This old `configure' script doesn't support
271 ;; variables passed as arguments.
272 (let ((out (assoc-ref outputs "out")))
273 (setenv "CONFIG_SHELL" (which "bash"))
274 (zero?
e2ca23c5
MW
275 (system*
276 "./configure"
277 (string-append "--prefix=" out)
278 ;; By default, man and info pages are put in
279 ;; PREFIX/{man,info}, but we want them in
280 ;; PREFIX/share/{man,info}.
281 (string-append "--mandir=" out "/share/man")
282 (string-append "--infodir=" out "/share/info")))))
ed9f9a77
LC
283 %standard-phases)))
284 (home-page "http://www.gnu.org/software/bc/")
f50d2669 285 (synopsis "Arbitrary precision numeric processing language")
ed9f9a77 286 (description
a22dc0c4
LC
287 "bc is an arbitrary precision numeric processing language. It includes
288an interactive environment for evaluating mathematical statements. Its
289syntax is similar to that of C, so basic usage is familiar. It also includes
290\"dc\", a reverse-polish calculator.")
ed9f9a77 291 (license gpl2+)))
37e6cdcd
LC
292
293(define-public fftw
294 (package
295 (name "fftw")
2cf287df 296 (version "3.3.4")
37e6cdcd
LC
297 (source (origin
298 (method url-fetch)
299 (uri (string-append "ftp://ftp.fftw.org/pub/fftw/fftw-"
300 version".tar.gz"))
301 (sha256
302 (base32
2cf287df 303 "10h9mzjxnwlsjziah4lri85scc05rlajz39nqf3mbh4vja8dw34g"))))
37e6cdcd
LC
304 (build-system gnu-build-system)
305 (arguments
e5c66f8c 306 '(#:configure-flags '("--enable-shared" "--enable-openmp")
37e6cdcd
LC
307 #:phases (alist-cons-before
308 'build 'no-native
309 (lambda _
310 ;; By default '-mtune=native' is used. However, that may
311 ;; cause the use of ISA extensions (SSE2, etc.) that are
312 ;; not necessarily available on the user's machine when
313 ;; that package is built on a different machine.
314 (substitute* (find-files "." "Makefile$")
315 (("-mtune=native") "")))
316 %standard-phases)))
317 (native-inputs `(("perl" ,perl)))
318 (home-page "http://fftw.org")
319 (synopsis "Computing the discrete Fourier transform")
320 (description
321 "FFTW is a C subroutine library for computing the discrete Fourier
322transform (DFT) in one or more dimensions, of arbitrary input size, and of
323both real and complex data (as well as of even/odd data---i.e. the discrete
324cosine/ sine transforms or DCT/DST).")
325 (license gpl2+)))
7569c5cb
EB
326
327(define-public fftwf
328 (package (inherit fftw)
329 (name "fftwf")
330 (arguments
331 (substitute-keyword-arguments (package-arguments fftw)
332 ((#:configure-flags cf)
333 `(cons "--enable-float" ,cf))))
334 (description
335 (string-append (package-description fftw)
336 " Single-precision version."))))
e5c66f8c
EB
337
338(define-public fftw-openmpi
339 (package (inherit fftw)
340 (name "fftw-openmpi")
341 (inputs
342 `(("openmpi" ,openmpi)
343 ,@(package-inputs fftw)))
344 (arguments
345 (substitute-keyword-arguments (package-arguments fftw)
346 ((#:configure-flags cf)
347 `(cons "--enable-mpi" ,cf))))
348 (description
349 (string-append (package-description fftw)
350 " With OpenMPI parallelism support."))))
8f4b1dfb
LC
351
352(define-public eigen
353 (package
354 (name "eigen")
9b268f12 355 (version "3.2.4")
8f4b1dfb
LC
356 (source (origin
357 (method url-fetch)
358 (uri (string-append "https://bitbucket.org/eigen/eigen/get/"
9b268f12 359 version ".tar.bz2"))
8f4b1dfb
LC
360 (sha256
361 (base32
9b268f12 362 "08l92i6vpzz9ypj89hn7rxm6cp4njgc6wr7nb4n3v01i5v4k4hyn"))
8f4b1dfb
LC
363 (modules '((guix build utils)))
364 (snippet
365 ;; There are 3 test failures in the "unsupported" directory,
366 ;; but maintainers say it's a known issue and it's unsupported
367 ;; anyway, so just skip them.
368 '(substitute* "CMakeLists.txt"
369 (("add_subdirectory\\(unsupported\\)")
370 "# Do not build the tests for unsupported features.\n")))))
371 (build-system cmake-build-system)
372 (arguments
373 '(;; Turn off debugging symbols to save space.
374 #:build-type "Release"
375
376 ;; Use 'make check', as per
377 ;; <http://eigen.tuxfamily.org/index.php?title=Tests>.
378 #:test-target "check"
379
380 #:phases (alist-cons-before
381 'check 'build-tests
382 (lambda _
383 ;; First build the tests, in parallel.
384 ;; See <http://eigen.tuxfamily.org/index.php?title=Tests>.
385 (let* ((cores (current-processor-count))
386 (dash-j (format #f "-j~a" cores)))
387 ;; These variables are supposed to be honored.
388 (setenv "EIGEN_MAKE_ARGS" dash-j)
389 (setenv "EIGEN_CTEST_ARGS" dash-j)
390
391 (zero? (system* "make" "buildtests" dash-j))))
392 %standard-phases)))
393 (home-page "http://eigen.tuxfamily.org")
394 (synopsis "C++ template library for linear algebra")
395 (description
396 "Eigen is a C++ template library for linear algebra: matrices, vectors,
397numerical solvers, and related algorithms. It provides an elegant API based
398on \"expression templates\". It is versatile: it supports all matrix sizes,
399all standard numeric types, various matrix decompositions and geometry
400features, and more.")
401
402 ;; Most of the code is MPLv2, with a few files under LGPLv2.1+ or BSD-3.
403 ;; See 'COPYING.README' for details.
404 (license mpl2.0)))