gnu: Add emacs-slime.
[jackhill/guix/guix.git] / gnu / packages / algebra.scm
CommitLineData
233e7676 1;;; GNU Guix --- Functional package management for GNU
4879d2ff 2;;; Copyright © 2012, 2013, 2014, 2015, 2016 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)
10b1f688 23 #:use-module (gnu packages compression)
1ffa7090 24 #:use-module (gnu packages multiprecision)
0fc54d4b 25 #:use-module (gnu packages mpi)
1ffa7090
LC
26 #:use-module (gnu packages perl)
27 #:use-module (gnu packages readline)
28 #:use-module (gnu packages flex)
fb8d1be8 29 #:use-module (gnu packages xorg)
9f51293c 30 #:use-module ((guix licenses) #:prefix license:)
2ed139c4
AE
31 #:use-module (guix packages)
32 #:use-module (guix download)
7569c5cb 33 #:use-module (guix build-system gnu)
8f4b1dfb 34 #:use-module (guix build-system cmake)
7569c5cb 35 #:use-module (guix utils))
2ed139c4
AE
36
37
38(define-public mpfrcx
39 (package
40 (name "mpfrcx")
9c68798d 41 (version "0.4.2")
2ed139c4
AE
42 (source (origin
43 (method url-fetch)
44 (uri (string-append
45 "http://www.multiprecision.org/mpfrcx/download/mpfrcx-"
46 version ".tar.gz"))
47 (sha256
48 (base32
9c68798d 49 "0grw66b255r574lvll1bqccm5myj2m8ajzsjaygcyq9zjnnbnhhy"))))
2ed139c4 50 (build-system gnu-build-system)
878c8f3f
AE
51 (propagated-inputs
52 `(("gmp" ,gmp)
53 ("mpfr" ,mpfr)
54 ("mpc" ,mpc))) ; Header files are included by mpfrcx.h.
35b9e423 55 (synopsis "Arithmetic of polynomials over arbitrary precision numbers")
2ed139c4 56 (description
35b9e423 57 "Mpfrcx is a library for the arithmetic of univariate polynomials over
2ed139c4 58arbitrary precision real (mpfr) or complex (mpc) numbers, without control
35b9e423 59on the rounding. For the time being, only the few functions needed to
2ed139c4 60implement the floating point approach to complex multiplication are
35b9e423 61implemented. On the other hand, these comprise asymptotically fast
e881752c 62multiplication routines such as Toom–Cook and the FFT.")
9f51293c 63 (license license:lgpl2.1+)
2ed139c4
AE
64 (home-page "http://mpfrcx.multiprecision.org/")))
65
10b1f688
AE
66(define-public cm
67 (package
68 (name "cm")
69 (version "0.2.1")
70 (source (origin
71 (method url-fetch)
72 (uri (string-append
73 "http://www.multiprecision.org/cm/download/cm-"
74 version ".tar.gz"))
75 (sha256
76 (base32
77 "1r5dx5qy0ka2sq26n9jll9iy4sjqg0jp5r3jnbjhpgxvmj8jbhq8"))))
78 (build-system gnu-build-system)
79 (propagated-inputs
80 `(("mpfrcx" ,mpfrcx)
81 ("zlib" ,zlib))) ; Header files included from cm_common.h.
82 (inputs
83 `(("pari-gp" ,pari-gp)))
84 (synopsis "CM constructions for elliptic curves")
85 (description
86 "The CM software implements the construction of ring class fields of
87imaginary quadratic number fields and of elliptic curves with complex
88multiplication via floating point approximations. It consists of libraries
89that can be called from within a C program and of executable command
90line applications.")
91 (license license:gpl2+)
92 (home-page "http://cm.multiprecision.org/")))
93
2ed139c4
AE
94(define-public fplll
95 (package
96 (name "fplll")
5a15ed50 97 (version "4.0.4")
2ed139c4
AE
98 (source (origin
99 (method url-fetch)
100 (uri (string-append
101 "http://perso.ens-lyon.fr/damien.stehle/fplll/libfplll-"
102 version ".tar.gz"))
103 (sha256 (base32
5a15ed50 104 "1cbiby7ykis4z84swclpysrljmqhfcllpkcbll1m08rzskgb1a6b"))))
2ed139c4
AE
105 (build-system gnu-build-system)
106 (inputs `(("gmp" ,gmp)
107 ("mpfr" ,mpfr)))
35b9e423 108 (synopsis "Library for LLL-reduction of euclidean lattices")
2ed139c4 109 (description
35b9e423 110 "fplll LLL-reduces euclidean lattices. Since version 3, it can also
2ed139c4 111solve the shortest vector problem.")
9f51293c 112 (license license:lgpl2.1+)
2ed139c4 113 (home-page "http://perso.ens-lyon.fr/damien.stehle/fplll/")))
4e6b699d 114
90a6d47c
AE
115(define-public pari-gp
116 (package
117 (name "pari-gp")
000e36f2 118 (version "2.7.5")
90a6d47c
AE
119 (source (origin
120 (method url-fetch)
121 (uri (string-append
122 "http://pari.math.u-bordeaux.fr/pub/pari/unix/pari-"
123 version ".tar.gz"))
f78c66aa
AE
124 (sha256
125 (base32
000e36f2 126 "0c8l83a0gjq73r9hndsrzkypwxvnnm4pxkkzbg6jm95m80nzwh11"))))
90a6d47c
AE
127 (build-system gnu-build-system)
128 (inputs `(("gmp" ,gmp)
fb8d1be8 129 ("libx11" ,libx11)
90a6d47c
AE
130 ("perl" ,perl)
131 ("readline" ,readline)))
132 (arguments
12abb19d 133 '(#:make-flags '("gp")
f78c66aa
AE
134 ;; FIXME: building the documentation requires tex; once this is
135 ;; available, replace "gp" by "all"
12abb19d
LC
136 #:test-target "dobench"
137 #:phases
138 (alist-replace
139 'configure
ee172b1a
AE
140 (lambda* (#:key outputs #:allow-other-keys)
141 (let ((out (assoc-ref outputs "out")))
12abb19d 142 (zero?
ee172b1a 143 (system* "./Configure" (string-append "--prefix=" out)))))
12abb19d 144 %standard-phases)))
90a6d47c
AE
145 (synopsis "PARI/GP, a computer algebra system for number theory")
146 (description
147 "PARI/GP is a widely used computer algebra system designed for fast
148computations in number theory (factorisations, algebraic number theory,
149elliptic curves...), but it also contains a large number of other useful
150functions to compute with mathematical entities such as matrices,
151polynomials, power series, algebraic numbers, etc., and a lot of
152transcendental functions.
153PARI is also available as a C library to allow for faster computations.")
9f51293c 154 (license license:gpl2+)
90a6d47c 155 (home-page "http://pari.math.u-bordeaux.fr/")))
ed9f9a77 156
f854a8c1
AE
157(define-public gp2c
158 (package
159 (name "gp2c")
4879d2ff 160 (version "0.0.9pl5")
f854a8c1
AE
161 (source (origin
162 (method url-fetch)
163 (uri (string-append
164 "http://pari.math.u-bordeaux.fr/pub/pari/GP2C/gp2c-"
165 version ".tar.gz"))
324bdcd8
AE
166 (sha256
167 (base32
4879d2ff 168 "1q003mkagc5ib6lqb2xfay7j4ffkwv7xlnznp6wdrq2sbqq4vyak"))))
f854a8c1 169 (build-system gnu-build-system)
c67ccedd 170 (native-inputs `(("perl" ,perl)))
f854a8c1
AE
171 (inputs `(("pari-gp" ,pari-gp)))
172 (arguments
173 '(#:configure-flags
174 (list (string-append "--with-paricfg="
175 (assoc-ref %build-inputs "pari-gp")
176 "/lib/pari/pari.cfg"))))
177 (synopsis "PARI/GP, a computer algebra system for number theory")
178 (description
179 "PARI/GP is a widely used computer algebra system designed for fast
180computations in number theory (factorisations, algebraic number theory,
181elliptic curves...), but it also contains a large number of other useful
182functions to compute with mathematical entities such as matrices,
183polynomials, power series, algebraic numbers, etc., and a lot of
184transcendental functions.
185PARI is also available as a C library to allow for faster computations.
186
187GP2C, the GP to C compiler, translates GP scripts to PARI programs.")
9f51293c 188 (license license:gpl2)
f854a8c1
AE
189 (home-page "http://pari.math.u-bordeaux.fr/")))
190
d7ab698a
AE
191(define-public flint
192 (package
193 (name "flint")
6c591c8e 194 (version "2.5.2")
d7ab698a
AE
195 (source (origin
196 (method url-fetch)
197 (uri (string-append
198 "http://flintlib.org/flint-"
199 version ".tar.gz"))
200 (sha256 (base32
6c591c8e
AE
201 "11syazv1a8rrnac3wj3hnyhhflpqcmq02q8pqk2m6g2k6h0gxwfb"))
202 (patches (map search-patch '("flint-ldconfig.patch")))))
d7ab698a 203 (build-system gnu-build-system)
df15d17d 204 (propagated-inputs
d7ab698a 205 `(("gmp" ,gmp)
df15d17d 206 ("mpfr" ,mpfr))) ; header files from both are included by flint/arith.h
d7ab698a 207 (arguments
ad11974e
AE
208 `(#:parallel-tests? #f ; seems to be necessary on arm
209 #:phases
91430de6
AE
210 (modify-phases %standard-phases
211 (replace 'configure
212 (lambda* (#:key inputs outputs #:allow-other-keys)
213 (let ((out (assoc-ref outputs "out"))
214 (gmp (assoc-ref inputs "gmp"))
215 (mpfr (assoc-ref inputs "mpfr")))
91430de6
AE
216 ;; do not pass "--enable-fast-install", which makes the
217 ;; homebrew configure process fail
218 (zero? (system*
219 "./configure"
220 (string-append "--prefix=" out)
221 (string-append "--with-gmp=" gmp)
222 (string-append "--with-mpfr=" mpfr)))))))))
d7ab698a
AE
223 (synopsis "Fast library for number theory")
224 (description
225 "FLINT is a C library for number theory. It supports arithmetic
226with numbers, polynomials, power series and matrices over many base
227rings, including multiprecision integers and rationals, integers
228modulo n, p-adic numbers, finite fields (prime and non-prime order)
229and real and complex numbers (via the Arb extension library).
230
231Operations that can be performed include conversions, arithmetic,
232GCDs, factoring, solving linear systems, and evaluating special
233functions. In addition, FLINT provides various low-level routines for
234fast arithmetic.")
9f51293c 235 (license license:gpl2+)
d7ab698a
AE
236 (home-page "http://flintlib.org/")))
237
6b8e8285
AE
238(define-public arb
239 (package
240 (name "arb")
ffc8f345 241 (version "2.8.1")
6b8e8285
AE
242 (source (origin
243 (method url-fetch)
244 (uri (string-append
245 "https://github.com/fredrik-johansson/arb/archive/"
246 version ".tar.gz"))
f586c877 247 (file-name (string-append name "-" version ".tar.gz"))
424ce93d
AE
248 (sha256
249 (base32
ffc8f345
AE
250 "04hhcpshfkcq9fr4hixbhpps50yf9drk62xgkvlcaj5kb4nyrx7l"))
251 (patches (map search-patch '("arb-ldconfig.patch")))))
6b8e8285 252 (build-system gnu-build-system)
480d19e6
AE
253 (propagated-inputs
254 `(("flint" ,flint))) ; flint.h is included by arf.h
6b8e8285 255 (inputs
480d19e6 256 `(("gmp" ,gmp)
6b8e8285
AE
257 ("mpfr" ,mpfr)))
258 (arguments
259 `(#:phases
260 (alist-replace
261 'configure
262 (lambda* (#:key inputs outputs #:allow-other-keys)
263 (let ((out (assoc-ref outputs "out"))
264 (flint (assoc-ref inputs "flint"))
265 (gmp (assoc-ref inputs "gmp"))
266 (mpfr (assoc-ref inputs "mpfr")))
267 ;; do not pass "--enable-fast-install", which makes the
268 ;; homebrew configure process fail
269 (zero? (system*
270 "./configure"
271 (string-append "--prefix=" out)
272 (string-append "--with-flint=" flint)
273 (string-append "--with-gmp=" gmp)
274 (string-append "--with-mpfr=" mpfr)))))
275 %standard-phases)))
276 (synopsis "Arbitrary precision floating-point ball arithmetic")
277 (description
278 "Arb is a C library for arbitrary-precision floating-point ball
279arithmetic. It supports efficient high-precision computation with
280polynomials, power series, matrices and special functions over the
281real and complex numbers, with automatic, rigorous error control.")
9f51293c 282 (license license:gpl2+)
6b8e8285
AE
283 (home-page "http://fredrikj.net/arb/")))
284
ed9f9a77
LC
285(define-public bc
286 (package
287 (name "bc")
288 (version "1.06")
289 (source (origin
290 (method url-fetch)
291 (uri (string-append "mirror://gnu/bc/bc-" version ".tar.gz"))
292 (sha256
293 (base32
294 "0cqf5jkwx6awgd2xc2a0mkpxilzcfmhncdcfg7c9439wgkqxkxjf"))))
295 (build-system gnu-build-system)
c4c4cc05
JD
296 (inputs `(("readline" ,readline)))
297 (native-inputs `(("flex" ,flex)))
ed9f9a77
LC
298 (arguments
299 '(#:phases
300 (alist-replace 'configure
301 (lambda* (#:key outputs #:allow-other-keys)
302 ;; This old `configure' script doesn't support
303 ;; variables passed as arguments.
304 (let ((out (assoc-ref outputs "out")))
305 (setenv "CONFIG_SHELL" (which "bash"))
306 (zero?
e2ca23c5
MW
307 (system*
308 "./configure"
309 (string-append "--prefix=" out)
310 ;; By default, man and info pages are put in
311 ;; PREFIX/{man,info}, but we want them in
312 ;; PREFIX/share/{man,info}.
313 (string-append "--mandir=" out "/share/man")
314 (string-append "--infodir=" out "/share/info")))))
ed9f9a77
LC
315 %standard-phases)))
316 (home-page "http://www.gnu.org/software/bc/")
f50d2669 317 (synopsis "Arbitrary precision numeric processing language")
ed9f9a77 318 (description
a22dc0c4
LC
319 "bc is an arbitrary precision numeric processing language. It includes
320an interactive environment for evaluating mathematical statements. Its
321syntax is similar to that of C, so basic usage is familiar. It also includes
322\"dc\", a reverse-polish calculator.")
9f51293c 323 (license license:gpl2+)))
37e6cdcd
LC
324
325(define-public fftw
326 (package
327 (name "fftw")
2cf287df 328 (version "3.3.4")
37e6cdcd
LC
329 (source (origin
330 (method url-fetch)
331 (uri (string-append "ftp://ftp.fftw.org/pub/fftw/fftw-"
332 version".tar.gz"))
333 (sha256
334 (base32
2cf287df 335 "10h9mzjxnwlsjziah4lri85scc05rlajz39nqf3mbh4vja8dw34g"))))
37e6cdcd
LC
336 (build-system gnu-build-system)
337 (arguments
e5c66f8c 338 '(#:configure-flags '("--enable-shared" "--enable-openmp")
37e6cdcd
LC
339 #:phases (alist-cons-before
340 'build 'no-native
341 (lambda _
342 ;; By default '-mtune=native' is used. However, that may
343 ;; cause the use of ISA extensions (SSE2, etc.) that are
344 ;; not necessarily available on the user's machine when
345 ;; that package is built on a different machine.
346 (substitute* (find-files "." "Makefile$")
347 (("-mtune=native") "")))
348 %standard-phases)))
349 (native-inputs `(("perl" ,perl)))
350 (home-page "http://fftw.org")
351 (synopsis "Computing the discrete Fourier transform")
352 (description
353 "FFTW is a C subroutine library for computing the discrete Fourier
354transform (DFT) in one or more dimensions, of arbitrary input size, and of
355both real and complex data (as well as of even/odd data---i.e. the discrete
356cosine/ sine transforms or DCT/DST).")
9f51293c 357 (license license:gpl2+)))
7569c5cb
EB
358
359(define-public fftwf
360 (package (inherit fftw)
361 (name "fftwf")
362 (arguments
363 (substitute-keyword-arguments (package-arguments fftw)
364 ((#:configure-flags cf)
365 `(cons "--enable-float" ,cf))))
366 (description
367 (string-append (package-description fftw)
368 " Single-precision version."))))
e5c66f8c
EB
369
370(define-public fftw-openmpi
371 (package (inherit fftw)
372 (name "fftw-openmpi")
373 (inputs
374 `(("openmpi" ,openmpi)
375 ,@(package-inputs fftw)))
376 (arguments
377 (substitute-keyword-arguments (package-arguments fftw)
378 ((#:configure-flags cf)
379 `(cons "--enable-mpi" ,cf))))
380 (description
381 (string-append (package-description fftw)
382 " With OpenMPI parallelism support."))))
8f4b1dfb
LC
383
384(define-public eigen
385 (package
386 (name "eigen")
2abcc935 387 (version "3.2.7")
8f4b1dfb
LC
388 (source (origin
389 (method url-fetch)
390 (uri (string-append "https://bitbucket.org/eigen/eigen/get/"
9b268f12 391 version ".tar.bz2"))
8f4b1dfb
LC
392 (sha256
393 (base32
2abcc935
LC
394 "0gigbjjdlw2q0gvcnyiwc6in314a647rkidk6977bwiwn88im3p5"))
395 (file-name (string-append name "-" version ".tar.bz2"))
8f4b1dfb
LC
396 (modules '((guix build utils)))
397 (snippet
398 ;; There are 3 test failures in the "unsupported" directory,
399 ;; but maintainers say it's a known issue and it's unsupported
400 ;; anyway, so just skip them.
401 '(substitute* "CMakeLists.txt"
402 (("add_subdirectory\\(unsupported\\)")
a4eb83b7
LC
403 "# Do not build the tests for unsupported features.\n")
404 ;; Work around
405 ;; <http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1114>.
406 (("\"include/eigen3\"")
407 "\"${CMAKE_INSTALL_PREFIX}/include/eigen3\"")))))
8f4b1dfb
LC
408 (build-system cmake-build-system)
409 (arguments
410 '(;; Turn off debugging symbols to save space.
411 #:build-type "Release"
412
354f4fe2 413 #:phases (modify-phases %standard-phases
ef8742ea 414 (replace 'check
354f4fe2 415 (lambda _
354f4fe2
LC
416 (let* ((cores (parallel-job-count))
417 (dash-j (format #f "-j~a" cores)))
ef8742ea
LC
418 ;; First build the tests, in parallel. See
419 ;; <http://eigen.tuxfamily.org/index.php?title=Tests>.
420 (and (zero? (system* "make" "buildtests" dash-j))
8f4b1dfb 421
ef8742ea
LC
422 ;; Then run 'CTest' with -V so we get more
423 ;; details upon failure.
424 (zero? (system* "ctest" "-V" dash-j)))))))))
8f4b1dfb
LC
425 (home-page "http://eigen.tuxfamily.org")
426 (synopsis "C++ template library for linear algebra")
427 (description
428 "Eigen is a C++ template library for linear algebra: matrices, vectors,
429numerical solvers, and related algorithms. It provides an elegant API based
430on \"expression templates\". It is versatile: it supports all matrix sizes,
431all standard numeric types, various matrix decompositions and geometry
432features, and more.")
433
434 ;; Most of the code is MPLv2, with a few files under LGPLv2.1+ or BSD-3.
435 ;; See 'COPYING.README' for details.
9f51293c 436 (license license:mpl2.0)))