Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / algebra.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2013, 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2016, 2017, 2018, 2019, 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
5 ;;; Copyright © 2014, 2018 Mark H Weaver <mhw@netris.org>
6 ;;; Copyright © 2016, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
7 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
8 ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
10 ;;; Copyright © 2017, 2019 Eric Bavier <bavier@member.fsf.org>
11 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
12 ;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
13 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
14 ;;;
15 ;;; This file is part of GNU Guix.
16 ;;;
17 ;;; GNU Guix is free software; you can redistribute it and/or modify it
18 ;;; under the terms of the GNU General Public License as published by
19 ;;; the Free Software Foundation; either version 3 of the License, or (at
20 ;;; your option) any later version.
21 ;;;
22 ;;; GNU Guix is distributed in the hope that it will be useful, but
23 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 ;;; GNU General Public License for more details.
26 ;;;
27 ;;; You should have received a copy of the GNU General Public License
28 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
29
30 (define-module (gnu packages algebra)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages autotools)
33 #:use-module (gnu packages bison)
34 #:use-module (gnu packages check)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages cpp)
37 #:use-module (gnu packages documentation)
38 #:use-module (gnu packages ed)
39 #:use-module (gnu packages flex)
40 #:use-module (gnu packages fltk)
41 #:use-module (gnu packages gl)
42 #:use-module (gnu packages graphviz)
43 #:use-module (gnu packages image)
44 #:use-module (gnu packages java)
45 #:use-module (gnu packages maths)
46 #:use-module (gnu packages mpi)
47 #:use-module (gnu packages multiprecision)
48 #:use-module (gnu packages perl)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages pulseaudio)
51 #:use-module (gnu packages python)
52 #:use-module (gnu packages python-xyz)
53 #:use-module (gnu packages readline)
54 #:use-module (gnu packages shells)
55 #:use-module (gnu packages tex)
56 #:use-module (gnu packages texinfo)
57 #:use-module (gnu packages xiph)
58 #:use-module (gnu packages xorg)
59 #:use-module (guix build-system ant)
60 #:use-module (guix build-system gnu)
61 #:use-module (guix build-system cmake)
62 #:use-module (guix build-system python)
63 #:use-module (guix download)
64 #:use-module (guix git-download)
65 #:use-module (guix hg-download)
66 #:use-module ((guix licenses) #:prefix license:)
67 #:use-module (guix packages)
68 #:use-module (guix utils))
69
70
71 (define-public mpfrcx
72 (package
73 (name "mpfrcx")
74 (version "0.5")
75 (source (origin
76 (method url-fetch)
77 (uri (string-append
78 "http://www.multiprecision.org/downloads/mpfrcx-"
79 version ".tar.gz"))
80 (sha256
81 (base32
82 "1s968480ymv6w0rnvfp9mxvx98hvi29fkvw8nk4ggzc6azxgwybs"))))
83 (build-system gnu-build-system)
84 (propagated-inputs
85 `(("gmp" ,gmp)
86 ("mpfr" ,mpfr)
87 ("mpc" ,mpc))) ; Header files are included by mpfrcx.h.
88 (synopsis "Arithmetic of polynomials over arbitrary precision numbers")
89 (description
90 "Mpfrcx is a library for the arithmetic of univariate polynomials over
91 arbitrary precision real (mpfr) or complex (mpc) numbers, without control
92 on the rounding. For the time being, only the few functions needed to
93 implement the floating point approach to complex multiplication are
94 implemented. On the other hand, these comprise asymptotically fast
95 multiplication routines such as Toom–Cook and the FFT.")
96 (license license:lgpl3+)
97 (home-page "http://www.multiprecision.org/mpfrcx/")))
98
99 (define-public gf2x
100 (package
101 (name "gf2x")
102 (version "1.2")
103 (source (origin
104 (method url-fetch)
105 (uri (string-append
106 "https://gforge.inria.fr/frs/download.php/file/36934/gf2x-"
107 version ".tar.gz"))
108 (sha256
109 (base32
110 "0d6vh1mxskvv3bxl6byp7gxxw3zzpkldrxnyajhnl05m0gx7yhk1"))))
111 (build-system gnu-build-system)
112 (synopsis "Arithmetic of polynomials over binary finite fields")
113 (description
114 "The gf2x library provides arithmetic of polynomials over finite fields
115 of characteristic 2. It implements the multiplication, squaring and
116 greatest common divisor operations.")
117 (license license:gpl3+)
118 (home-page "https://gforge.inria.fr/projects/gf2x/")))
119
120 (define-public cm
121 (package
122 (name "cm")
123 (version "0.3")
124 (source (origin
125 (method url-fetch)
126 (uri (string-append
127 "http://www.multiprecision.org/cm/download/cm-"
128 version ".tar.gz"))
129 (sha256
130 (base32
131 "1nf5kr0nqmhbzrsrinky18z0ighjpsmb5cr8zyg8jf04bfbyrfmc"))))
132 (build-system gnu-build-system)
133 (propagated-inputs
134 `(("mpfrcx" ,mpfrcx)
135 ("zlib" ,zlib))) ; Header files included from cm_common.h.
136 (inputs
137 `(("pari-gp" ,pari-gp)))
138 (synopsis "CM constructions for elliptic curves")
139 (description
140 "The CM software implements the construction of ring class fields of
141 imaginary quadratic number fields and of elliptic curves with complex
142 multiplication via floating point approximations. It consists of libraries
143 that can be called from within a C program and of executable command
144 line applications.")
145 (license license:gpl3+)
146 (home-page "http://www.multiprecision.org/cm/")))
147
148 (define-public fplll
149 (package
150 (name "fplll")
151 (version "5.2.1")
152 (source (origin
153 (method git-fetch)
154 (uri (git-reference
155 (url "https://github.com/fplll/fplll.git")
156 (commit version)))
157 (file-name (git-file-name name version))
158 (sha256
159 (base32
160 "015qmrd7nfaysbv1hbwiprz9g6hnww1y1z1xw8f43ysb7k1b5nbg"))))
161 (build-system gnu-build-system)
162 (native-inputs
163 `(("autoconf" ,autoconf)
164 ("automake" ,automake)
165 ("libtool" ,libtool)))
166 (inputs
167 `(("gmp" ,gmp)
168 ("mpfr" ,mpfr)))
169 (home-page "https://github.com/fplll/fplll")
170 (synopsis "Library for LLL-reduction of euclidean lattices")
171 (description
172 "fplll contains implementations of several lattice algorithms.
173 The implementation relies on floating-point orthogonalization, and LLL
174 is central to the code, hence the name.
175
176 It includes implementations of floating-point LLL reduction
177 algorithms, offering different speed/guarantees ratios. It contains
178 a @emph{wrapper} choosing the estimated best sequence of variants in
179 order to provide a guaranteed output as fast as possible. In the case
180 of the wrapper, the succession of variants is oblivious to the user.
181
182 It includes an implementation of the BKZ reduction algorithm,
183 including the BKZ-2.0 improvements (extreme enumeration
184 pruning, pre-processing of blocks, early termination). Additionally,
185 Slide reduction and self dual BKZ are supported.
186
187 It also includes a floating-point implementation of the
188 Kannan-Fincke-Pohst algorithm that finds a shortest non-zero lattice
189 vector. For the same task, the GaussSieve algorithm is also available
190 in fplll. Finally, it contains a variant of the enumeration algorithm
191 that computes a lattice vector closest to a given vector belonging to
192 the real span of the lattice.")
193 (license license:lgpl2.1+)))
194
195 (define-public python-fpylll
196 (package
197 (name "python-fpylll")
198 (version "0.4.1")
199 (source
200 (origin
201 ;; Pypi contains and older release, so we use a tagged release from
202 ;; Github instead.
203 (method git-fetch)
204 (uri (git-reference
205 (url "https://github.com/fplll/fpylll.git")
206 (commit (string-append version "dev"))))
207 (file-name (git-file-name name version))
208 (sha256
209 (base32
210 "01x2sqdv0sbjj4g4waj0hj4rcn4bq7h17442xaqwbznym9azmn9w"))))
211 (build-system python-build-system)
212 (inputs
213 `(("fplll" ,fplll)
214 ("gmp" ,gmp)
215 ("mpfr" ,mpfr)
216 ("pari-gp" ,pari-gp)))
217 (propagated-inputs
218 `(("cysignals" ,python-cysignals)
219 ("cython" ,python-cython)
220 ("flake8" ,python-flake8)
221 ("numpy" ,python-numpy)
222 ("pytest" ,python-pytest)))
223 (home-page "https://github.com/fplll/fpylll")
224 (synopsis "Python interface for fplll")
225 (description "fpylll is a Python wrapper for fplll.")
226 (license license:gpl2+)))
227
228 (define-public pari-gp
229 (package
230 (name "pari-gp")
231 (version "2.11.4")
232 (source (origin
233 (method url-fetch)
234 (uri (string-append
235 "https://pari.math.u-bordeaux.fr/pub/pari/unix/pari-"
236 version ".tar.gz"))
237 (sha256
238 (base32
239 "070bjw4kg7r6lqs1hfs08n5fmjv90cpwflp3wr04hbrmyz28zj5z"))))
240 (build-system gnu-build-system)
241 (native-inputs
242 `(("texlive" ,(texlive-union
243 (list texlive-amsfonts)))))
244 (inputs `(("gmp" ,gmp)
245 ("libx11" ,libx11)
246 ("perl" ,perl)
247 ("readline" ,readline)))
248 (arguments
249 '(#:make-flags '("all")
250 #:test-target "dobench"
251 #:phases
252 (modify-phases %standard-phases
253 (replace 'configure
254 (lambda* (#:key outputs #:allow-other-keys)
255 (invoke "./Configure"
256 (string-append "--prefix="
257 (assoc-ref outputs "out"))))))))
258 (synopsis "PARI/GP, a computer algebra system for number theory")
259 (description
260 "PARI/GP is a widely used computer algebra system designed for fast
261 computations in number theory (factorisations, algebraic number theory,
262 elliptic curves...), but it also contains a large number of other useful
263 functions to compute with mathematical entities such as matrices,
264 polynomials, power series, algebraic numbers, etc., and a lot of
265 transcendental functions.
266 PARI is also available as a C library to allow for faster computations.")
267 (license license:gpl2+)
268 (home-page "https://pari.math.u-bordeaux.fr/")))
269
270 (define-public gp2c
271 (package
272 (name "gp2c")
273 (version "0.0.11pl3")
274 (source (origin
275 (method url-fetch)
276 (uri (string-append
277 "https://pari.math.u-bordeaux.fr/pub/pari/GP2C/gp2c-"
278 version ".tar.gz"))
279 (sha256
280 (base32
281 "0yymbrgyjw500hqgmkj5m4nmscd7c9rs9w2c96lxgrcyab8krhrm"))))
282 (build-system gnu-build-system)
283 (native-inputs `(("perl" ,perl)))
284 (inputs `(("pari-gp" ,pari-gp)))
285 (arguments
286 '(#:configure-flags
287 (list (string-append "--with-paricfg="
288 (assoc-ref %build-inputs "pari-gp")
289 "/lib/pari/pari.cfg"))))
290 (synopsis "PARI/GP, a computer algebra system for number theory")
291 (description
292 "PARI/GP is a widely used computer algebra system designed for fast
293 computations in number theory (factorisations, algebraic number theory,
294 elliptic curves...), but it also contains a large number of other useful
295 functions to compute with mathematical entities such as matrices,
296 polynomials, power series, algebraic numbers, etc., and a lot of
297 transcendental functions.
298 PARI is also available as a C library to allow for faster computations.
299
300 GP2C, the GP to C compiler, translates GP scripts to PARI programs.")
301 (license license:gpl2)
302 (home-page "https://pari.math.u-bordeaux.fr/")))
303
304 (define fplll-4-cmh
305 (package
306 (inherit fplll)
307 (name "fplll")
308 (version "4.0.4")
309 (source
310 (origin
311 (method url-fetch)
312 (uri (string-append
313 "http://perso.ens-lyon.fr/damien.stehle/fplll/libfplll-"
314 version ".tar.gz"))
315 (sha256
316 (base32 "1cbiby7ykis4z84swclpysrljmqhfcllpkcbll1m08rzskgb1a6b"))))))
317
318 (define-public cmh
319 (package
320 (name "cmh")
321 (version "1.0")
322 (source (origin
323 (method url-fetch)
324 (uri (string-append
325 "https://gforge.inria.fr/frs/download.php/33497/cmh-"
326 version ".tar.gz"))
327 (sha256
328 (base32
329 "1a28xr9bs0igms0ik99x0w8lnb0jyfcmvyi26pbyh9ggcdivd33p"))))
330 (build-system gnu-build-system)
331 (inputs
332 `(("gmp" ,gmp)
333 ("mpfr" ,mpfr)
334 ("mpc" ,mpc)
335 ("mpfrcx" ,mpfrcx)
336 ("fplll" ,fplll-4-cmh)
337 ("pari-gp" ,pari-gp)))
338 (synopsis "Igusa class polynomial computations")
339 (description
340 "The CMH software computes Igusa (genus 2) class polynomials, which
341 parameterize the CM points in the moduli space of 2-dimensional abelian
342 varieties, i.e. Jacobians of hyperelliptic curves.
343 It can also be used to compute theta constants at arbitrary
344 precision.")
345 (license license:gpl3+)
346 (home-page "http://cmh.gforge.inria.fr/")))
347
348 (define-public giac
349 (package
350 (name "giac")
351 (version "1.5.0-87")
352 (source
353 (origin
354 (method url-fetch)
355 ;; "~parisse/giac" is not used because the maintainer regularly
356 ;; overwrites the release tarball there, introducing a checksum
357 ;; mismatch every time. See
358 ;; <https://www-fourier.ujf-grenoble.fr/~parisse/debian/dists/stable/main/source/README>
359 (uri (string-append "https://www-fourier.ujf-grenoble.fr/"
360 "~parisse/debian/dists/stable/main/source/"
361 "giac_" version ".tar.gz"))
362 (sha256
363 (base32 "1d0h1yb7qvh9x7wwv9yrzmcp712f49w1iljkxp4y6g9pzsmg1mmv"))))
364 (build-system gnu-build-system)
365 (arguments
366 `(#:modules ((ice-9 ftw)
367 (guix build utils)
368 (guix build gnu-build-system))
369 #:phases
370 (modify-phases %standard-phases
371 (add-after 'unpack 'patch-bin-cp
372 ;; Some Makefiles contain hard-coded "/bin/cp".
373 (lambda _
374 (substitute* (find-files "doc" "^Makefile")
375 (("/bin/cp") (which "cp")))
376 #t))
377 (add-after 'unpack 'disable-failing-test
378 ;; FIXME: Test failing. Not sure why.
379 (lambda _
380 (substitute* "check/Makefile.in"
381 (("chk_fhan11") ""))
382 #t))
383 (add-after 'install 'fix-doc
384 (lambda* (#:key outputs #:allow-other-keys)
385 (let ((out (assoc-ref outputs "out")))
386 ;; Most French documentation has a non-commercial
387 ;; license, so we need to remove it.
388 (with-directory-excursion (string-append out "/share/giac/doc/fr")
389 (for-each delete-file-recursively
390 '("cascas" "casexo" "casgeo" "casrouge" "cassim"
391 "castor")))
392 ;; Remove duplicate documentation in
393 ;; "%out/share/doc/giac/", where Xcas does not expect
394 ;; to find it.
395 (delete-file-recursively (string-append out "/share/doc/giac"))
396 #t)))
397 (add-after 'install 'remove-unnecessary-executable
398 (lambda* (#:key outputs #:allow-other-keys)
399 (let ((out (assoc-ref outputs "out")))
400 (delete-file (string-append out "/bin/xcasnew"))
401 #t))))))
402 (inputs
403 ;;; TODO: Add libnauty.
404 `(("fltk" ,fltk)
405 ("glpk" ,glpk)
406 ("gmp" ,gmp)
407 ("gsl" ,gsl)
408 ("lapack" ,lapack)
409 ("libao" ,ao)
410 ("libjpeg" ,libjpeg-turbo)
411 ("libpng" ,libpng)
412 ("libsamplerate" ,libsamplerate)
413 ("libx11" ,libx11)
414 ("libxinerama" ,libxinerama)
415 ("libxft" ,libxft)
416 ("libxt" ,libxt)
417 ("mesa" ,mesa)
418 ("mpfi" ,mpfi)
419 ("mpfr" ,mpfr)
420 ("ntl" ,ntl)
421 ("perl" ,perl)
422 ("pari-gp" ,pari-gp)
423 ("tcsh" ,tcsh)))
424 (native-inputs
425 `(("bison" ,bison)
426 ("flex" ,flex)
427 ("readline" ,readline)
428 ("texlive" ,texlive-tiny)))
429 (home-page "https://www-fourier.ujf-grenoble.fr/~parisse/giac.html")
430 (synopsis "Computer algebra system")
431 (description
432 "Giac/Xcas is a computer algebra system. It has a compatibility mode for
433 maple, mupad and the TI89. It is available as a standalone program (graphic
434 or text interfaces) or as a C++ library.")
435 (license license:gpl3+)))
436
437 (define-public flint
438 (package
439 (name "flint")
440 (version "2.5.2")
441 (source (origin
442 (method url-fetch)
443 (uri (string-append
444 "http://flintlib.org/flint-"
445 version ".tar.gz"))
446 (sha256 (base32
447 "11syazv1a8rrnac3wj3hnyhhflpqcmq02q8pqk2m6g2k6h0gxwfb"))
448 (patches (search-patches "flint-ldconfig.patch"))))
449 (build-system gnu-build-system)
450 (propagated-inputs
451 `(("gmp" ,gmp)
452 ("mpfr" ,mpfr))) ; header files from both are included by flint/arith.h
453 (arguments
454 `(#:parallel-tests? #f ; seems to be necessary on arm
455 #:phases
456 (modify-phases %standard-phases
457 (replace 'configure
458 (lambda* (#:key inputs outputs #:allow-other-keys)
459 (let ((out (assoc-ref outputs "out"))
460 (gmp (assoc-ref inputs "gmp"))
461 (mpfr (assoc-ref inputs "mpfr")))
462 ;; do not pass "--enable-fast-install", which makes the
463 ;; homebrew configure process fail
464 (invoke "./configure"
465 (string-append "--prefix=" out)
466 (string-append "--with-gmp=" gmp)
467 (string-append "--with-mpfr=" mpfr))
468 #t))))))
469 (synopsis "Fast library for number theory")
470 (description
471 "FLINT is a C library for number theory. It supports arithmetic
472 with numbers, polynomials, power series and matrices over many base
473 rings, including multiprecision integers and rationals, integers
474 modulo n, p-adic numbers, finite fields (prime and non-prime order)
475 and real and complex numbers (via the Arb extension library).
476
477 Operations that can be performed include conversions, arithmetic,
478 GCDs, factoring, solving linear systems, and evaluating special
479 functions. In addition, FLINT provides various low-level routines for
480 fast arithmetic.")
481 (license license:gpl2+)
482 (home-page "http://flintlib.org/")))
483
484 (define-public arb
485 (package
486 (name "arb")
487 (version "2.17.0")
488 (source (origin
489 (method git-fetch)
490 (uri (git-reference
491 (url "https://github.com/fredrik-johansson/arb.git")
492 (commit version)))
493 (file-name (git-file-name name version))
494 (sha256
495 (base32
496 "05lpy3hkl5f8ik19aw40cqydrb932xaf2n8hbq9ib5dnk7f010p1"))))
497 (build-system gnu-build-system)
498 (propagated-inputs
499 `(("flint" ,flint))) ; flint.h is included by arf.h
500 (inputs
501 `(("gmp" ,gmp)
502 ("mpfr" ,mpfr)))
503 (arguments
504 `(#:phases
505 (modify-phases %standard-phases
506 (replace 'configure
507 (lambda* (#:key inputs outputs #:allow-other-keys)
508 (let ((out (assoc-ref outputs "out"))
509 (flint (assoc-ref inputs "flint"))
510 (gmp (assoc-ref inputs "gmp"))
511 (mpfr (assoc-ref inputs "mpfr")))
512 ;; Do not pass "--enable-fast-install", which makes the
513 ;; homebrew configure process fail.
514 (invoke "./configure"
515 (string-append "--prefix=" out)
516 (string-append "--with-flint=" flint)
517 (string-append "--with-gmp=" gmp)
518 (string-append "--with-mpfr=" mpfr))))))))
519 (synopsis "Arbitrary precision floating-point ball arithmetic")
520 (description
521 "Arb is a C library for arbitrary-precision floating-point ball
522 arithmetic. It supports efficient high-precision computation with
523 polynomials, power series, matrices and special functions over the
524 real and complex numbers, with automatic, rigorous error control.")
525 (license license:lgpl2.1+)
526 (home-page "http://arblib.org")))
527
528 (define-public python-flint
529 (package
530 (name "python-flint")
531 (version "0.3.0")
532 (source (origin
533 (method git-fetch)
534 (uri (git-reference
535 (url "https://github.com/fredrik-johansson/python-flint.git")
536 (commit version)))
537 (file-name (git-file-name name version))
538 (sha256
539 (base32
540 "1v0anazbj1cfi68nl2j6dbd31kgkc1563xmr0zk5xk3xj78569pw"))
541 (patches (search-patches "python-flint-includes.patch"))))
542 (build-system python-build-system)
543 (native-inputs
544 `(("python-cython" ,python-cython)))
545 (propagated-inputs
546 `(("python-numpy" ,python-numpy)))
547 (inputs
548 `(("arb" ,arb)
549 ("flint" ,flint)))
550 (synopsis "Python module wrapping ARB and FLINT")
551 (description
552 "Python-flint is a Python extension module wrapping FLINT
553 (Fast Library for Number Theory) and Arb (arbitrary-precision ball
554 arithmetic). It supports integers, rationals, modular integers,
555 real and complex ball arithmetic, polynomials and matrices over all
556 these types and other mathematical functions.")
557 (license license:expat)
558 (home-page "http://fredrikj.net/python-flint/")))
559
560 (define-public ntl
561 (package
562 (name "ntl")
563 (version "11.4.3")
564 (source (origin
565 (method url-fetch)
566 (uri (string-append "https://shoup.net/ntl/ntl-"
567 version ".tar.gz"))
568 (sha256
569 (base32
570 "1lisp3064rch3jaa2wrhy1s9kll7i3ka3d0y6lj6l3l4ckfcrhdp"))
571 (modules '((guix build utils)))
572 (snippet
573 '(begin
574 (delete-file-recursively "src/libtool-origin")
575 #t))))
576 (build-system gnu-build-system)
577 (native-inputs
578 `(("libtool" ,libtool)
579 ("perl" ,perl))) ; for configuration
580 (inputs
581 `(("gmp" ,gmp)
582 ("gf2x" ,gf2x)))
583 (arguments
584 `(#:phases
585 (modify-phases %standard-phases
586 (replace 'configure
587 (lambda* (#:key inputs outputs #:allow-other-keys)
588 (chdir "src")
589 (invoke "./configure"
590 (string-append "PREFIX=" (assoc-ref outputs "out"))
591 (string-append "LIBTOOL=" (assoc-ref inputs "libtool") "/bin/libtool")
592 ;; set the library prefixes explicitly so that they get
593 ;; embedded in the .la file
594 (string-append "GMP_PREFIX=" (assoc-ref inputs "gmp"))
595 (string-append "GF2X_PREFIX=" (assoc-ref inputs "gf2x"))
596 ;; Do not build especially for the build machine.
597 "NATIVE=off"
598 "NTL_GF2X_LIB=on"
599 "SHARED=on"))))))
600 (synopsis "C++ library for number theory")
601 (description
602 "NTL is a C++ library providing data structures and algorithms
603 for manipulating signed, arbitrary length integers, and for vectors,
604 matrices, and polynomials over the integers and over finite fields.")
605 (license license:gpl2+)
606 (home-page "https://shoup.net/ntl/")))
607
608 (define-public singular
609 (package
610 (name "singular")
611 (version "4.1.2p1")
612 (source
613 (origin
614 (method url-fetch)
615 (uri
616 (string-append "http://www.mathematik.uni-kl.de/ftp/pub/Math/"
617 "Singular/SOURCES/"
618 (string-join
619 (string-split
620 (string-trim-right version #\p
621 0 (1- (string-length version)))
622 #\.) "-")
623 "/singular-" version ".tar.gz"))
624 (sha256 (base32
625 "0kvd55353fiqyq1msmi0kka66n5h0aqs7m3km60r01b1w2f8085m"))))
626 (build-system gnu-build-system)
627 (native-inputs
628 `(("doxygen" ,doxygen)
629 ("graphviz" ,graphviz)
630 ("perl" ,perl)))
631 (inputs
632 `(("cddlib" ,cddlib)
633 ("gmp" ,gmp)
634 ("flint" ,flint)
635 ("mpfr" ,mpfr)
636 ("ntl" ,ntl)
637 ("python" ,python-2)
638 ("readline" ,readline)))
639 (arguments
640 `(#:configure-flags
641 (list (string-append "--with-ntl="
642 (assoc-ref %build-inputs "ntl")))))
643 (synopsis "Computer algebra system for polynomial computations")
644 (description
645 "Singular is a computer algebra system for polynomial computations,
646 with special emphasis on commutative and non-commutative algebra, algebraic
647 geometry and singularity theory.")
648 ;; Singular itself is dual licensed gpl2 or gpl3, but some of the
649 ;; libraries with which it links are licensed under lgpl3+, so the
650 ;; combined work becomes gpl3. See COPYING in the source code.
651 (license license:gpl3)
652 (home-page "http://www.singular.uni-kl.de/index.php")))
653
654 (define-public gmp-ecm
655 (package
656 (name "gmp-ecm")
657 (version "7.0.4")
658 (source (origin
659 (method url-fetch)
660 ;; Use the ‘Latest version’ link for a stable URI across releases.
661 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
662 "latestfile/160/ecm-" version ".tar.gz"))
663 (sha256 (base32
664 "0hxs24c2m3mh0nq1zz63z3sb7dhy1rilg2s1igwwcb26x3pb7xqc"))))
665 (build-system gnu-build-system)
666 (inputs
667 `(("gmp" ,gmp)))
668 (arguments
669 `(#:configure-flags '("--enable-shared"
670 ;; Disable specific assembly routines, which depend
671 ;; on the subarchitecture of the build machine,
672 ;; and use gmp instead.
673 "--disable-asm-redc")))
674 (synopsis "Integer factorization library using the elliptic curve method")
675 (description
676 "GMP-ECM factors integers using the elliptic curve method (ECM) as well
677 as the P-1 and P+1 algorithms. It provides a library and a stand-alone
678 binary.")
679 ;; Most files are under lgpl3+, but some are under gpl3+ or gpl2+,
680 ;; so the combined work is under gpl3+.
681 (license license:gpl3+)
682 (home-page "http://ecm.gforge.inria.fr/")))
683
684 (define-public bc
685 (package
686 (name "bc")
687 (version "1.07.1")
688 (source (origin
689 (method url-fetch)
690 (uri (string-append "mirror://gnu/bc/bc-" version ".tar.gz"))
691 (sha256
692 (base32
693 "0amh9ik44jfg66csyvf4zz1l878c4755kjndq9j0270akflgrbb2"))
694 (patches (search-patches "bc-fix-cross-compilation.patch"))))
695 (build-system gnu-build-system)
696 (native-inputs
697 `(("automake" ,automake)
698 ("autoconf" ,autoconf)
699 ("ed" ,ed)
700 ("flex" ,flex)
701 ("texinfo" ,texinfo)))
702 (arguments
703 '(#:configure-flags
704 (list "--with-readline")
705 #:phases
706 (modify-phases %standard-phases
707 (add-after 'unpack 'autogen
708 (lambda _
709 (invoke "autoreconf" "-vif"))))))
710 (home-page "https://www.gnu.org/software/bc/")
711 (synopsis "Arbitrary precision numeric processing language")
712 (description
713 "bc is an arbitrary precision numeric processing language. It includes
714 an interactive environment for evaluating mathematical statements. Its
715 syntax is similar to that of C, so basic usage is familiar. It also includes
716 \"dc\", a reverse-polish calculator.")
717 (license license:gpl2+)))
718
719 ;; The original kiss-fft does not have a complete build system and does not
720 ;; build any shared libraries. This is a fork used by Extempore.
721 (define-public kiss-fft-for-extempore
722 (package
723 (name "kiss-fft-for-extempore")
724 (version "1.3.0")
725 (source (origin
726 (method git-fetch)
727 (uri (git-reference
728 (url "https://github.com/extemporelang/kiss_fft.git")
729 (commit version)))
730 (file-name (git-file-name name version))
731 (sha256
732 (base32
733 "0jasbmqy4wkqrqx3w64s1dfmj34875xmsl72mb26aa4hpyn14bi2"))))
734 (build-system cmake-build-system)
735 (arguments `(#:tests? #f)) ; no tests included
736 ;; Extempore refuses to build on architectures other than x86_64
737 (supported-systems '("x86_64-linux"))
738 (home-page "https://github.com/extemporelang/kiss_fft")
739 (synopsis "Mixed-radix Fast Fourier Transform")
740 (description
741 "Kiss FFT attempts to be a reasonably efficient, moderately useful FFT
742 that can use fixed or floating data types and can easily be incorporated into
743 a C program.")
744 (license license:bsd-3)))
745
746 (define-public fftw
747 (package
748 (name "fftw")
749 (version "3.3.8")
750 (source (origin
751 (method url-fetch)
752 (uri (string-append "ftp://ftp.fftw.org/pub/fftw/fftw-"
753 version".tar.gz"))
754 (sha256
755 (base32
756 "00z3k8fq561wq2khssqg0kallk0504dzlx989x3vvicjdqpjc4v1"))))
757 (build-system gnu-build-system)
758 (arguments
759 `(#:configure-flags
760 '("--enable-shared" "--enable-openmp" "--enable-threads"
761 ,@(let ((system (or (%current-target-system) (%current-system))))
762 ;; Enable SIMD extensions for codelets. See details at:
763 ;; <http://fftw.org/fftw3_doc/Installation-on-Unix.html>.
764 (cond
765 ((string-prefix? "x86_64" system)
766 '("--enable-sse2" "--enable-avx" "--enable-avx2"
767 "--enable-avx512" "--enable-avx-128-fma"))
768 ((string-prefix? "i686" system)
769 '("--enable-sse2"))
770 ((string-prefix? "aarch64" system)
771 ;; Note that fftw supports NEON on 32-bit ARM only when
772 ;; compiled for single-precision.
773 '("--enable-neon"))
774 (else
775 '())))
776 ;; By default '-mtune=native' is used. However, that may cause the
777 ;; use of ISA extensions (e.g. AVX) that are not necessarily
778 ;; available on the user's machine when that package is built on a
779 ;; different machine.
780 "ax_cv_c_flags__mtune_native=no")))
781 (native-inputs `(("perl" ,perl)))
782 (home-page "http://fftw.org")
783 (synopsis "Computing the discrete Fourier transform")
784 (description
785 "FFTW is a C subroutine library for computing the discrete Fourier
786 transform (DFT) in one or more dimensions, of arbitrary input size, and of
787 both real and complex data (as well as of even/odd data---i.e. the discrete
788 cosine/ sine transforms or DCT/DST).")
789 (license license:gpl2+)))
790
791 (define-public fftwf
792 (package (inherit fftw)
793 (name "fftwf")
794 (arguments
795 (substitute-keyword-arguments (package-arguments fftw)
796 ((#:configure-flags fftw-configure-flags)
797 `(cons* "--enable-single"
798 ,@(if (string-prefix? "arm" (or (%current-target-system)
799 (%current-system)))
800 ;; fftw supports NEON on 32-bit ARM only when compiled
801 ;; for single-precision, so add it here.
802 '("--enable-neon")
803 '())
804 ,fftw-configure-flags))))
805 (description
806 (string-append (package-description fftw)
807 " Single-precision version."))))
808
809 (define-public fftw-openmpi
810 (package (inherit fftw)
811 (name "fftw-openmpi")
812 (inputs
813 `(("openmpi" ,openmpi)
814 ,@(package-inputs fftw)))
815 (arguments
816 (substitute-keyword-arguments (package-arguments fftw)
817 ((#:configure-flags cf)
818 `(cons "--enable-mpi" ,cf))
819 ((#:phases phases '%standard-phases)
820 `(modify-phases ,phases
821 (add-before 'check 'mpi-setup
822 ,%openmpi-setup)))))
823 (description
824 (string-append (package-description fftw)
825 " With OpenMPI parallelism support."))))
826
827 (define-public java-la4j
828 (package
829 (name "java-la4j")
830 (version "0.6.0")
831 (source (origin
832 (method git-fetch)
833 (uri (git-reference
834 (url "https://github.com/vkostyukov/la4j.git")
835 (commit version)))
836 (file-name (string-append name "-" version "-checkout"))
837 (sha256
838 (base32
839 "1qir8dr978cfvz9k12m2kbdwpyf6cqdf1d0ilb7lnkhbgq5i53w3"))))
840 (build-system ant-build-system)
841 (arguments
842 `(#:jar-name "la4j.jar"
843 #:jdk ,icedtea-8
844 #:test-exclude (list "**/Abstract*.java"
845 "**/MatrixTest.java"
846 "**/DenseMatrixTest.java"
847 "**/SparseMatrixTest.java"
848 "**/VectorTest.java"
849 "**/SparseVectorTest.java"
850 "**/DenseVectorTest.java")))
851 (native-inputs
852 `(("java-junit" ,java-junit)
853 ("java-hamcrest-core" ,java-hamcrest-core)))
854 (home-page "http://la4j.org/")
855 (synopsis "Java library that provides Linear Algebra primitives and algorithms")
856 (description "The la4j library is a Java library that provides Linear
857 Algebra primitives (matrices and vectors) and algorithms. The key features of
858 the la4j library are:
859
860 @itemize
861 @item No dependencies and tiny size
862 @item Fluent object-oriented/functional API
863 @item Sparse (CRS, CCS) and dense (1D/2D arrays) matrices
864 @item Linear systems solving (Gaussian, Jacobi, Zeidel, Square Root, Sweep and other)
865 @item Matrices decomposition (Eigenvalues/Eigenvectors, SVD, QR, LU, Cholesky and other)
866 @item MatrixMarket/CSV IO formats support for matrices and vectors
867 @end itemize\n")
868 (license license:asl2.0)))
869
870 (define-public java-jlargearrays
871 (package
872 (name "java-jlargearrays")
873 (version "1.6")
874 (source (origin
875 (method url-fetch)
876 (uri (string-append "https://repo1.maven.org/maven2/"
877 "pl/edu/icm/JLargeArrays/"
878 version "/JLargeArrays-" version
879 "-sources.jar"))
880 (file-name (string-append name "-" version ".jar"))
881 (sha256
882 (base32
883 "0v05iphpxbjnd7f4jf1rlqq3m8hslhcm0imdbsgxr20pi3xkaf2a"))))
884 (build-system ant-build-system)
885 (arguments
886 `(#:jar-name "jlargearrays.jar"
887 #:tests? #f ; tests are not included in the release archive
888 #:jdk ,icedtea-8))
889 (propagated-inputs
890 `(("java-commons-math3" ,java-commons-math3)))
891 (home-page "https://gitlab.com/ICM-VisLab/JLargeArrays")
892 (synopsis "Library of one-dimensional arrays that can store up to 263 elements")
893 (description "JLargeArrays is a Java library of one-dimensional arrays
894 that can store up to 263 elements.")
895 (license license:bsd-2)))
896
897 (define-public java-jtransforms
898 (package
899 (name "java-jtransforms")
900 (version "3.1")
901 (source (origin
902 (method url-fetch)
903 (uri (string-append "https://repo1.maven.org/maven2/"
904 "com/github/wendykierp/JTransforms/"
905 version "/JTransforms-" version "-sources.jar"))
906 (sha256
907 (base32
908 "1haw5m8shv5srgcpwkl853dz8bv6h90bzlhcps6mdpb4cixjirsg"))))
909 (build-system ant-build-system)
910 (arguments
911 `(#:jar-name "jtransforms.jar"
912 #:tests? #f ; tests are not included in the release archive
913 #:jdk ,icedtea-8))
914 (propagated-inputs
915 `(("java-commons-math3" ,java-commons-math3)
916 ("java-jlargearrays" ,java-jlargearrays)))
917 (home-page "https://github.com/wendykierp/JTransforms")
918 (synopsis "Multithreaded FFT library written in pure Java")
919 (description "JTransforms is a multithreaded FFT library written in pure
920 Java. Currently, four types of transforms are available: @dfn{Discrete
921 Fourier Transform} (DFT), @dfn{Discrete Cosine Transform} (DCT), @dfn{Discrete
922 Sine Transform} (DST) and @dfn{Discrete Hartley Transform} (DHT).")
923 (license license:bsd-2)))
924
925 (define-public eigen
926 (package
927 (name "eigen")
928 (version "3.3.7")
929 (source (origin
930 (method url-fetch)
931 (uri (string-append "https://bitbucket.org/eigen/eigen/get/"
932 version ".tar.bz2"))
933 (sha256
934 (base32
935 "1km3fyfzyqfdvmnl79drps3fjwnz3zbh0c7l34mfbqyvvs8cy4wz"))
936 (file-name (string-append name "-" version ".tar.bz2"))
937 (patches (search-patches "eigen-stabilise-sparseqr-test.patch"))
938 (modules '((guix build utils)))
939 (snippet
940 ;; There are 3 test failures in the "unsupported" directory,
941 ;; but maintainers say it's a known issue and it's unsupported
942 ;; anyway, so just skip them.
943 '(begin
944 (substitute* "unsupported/CMakeLists.txt"
945 (("add_subdirectory\\(test.*")
946 "# Do not build the tests for unsupported features.\n"))
947 #t))))
948 (build-system cmake-build-system)
949 (arguments
950 '(;; Turn off debugging symbols to save space.
951 #:build-type "Release"
952
953 #:phases (modify-phases %standard-phases
954 (replace 'check
955 (lambda _
956 (let* ((cores (parallel-job-count))
957 (dash-j (format #f "-j~a" cores)))
958 (setenv "EIGEN_SEED" "1") ;for reproducibility
959 ;; First build the tests, in parallel. See
960 ;; <http://eigen.tuxfamily.org/index.php?title=Tests>.
961 (invoke "make" "buildtests" dash-j)
962
963 ;; Then run 'CTest' with -V so we get more
964 ;; details upon failure.
965 (invoke "ctest" "-V" dash-j)))))))
966 (home-page "https://eigen.tuxfamily.org")
967 (synopsis "C++ template library for linear algebra")
968 (description
969 "Eigen is a C++ template library for linear algebra: matrices, vectors,
970 numerical solvers, and related algorithms. It provides an elegant API based
971 on \"expression templates\". It is versatile: it supports all matrix sizes,
972 all standard numeric types, various matrix decompositions and geometry
973 features, and more.")
974
975 ;; Most of the code is MPLv2, with a few files under LGPLv2.1+ or BSD-3.
976 ;; See 'COPYING.README' for details.
977 (license license:mpl2.0)))
978
979 (define-public eigen-for-tensorflow
980 (let ((changeset "fd6845384b86")
981 (revision "1"))
982 (package (inherit eigen)
983 (name "eigen-for-tensorflow")
984 (version (string-append "3.3.5-" revision "." changeset))
985 (source (origin
986 (method hg-fetch)
987 (uri (hg-reference
988 (url "https://bitbucket.org/eigen/eigen")
989 (changeset changeset)))
990 (sha256
991 (base32
992 "12cwgah63wqwb66xji048hcxc1z5zjg8a7701zlia5zbilnnk1n5"))
993 (file-name (string-append name "-" version "-checkout"))
994 (modules '((guix build utils)))
995 (snippet
996 ;; There are 3 test failures in the "unsupported" directory,
997 ;; but maintainers say it's a known issue and it's unsupported
998 ;; anyway, so just skip them.
999 '(begin
1000 (substitute* "unsupported/CMakeLists.txt"
1001 (("add_subdirectory\\(test.*")
1002 "# Do not build the tests for unsupported features.\n"))
1003 #t)))))))
1004
1005 (define-public xtensor
1006 (package
1007 (name "xtensor")
1008 (version "0.20.10")
1009 (source (origin
1010 (method git-fetch)
1011 (uri (git-reference
1012 (url "https://github.com/QuantStack/xtensor.git")
1013 (commit version)))
1014 (sha256
1015 (base32
1016 "1fmv2hpx610xwhxrndfsfvlbqfyk4l3gi5q5d7pa9m82kblxjj9l"))
1017 (file-name (git-file-name name version))))
1018 (build-system cmake-build-system)
1019 (native-inputs
1020 `(("googletest" ,googletest)
1021 ("xtl" ,xtl)))
1022 (arguments
1023 `(#:configure-flags
1024 '("-DBUILD_TESTS=ON")
1025 #:test-target "xtest"))
1026 (home-page "https://quantstack.net/xtensor")
1027 (synopsis "C++ tensors with broadcasting and lazy computing")
1028 (description "xtensor is a C++ library meant for numerical analysis with
1029 multi-dimensional array expressions.
1030
1031 xtensor provides:
1032 @itemize
1033 @item an extensible expression system enabling lazy broadcasting.
1034 @item an API following the idioms of the C++ standard library.
1035 @item tools to manipulate array expressions and build upon xtensor.
1036 @end itemize")
1037 (license license:bsd-3)))
1038
1039 (define-public gap
1040 (package
1041 (name "gap")
1042 (version "4.10.2")
1043 (source
1044 (origin
1045 (method url-fetch)
1046 (uri (string-append "https://www.gap-system.org/pub/gap/gap-"
1047 (version-major+minor version)
1048 "/tar.bz2/gap-"
1049 version
1050 ".tar.bz2"))
1051 (sha256
1052 (base32 "0cp6ddk0469zzv1m1vair6gm27ic6c5m77ri8rn0znq3gaps6x94"))
1053 (modules '((guix build utils) (ice-9 ftw) (srfi srfi-1)))
1054 (snippet
1055 '(begin
1056 ;; Delete the external gmp and zlib libraries
1057 ;; and a subdirectory not needed for our build.
1058 (for-each delete-file-recursively
1059 '("extern" "hpcgap"))
1060 ;; Delete a failing test.
1061 ;; FIXME: This might be fixed in the next release, see
1062 ;; https://github.com/gap-system/gap/issues/3292
1063 (delete-file "tst/testinstall/dir.tst")
1064 ;; Delete all packages except for a fixed list.
1065 (with-directory-excursion "pkg"
1066 (for-each delete-file-recursively
1067 (lset-difference string=? (scandir ".")
1068 '("." ".."
1069 ;; Necessary packages.
1070 "GAPDoc-1.6.2"
1071 "primgrp-3.3.2"
1072 "SmallGrp-1.3" ; artistic2.0
1073 "transgrp" ; artistic2.0 for data,
1074 ; gpl2 or gpl3 for code
1075 ;; Recommanded package.
1076 "io-4.5.4" ; gpl3+
1077 ;; Optional packages, searched for at start,
1078 ;; and their depedencies.
1079 "alnuth-3.1.0"
1080 "autpgrp-1.10"
1081 "crisp-1.4.4" ; bsd-2
1082 "ctbllib" ; gpl3+ according to doc/chap0.txt
1083 "FactInt-1.6.2"
1084 "fga"
1085 "irredsol-1.4" ; bsd-2
1086 "laguna-3.9.2"
1087 "polenta-1.3.8"
1088 "polycyclic-2.14"
1089 "radiroot-2.8"
1090 "resclasses-4.7.1"
1091 "sophus-1.24"
1092 "tomlib-1.2.7" ; gpl2+, clarified in the git repository
1093 ; and the next release
1094 "utils-0.59"))))
1095 #t))))
1096 (build-system gnu-build-system)
1097 (inputs
1098 `(("gmp" ,gmp)
1099 ("zlib" ,zlib)))
1100 (arguments
1101 `(#:modules ((ice-9 ftw)
1102 (srfi srfi-26)
1103 (guix build gnu-build-system)
1104 (guix build utils))
1105 #:phases
1106 (modify-phases %standard-phases
1107 (add-after 'build 'build-packages
1108 ;; Compile all packages that have not been deleted by the
1109 ;; code snippet above.
1110 (lambda _
1111 (setenv "CONFIG_SHELL" (which "bash"))
1112 (with-directory-excursion "pkg"
1113 (invoke "../bin/BuildPackages.sh")
1114 #t)))
1115 (add-after 'build-packages 'build-doc
1116 ;; The documentation is bundled, but we create it from source.
1117 (lambda _
1118 (with-directory-excursion "doc"
1119 (invoke "./make_doc"))
1120 #t))
1121 (replace 'install
1122 (lambda* (#:key outputs #:allow-other-keys)
1123 (let* ((out (assoc-ref outputs "out"))
1124 (bin (string-append out "/bin"))
1125 (lib (string-append out "/lib"))
1126 (prog (string-append bin "/gap"))
1127 (prog-real (string-append bin "/.gap-real"))
1128 (share (string-append out "/share/gap"))
1129 (include (string-append out "/include/gap"))
1130 (include-hpc (string-append include "/hpc")))
1131 ;; Install only the gap binary; the gac compiler is left
1132 ;; for maybe later. "Wrap" it in a shell script that calls
1133 ;; the binary with the correct parameter.
1134 (mkdir-p bin)
1135 (copy-file "gap" prog-real)
1136 (call-with-output-file prog
1137 (lambda (port)
1138 (format port
1139 "#!~a~%exec ~a -l ~a \"$@\"~%"
1140 (which "bash")
1141 prog-real
1142 share)))
1143 (chmod prog #o755)
1144 ;; Install the headers, which are needed by Sage. The
1145 ;; Makefile target "install-headers" was available in
1146 ;; gap-4.10.0, but has been commented out in gap-4.10.1.
1147 (mkdir-p include-hpc)
1148 (install-file "gen/config.h" include)
1149 (let ((file-name-predicate-without-stat
1150 (lambda (regex)
1151 (cut (file-name-predicate regex) <> #f))))
1152 (with-directory-excursion "src"
1153 (for-each
1154 (cut install-file <> include)
1155 (scandir "."
1156 (file-name-predicate-without-stat ".*\\.h$"))))
1157 (with-directory-excursion "src/hpc"
1158 (for-each
1159 (cut install-file <> include-hpc)
1160 (scandir "."
1161 (file-name-predicate-without-stat ".*\\.h$")))))
1162 ;; Install the library, which is needed by Sage. The
1163 ;; Makefile target "install-libgap" was available in
1164 ;; gap-4.10.0, but has been commented out in gap-4.10.1.
1165 ;; Compared to the Makefile, which used libtool, the
1166 ;; following approach of copying files and making symlinks
1167 ;; is rather pedestrian. There is hope that some later
1168 ;; version of gap reinstates and completes the install
1169 ;; targets.
1170 (invoke "make" "libgap.la")
1171 (install-file "libgap.la" lib)
1172 (install-file ".libs/libgap.so.0.0.0" lib)
1173 (symlink "libgap.so.0.0.0" (string-append lib "/libgap.so"))
1174 (symlink "libgap.so.0.0.0" (string-append lib "/libgap.so.0"))
1175 ;; Install a certain number of files and directories to
1176 ;; SHARE, where the wrapped shell script expects them.
1177 ;; Remove information on the build directory from sysinfo.gap.
1178 (substitute* "sysinfo.gap"
1179 (("GAP_BIN_DIR=\".*\"") "GAP_BIN_DIR=\"\"")
1180 (("GAP_LIB_DIR=\".*\"") "GAP_LIB_DIR=\"\"")
1181 (("GAP_CPPFLAGS=\".*\"") "GAP_CPPFLAGS=\"\""))
1182 (install-file "sysinfo.gap" share)
1183 (copy-recursively "grp" (string-append share "/grp"))
1184 (copy-recursively "pkg" (string-append share "/pkg"))
1185 ;; The following is not the C library libgap.so, but a
1186 ;; library of GAP code.
1187 (copy-recursively "lib" (string-append share "/lib"))
1188 ;; The gap binary looks for documentation inside SHARE.
1189 (copy-recursively "doc" (string-append share "/doc")))
1190 #t)))))
1191 (home-page "https://www.gap-system.org/")
1192 (synopsis
1193 "System for computational group theory")
1194 (description
1195 "GAP is a system for computational discrete algebra, with particular
1196 emphasis on computational group theory. It provides a programming language,
1197 a library of thousands of functions implementing algebraic algorithms
1198 written in the GAP language as well as large data libraries of algebraic
1199 objects.")
1200 ;; Some packages have different licenses (effectively forcing the
1201 ;; combined work to be licensed as gpl3+); if this is the case, this
1202 ;; is mentioned above next to their name.
1203 ;; Some packages have no license mentioned explicitly; supposedly this
1204 ;; means that the gpl2+ licence of GAP itself applies, but to be on the
1205 ;; safe side, we drop them for now.
1206 (license license:gpl2+)))
1207
1208 (define-public givaro
1209 (package
1210 (name "givaro")
1211 (version "4.1.1")
1212 (source (origin
1213 (method git-fetch)
1214 (uri (git-reference
1215 (url "https://github.com/linbox-team/givaro")
1216 (commit (string-append "v" version))))
1217 (file-name (git-file-name name version))
1218 (sha256
1219 (base32
1220 "11wz57q6ijsvfs5r82masxgr319as92syi78lnl9lgdblpc6xigk"))))
1221 (build-system gnu-build-system)
1222 (native-inputs
1223 `(("autoconf" ,autoconf)
1224 ("automake" ,automake)
1225 ("libtool" ,libtool)))
1226 (propagated-inputs
1227 `(("gmp" ,gmp))) ; gmp++.h includes gmpxx.h
1228 (synopsis "Algebraic computations with exact rings and fields")
1229 (description
1230 "Givaro is a C++ library implementing the basic arithmetic of various
1231 algebraic objects: prime fields, extension fields, finite fields, finite
1232 rings, polynomials, algebraic numbers, arbitrary precision integers and
1233 rationals (C++ wrappers over gmp), fixed precision integers. It also
1234 provides data-structures and templated classes for the manipulation of
1235 compound objects, such as vectors, matrices and univariate polynomials.")
1236 (license license:cecill-b)
1237 (home-page "https://github.com/linbox-team/givaro")))
1238
1239 (define-public fflas-ffpack
1240 (package
1241 (name "fflas-ffpack")
1242 (version "2.4.3")
1243 (source (origin
1244 (method git-fetch)
1245 (uri (git-reference
1246 (url "https://github.com/linbox-team/fflas-ffpack")
1247 (commit version)))
1248 (file-name (git-file-name name version))
1249 (sha256
1250 (base32
1251 "1ynbjd72qrwp0b4kpn0p5d7gddpvj8dlb5fwdxajr5pvkvi3if74"))))
1252 (build-system gnu-build-system)
1253 (native-inputs
1254 `(("autoconf" ,autoconf)
1255 ("automake" ,automake)
1256 ("libtool" ,libtool)
1257 ("pkg-config" ,pkg-config)))
1258 (inputs
1259 `(("openblas" ,openblas)))
1260 (propagated-inputs
1261 `(("givaro" ,givaro))) ; required according to the .pc file
1262 (arguments
1263 `(#:configure-flags
1264 (list (string-append "--with-blas-libs="
1265 (assoc-ref %build-inputs "openblas")
1266 "/lib/libopenblas.so"))))
1267 (synopsis "C++ library for linear algebra over finite fields")
1268 (description
1269 "FFLAS-FFPACK is a C++ template library for basic linear algebra
1270 operations over a finite field.
1271 FFLAS (Finite Field Linear Algebra Subprograms) provides the implementation
1272 of a subset of routines of the numerical BLAS; it also supports sparse
1273 matrix-vector products.
1274 FFPACK (Finite Field Linear Algebra Package) is inspired by the LAPACK
1275 library to provide functionalities of higher level, using the kernel
1276 of a BLAS. Additionally, it provides routines specific to exact linear
1277 algebra, such as the row echelon form.")
1278 (license license:lgpl2.1+)
1279 (home-page "https://linbox-team.github.io/fflas-ffpack/")))
1280
1281 (define-public linbox
1282 (package
1283 (name "linbox")
1284 (version "1.6.3")
1285 (source (origin
1286 (method git-fetch)
1287 (uri (git-reference
1288 (url "https://github.com/linbox-team/linbox")
1289 (commit (string-append "v" version))))
1290 (file-name (git-file-name name version))
1291 (sha256
1292 (base32
1293 "10j6dspbsq7d2l4q3y0c1l1xwmaqqba2fxg59q5bhgk9h5d7q571"))))
1294 (build-system gnu-build-system)
1295 (native-inputs
1296 `(("autoconf" ,autoconf)
1297 ("automake" ,automake)
1298 ("libtool" ,libtool)
1299 ("pkg-config" ,pkg-config)))
1300 (inputs
1301 `(("fflas-ffpack" ,fflas-ffpack)))
1302 (synopsis "C++ library for linear algebra over exact rings")
1303 (description
1304 "LinBox is a C++ template library for exact linear algebra computation
1305 with dense, sparse, and structured matrices over the integers and over
1306 finite fields.")
1307 (license license:lgpl2.1+)
1308 (home-page "https://linbox-team.github.io/linbox/")))
1309
1310 (define-public m4ri
1311 (package
1312 (name "m4ri")
1313 (version "20140914")
1314 (source (origin
1315 (method git-fetch)
1316 (uri (git-reference
1317 (url "https://bitbucket.org/malb/m4ri")
1318 (commit (string-append "release-" version))))
1319 (file-name (git-file-name name version))
1320 (sha256
1321 (base32
1322 "0xfg6pffbn8r1s0y7bn9b8i55l00d41dkmhrpf7pwk53qa3achd3"))))
1323 (build-system gnu-build-system)
1324 (native-inputs
1325 `(("autoconf" ,autoconf)
1326 ("automake" ,automake)
1327 ("libtool" ,libtool)
1328 ("pkg-config" ,pkg-config)))
1329 (inputs
1330 `(("libpng" ,libpng)))
1331 (synopsis "Arithmetic of dense matrices over F_2")
1332 (description "M4RI is a library for fast arithmetic with dense matrices
1333 over F2. The name M4RI comes from the first implemented algorithm: The
1334 Method of the Four Russians inversion algorithm published by Gregory Bard.
1335 This algorithm in turn is named after the Method of the Four Russians
1336 multiplication algorithm.")
1337 (license license:gpl2+)
1338 (home-page "https://bitbucket.org/malb/m4ri/")))
1339
1340 (define-public symmetrica
1341 (package
1342 (name "symmetrica")
1343 (version "2.0")
1344 (source (origin
1345 (method url-fetch/tarbomb)
1346 (uri (let ((v (string-join (string-split version #\.) "_")))
1347 (string-append "http://www.algorithm.uni-bayreuth.de/"
1348 "en/research/SYMMETRICA/"
1349 "SYM" v "_tar.gz")))
1350 (sha256
1351 (base32
1352 "1qhfrbd5ybb0sinl9pad64rscr08qvlfzrzmi4p4hk61xn6phlmz"))
1353 ;; Taken from <https://git.sagemath.org/sage.git/plain/build/pkgs/symmetrica/patches/>
1354 (patches (search-patches "symmetrica-bruch.patch"
1355 "symmetrica-int32.patch"
1356 "symmetrica-return_values.patch"
1357 "symmetrica-sort_sum_rename.patch"))))
1358 (build-system gnu-build-system)
1359 (arguments
1360 `(#:tests? #f ;no test
1361 #:phases
1362 (modify-phases %standard-phases
1363 (add-after 'unpack 'fix-makefile
1364 (lambda _
1365 (substitute* "makefile"
1366 (("cc -c") "gcc -c -fPIC"))
1367 #t))
1368 (add-after 'fix-makefile 'turn-off-banner
1369 (lambda _
1370 (substitute* "de.c"
1371 (("(INT no_banner = )FALSE" _ pre) (string-append pre "TRUE")))
1372 #t))
1373 (delete 'configure) ;no configure script
1374 (replace 'install ;no install target
1375 (lambda* (#:key outputs #:allow-other-keys)
1376 (let* ((out (assoc-ref outputs "out"))
1377 (lib (string-append out "/lib"))
1378 (inc (string-append out "/include/symmetrica"))
1379 (doc (string-append out "/share/doc/symmetrica-" ,version))
1380 (static "libsymmetrica.a"))
1381 ;; Build static library.
1382 (apply invoke "ar" "crs" static (find-files "." "\\.o$"))
1383 (invoke "ranlib" static)
1384 ;; Install static library and headers.
1385 (for-each (lambda (f) (install-file f inc))
1386 (find-files "." "\\.h$"))
1387 (install-file "libsymmetrica.a" lib)
1388 ;; Install documentation.
1389 (for-each (lambda (f) (install-file f doc))
1390 (find-files "." "\\.doc$"))
1391 #t))))))
1392 (home-page "http://www.algorithm.uni-bayreuth.de/en/research/SYMMETRICA/")
1393 (synopsis "Combinatoric C Library")
1394 (description "Symmetrica is a library for combinatorics. It has support
1395 for the representation theory of the symmetric group and related groups,
1396 combinatorics of tableaux, symmetric functions and polynomials, Schubert
1397 polynomials, and the representation theory of Hecke algebras of type A_n.")
1398 (license license:public-domain)))
1399
1400 (define-public m4rie
1401 (package
1402 (name "m4rie")
1403 (version "20150908")
1404 (source (origin
1405 (method git-fetch)
1406 (uri (git-reference
1407 (url "https://bitbucket.org/malb/m4rie")
1408 (commit (string-append "release-" version))))
1409 (file-name (git-file-name name version))
1410 (sha256
1411 (base32
1412 "0r8lv46qx5mkz5kp3ay2jnsp0mbhlqr5z2z220wdk73wdshcznss"))))
1413 (build-system gnu-build-system)
1414 (native-inputs
1415 `(("autoconf" ,autoconf)
1416 ("automake" ,automake)
1417 ("libtool" ,libtool)))
1418 (inputs
1419 `(("m4ri" ,m4ri)))
1420 (synopsis "Arithmetic of dense matrices over F_{2^e}")
1421 (description "M4RI is a library for fast arithmetic with dense matrices
1422 over finite fields of characteristic 2. So it extends the functionality
1423 of M4RI from F_2 to F_{2^e}.")
1424 (license license:gpl2+)
1425 (home-page "https://bitbucket.org/malb/m4rie/")))
1426
1427 (define-public eclib
1428 (package
1429 (name "eclib")
1430 (version "20190909")
1431 (source (origin
1432 (method git-fetch)
1433 (uri (git-reference
1434 (url "https://github.com/JohnCremona/eclib/")
1435 (commit (string-append "v" version))))
1436 (file-name (git-file-name name version))
1437 (sha256
1438 (base32
1439 "1gw27lqc3f525n8qdcmr2nyn16y9g10z9f6dnmckyyxcdzvhq35n"))))
1440 (build-system gnu-build-system)
1441 (native-inputs
1442 `(("autoconf" ,autoconf)
1443 ("automake" ,automake)
1444 ("libtool" ,libtool)))
1445 (inputs
1446 `(("ntl" ,ntl)
1447 ("pari-gp" ,pari-gp)))
1448 (synopsis "Ranks of elliptic curves and modular symbols")
1449 (description "The eclib package includes mwrank (for 2-descent on
1450 elliptic curves over Q) and modular symbol code; it has been written by
1451 John Cremona to compute his elliptic curve database.")
1452 (license license:gpl2+)
1453 (home-page (string-append "http://homepages.warwick.ac.uk/staff/"
1454 "J.E.Cremona/mwrank/index.html"))))
1455
1456 (define-public lrcalc
1457 (package
1458 (name "lrcalc")
1459 (version "1.2")
1460 (source (origin
1461 (method git-fetch)
1462 (uri (git-reference
1463 (url "https://bitbucket.org/asbuch/lrcalc")
1464 (commit (string-append "lrcalc-" version))))
1465 (file-name (git-file-name name version))
1466 (sha256
1467 (base32
1468 "1c12d04jdyxkkav4ak8d1aqrv594gzihwhpxvc6p9js0ry1fahss"))
1469 (patches (search-patches "lrcalc-includes.patch"))))
1470 (build-system gnu-build-system)
1471 (native-inputs
1472 `(("autoconf" ,autoconf)
1473 ("automake" ,automake)
1474 ("libtool" ,libtool)))
1475 (arguments
1476 `(#:phases
1477 (modify-phases %standard-phases
1478 (add-before 'build 'fix-permission
1479 (lambda _
1480 (chmod "lrcalc.maple.src" #o644)
1481 #t)))))
1482 (synopsis "Littlewood-Richardson calculator in algebraic combinatorics")
1483 (description "The Littlewood-Richardson Calculator (lrcalc) is a
1484 program designed to compute Littlewood-Richardson coefficients. It computes
1485 single Littlewood-Richardson coefficients, products of Schur functions, or
1486 skew Schur functions. In addition it computes products in the small quantum
1487 cohomology ring of a Grassmann variety. The software package also includes
1488 a program that performs fast computation of the more general multiplicative
1489 structure constants of Schubert polynomials.")
1490 (license license:gpl2+)
1491 (home-page "https://sites.math.rutgers.edu/~asbuch/lrcalc/")))
1492
1493 (define-public iml
1494 (package
1495 (name "iml")
1496 (version "1.0.5")
1497 (source
1498 (origin
1499 (method url-fetch)
1500 (uri (string-append "http://www.cs.uwaterloo.ca/~astorjoh/iml-"
1501 version ".tar.bz2"))
1502 (sha256
1503 (base32
1504 "0akwhhz9b40bz6lrfxpamp7r7wkk48p455qbn04mfnl9a1l6db8x"))))
1505 (build-system gnu-build-system)
1506 (inputs
1507 `(("gmp", gmp)
1508 ("cblas" ,openblas))) ; or any other BLAS library; the documentation
1509 ; mentions ATLAS in particular
1510 (arguments
1511 `(#:configure-flags
1512 (list
1513 "--enable-shared"
1514 (string-append "--with-gmp-include="
1515 (assoc-ref %build-inputs "gmp") "/include")
1516 (string-append "--with-gmp-lib="
1517 (assoc-ref %build-inputs "gmp") "/lib")
1518 "--with-cblas=-lopenblas"
1519 (string-append "--with-cblas-include="
1520 (assoc-ref %build-inputs "cblas") "/include")
1521 (string-append "--with-cblas-lib="
1522 (assoc-ref %build-inputs "cblas") "/lib"))))
1523 (home-page "https://cs.uwaterloo.ca/~astorjoh/iml.html")
1524 (synopsis
1525 "Solver for systems of linear equations over the integers")
1526 (description
1527 "IML is a C library implementing algorithms for computing exact
1528 solutions to dense systems of linear equations over the integers.
1529 Currently, IML provides the following functionality:
1530
1531 @itemize
1532 @item Nonsingular rational system solving:
1533 compute the unique rational solution X to the system AX=B, where A and B
1534 are integer matrices, A nonsingular.
1535 @item Compute the right nullspace or kernel of an integer matrix.
1536 @item Certified linear system solving:
1537 compute a minimal denominator solution x to a system Ax=b, where b is an
1538 integer vector and A is an integer matrix with arbitrary shape and
1539 rank profile.
1540 @end itemize
1541
1542 In addition, IML provides some low level routines for a variety of mod p
1543 matrix operations: computing the row-echelon form, determinant, rank
1544 profile, and inverse of a mod p matrix. These mod p routines are not
1545 general purpose; they require that p satisfy some preconditions based on
1546 the dimension of the input matrix (usually p should be prime and should be
1547 no more than about 20 bits long).")
1548 (license license:bsd-3)))