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