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