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