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 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.5")
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 "1qh3yrwn78ms5yhwbpl5wvblk4gbz02cacdygxylr7i9xbrvylkk"))
930 (file-name (string-append name "-" version ".tar.bz2"))
931 (modules '((guix build utils)))
932 (snippet
933 ;; There are 3 test failures in the "unsupported" directory,
934 ;; but maintainers say it's a known issue and it's unsupported
935 ;; anyway, so just skip them.
936 '(begin
937 (substitute* "unsupported/CMakeLists.txt"
938 (("add_subdirectory\\(test.*")
939 "# Do not build the tests for unsupported features.\n"))
940 #t))))
941 (build-system cmake-build-system)
942 (arguments
943 '(;; Turn off debugging symbols to save space.
944 #:build-type "Release"
945
946 #:phases (modify-phases %standard-phases
947 (replace 'check
948 (lambda _
949 (let* ((cores (parallel-job-count))
950 (dash-j (format #f "-j~a" cores)))
951 (setenv "EIGEN_SEED" "1") ;for reproducibility
952 ;; First build the tests, in parallel. See
953 ;; <http://eigen.tuxfamily.org/index.php?title=Tests>.
954 (invoke "make" "buildtests" dash-j)
955
956 ;; Then run 'CTest' with -V so we get more
957 ;; details upon failure.
958 (invoke "ctest" "-V" dash-j)))))))
959 (home-page "https://eigen.tuxfamily.org")
960 (synopsis "C++ template library for linear algebra")
961 (description
962 "Eigen is a C++ template library for linear algebra: matrices, vectors,
963 numerical solvers, and related algorithms. It provides an elegant API based
964 on \"expression templates\". It is versatile: it supports all matrix sizes,
965 all standard numeric types, various matrix decompositions and geometry
966 features, and more.")
967
968 ;; Most of the code is MPLv2, with a few files under LGPLv2.1+ or BSD-3.
969 ;; See 'COPYING.README' for details.
970 (license license:mpl2.0)))
971
972 (define-public eigen-for-tensorflow
973 (let ((changeset "fd6845384b86")
974 (revision "1"))
975 (package (inherit eigen)
976 (name "eigen-for-tensorflow")
977 (version (string-append "3.3.5-" revision "." changeset))
978 (source (origin
979 (method hg-fetch)
980 (uri (hg-reference
981 (url "https://bitbucket.org/eigen/eigen")
982 (changeset changeset)))
983 (sha256
984 (base32
985 "12cwgah63wqwb66xji048hcxc1z5zjg8a7701zlia5zbilnnk1n5"))
986 (file-name (string-append name "-" version "-checkout"))
987 (modules '((guix build utils)))
988 (snippet
989 ;; There are 3 test failures in the "unsupported" directory,
990 ;; but maintainers say it's a known issue and it's unsupported
991 ;; anyway, so just skip them.
992 '(begin
993 (substitute* "unsupported/CMakeLists.txt"
994 (("add_subdirectory\\(test.*")
995 "# Do not build the tests for unsupported features.\n"))
996 #t)))))))
997
998 (define-public xtensor
999 (package
1000 (name "xtensor")
1001 (version "0.20.10")
1002 (source (origin
1003 (method git-fetch)
1004 (uri (git-reference
1005 (url "https://github.com/QuantStack/xtensor.git")
1006 (commit version)))
1007 (sha256
1008 (base32
1009 "1fmv2hpx610xwhxrndfsfvlbqfyk4l3gi5q5d7pa9m82kblxjj9l"))
1010 (file-name (git-file-name name version))))
1011 (build-system cmake-build-system)
1012 (native-inputs
1013 `(("googletest" ,googletest)
1014 ("xtl" ,xtl)))
1015 (arguments
1016 `(#:configure-flags
1017 '("-DBUILD_TESTS=ON")
1018 #:test-target "xtest"))
1019 (home-page "https://quantstack.net/xtensor")
1020 (synopsis "C++ tensors with broadcasting and lazy computing")
1021 (description "xtensor is a C++ library meant for numerical analysis with
1022 multi-dimensional array expressions.
1023
1024 xtensor provides:
1025 @itemize
1026 @item an extensible expression system enabling lazy broadcasting.
1027 @item an API following the idioms of the C++ standard library.
1028 @item tools to manipulate array expressions and build upon xtensor.
1029 @end itemize")
1030 (license license:bsd-3)))
1031
1032 (define-public gap
1033 (package
1034 (name "gap")
1035 (version "4.10.2")
1036 (source
1037 (origin
1038 (method url-fetch)
1039 (uri (string-append "https://www.gap-system.org/pub/gap/gap-"
1040 (version-major+minor version)
1041 "/tar.bz2/gap-"
1042 version
1043 ".tar.bz2"))
1044 (sha256
1045 (base32 "0cp6ddk0469zzv1m1vair6gm27ic6c5m77ri8rn0znq3gaps6x94"))
1046 (modules '((guix build utils) (ice-9 ftw) (srfi srfi-1)))
1047 (snippet
1048 '(begin
1049 ;; Delete the external gmp and zlib libraries
1050 ;; and a subdirectory not needed for our build.
1051 (for-each delete-file-recursively
1052 '("extern" "hpcgap"))
1053 ;; Delete a failing test.
1054 ;; FIXME: This might be fixed in the next release, see
1055 ;; https://github.com/gap-system/gap/issues/3292
1056 (delete-file "tst/testinstall/dir.tst")
1057 ;; Delete all packages except for a fixed list.
1058 (with-directory-excursion "pkg"
1059 (for-each delete-file-recursively
1060 (lset-difference string=? (scandir ".")
1061 '("." ".."
1062 ;; Necessary packages.
1063 "GAPDoc-1.6.2"
1064 "primgrp-3.3.2"
1065 "SmallGrp-1.3" ; artistic2.0
1066 "transgrp" ; artistic2.0 for data,
1067 ; gpl2 or gpl3 for code
1068 ;; Recommanded package.
1069 "io-4.5.4" ; gpl3+
1070 ;; Optional packages, searched for at start,
1071 ;; and their depedencies.
1072 "alnuth-3.1.0"
1073 "autpgrp-1.10"
1074 "crisp-1.4.4" ; bsd-2
1075 "ctbllib" ; gpl3+ according to doc/chap0.txt
1076 "FactInt-1.6.2"
1077 "fga"
1078 "irredsol-1.4" ; bsd-2
1079 "laguna-3.9.2"
1080 "polenta-1.3.8"
1081 "polycyclic-2.14"
1082 "radiroot-2.8"
1083 "resclasses-4.7.1"
1084 "sophus-1.24"
1085 "tomlib-1.2.7" ; gpl2+, clarified in the git repository
1086 ; and the next release
1087 "utils-0.59"))))
1088 #t))))
1089 (build-system gnu-build-system)
1090 (inputs
1091 `(("gmp" ,gmp)
1092 ("zlib" ,zlib)))
1093 (arguments
1094 `(#:modules ((ice-9 ftw)
1095 (srfi srfi-26)
1096 (guix build gnu-build-system)
1097 (guix build utils))
1098 #:phases
1099 (modify-phases %standard-phases
1100 (add-after 'build 'build-packages
1101 ;; Compile all packages that have not been deleted by the
1102 ;; code snippet above.
1103 (lambda _
1104 (setenv "CONFIG_SHELL" (which "bash"))
1105 (with-directory-excursion "pkg"
1106 (invoke "../bin/BuildPackages.sh")
1107 #t)))
1108 (add-after 'build-packages 'build-doc
1109 ;; The documentation is bundled, but we create it from source.
1110 (lambda _
1111 (with-directory-excursion "doc"
1112 (invoke "./make_doc"))
1113 #t))
1114 (replace 'install
1115 (lambda* (#:key outputs #:allow-other-keys)
1116 (let* ((out (assoc-ref outputs "out"))
1117 (bin (string-append out "/bin"))
1118 (lib (string-append out "/lib"))
1119 (prog (string-append bin "/gap"))
1120 (prog-real (string-append bin "/.gap-real"))
1121 (share (string-append out "/share/gap"))
1122 (include (string-append out "/include/gap"))
1123 (include-hpc (string-append include "/hpc")))
1124 ;; Install only the gap binary; the gac compiler is left
1125 ;; for maybe later. "Wrap" it in a shell script that calls
1126 ;; the binary with the correct parameter.
1127 (mkdir-p bin)
1128 (copy-file "gap" prog-real)
1129 (call-with-output-file prog
1130 (lambda (port)
1131 (format port
1132 "#!~a~%exec ~a -l ~a \"$@\"~%"
1133 (which "bash")
1134 prog-real
1135 share)))
1136 (chmod prog #o755)
1137 ;; Install the headers, which are needed by Sage. The
1138 ;; Makefile target "install-headers" was available in
1139 ;; gap-4.10.0, but has been commented out in gap-4.10.1.
1140 (mkdir-p include-hpc)
1141 (install-file "gen/config.h" include)
1142 (let ((file-name-predicate-without-stat
1143 (lambda (regex)
1144 (cut (file-name-predicate regex) <> #f))))
1145 (with-directory-excursion "src"
1146 (for-each
1147 (cut install-file <> include)
1148 (scandir "."
1149 (file-name-predicate-without-stat ".*\\.h$"))))
1150 (with-directory-excursion "src/hpc"
1151 (for-each
1152 (cut install-file <> include-hpc)
1153 (scandir "."
1154 (file-name-predicate-without-stat ".*\\.h$")))))
1155 ;; Install the library, which is needed by Sage. The
1156 ;; Makefile target "install-libgap" was available in
1157 ;; gap-4.10.0, but has been commented out in gap-4.10.1.
1158 ;; Compared to the Makefile, which used libtool, the
1159 ;; following approach of copying files and making symlinks
1160 ;; is rather pedestrian. There is hope that some later
1161 ;; version of gap reinstates and completes the install
1162 ;; targets.
1163 (invoke "make" "libgap.la")
1164 (install-file "libgap.la" lib)
1165 (install-file ".libs/libgap.so.0.0.0" lib)
1166 (symlink "libgap.so.0.0.0" (string-append lib "/libgap.so"))
1167 (symlink "libgap.so.0.0.0" (string-append lib "/libgap.so.0"))
1168 ;; Install a certain number of files and directories to
1169 ;; SHARE, where the wrapped shell script expects them.
1170 ;; Remove information on the build directory from sysinfo.gap.
1171 (substitute* "sysinfo.gap"
1172 (("GAP_BIN_DIR=\".*\"") "GAP_BIN_DIR=\"\"")
1173 (("GAP_LIB_DIR=\".*\"") "GAP_LIB_DIR=\"\"")
1174 (("GAP_CPPFLAGS=\".*\"") "GAP_CPPFLAGS=\"\""))
1175 (install-file "sysinfo.gap" share)
1176 (copy-recursively "grp" (string-append share "/grp"))
1177 (copy-recursively "pkg" (string-append share "/pkg"))
1178 ;; The following is not the C library libgap.so, but a
1179 ;; library of GAP code.
1180 (copy-recursively "lib" (string-append share "/lib"))
1181 ;; The gap binary looks for documentation inside SHARE.
1182 (copy-recursively "doc" (string-append share "/doc")))
1183 #t)))))
1184 (home-page "https://www.gap-system.org/")
1185 (synopsis
1186 "System for computational group theory")
1187 (description
1188 "GAP is a system for computational discrete algebra, with particular
1189 emphasis on computational group theory. It provides a programming language,
1190 a library of thousands of functions implementing algebraic algorithms
1191 written in the GAP language as well as large data libraries of algebraic
1192 objects.")
1193 ;; Some packages have different licenses (effectively forcing the
1194 ;; combined work to be licensed as gpl3+); if this is the case, this
1195 ;; is mentioned above next to their name.
1196 ;; Some packages have no license mentioned explicitly; supposedly this
1197 ;; means that the gpl2+ licence of GAP itself applies, but to be on the
1198 ;; safe side, we drop them for now.
1199 (license license:gpl2+)))
1200
1201 (define-public givaro
1202 (package
1203 (name "givaro")
1204 (version "4.1.1")
1205 (source (origin
1206 (method git-fetch)
1207 (uri (git-reference
1208 (url "https://github.com/linbox-team/givaro")
1209 (commit (string-append "v" version))))
1210 (file-name (git-file-name name version))
1211 (sha256
1212 (base32
1213 "11wz57q6ijsvfs5r82masxgr319as92syi78lnl9lgdblpc6xigk"))))
1214 (build-system gnu-build-system)
1215 (native-inputs
1216 `(("autoconf" ,autoconf)
1217 ("automake" ,automake)
1218 ("libtool" ,libtool)))
1219 (propagated-inputs
1220 `(("gmp" ,gmp))) ; gmp++.h includes gmpxx.h
1221 (synopsis "Algebraic computations with exact rings and fields")
1222 (description
1223 "Givaro is a C++ library implementing the basic arithmetic of various
1224 algebraic objects: prime fields, extension fields, finite fields, finite
1225 rings, polynomials, algebraic numbers, arbitrary precision integers and
1226 rationals (C++ wrappers over gmp), fixed precision integers. It also
1227 provides data-structures and templated classes for the manipulation of
1228 compound objects, such as vectors, matrices and univariate polynomials.")
1229 (license license:cecill-b)
1230 (home-page "https://github.com/linbox-team/givaro")))
1231
1232 (define-public fflas-ffpack
1233 (package
1234 (name "fflas-ffpack")
1235 (version "2.4.3")
1236 (source (origin
1237 (method git-fetch)
1238 (uri (git-reference
1239 (url "https://github.com/linbox-team/fflas-ffpack")
1240 (commit version)))
1241 (file-name (git-file-name name version))
1242 (sha256
1243 (base32
1244 "1ynbjd72qrwp0b4kpn0p5d7gddpvj8dlb5fwdxajr5pvkvi3if74"))))
1245 (build-system gnu-build-system)
1246 (native-inputs
1247 `(("autoconf" ,autoconf)
1248 ("automake" ,automake)
1249 ("libtool" ,libtool)
1250 ("pkg-config" ,pkg-config)))
1251 (inputs
1252 `(("openblas" ,openblas)))
1253 (propagated-inputs
1254 `(("givaro" ,givaro))) ; required according to the .pc file
1255 (arguments
1256 `(#:configure-flags
1257 (list (string-append "--with-blas-libs="
1258 (assoc-ref %build-inputs "openblas")
1259 "/lib/libopenblas.so"))))
1260 (synopsis "C++ library for linear algebra over finite fields")
1261 (description
1262 "FFLAS-FFPACK is a C++ template library for basic linear algebra
1263 operations over a finite field.
1264 FFLAS (Finite Field Linear Algebra Subprograms) provides the implementation
1265 of a subset of routines of the numerical BLAS; it also supports sparse
1266 matrix-vector products.
1267 FFPACK (Finite Field Linear Algebra Package) is inspired by the LAPACK
1268 library to provide functionalities of higher level, using the kernel
1269 of a BLAS. Additionally, it provides routines specific to exact linear
1270 algebra, such as the row echelon form.")
1271 (license license:lgpl2.1+)
1272 (home-page "https://linbox-team.github.io/fflas-ffpack/")))
1273
1274 (define-public linbox
1275 (package
1276 (name "linbox")
1277 (version "1.6.3")
1278 (source (origin
1279 (method git-fetch)
1280 (uri (git-reference
1281 (url "https://github.com/linbox-team/linbox")
1282 (commit (string-append "v" version))))
1283 (file-name (git-file-name name version))
1284 (sha256
1285 (base32
1286 "10j6dspbsq7d2l4q3y0c1l1xwmaqqba2fxg59q5bhgk9h5d7q571"))))
1287 (build-system gnu-build-system)
1288 (native-inputs
1289 `(("autoconf" ,autoconf)
1290 ("automake" ,automake)
1291 ("libtool" ,libtool)
1292 ("pkg-config" ,pkg-config)))
1293 (inputs
1294 `(("fflas-ffpack" ,fflas-ffpack)))
1295 (synopsis "C++ library for linear algebra over exact rings")
1296 (description
1297 "LinBox is a C++ template library for exact linear algebra computation
1298 with dense, sparse, and structured matrices over the integers and over
1299 finite fields.")
1300 (license license:lgpl2.1+)
1301 (home-page "https://linbox-team.github.io/linbox/")))
1302
1303 (define-public m4ri
1304 (package
1305 (name "m4ri")
1306 (version "20140914")
1307 (source (origin
1308 (method git-fetch)
1309 (uri (git-reference
1310 (url "https://bitbucket.org/malb/m4ri")
1311 (commit (string-append "release-" version))))
1312 (file-name (git-file-name name version))
1313 (sha256
1314 (base32
1315 "0xfg6pffbn8r1s0y7bn9b8i55l00d41dkmhrpf7pwk53qa3achd3"))))
1316 (build-system gnu-build-system)
1317 (native-inputs
1318 `(("autoconf" ,autoconf)
1319 ("automake" ,automake)
1320 ("libtool" ,libtool)
1321 ("pkg-config" ,pkg-config)))
1322 (inputs
1323 `(("libpng" ,libpng)))
1324 (synopsis "Arithmetic of dense matrices over F_2")
1325 (description "M4RI is a library for fast arithmetic with dense matrices
1326 over F2. The name M4RI comes from the first implemented algorithm: The
1327 Method of the Four Russians inversion algorithm published by Gregory Bard.
1328 This algorithm in turn is named after the Method of the Four Russians
1329 multiplication algorithm.")
1330 (license license:gpl2+)
1331 (home-page "https://bitbucket.org/malb/m4ri/")))
1332
1333 (define-public symmetrica
1334 (package
1335 (name "symmetrica")
1336 (version "2.0")
1337 (source (origin
1338 (method url-fetch/tarbomb)
1339 (uri (let ((v (string-join (string-split version #\.) "_")))
1340 (string-append "http://www.algorithm.uni-bayreuth.de/"
1341 "en/research/SYMMETRICA/"
1342 "SYM" v "_tar.gz")))
1343 (sha256
1344 (base32
1345 "1qhfrbd5ybb0sinl9pad64rscr08qvlfzrzmi4p4hk61xn6phlmz"))
1346 ;; Taken from <https://git.sagemath.org/sage.git/plain/build/pkgs/symmetrica/patches/>
1347 (patches (search-patches "symmetrica-bruch.patch"
1348 "symmetrica-int32.patch"
1349 "symmetrica-return_values.patch"
1350 "symmetrica-sort_sum_rename.patch"))))
1351 (build-system gnu-build-system)
1352 (arguments
1353 `(#:tests? #f ;no test
1354 #:phases
1355 (modify-phases %standard-phases
1356 (add-after 'unpack 'fix-makefile
1357 (lambda _
1358 (substitute* "makefile"
1359 (("cc -c") "gcc -c -fPIC"))
1360 #t))
1361 (add-after 'fix-makefile 'turn-off-banner
1362 (lambda _
1363 (substitute* "de.c"
1364 (("(INT no_banner = )FALSE" _ pre) (string-append pre "TRUE")))
1365 #t))
1366 (delete 'configure) ;no configure script
1367 (replace 'install ;no install target
1368 (lambda* (#:key outputs #:allow-other-keys)
1369 (let* ((out (assoc-ref outputs "out"))
1370 (lib (string-append out "/lib"))
1371 (inc (string-append out "/include/symmetrica"))
1372 (doc (string-append out "/share/doc/symmetrica-" ,version))
1373 (static "libsymmetrica.a"))
1374 ;; Build static library.
1375 (apply invoke "ar" "crs" static (find-files "." "\\.o$"))
1376 (invoke "ranlib" static)
1377 ;; Install static library and headers.
1378 (for-each (lambda (f) (install-file f inc))
1379 (find-files "." "\\.h$"))
1380 (install-file "libsymmetrica.a" lib)
1381 ;; Install documentation.
1382 (for-each (lambda (f) (install-file f doc))
1383 (find-files "." "\\.doc$"))
1384 #t))))))
1385 (home-page "http://www.algorithm.uni-bayreuth.de/en/research/SYMMETRICA/")
1386 (synopsis "Combinatoric C Library")
1387 (description "Symmetrica is a library for combinatorics. It has support
1388 for the representation theory of the symmetric group and related groups,
1389 combinatorics of tableaux, symmetric functions and polynomials, Schubert
1390 polynomials, and the representation theory of Hecke algebras of type A_n.")
1391 (license license:public-domain)))
1392
1393 (define-public m4rie
1394 (package
1395 (name "m4rie")
1396 (version "20150908")
1397 (source (origin
1398 (method git-fetch)
1399 (uri (git-reference
1400 (url "https://bitbucket.org/malb/m4rie")
1401 (commit (string-append "release-" version))))
1402 (file-name (git-file-name name version))
1403 (sha256
1404 (base32
1405 "0r8lv46qx5mkz5kp3ay2jnsp0mbhlqr5z2z220wdk73wdshcznss"))))
1406 (build-system gnu-build-system)
1407 (native-inputs
1408 `(("autoconf" ,autoconf)
1409 ("automake" ,automake)
1410 ("libtool" ,libtool)))
1411 (inputs
1412 `(("m4ri" ,m4ri)))
1413 (synopsis "Arithmetic of dense matrices over F_{2^e}")
1414 (description "M4RI is a library for fast arithmetic with dense matrices
1415 over finite fields of characteristic 2. So it extends the functionality
1416 of M4RI from F_2 to F_{2^e}.")
1417 (license license:gpl2+)
1418 (home-page "https://bitbucket.org/malb/m4rie/")))
1419
1420 (define-public eclib
1421 (package
1422 (name "eclib")
1423 (version "20190909")
1424 (source (origin
1425 (method git-fetch)
1426 (uri (git-reference
1427 (url "https://github.com/JohnCremona/eclib/")
1428 (commit (string-append "v" version))))
1429 (file-name (git-file-name name version))
1430 (sha256
1431 (base32
1432 "1gw27lqc3f525n8qdcmr2nyn16y9g10z9f6dnmckyyxcdzvhq35n"))))
1433 (build-system gnu-build-system)
1434 (native-inputs
1435 `(("autoconf" ,autoconf)
1436 ("automake" ,automake)
1437 ("libtool" ,libtool)))
1438 (inputs
1439 `(("gmp" ,gmp)
1440 ("ntl" ,ntl)
1441 ("pari-gp" ,pari-gp)))
1442 (synopsis "Ranks of elliptic curves and modular symbols")
1443 (description "The eclib package includes mwrank (for 2-descent on
1444 elliptic curves over Q) and modular symbol code; it has been written by
1445 John Cremona to compute his elliptic curve database.")
1446 (license license:gpl2+)
1447 (home-page (string-append "http://homepages.warwick.ac.uk/staff/"
1448 "J.E.Cremona/mwrank/index.html"))))
1449
1450 (define-public lrcalc
1451 (package
1452 (name "lrcalc")
1453 (version "1.2")
1454 (source (origin
1455 (method git-fetch)
1456 (uri (git-reference
1457 (url "https://bitbucket.org/asbuch/lrcalc")
1458 (commit (string-append "lrcalc-" version))))
1459 (file-name (git-file-name name version))
1460 (sha256
1461 (base32
1462 "1c12d04jdyxkkav4ak8d1aqrv594gzihwhpxvc6p9js0ry1fahss"))
1463 (patches (search-patches "lrcalc-includes.patch"))))
1464 (build-system gnu-build-system)
1465 (native-inputs
1466 `(("autoconf" ,autoconf)
1467 ("automake" ,automake)
1468 ("libtool" ,libtool)))
1469 (arguments
1470 `(#:phases
1471 (modify-phases %standard-phases
1472 (add-before 'build 'fix-permission
1473 (lambda _
1474 (chmod "lrcalc.maple.src" #o644)
1475 #t)))))
1476 (synopsis "Littlewood-Richardson calculator in algebraic combinatorics")
1477 (description "The Littlewood-Richardson Calculator (lrcalc) is a
1478 program designed to compute Littlewood-Richardson coefficients. It computes
1479 single Littlewood-Richardson coefficients, products of Schur functions, or
1480 skew Schur functions. In addition it computes products in the small quantum
1481 cohomology ring of a Grassmann variety. The software package also includes
1482 a program that performs fast computation of the more general multiplicative
1483 structure constants of Schubert polynomials.")
1484 (license license:gpl2+)
1485 (home-page "https://sites.math.rutgers.edu/~asbuch/lrcalc/")))
1486
1487 (define-public iml
1488 (package
1489 (name "iml")
1490 (version "1.0.5")
1491 (source
1492 (origin
1493 (method url-fetch)
1494 (uri (string-append "http://www.cs.uwaterloo.ca/~astorjoh/iml-"
1495 version ".tar.bz2"))
1496 (sha256
1497 (base32
1498 "0akwhhz9b40bz6lrfxpamp7r7wkk48p455qbn04mfnl9a1l6db8x"))))
1499 (build-system gnu-build-system)
1500 (inputs
1501 `(("gmp", gmp)
1502 ("cblas" ,openblas))) ; or any other BLAS library; the documentation
1503 ; mentions ATLAS in particular
1504 (arguments
1505 `(#:configure-flags
1506 (list
1507 "--enable-shared"
1508 (string-append "--with-gmp-include="
1509 (assoc-ref %build-inputs "gmp") "/include")
1510 (string-append "--with-gmp-lib="
1511 (assoc-ref %build-inputs "gmp") "/lib")
1512 "--with-cblas=-lopenblas"
1513 (string-append "--with-cblas-include="
1514 (assoc-ref %build-inputs "cblas") "/include")
1515 (string-append "--with-cblas-lib="
1516 (assoc-ref %build-inputs "cblas") "/lib"))))
1517 (home-page "https://cs.uwaterloo.ca/~astorjoh/iml.html")
1518 (synopsis
1519 "Solver for systems of linear equations over the integers")
1520 (description
1521 "IML is a C library implementing algorithms for computing exact
1522 solutions to dense systems of linear equations over the integers.
1523 Currently, IML provides the following functionality:
1524
1525 @itemize
1526 @item Nonsingular rational system solving:
1527 compute the unique rational solution X to the system AX=B, where A and B
1528 are integer matrices, A nonsingular.
1529 @item Compute the right nullspace or kernel of an integer matrix.
1530 @item Certified linear system solving:
1531 compute a minimal denominator solution x to a system Ax=b, where b is an
1532 integer vector and A is an integer matrix with arbitrary shape and
1533 rank profile.
1534 @end itemize
1535
1536 In addition, IML provides some low level routines for a variety of mod p
1537 matrix operations: computing the row-echelon form, determinant, rank
1538 profile, and inverse of a mod p matrix. These mod p routines are not
1539 general purpose; they require that p satisfy some preconditions based on
1540 the dimension of the input matrix (usually p should be prime and should be
1541 no more than about 20 bits long).")
1542 (license license:bsd-3)))