gnu: gp2c: Update to 0.0.9pl4.
[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)
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")
08c28b6d 160 (version "0.0.9pl4")
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
08c28b6d 168 "079qq4yyxpc53a2kn08gg9pcfgdyffbl14c2hqsic11q8pnsr08z"))))
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")
424ce93d 241 (version "2.7.0")
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
250 "1rwkffs57v8mry63rq8l2dyw69zfs9rg5fpbfllqp3nkjnkp1fly"))))
6b8e8285 251 (build-system gnu-build-system)
480d19e6
AE
252 (propagated-inputs
253 `(("flint" ,flint))) ; flint.h is included by arf.h
6b8e8285 254 (inputs
480d19e6 255 `(("gmp" ,gmp)
6b8e8285
AE
256 ("mpfr" ,mpfr)))
257 (arguments
258 `(#:phases
259 (alist-replace
260 'configure
261 (lambda* (#:key inputs outputs #:allow-other-keys)
262 (let ((out (assoc-ref outputs "out"))
263 (flint (assoc-ref inputs "flint"))
264 (gmp (assoc-ref inputs "gmp"))
265 (mpfr (assoc-ref inputs "mpfr")))
266 ;; do not pass "--enable-fast-install", which makes the
267 ;; homebrew configure process fail
268 (zero? (system*
269 "./configure"
270 (string-append "--prefix=" out)
271 (string-append "--with-flint=" flint)
272 (string-append "--with-gmp=" gmp)
273 (string-append "--with-mpfr=" mpfr)))))
274 %standard-phases)))
275 (synopsis "Arbitrary precision floating-point ball arithmetic")
276 (description
277 "Arb is a C library for arbitrary-precision floating-point ball
278arithmetic. It supports efficient high-precision computation with
279polynomials, power series, matrices and special functions over the
280real and complex numbers, with automatic, rigorous error control.")
9f51293c 281 (license license:gpl2+)
6b8e8285
AE
282 (home-page "http://fredrikj.net/arb/")))
283
ed9f9a77
LC
284(define-public bc
285 (package
286 (name "bc")
287 (version "1.06")
288 (source (origin
289 (method url-fetch)
290 (uri (string-append "mirror://gnu/bc/bc-" version ".tar.gz"))
291 (sha256
292 (base32
293 "0cqf5jkwx6awgd2xc2a0mkpxilzcfmhncdcfg7c9439wgkqxkxjf"))))
294 (build-system gnu-build-system)
c4c4cc05
JD
295 (inputs `(("readline" ,readline)))
296 (native-inputs `(("flex" ,flex)))
ed9f9a77
LC
297 (arguments
298 '(#:phases
299 (alist-replace 'configure
300 (lambda* (#:key outputs #:allow-other-keys)
301 ;; This old `configure' script doesn't support
302 ;; variables passed as arguments.
303 (let ((out (assoc-ref outputs "out")))
304 (setenv "CONFIG_SHELL" (which "bash"))
305 (zero?
e2ca23c5
MW
306 (system*
307 "./configure"
308 (string-append "--prefix=" out)
309 ;; By default, man and info pages are put in
310 ;; PREFIX/{man,info}, but we want them in
311 ;; PREFIX/share/{man,info}.
312 (string-append "--mandir=" out "/share/man")
313 (string-append "--infodir=" out "/share/info")))))
ed9f9a77
LC
314 %standard-phases)))
315 (home-page "http://www.gnu.org/software/bc/")
f50d2669 316 (synopsis "Arbitrary precision numeric processing language")
ed9f9a77 317 (description
a22dc0c4
LC
318 "bc is an arbitrary precision numeric processing language. It includes
319an interactive environment for evaluating mathematical statements. Its
320syntax is similar to that of C, so basic usage is familiar. It also includes
321\"dc\", a reverse-polish calculator.")
9f51293c 322 (license license:gpl2+)))
37e6cdcd
LC
323
324(define-public fftw
325 (package
326 (name "fftw")
2cf287df 327 (version "3.3.4")
37e6cdcd
LC
328 (source (origin
329 (method url-fetch)
330 (uri (string-append "ftp://ftp.fftw.org/pub/fftw/fftw-"
331 version".tar.gz"))
332 (sha256
333 (base32
2cf287df 334 "10h9mzjxnwlsjziah4lri85scc05rlajz39nqf3mbh4vja8dw34g"))))
37e6cdcd
LC
335 (build-system gnu-build-system)
336 (arguments
e5c66f8c 337 '(#:configure-flags '("--enable-shared" "--enable-openmp")
37e6cdcd
LC
338 #:phases (alist-cons-before
339 'build 'no-native
340 (lambda _
341 ;; By default '-mtune=native' is used. However, that may
342 ;; cause the use of ISA extensions (SSE2, etc.) that are
343 ;; not necessarily available on the user's machine when
344 ;; that package is built on a different machine.
345 (substitute* (find-files "." "Makefile$")
346 (("-mtune=native") "")))
347 %standard-phases)))
348 (native-inputs `(("perl" ,perl)))
349 (home-page "http://fftw.org")
350 (synopsis "Computing the discrete Fourier transform")
351 (description
352 "FFTW is a C subroutine library for computing the discrete Fourier
353transform (DFT) in one or more dimensions, of arbitrary input size, and of
354both real and complex data (as well as of even/odd data---i.e. the discrete
355cosine/ sine transforms or DCT/DST).")
9f51293c 356 (license license:gpl2+)))
7569c5cb
EB
357
358(define-public fftwf
359 (package (inherit fftw)
360 (name "fftwf")
361 (arguments
362 (substitute-keyword-arguments (package-arguments fftw)
363 ((#:configure-flags cf)
364 `(cons "--enable-float" ,cf))))
365 (description
366 (string-append (package-description fftw)
367 " Single-precision version."))))
e5c66f8c
EB
368
369(define-public fftw-openmpi
370 (package (inherit fftw)
371 (name "fftw-openmpi")
372 (inputs
373 `(("openmpi" ,openmpi)
374 ,@(package-inputs fftw)))
375 (arguments
376 (substitute-keyword-arguments (package-arguments fftw)
377 ((#:configure-flags cf)
378 `(cons "--enable-mpi" ,cf))))
379 (description
380 (string-append (package-description fftw)
381 " With OpenMPI parallelism support."))))
8f4b1dfb
LC
382
383(define-public eigen
384 (package
385 (name "eigen")
2abcc935 386 (version "3.2.7")
8f4b1dfb
LC
387 (source (origin
388 (method url-fetch)
389 (uri (string-append "https://bitbucket.org/eigen/eigen/get/"
9b268f12 390 version ".tar.bz2"))
8f4b1dfb
LC
391 (sha256
392 (base32
2abcc935
LC
393 "0gigbjjdlw2q0gvcnyiwc6in314a647rkidk6977bwiwn88im3p5"))
394 (file-name (string-append name "-" version ".tar.bz2"))
8f4b1dfb
LC
395 (modules '((guix build utils)))
396 (snippet
397 ;; There are 3 test failures in the "unsupported" directory,
398 ;; but maintainers say it's a known issue and it's unsupported
399 ;; anyway, so just skip them.
400 '(substitute* "CMakeLists.txt"
401 (("add_subdirectory\\(unsupported\\)")
a4eb83b7
LC
402 "# Do not build the tests for unsupported features.\n")
403 ;; Work around
404 ;; <http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1114>.
405 (("\"include/eigen3\"")
406 "\"${CMAKE_INSTALL_PREFIX}/include/eigen3\"")))))
8f4b1dfb
LC
407 (build-system cmake-build-system)
408 (arguments
409 '(;; Turn off debugging symbols to save space.
410 #:build-type "Release"
411
412 ;; Use 'make check', as per
413 ;; <http://eigen.tuxfamily.org/index.php?title=Tests>.
414 #:test-target "check"
415
354f4fe2
LC
416 #:phases (modify-phases %standard-phases
417 (add-before 'check 'build-tests
418 (lambda _
419 ;; First build the tests, in parallel.
420 ;; See <http://eigen.tuxfamily.org/index.php?title=Tests>.
421 (let* ((cores (parallel-job-count))
422 (dash-j (format #f "-j~a" cores)))
423 ;; These variables are supposed to be honored.
424 (setenv "EIGEN_MAKE_ARGS" dash-j)
d3a33fe2
LC
425
426 ;; Use '-V' to get more details in case of test
427 ;; failures.
428 (setenv "EIGEN_CTEST_ARGS"
429 (string-append "-V " dash-j))
8f4b1dfb 430
354f4fe2 431 (zero? (system* "make" "buildtests" dash-j))))))))
8f4b1dfb
LC
432 (home-page "http://eigen.tuxfamily.org")
433 (synopsis "C++ template library for linear algebra")
434 (description
435 "Eigen is a C++ template library for linear algebra: matrices, vectors,
436numerical solvers, and related algorithms. It provides an elegant API based
437on \"expression templates\". It is versatile: it supports all matrix sizes,
438all standard numeric types, various matrix decompositions and geometry
439features, and more.")
440
441 ;; Most of the code is MPLv2, with a few files under LGPLv2.1+ or BSD-3.
442 ;; See 'COPYING.README' for details.
9f51293c 443 (license license:mpl2.0)))