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