Commit | Line | Data |
---|---|---|
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 | 57 | arbitrary precision real (mpfr) or complex (mpc) numbers, without control |
35b9e423 | 58 | on the rounding. For the time being, only the few functions needed to |
2ed139c4 | 59 | implement the floating point approach to complex multiplication are |
35b9e423 | 60 | implemented. On the other hand, these comprise asymptotically fast |
e881752c | 61 | multiplication 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 | |
86 | imaginary quadratic number fields and of elliptic curves with complex | |
87 | multiplication via floating point approximations. It consists of libraries | |
88 | that can be called from within a C program and of executable command | |
89 | line 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 | 110 | solve 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 | |
146 | computations in number theory (factorisations, algebraic number theory, | |
147 | elliptic curves...), but it also contains a large number of other useful | |
148 | functions to compute with mathematical entities such as matrices, | |
149 | polynomials, power series, algebraic numbers, etc., and a lot of | |
150 | transcendental functions. | |
151 | PARI 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 | |
178 | computations in number theory (factorisations, algebraic number theory, | |
179 | elliptic curves...), but it also contains a large number of other useful | |
180 | functions to compute with mathematical entities such as matrices, | |
181 | polynomials, power series, algebraic numbers, etc., and a lot of | |
182 | transcendental functions. | |
183 | PARI is also available as a C library to allow for faster computations. | |
184 | ||
185 | GP2C, 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") | |
6c591c8e | 192 | (version "2.5.2") |
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 | |
6c591c8e AE |
199 | "11syazv1a8rrnac3wj3hnyhhflpqcmq02q8pqk2m6g2k6h0gxwfb")) |
200 | (patches (map search-patch '("flint-ldconfig.patch"))))) | |
d7ab698a | 201 | (build-system gnu-build-system) |
df15d17d | 202 | (propagated-inputs |
d7ab698a | 203 | `(("gmp" ,gmp) |
df15d17d | 204 | ("mpfr" ,mpfr))) ; header files from both are included by flint/arith.h |
d7ab698a | 205 | (arguments |
ad11974e AE |
206 | `(#:parallel-tests? #f ; seems to be necessary on arm |
207 | #:phases | |
91430de6 AE |
208 | (modify-phases %standard-phases |
209 | (replace 'configure | |
210 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
211 | (let ((out (assoc-ref outputs "out")) | |
212 | (gmp (assoc-ref inputs "gmp")) | |
213 | (mpfr (assoc-ref inputs "mpfr"))) | |
91430de6 AE |
214 | ;; do not pass "--enable-fast-install", which makes the |
215 | ;; homebrew configure process fail | |
216 | (zero? (system* | |
217 | "./configure" | |
218 | (string-append "--prefix=" out) | |
219 | (string-append "--with-gmp=" gmp) | |
220 | (string-append "--with-mpfr=" mpfr))))))))) | |
d7ab698a AE |
221 | (synopsis "Fast library for number theory") |
222 | (description | |
223 | "FLINT is a C library for number theory. It supports arithmetic | |
224 | with numbers, polynomials, power series and matrices over many base | |
225 | rings, including multiprecision integers and rationals, integers | |
226 | modulo n, p-adic numbers, finite fields (prime and non-prime order) | |
227 | and real and complex numbers (via the Arb extension library). | |
228 | ||
229 | Operations that can be performed include conversions, arithmetic, | |
230 | GCDs, factoring, solving linear systems, and evaluating special | |
231 | functions. In addition, FLINT provides various low-level routines for | |
232 | fast arithmetic.") | |
9f51293c | 233 | (license license:gpl2+) |
d7ab698a AE |
234 | (home-page "http://flintlib.org/"))) |
235 | ||
6b8e8285 AE |
236 | (define-public arb |
237 | (package | |
238 | (name "arb") | |
424ce93d | 239 | (version "2.7.0") |
6b8e8285 AE |
240 | (source (origin |
241 | (method url-fetch) | |
242 | (uri (string-append | |
243 | "https://github.com/fredrik-johansson/arb/archive/" | |
244 | version ".tar.gz")) | |
f586c877 | 245 | (file-name (string-append name "-" version ".tar.gz")) |
424ce93d AE |
246 | (sha256 |
247 | (base32 | |
248 | "1rwkffs57v8mry63rq8l2dyw69zfs9rg5fpbfllqp3nkjnkp1fly")))) | |
6b8e8285 | 249 | (build-system gnu-build-system) |
480d19e6 AE |
250 | (propagated-inputs |
251 | `(("flint" ,flint))) ; flint.h is included by arf.h | |
6b8e8285 | 252 | (inputs |
480d19e6 | 253 | `(("gmp" ,gmp) |
6b8e8285 AE |
254 | ("mpfr" ,mpfr))) |
255 | (arguments | |
256 | `(#:phases | |
257 | (alist-replace | |
258 | 'configure | |
259 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
260 | (let ((out (assoc-ref outputs "out")) | |
261 | (flint (assoc-ref inputs "flint")) | |
262 | (gmp (assoc-ref inputs "gmp")) | |
263 | (mpfr (assoc-ref inputs "mpfr"))) | |
264 | ;; do not pass "--enable-fast-install", which makes the | |
265 | ;; homebrew configure process fail | |
266 | (zero? (system* | |
267 | "./configure" | |
268 | (string-append "--prefix=" out) | |
269 | (string-append "--with-flint=" flint) | |
270 | (string-append "--with-gmp=" gmp) | |
271 | (string-append "--with-mpfr=" mpfr))))) | |
272 | %standard-phases))) | |
273 | (synopsis "Arbitrary precision floating-point ball arithmetic") | |
274 | (description | |
275 | "Arb is a C library for arbitrary-precision floating-point ball | |
276 | arithmetic. It supports efficient high-precision computation with | |
277 | polynomials, power series, matrices and special functions over the | |
278 | real and complex numbers, with automatic, rigorous error control.") | |
9f51293c | 279 | (license license:gpl2+) |
6b8e8285 AE |
280 | (home-page "http://fredrikj.net/arb/"))) |
281 | ||
ed9f9a77 LC |
282 | (define-public bc |
283 | (package | |
284 | (name "bc") | |
285 | (version "1.06") | |
286 | (source (origin | |
287 | (method url-fetch) | |
288 | (uri (string-append "mirror://gnu/bc/bc-" version ".tar.gz")) | |
289 | (sha256 | |
290 | (base32 | |
291 | "0cqf5jkwx6awgd2xc2a0mkpxilzcfmhncdcfg7c9439wgkqxkxjf")))) | |
292 | (build-system gnu-build-system) | |
c4c4cc05 JD |
293 | (inputs `(("readline" ,readline))) |
294 | (native-inputs `(("flex" ,flex))) | |
ed9f9a77 LC |
295 | (arguments |
296 | '(#:phases | |
297 | (alist-replace 'configure | |
298 | (lambda* (#:key outputs #:allow-other-keys) | |
299 | ;; This old `configure' script doesn't support | |
300 | ;; variables passed as arguments. | |
301 | (let ((out (assoc-ref outputs "out"))) | |
302 | (setenv "CONFIG_SHELL" (which "bash")) | |
303 | (zero? | |
e2ca23c5 MW |
304 | (system* |
305 | "./configure" | |
306 | (string-append "--prefix=" out) | |
307 | ;; By default, man and info pages are put in | |
308 | ;; PREFIX/{man,info}, but we want them in | |
309 | ;; PREFIX/share/{man,info}. | |
310 | (string-append "--mandir=" out "/share/man") | |
311 | (string-append "--infodir=" out "/share/info"))))) | |
ed9f9a77 LC |
312 | %standard-phases))) |
313 | (home-page "http://www.gnu.org/software/bc/") | |
f50d2669 | 314 | (synopsis "Arbitrary precision numeric processing language") |
ed9f9a77 | 315 | (description |
a22dc0c4 LC |
316 | "bc is an arbitrary precision numeric processing language. It includes |
317 | an interactive environment for evaluating mathematical statements. Its | |
318 | syntax is similar to that of C, so basic usage is familiar. It also includes | |
319 | \"dc\", a reverse-polish calculator.") | |
9f51293c | 320 | (license license:gpl2+))) |
37e6cdcd LC |
321 | |
322 | (define-public fftw | |
323 | (package | |
324 | (name "fftw") | |
2cf287df | 325 | (version "3.3.4") |
37e6cdcd LC |
326 | (source (origin |
327 | (method url-fetch) | |
328 | (uri (string-append "ftp://ftp.fftw.org/pub/fftw/fftw-" | |
329 | version".tar.gz")) | |
330 | (sha256 | |
331 | (base32 | |
2cf287df | 332 | "10h9mzjxnwlsjziah4lri85scc05rlajz39nqf3mbh4vja8dw34g")))) |
37e6cdcd LC |
333 | (build-system gnu-build-system) |
334 | (arguments | |
e5c66f8c | 335 | '(#:configure-flags '("--enable-shared" "--enable-openmp") |
37e6cdcd LC |
336 | #:phases (alist-cons-before |
337 | 'build 'no-native | |
338 | (lambda _ | |
339 | ;; By default '-mtune=native' is used. However, that may | |
340 | ;; cause the use of ISA extensions (SSE2, etc.) that are | |
341 | ;; not necessarily available on the user's machine when | |
342 | ;; that package is built on a different machine. | |
343 | (substitute* (find-files "." "Makefile$") | |
344 | (("-mtune=native") ""))) | |
345 | %standard-phases))) | |
346 | (native-inputs `(("perl" ,perl))) | |
347 | (home-page "http://fftw.org") | |
348 | (synopsis "Computing the discrete Fourier transform") | |
349 | (description | |
350 | "FFTW is a C subroutine library for computing the discrete Fourier | |
351 | transform (DFT) in one or more dimensions, of arbitrary input size, and of | |
352 | both real and complex data (as well as of even/odd data---i.e. the discrete | |
353 | cosine/ sine transforms or DCT/DST).") | |
9f51293c | 354 | (license license:gpl2+))) |
7569c5cb EB |
355 | |
356 | (define-public fftwf | |
357 | (package (inherit fftw) | |
358 | (name "fftwf") | |
359 | (arguments | |
360 | (substitute-keyword-arguments (package-arguments fftw) | |
361 | ((#:configure-flags cf) | |
362 | `(cons "--enable-float" ,cf)))) | |
363 | (description | |
364 | (string-append (package-description fftw) | |
365 | " Single-precision version.")))) | |
e5c66f8c EB |
366 | |
367 | (define-public fftw-openmpi | |
368 | (package (inherit fftw) | |
369 | (name "fftw-openmpi") | |
370 | (inputs | |
371 | `(("openmpi" ,openmpi) | |
372 | ,@(package-inputs fftw))) | |
373 | (arguments | |
374 | (substitute-keyword-arguments (package-arguments fftw) | |
375 | ((#:configure-flags cf) | |
376 | `(cons "--enable-mpi" ,cf)))) | |
377 | (description | |
378 | (string-append (package-description fftw) | |
379 | " With OpenMPI parallelism support.")))) | |
8f4b1dfb LC |
380 | |
381 | (define-public eigen | |
382 | (package | |
383 | (name "eigen") | |
4d835808 | 384 | (version "3.2.6") |
8f4b1dfb LC |
385 | (source (origin |
386 | (method url-fetch) | |
387 | (uri (string-append "https://bitbucket.org/eigen/eigen/get/" | |
9b268f12 | 388 | version ".tar.bz2")) |
8f4b1dfb LC |
389 | (sha256 |
390 | (base32 | |
4d835808 | 391 | "0gil5ksmgcg6v3nw0v613mvpzz4n33xhawqs8l7fj7rnlpwm4cwa")) |
8f4b1dfb LC |
392 | (modules '((guix build utils))) |
393 | (snippet | |
394 | ;; There are 3 test failures in the "unsupported" directory, | |
395 | ;; but maintainers say it's a known issue and it's unsupported | |
396 | ;; anyway, so just skip them. | |
397 | '(substitute* "CMakeLists.txt" | |
398 | (("add_subdirectory\\(unsupported\\)") | |
399 | "# Do not build the tests for unsupported features.\n"))))) | |
400 | (build-system cmake-build-system) | |
401 | (arguments | |
402 | '(;; Turn off debugging symbols to save space. | |
403 | #:build-type "Release" | |
404 | ||
405 | ;; Use 'make check', as per | |
406 | ;; <http://eigen.tuxfamily.org/index.php?title=Tests>. | |
407 | #:test-target "check" | |
408 | ||
409 | #:phases (alist-cons-before | |
410 | 'check 'build-tests | |
411 | (lambda _ | |
412 | ;; First build the tests, in parallel. | |
413 | ;; See <http://eigen.tuxfamily.org/index.php?title=Tests>. | |
fc3cbc67 | 414 | (let* ((cores (parallel-job-count)) |
8f4b1dfb LC |
415 | (dash-j (format #f "-j~a" cores))) |
416 | ;; These variables are supposed to be honored. | |
417 | (setenv "EIGEN_MAKE_ARGS" dash-j) | |
418 | (setenv "EIGEN_CTEST_ARGS" dash-j) | |
419 | ||
420 | (zero? (system* "make" "buildtests" dash-j)))) | |
421 | %standard-phases))) | |
422 | (home-page "http://eigen.tuxfamily.org") | |
423 | (synopsis "C++ template library for linear algebra") | |
424 | (description | |
425 | "Eigen is a C++ template library for linear algebra: matrices, vectors, | |
426 | numerical solvers, and related algorithms. It provides an elegant API based | |
427 | on \"expression templates\". It is versatile: it supports all matrix sizes, | |
428 | all standard numeric types, various matrix decompositions and geometry | |
429 | features, and more.") | |
430 | ||
431 | ;; Most of the code is MPLv2, with a few files under LGPLv2.1+ or BSD-3. | |
432 | ;; See 'COPYING.README' for details. | |
9f51293c | 433 | (license license:mpl2.0))) |