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