gnu: pari-gp: Update to 2.11.3.
[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 © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
12 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
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.3")
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 "1jd65h2psrmba2dx7rkf5qidf9ka0cwbsg20pd18k45ggr30l467"))))
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)
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 flint
437 (package
438 (name "flint")
439 (version "2.5.2")
440 (source (origin
441 (method url-fetch)
442 (uri (string-append
443 "http://flintlib.org/flint-"
444 version ".tar.gz"))
445 (sha256 (base32
446 "11syazv1a8rrnac3wj3hnyhhflpqcmq02q8pqk2m6g2k6h0gxwfb"))
447 (patches (search-patches "flint-ldconfig.patch"))))
448 (build-system gnu-build-system)
449 (propagated-inputs
450 `(("gmp" ,gmp)
451 ("mpfr" ,mpfr))) ; header files from both are included by flint/arith.h
452 (arguments
453 `(#:parallel-tests? #f ; seems to be necessary on arm
454 #:phases
455 (modify-phases %standard-phases
456 (replace 'configure
457 (lambda* (#:key inputs outputs #:allow-other-keys)
458 (let ((out (assoc-ref outputs "out"))
459 (gmp (assoc-ref inputs "gmp"))
460 (mpfr (assoc-ref inputs "mpfr")))
461 ;; do not pass "--enable-fast-install", which makes the
462 ;; homebrew configure process fail
463 (invoke "./configure"
464 (string-append "--prefix=" out)
465 (string-append "--with-gmp=" gmp)
466 (string-append "--with-mpfr=" mpfr))
467 #t))))))
468 (synopsis "Fast library for number theory")
469 (description
470 "FLINT is a C library for number theory. It supports arithmetic
471 with numbers, polynomials, power series and matrices over many base
472 rings, including multiprecision integers and rationals, integers
473 modulo n, p-adic numbers, finite fields (prime and non-prime order)
474 and real and complex numbers (via the Arb extension library).
475
476 Operations that can be performed include conversions, arithmetic,
477 GCDs, factoring, solving linear systems, and evaluating special
478 functions. In addition, FLINT provides various low-level routines for
479 fast arithmetic.")
480 (license license:gpl2+)
481 (home-page "http://flintlib.org/")))
482
483 (define-public arb
484 (package
485 (name "arb")
486 (version "2.17.0")
487 (source (origin
488 (method git-fetch)
489 (uri (git-reference
490 (url "https://github.com/fredrik-johansson/arb.git")
491 (commit version)))
492 (file-name (git-file-name name version))
493 (sha256
494 (base32
495 "05lpy3hkl5f8ik19aw40cqydrb932xaf2n8hbq9ib5dnk7f010p1"))))
496 (build-system gnu-build-system)
497 (propagated-inputs
498 `(("flint" ,flint))) ; flint.h is included by arf.h
499 (inputs
500 `(("gmp" ,gmp)
501 ("mpfr" ,mpfr)))
502 (arguments
503 `(#:phases
504 (modify-phases %standard-phases
505 (replace 'configure
506 (lambda* (#:key inputs outputs #:allow-other-keys)
507 (let ((out (assoc-ref outputs "out"))
508 (flint (assoc-ref inputs "flint"))
509 (gmp (assoc-ref inputs "gmp"))
510 (mpfr (assoc-ref inputs "mpfr")))
511 ;; Do not pass "--enable-fast-install", which makes the
512 ;; homebrew configure process fail.
513 (invoke "./configure"
514 (string-append "--prefix=" out)
515 (string-append "--with-flint=" flint)
516 (string-append "--with-gmp=" gmp)
517 (string-append "--with-mpfr=" mpfr))))))))
518 (synopsis "Arbitrary precision floating-point ball arithmetic")
519 (description
520 "Arb is a C library for arbitrary-precision floating-point ball
521 arithmetic. It supports efficient high-precision computation with
522 polynomials, power series, matrices and special functions over the
523 real and complex numbers, with automatic, rigorous error control.")
524 (license license:lgpl2.1+)
525 (home-page "http://arblib.org")))
526
527 (define-public python-flint
528 (package
529 (name "python-flint")
530 (version "0.3.0")
531 (source (origin
532 (method git-fetch)
533 (uri (git-reference
534 (url "https://github.com/fredrik-johansson/python-flint.git")
535 (commit version)))
536 (file-name (git-file-name name version))
537 (sha256
538 (base32
539 "1v0anazbj1cfi68nl2j6dbd31kgkc1563xmr0zk5xk3xj78569pw"))
540 (patches (search-patches "python-flint-includes.patch"))))
541 (build-system python-build-system)
542 (native-inputs
543 `(("python-cython" ,python-cython)))
544 (propagated-inputs
545 `(("python-numpy" ,python-numpy)))
546 (inputs
547 `(("arb" ,arb)
548 ("flint" ,flint)))
549 (synopsis "Python module wrapping ARB and FLINT")
550 (description
551 "Python-flint is a Python extension module wrapping FLINT
552 (Fast Library for Number Theory) and Arb (arbitrary-precision ball
553 arithmetic). It supports integers, rationals, modular integers,
554 real and complex ball arithmetic, polynomials and matrices over all
555 these types and other mathematical functions.")
556 (license license:expat)
557 (home-page "http://fredrikj.net/python-flint/")))
558
559 (define-public ntl
560 (package
561 (name "ntl")
562 (version "11.4.3")
563 (source (origin
564 (method url-fetch)
565 (uri (string-append "https://shoup.net/ntl/ntl-"
566 version ".tar.gz"))
567 (sha256
568 (base32
569 "1lisp3064rch3jaa2wrhy1s9kll7i3ka3d0y6lj6l3l4ckfcrhdp"))
570 (modules '((guix build utils)))
571 (snippet
572 '(begin
573 (delete-file-recursively "src/libtool-origin")
574 #t))))
575 (build-system gnu-build-system)
576 (native-inputs
577 `(("libtool" ,libtool)
578 ("perl" ,perl))) ; for configuration
579 (inputs
580 `(("gmp" ,gmp)
581 ("gf2x" ,gf2x)))
582 (arguments
583 `(#:phases
584 (modify-phases %standard-phases
585 (replace 'configure
586 (lambda* (#:key inputs outputs #:allow-other-keys)
587 (chdir "src")
588 (invoke "./configure"
589 (string-append "PREFIX=" (assoc-ref outputs "out"))
590 (string-append "LIBTOOL=" (assoc-ref inputs "libtool") "/bin/libtool")
591 ;; set the library prefixes explicitly so that they get
592 ;; embedded in the .la file
593 (string-append "GMP_PREFIX=" (assoc-ref inputs "gmp"))
594 (string-append "GF2X_PREFIX=" (assoc-ref inputs "gf2x"))
595 ;; Do not build especially for the build machine.
596 "NATIVE=off"
597 "NTL_GF2X_LIB=on"
598 "SHARED=on"))))))
599 (synopsis "C++ library for number theory")
600 (description
601 "NTL is a C++ library providing data structures and algorithms
602 for manipulating signed, arbitrary length integers, and for vectors,
603 matrices, and polynomials over the integers and over finite fields.")
604 (license license:gpl2+)
605 (home-page "https://shoup.net/ntl/")))
606
607 (define-public singular
608 (package
609 (name "singular")
610 (version "4.1.2p1")
611 (source
612 (origin
613 (method url-fetch)
614 (uri
615 (string-append "http://www.mathematik.uni-kl.de/ftp/pub/Math/"
616 "Singular/SOURCES/"
617 (string-join
618 (string-split
619 (string-trim-right version #\p
620 0 (1- (string-length version)))
621 #\.) "-")
622 "/singular-" version ".tar.gz"))
623 (sha256 (base32
624 "0kvd55353fiqyq1msmi0kka66n5h0aqs7m3km60r01b1w2f8085m"))))
625 (build-system gnu-build-system)
626 (native-inputs
627 `(("doxygen" ,doxygen)
628 ("graphviz" ,graphviz)
629 ("perl" ,perl)))
630 (inputs
631 `(("cddlib" ,cddlib)
632 ("gmp" ,gmp)
633 ("flint" ,flint)
634 ("mpfr" ,mpfr)
635 ("ntl" ,ntl)
636 ("python" ,python-2)
637 ("readline" ,readline)))
638 (arguments
639 `(#:configure-flags
640 (list (string-append "--with-ntl="
641 (assoc-ref %build-inputs "ntl")))))
642 (synopsis "Computer algebra system for polynomial computations")
643 (description
644 "Singular is a computer algebra system for polynomial computations,
645 with special emphasis on commutative and non-commutative algebra, algebraic
646 geometry and singularity theory.")
647 ;; Singular itself is dual licensed gpl2 or gpl3, but some of the
648 ;; libraries with which it links are licensed under lgpl3+, so the
649 ;; combined work becomes gpl3. See COPYING in the source code.
650 (license license:gpl3)
651 (home-page "http://www.singular.uni-kl.de/index.php")))
652
653 (define-public gmp-ecm
654 (package
655 (name "gmp-ecm")
656 (version "7.0.4")
657 (source (origin
658 (method url-fetch)
659 ;; Use the ‘Latest version’ link for a stable URI across releases.
660 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
661 "latestfile/160/ecm-" version ".tar.gz"))
662 (sha256 (base32
663 "0hxs24c2m3mh0nq1zz63z3sb7dhy1rilg2s1igwwcb26x3pb7xqc"))))
664 (build-system gnu-build-system)
665 (inputs
666 `(("gmp" ,gmp)))
667 (arguments
668 `(#:configure-flags '("--enable-shared"
669 ;; Disable specific assembly routines, which depend
670 ;; on the subarchitecture of the build machine,
671 ;; and use gmp instead.
672 "--disable-asm-redc")))
673 (synopsis "Integer factorization library using the elliptic curve method")
674 (description
675 "GMP-ECM factors integers using the elliptic curve method (ECM) as well
676 as the P-1 and P+1 algorithms. It provides a library and a stand-alone
677 binary.")
678 ;; Most files are under lgpl3+, but some are under gpl3+ or gpl2+,
679 ;; so the combined work is under gpl3+.
680 (license license:gpl3+)
681 (home-page "http://ecm.gforge.inria.fr/")))
682
683 (define-public bc
684 (package
685 (name "bc")
686 (version "1.07.1")
687 (source (origin
688 (method url-fetch)
689 (uri (string-append "mirror://gnu/bc/bc-" version ".tar.gz"))
690 (sha256
691 (base32
692 "0amh9ik44jfg66csyvf4zz1l878c4755kjndq9j0270akflgrbb2"))))
693 (build-system gnu-build-system)
694 (native-inputs
695 `(("ed" ,ed)
696 ("flex" ,flex)
697 ("texinfo" ,texinfo)))
698 (arguments
699 '(#:configure-flags
700 (list "--with-readline")))
701 (home-page "https://www.gnu.org/software/bc/")
702 (synopsis "Arbitrary precision numeric processing language")
703 (description
704 "bc is an arbitrary precision numeric processing language. It includes
705 an interactive environment for evaluating mathematical statements. Its
706 syntax is similar to that of C, so basic usage is familiar. It also includes
707 \"dc\", a reverse-polish calculator.")
708 (license license:gpl2+)))
709
710 ;; The original kiss-fft does not have a complete build system and does not
711 ;; build any shared libraries. This is a fork used by Extempore.
712 (define-public kiss-fft-for-extempore
713 (package
714 (name "kiss-fft-for-extempore")
715 (version "1.3.0")
716 (source (origin
717 (method git-fetch)
718 (uri (git-reference
719 (url "https://github.com/extemporelang/kiss_fft.git")
720 (commit version)))
721 (file-name (git-file-name name version))
722 (sha256
723 (base32
724 "0jasbmqy4wkqrqx3w64s1dfmj34875xmsl72mb26aa4hpyn14bi2"))))
725 (build-system cmake-build-system)
726 (arguments `(#:tests? #f)) ; no tests included
727 ;; Extempore refuses to build on architectures other than x86_64
728 (supported-systems '("x86_64-linux"))
729 (home-page "https://github.com/extemporelang/kiss_fft")
730 (synopsis "Mixed-radix Fast Fourier Transform")
731 (description
732 "Kiss FFT attempts to be a reasonably efficient, moderately useful FFT
733 that can use fixed or floating data types and can easily be incorporated into
734 a C program.")
735 (license license:bsd-3)))
736
737 (define-public fftw
738 (package
739 (name "fftw")
740 (version "3.3.8")
741 (source (origin
742 (method url-fetch)
743 (uri (string-append "ftp://ftp.fftw.org/pub/fftw/fftw-"
744 version".tar.gz"))
745 (sha256
746 (base32
747 "00z3k8fq561wq2khssqg0kallk0504dzlx989x3vvicjdqpjc4v1"))))
748 (build-system gnu-build-system)
749 (arguments
750 `(#:configure-flags
751 '("--enable-shared" "--enable-openmp" "--enable-threads"
752 ,@(let ((system (or (%current-target-system) (%current-system))))
753 ;; Enable SIMD extensions for codelets. See details at:
754 ;; <http://fftw.org/fftw3_doc/Installation-on-Unix.html>.
755 (cond
756 ((string-prefix? "x86_64" system)
757 '("--enable-sse2" "--enable-avx" "--enable-avx2"
758 "--enable-avx512" "--enable-avx-128-fma"))
759 ((string-prefix? "i686" system)
760 '("--enable-sse2"))
761 ((string-prefix? "aarch64" system)
762 ;; Note that fftw supports NEON on 32-bit ARM only when
763 ;; compiled for single-precision.
764 '("--enable-neon"))
765 (else
766 '())))
767 ;; By default '-mtune=native' is used. However, that may cause the
768 ;; use of ISA extensions (e.g. AVX) that are not necessarily
769 ;; available on the user's machine when that package is built on a
770 ;; different machine.
771 "ax_cv_c_flags__mtune_native=no")))
772 (native-inputs `(("perl" ,perl)))
773 (home-page "http://fftw.org")
774 (synopsis "Computing the discrete Fourier transform")
775 (description
776 "FFTW is a C subroutine library for computing the discrete Fourier
777 transform (DFT) in one or more dimensions, of arbitrary input size, and of
778 both real and complex data (as well as of even/odd data---i.e. the discrete
779 cosine/ sine transforms or DCT/DST).")
780 (license license:gpl2+)))
781
782 (define-public fftwf
783 (package (inherit fftw)
784 (name "fftwf")
785 (arguments
786 (substitute-keyword-arguments (package-arguments fftw)
787 ((#:configure-flags fftw-configure-flags)
788 `(cons* "--enable-single"
789 ,@(if (string-prefix? "arm" (or (%current-target-system)
790 (%current-system)))
791 ;; fftw supports NEON on 32-bit ARM only when compiled
792 ;; for single-precision, so add it here.
793 '("--enable-neon")
794 '())
795 ,fftw-configure-flags))))
796 (description
797 (string-append (package-description fftw)
798 " Single-precision version."))))
799
800 (define-public fftw-openmpi
801 (package (inherit fftw)
802 (name "fftw-openmpi")
803 (inputs
804 `(("openmpi" ,openmpi)
805 ,@(package-inputs fftw)))
806 (arguments
807 (substitute-keyword-arguments (package-arguments fftw)
808 ((#:configure-flags cf)
809 `(cons "--enable-mpi" ,cf))
810 ((#:phases phases '%standard-phases)
811 `(modify-phases ,phases
812 (add-before 'check 'mpi-setup
813 ,%openmpi-setup)))))
814 (description
815 (string-append (package-description fftw)
816 " With OpenMPI parallelism support."))))
817
818 (define-public java-la4j
819 (package
820 (name "java-la4j")
821 (version "0.6.0")
822 (source (origin
823 (method git-fetch)
824 (uri (git-reference
825 (url "https://github.com/vkostyukov/la4j.git")
826 (commit version)))
827 (file-name (string-append name "-" version "-checkout"))
828 (sha256
829 (base32
830 "1qir8dr978cfvz9k12m2kbdwpyf6cqdf1d0ilb7lnkhbgq5i53w3"))))
831 (build-system ant-build-system)
832 (arguments
833 `(#:jar-name "la4j.jar"
834 #:jdk ,icedtea-8
835 #:test-exclude (list "**/Abstract*.java"
836 "**/MatrixTest.java"
837 "**/DenseMatrixTest.java"
838 "**/SparseMatrixTest.java"
839 "**/VectorTest.java"
840 "**/SparseVectorTest.java"
841 "**/DenseVectorTest.java")))
842 (native-inputs
843 `(("java-junit" ,java-junit)
844 ("java-hamcrest-core" ,java-hamcrest-core)))
845 (home-page "http://la4j.org/")
846 (synopsis "Java library that provides Linear Algebra primitives and algorithms")
847 (description "The la4j library is a Java library that provides Linear
848 Algebra primitives (matrices and vectors) and algorithms. The key features of
849 the la4j library are:
850
851 @itemize
852 @item No dependencies and tiny size
853 @item Fluent object-oriented/functional API
854 @item Sparse (CRS, CCS) and dense (1D/2D arrays) matrices
855 @item Linear systems solving (Gaussian, Jacobi, Zeidel, Square Root, Sweep and other)
856 @item Matrices decomposition (Eigenvalues/Eigenvectors, SVD, QR, LU, Cholesky and other)
857 @item MatrixMarket/CSV IO formats support for matrices and vectors
858 @end itemize\n")
859 (license license:asl2.0)))
860
861 (define-public java-jlargearrays
862 (package
863 (name "java-jlargearrays")
864 (version "1.6")
865 (source (origin
866 (method url-fetch)
867 (uri (string-append "https://repo1.maven.org/maven2/"
868 "pl/edu/icm/JLargeArrays/"
869 version "/JLargeArrays-" version
870 "-sources.jar"))
871 (file-name (string-append name "-" version ".jar"))
872 (sha256
873 (base32
874 "0v05iphpxbjnd7f4jf1rlqq3m8hslhcm0imdbsgxr20pi3xkaf2a"))))
875 (build-system ant-build-system)
876 (arguments
877 `(#:jar-name "jlargearrays.jar"
878 #:tests? #f ; tests are not included in the release archive
879 #:jdk ,icedtea-8))
880 (propagated-inputs
881 `(("java-commons-math3" ,java-commons-math3)))
882 (home-page "https://gitlab.com/ICM-VisLab/JLargeArrays")
883 (synopsis "Library of one-dimensional arrays that can store up to 263 elements")
884 (description "JLargeArrays is a Java library of one-dimensional arrays
885 that can store up to 263 elements.")
886 (license license:bsd-2)))
887
888 (define-public java-jtransforms
889 (package
890 (name "java-jtransforms")
891 (version "3.1")
892 (source (origin
893 (method url-fetch)
894 (uri (string-append "https://repo1.maven.org/maven2/"
895 "com/github/wendykierp/JTransforms/"
896 version "/JTransforms-" version "-sources.jar"))
897 (sha256
898 (base32
899 "1haw5m8shv5srgcpwkl853dz8bv6h90bzlhcps6mdpb4cixjirsg"))))
900 (build-system ant-build-system)
901 (arguments
902 `(#:jar-name "jtransforms.jar"
903 #:tests? #f ; tests are not included in the release archive
904 #:jdk ,icedtea-8))
905 (propagated-inputs
906 `(("java-commons-math3" ,java-commons-math3)
907 ("java-jlargearrays" ,java-jlargearrays)))
908 (home-page "https://github.com/wendykierp/JTransforms")
909 (synopsis "Multithreaded FFT library written in pure Java")
910 (description "JTransforms is a multithreaded FFT library written in pure
911 Java. Currently, four types of transforms are available: @dfn{Discrete
912 Fourier Transform} (DFT), @dfn{Discrete Cosine Transform} (DCT), @dfn{Discrete
913 Sine Transform} (DST) and @dfn{Discrete Hartley Transform} (DHT).")
914 (license license:bsd-2)))
915
916 (define-public eigen
917 (package
918 (name "eigen")
919 (version "3.3.7")
920 (source (origin
921 (method url-fetch)
922 (uri (string-append "https://bitbucket.org/eigen/eigen/get/"
923 version ".tar.bz2"))
924 (sha256
925 (base32
926 "1km3fyfzyqfdvmnl79drps3fjwnz3zbh0c7l34mfbqyvvs8cy4wz"))
927 (file-name (string-append name "-" version ".tar.bz2"))
928 (patches (search-patches "eigen-stabilise-sparseqr-test.patch"))
929 (modules '((guix build utils)))
930 (snippet
931 ;; There are 3 test failures in the "unsupported" directory,
932 ;; but maintainers say it's a known issue and it's unsupported
933 ;; anyway, so just skip them.
934 '(begin
935 (substitute* "unsupported/CMakeLists.txt"
936 (("add_subdirectory\\(test.*")
937 "# Do not build the tests for unsupported features.\n"))
938 #t))))
939 (build-system cmake-build-system)
940 (arguments
941 '(;; Turn off debugging symbols to save space.
942 #:build-type "Release"
943
944 #:phases (modify-phases %standard-phases
945 (replace 'check
946 (lambda _
947 (let* ((cores (parallel-job-count))
948 (dash-j (format #f "-j~a" cores)))
949 (setenv "EIGEN_SEED" "1") ;for reproducibility
950 ;; First build the tests, in parallel. See
951 ;; <http://eigen.tuxfamily.org/index.php?title=Tests>.
952 (invoke "make" "buildtests" dash-j)
953
954 ;; Then run 'CTest' with -V so we get more
955 ;; details upon failure.
956 (invoke "ctest" "-V" dash-j)))))))
957 (home-page "https://eigen.tuxfamily.org")
958 (synopsis "C++ template library for linear algebra")
959 (description
960 "Eigen is a C++ template library for linear algebra: matrices, vectors,
961 numerical solvers, and related algorithms. It provides an elegant API based
962 on \"expression templates\". It is versatile: it supports all matrix sizes,
963 all standard numeric types, various matrix decompositions and geometry
964 features, and more.")
965
966 ;; Most of the code is MPLv2, with a few files under LGPLv2.1+ or BSD-3.
967 ;; See 'COPYING.README' for details.
968 (license license:mpl2.0)))
969
970 (define-public eigen-for-tensorflow
971 (let ((changeset "fd6845384b86")
972 (revision "1"))
973 (package (inherit eigen)
974 (name "eigen-for-tensorflow")
975 (version (string-append "3.3.5-" revision "." changeset))
976 (source (origin
977 (method hg-fetch)
978 (uri (hg-reference
979 (url "https://bitbucket.org/eigen/eigen")
980 (changeset changeset)))
981 (sha256
982 (base32
983 "12cwgah63wqwb66xji048hcxc1z5zjg8a7701zlia5zbilnnk1n5"))
984 (file-name (string-append name "-" version "-checkout"))
985 (modules '((guix build utils)))
986 (snippet
987 ;; There are 3 test failures in the "unsupported" directory,
988 ;; but maintainers say it's a known issue and it's unsupported
989 ;; anyway, so just skip them.
990 '(begin
991 (substitute* "unsupported/CMakeLists.txt"
992 (("add_subdirectory\\(test.*")
993 "# Do not build the tests for unsupported features.\n"))
994 #t)))))))
995
996 (define-public xtensor
997 (package
998 (name "xtensor")
999 (version "0.20.10")
1000 (source (origin
1001 (method git-fetch)
1002 (uri (git-reference
1003 (url "https://github.com/QuantStack/xtensor.git")
1004 (commit version)))
1005 (sha256
1006 (base32
1007 "1fmv2hpx610xwhxrndfsfvlbqfyk4l3gi5q5d7pa9m82kblxjj9l"))
1008 (file-name (git-file-name name version))))
1009 (build-system cmake-build-system)
1010 (native-inputs
1011 `(("googletest" ,googletest)
1012 ("xtl" ,xtl)))
1013 (arguments
1014 `(#:configure-flags
1015 '("-DBUILD_TESTS=ON")
1016 #:test-target "xtest"))
1017 (home-page "https://quantstack.net/xtensor")
1018 (synopsis "C++ tensors with broadcasting and lazy computing")
1019 (description "xtensor is a C++ library meant for numerical analysis with
1020 multi-dimensional array expressions.
1021
1022 xtensor provides:
1023 @itemize
1024 @item an extensible expression system enabling lazy broadcasting.
1025 @item an API following the idioms of the C++ standard library.
1026 @item tools to manipulate array expressions and build upon xtensor.
1027 @end itemize")
1028 (license license:bsd-3)))
1029
1030 (define-public gap
1031 (package
1032 (name "gap")
1033 (version "4.10.2")
1034 (source
1035 (origin
1036 (method url-fetch)
1037 (uri (string-append "https://www.gap-system.org/pub/gap/gap-"
1038 (version-major+minor version)
1039 "/tar.bz2/gap-"
1040 version
1041 ".tar.bz2"))
1042 (sha256
1043 (base32 "0cp6ddk0469zzv1m1vair6gm27ic6c5m77ri8rn0znq3gaps6x94"))
1044 (modules '((guix build utils) (ice-9 ftw) (srfi srfi-1)))
1045 (snippet
1046 '(begin
1047 ;; Delete the external gmp and zlib libraries
1048 ;; and a subdirectory not needed for our build.
1049 (for-each delete-file-recursively
1050 '("extern" "hpcgap"))
1051 ;; Delete a failing test.
1052 ;; FIXME: This might be fixed in the next release, see
1053 ;; https://github.com/gap-system/gap/issues/3292
1054 (delete-file "tst/testinstall/dir.tst")
1055 ;; Delete all packages except for a fixed list.
1056 (with-directory-excursion "pkg"
1057 (for-each delete-file-recursively
1058 (lset-difference string=? (scandir ".")
1059 '("." ".."
1060 ;; Necessary packages.
1061 "GAPDoc-1.6.2"
1062 "primgrp-3.3.2"
1063 "SmallGrp-1.3" ; artistic2.0
1064 "transgrp" ; artistic2.0 for data,
1065 ; gpl2 or gpl3 for code
1066 ;; Recommanded package.
1067 "io-4.5.4" ; gpl3+
1068 ;; Optional packages, searched for at start,
1069 ;; and their depedencies.
1070 "alnuth-3.1.0"
1071 "autpgrp-1.10"
1072 "crisp-1.4.4" ; bsd-2
1073 "ctbllib" ; gpl3+ according to doc/chap0.txt
1074 "FactInt-1.6.2"
1075 "fga"
1076 "irredsol-1.4" ; bsd-2
1077 "laguna-3.9.2"
1078 "polenta-1.3.8"
1079 "polycyclic-2.14"
1080 "radiroot-2.8"
1081 "resclasses-4.7.1"
1082 "sophus-1.24"
1083 "tomlib-1.2.7" ; gpl2+, clarified in the git repository
1084 ; and the next release
1085 "utils-0.59"))))
1086 #t))))
1087 (build-system gnu-build-system)
1088 (inputs
1089 `(("gmp" ,gmp)
1090 ("zlib" ,zlib)))
1091 (arguments
1092 `(#:modules ((ice-9 ftw)
1093 (srfi srfi-26)
1094 (guix build gnu-build-system)
1095 (guix build utils))
1096 #:phases
1097 (modify-phases %standard-phases
1098 (add-after 'build 'build-packages
1099 ;; Compile all packages that have not been deleted by the
1100 ;; code snippet above.
1101 (lambda _
1102 (setenv "CONFIG_SHELL" (which "bash"))
1103 (with-directory-excursion "pkg"
1104 (invoke "../bin/BuildPackages.sh")
1105 #t)))
1106 (add-after 'build-packages 'build-doc
1107 ;; The documentation is bundled, but we create it from source.
1108 (lambda _
1109 (with-directory-excursion "doc"
1110 (invoke "./make_doc"))
1111 #t))
1112 (replace 'install
1113 (lambda* (#:key outputs #:allow-other-keys)
1114 (let* ((out (assoc-ref outputs "out"))
1115 (bin (string-append out "/bin"))
1116 (lib (string-append out "/lib"))
1117 (prog (string-append bin "/gap"))
1118 (prog-real (string-append bin "/.gap-real"))
1119 (share (string-append out "/share/gap"))
1120 (include (string-append out "/include/gap"))
1121 (include-hpc (string-append include "/hpc")))
1122 ;; Install only the gap binary; the gac compiler is left
1123 ;; for maybe later. "Wrap" it in a shell script that calls
1124 ;; the binary with the correct parameter.
1125 (mkdir-p bin)
1126 (copy-file "gap" prog-real)
1127 (call-with-output-file prog
1128 (lambda (port)
1129 (format port
1130 "#!~a~%exec ~a -l ~a \"$@\"~%"
1131 (which "bash")
1132 prog-real
1133 share)))
1134 (chmod prog #o755)
1135 ;; Install the headers, which are needed by Sage. The
1136 ;; Makefile target "install-headers" was available in
1137 ;; gap-4.10.0, but has been commented out in gap-4.10.1.
1138 (mkdir-p include-hpc)
1139 (install-file "gen/config.h" include)
1140 (let ((file-name-predicate-without-stat
1141 (lambda (regex)
1142 (cut (file-name-predicate regex) <> #f))))
1143 (with-directory-excursion "src"
1144 (for-each
1145 (cut install-file <> include)
1146 (scandir "."
1147 (file-name-predicate-without-stat ".*\\.h$"))))
1148 (with-directory-excursion "src/hpc"
1149 (for-each
1150 (cut install-file <> include-hpc)
1151 (scandir "."
1152 (file-name-predicate-without-stat ".*\\.h$")))))
1153 ;; Install the library, which is needed by Sage. The
1154 ;; Makefile target "install-libgap" was available in
1155 ;; gap-4.10.0, but has been commented out in gap-4.10.1.
1156 ;; Compared to the Makefile, which used libtool, the
1157 ;; following approach of copying files and making symlinks
1158 ;; is rather pedestrian. There is hope that some later
1159 ;; version of gap reinstates and completes the install
1160 ;; targets.
1161 (invoke "make" "libgap.la")
1162 (install-file "libgap.la" lib)
1163 (install-file ".libs/libgap.so.0.0.0" lib)
1164 (symlink "libgap.so.0.0.0" (string-append lib "/libgap.so"))
1165 (symlink "libgap.so.0.0.0" (string-append lib "/libgap.so.0"))
1166 ;; Install a certain number of files and directories to
1167 ;; SHARE, where the wrapped shell script expects them.
1168 ;; Remove information on the build directory from sysinfo.gap.
1169 (substitute* "sysinfo.gap"
1170 (("GAP_BIN_DIR=\".*\"") "GAP_BIN_DIR=\"\"")
1171 (("GAP_LIB_DIR=\".*\"") "GAP_LIB_DIR=\"\"")
1172 (("GAP_CPPFLAGS=\".*\"") "GAP_CPPFLAGS=\"\""))
1173 (install-file "sysinfo.gap" share)
1174 (copy-recursively "grp" (string-append share "/grp"))
1175 (copy-recursively "pkg" (string-append share "/pkg"))
1176 ;; The following is not the C library libgap.so, but a
1177 ;; library of GAP code.
1178 (copy-recursively "lib" (string-append share "/lib"))
1179 ;; The gap binary looks for documentation inside SHARE.
1180 (copy-recursively "doc" (string-append share "/doc")))
1181 #t)))))
1182 (home-page "https://www.gap-system.org/")
1183 (synopsis
1184 "System for computational group theory")
1185 (description
1186 "GAP is a system for computational discrete algebra, with particular
1187 emphasis on computational group theory. It provides a programming language,
1188 a library of thousands of functions implementing algebraic algorithms
1189 written in the GAP language as well as large data libraries of algebraic
1190 objects.")
1191 ;; Some packages have different licenses (effectively forcing the
1192 ;; combined work to be licensed as gpl3+); if this is the case, this
1193 ;; is mentioned above next to their name.
1194 ;; Some packages have no license mentioned explicitly; supposedly this
1195 ;; means that the gpl2+ licence of GAP itself applies, but to be on the
1196 ;; safe side, we drop them for now.
1197 (license license:gpl2+)))
1198
1199 (define-public givaro
1200 (package
1201 (name "givaro")
1202 (version "4.1.1")
1203 (source (origin
1204 (method git-fetch)
1205 (uri (git-reference
1206 (url "https://github.com/linbox-team/givaro")
1207 (commit (string-append "v" version))))
1208 (file-name (git-file-name name version))
1209 (sha256
1210 (base32
1211 "11wz57q6ijsvfs5r82masxgr319as92syi78lnl9lgdblpc6xigk"))))
1212 (build-system gnu-build-system)
1213 (native-inputs
1214 `(("autoconf" ,autoconf)
1215 ("automake" ,automake)
1216 ("libtool" ,libtool)))
1217 (propagated-inputs
1218 `(("gmp" ,gmp))) ; gmp++.h includes gmpxx.h
1219 (arguments
1220 `(#:phases
1221 (modify-phases %standard-phases
1222 (add-before 'bootstrap 'setenv
1223 ;; Prevent the autogen.sh script to carry out the configure
1224 ;; script, which has not yet been patched to replace /bin/sh.
1225 (lambda _
1226 (setenv "NOCONFIGURE" "yes")
1227 #t)))))
1228 (synopsis "Algebraic computations with exact rings and fields")
1229 (description
1230 "Givaro is a C++ library implementing the basic arithmetic of various
1231 algebraic objects: prime fields, extension fields, finite fields, finite
1232 rings, polynomials, algebraic numbers, arbitrary precision integers and
1233 rationals (C++ wrappers over gmp), fixed precision integers. It also
1234 provides data-structures and templated classes for the manipulation of
1235 compound objects, such as vectors, matrices and univariate polynomials.")
1236 (license license:cecill-b)
1237 (home-page "https://github.com/linbox-team/givaro")))
1238
1239 (define-public fflas-ffpack
1240 (package
1241 (name "fflas-ffpack")
1242 (version "2.4.3")
1243 (source (origin
1244 (method git-fetch)
1245 (uri (git-reference
1246 (url "https://github.com/linbox-team/fflas-ffpack")
1247 (commit version)))
1248 (file-name (git-file-name name version))
1249 (sha256
1250 (base32
1251 "1ynbjd72qrwp0b4kpn0p5d7gddpvj8dlb5fwdxajr5pvkvi3if74"))))
1252 (build-system gnu-build-system)
1253 (native-inputs
1254 `(("autoconf" ,autoconf)
1255 ("automake" ,automake)
1256 ("libtool" ,libtool)
1257 ("pkg-config" ,pkg-config)))
1258 (inputs
1259 `(("openblas" ,openblas)))
1260 (propagated-inputs
1261 `(("givaro" ,givaro))) ; required according to the .pc file
1262 (arguments
1263 `(#:configure-flags
1264 (list (string-append "--with-blas-libs="
1265 (assoc-ref %build-inputs "openblas")
1266 "/lib/libopenblas.so"))
1267 #:phases
1268 (modify-phases %standard-phases
1269 (add-before 'bootstrap 'setenv
1270 ;; Prevent the autogen.sh script to carry out the configure
1271 ;; script, which has not yet been patched to replace /bin/sh.
1272 (lambda _
1273 (setenv "NOCONFIGURE" "yes")
1274 #t)))))
1275 (synopsis "C++ library for linear algebra over finite fields")
1276 (description
1277 "FFLAS-FFPACK is a C++ template library for basic linear algebra
1278 operations over a finite field.
1279 FFLAS (Finite Field Linear Algebra Subprograms) provides the implementation
1280 of a subset of routines of the numerical BLAS; it also supports sparse
1281 matrix-vector products.
1282 FFPACK (Finite Field Linear Algebra Package) is inspired by the LAPACK
1283 library to provide functionalities of higher level, using the kernel
1284 of a BLAS. Additionally, it provides routines specific to exact linear
1285 algebra, such as the row echelon form.")
1286 (license license:lgpl2.1+)
1287 (home-page "https://linbox-team.github.io/fflas-ffpack/")))
1288
1289 (define-public linbox
1290 (package
1291 (name "linbox")
1292 (version "1.6.3")
1293 (source (origin
1294 (method git-fetch)
1295 (uri (git-reference
1296 (url "https://github.com/linbox-team/linbox")
1297 (commit (string-append "v" version))))
1298 (file-name (git-file-name name version))
1299 (sha256
1300 (base32
1301 "10j6dspbsq7d2l4q3y0c1l1xwmaqqba2fxg59q5bhgk9h5d7q571"))))
1302 (build-system gnu-build-system)
1303 (native-inputs
1304 `(("autoconf" ,autoconf)
1305 ("automake" ,automake)
1306 ("libtool" ,libtool)
1307 ("pkg-config" ,pkg-config)))
1308 (inputs
1309 `(("fflas-ffpack" ,fflas-ffpack)))
1310 (arguments
1311 `(#:phases
1312 (modify-phases %standard-phases
1313 (add-before 'bootstrap 'setenv
1314 ;; Prevent the autogen.sh script to carry out the configure
1315 ;; script, which has not yet been patched to replace /bin/sh.
1316 (lambda _
1317 (setenv "NOCONFIGURE" "yes")
1318 #t)))))
1319 (synopsis "C++ library for linear algebra over exact rings")
1320 (description
1321 "LinBox is a C++ template library for exact linear algebra computation
1322 with dense, sparse, and structured matrices over the integers and over
1323 finite fields.")
1324 (license license:lgpl2.1+)
1325 (home-page "https://linbox-team.github.io/linbox/")))
1326
1327 (define-public m4ri
1328 (package
1329 (name "m4ri")
1330 (version "20140914")
1331 (source (origin
1332 (method git-fetch)
1333 (uri (git-reference
1334 (url "https://bitbucket.org/malb/m4ri")
1335 (commit (string-append "release-" version))))
1336 (file-name (git-file-name name version))
1337 (sha256
1338 (base32
1339 "0xfg6pffbn8r1s0y7bn9b8i55l00d41dkmhrpf7pwk53qa3achd3"))))
1340 (build-system gnu-build-system)
1341 (native-inputs
1342 `(("autoconf" ,autoconf)
1343 ("automake" ,automake)
1344 ("libtool" ,libtool)
1345 ("pkg-config" ,pkg-config)))
1346 (inputs
1347 `(("libpng" ,libpng)))
1348 (synopsis "Arithmetic of dense matrices over F_2")
1349 (description "M4RI is a library for fast arithmetic with dense matrices
1350 over F2. The name M4RI comes from the first implemented algorithm: The
1351 Method of the Four Russians inversion algorithm published by Gregory Bard.
1352 This algorithm in turn is named after the Method of the Four Russians
1353 multiplication algorithm.")
1354 (license license:gpl2+)
1355 (home-page "https://bitbucket.org/malb/m4ri/")))
1356
1357 (define-public symmetrica
1358 (package
1359 (name "symmetrica")
1360 (version "2.0")
1361 (source (origin
1362 (method url-fetch/tarbomb)
1363 (uri (let ((v (string-join (string-split version #\.) "_")))
1364 (string-append "http://www.algorithm.uni-bayreuth.de/"
1365 "en/research/SYMMETRICA/"
1366 "SYM" v "_tar.gz")))
1367 (sha256
1368 (base32
1369 "1qhfrbd5ybb0sinl9pad64rscr08qvlfzrzmi4p4hk61xn6phlmz"))
1370 ;; Taken from <https://git.sagemath.org/sage.git/plain/build/pkgs/symmetrica/patches/>
1371 (patches (search-patches "symmetrica-bruch.patch"
1372 "symmetrica-int32.patch"
1373 "symmetrica-return_values.patch"
1374 "symmetrica-sort_sum_rename.patch"))))
1375 (build-system gnu-build-system)
1376 (arguments
1377 `(#:tests? #f ;no test
1378 #:phases
1379 (modify-phases %standard-phases
1380 (add-after 'unpack 'fix-makefile
1381 (lambda _
1382 (substitute* "makefile"
1383 (("cc -c") "gcc -c -fPIC"))
1384 #t))
1385 (add-after 'fix-makefile 'turn-off-banner
1386 (lambda _
1387 (substitute* "de.c"
1388 (("(INT no_banner = )FALSE" _ pre) (string-append pre "TRUE")))
1389 #t))
1390 (delete 'configure) ;no configure script
1391 (replace 'install ;no install target
1392 (lambda* (#:key outputs #:allow-other-keys)
1393 (let* ((out (assoc-ref outputs "out"))
1394 (lib (string-append out "/lib"))
1395 (inc (string-append out "/include/symmetrica"))
1396 (doc (string-append out "/share/doc/symmetrica-" ,version))
1397 (static "libsymmetrica.a"))
1398 ;; Build static library.
1399 (apply invoke "ar" "crs" static (find-files "." "\\.o$"))
1400 (invoke "ranlib" static)
1401 ;; Install static library and headers.
1402 (for-each (lambda (f) (install-file f inc))
1403 (find-files "." "\\.h$"))
1404 (install-file "libsymmetrica.a" lib)
1405 ;; Install documentation.
1406 (for-each (lambda (f) (install-file f doc))
1407 (find-files "." "\\.doc$"))
1408 #t))))))
1409 (home-page "http://www.algorithm.uni-bayreuth.de/en/research/SYMMETRICA/")
1410 (synopsis "Combinatoric C Library")
1411 (description "Symmetrica is a library for combinatorics. It has support
1412 for the representation theory of the symmetric group and related groups,
1413 combinatorics of tableaux, symmetric functions and polynomials, Schubert
1414 polynomials, and the representation theory of Hecke algebras of type A_n.")
1415 (license license:public-domain)))
1416
1417 (define-public m4rie
1418 (package
1419 (name "m4rie")
1420 (version "20150908")
1421 (source (origin
1422 (method git-fetch)
1423 (uri (git-reference
1424 (url "https://bitbucket.org/malb/m4rie")
1425 (commit (string-append "release-" version))))
1426 (file-name (git-file-name name version))
1427 (sha256
1428 (base32
1429 "0r8lv46qx5mkz5kp3ay2jnsp0mbhlqr5z2z220wdk73wdshcznss"))))
1430 (build-system gnu-build-system)
1431 (native-inputs
1432 `(("autoconf" ,autoconf)
1433 ("automake" ,automake)
1434 ("libtool" ,libtool)))
1435 (inputs
1436 `(("m4ri" ,m4ri)))
1437 (synopsis "Arithmetic of dense matrices over F_{2^e}")
1438 (description "M4RI is a library for fast arithmetic with dense matrices
1439 over finite fields of characteristic 2. So it extends the functionality
1440 of M4RI from F_2 to F_{2^e}.")
1441 (license license:gpl2+)
1442 (home-page "https://bitbucket.org/malb/m4rie/")))
1443
1444 (define-public eclib
1445 (package
1446 (name "eclib")
1447 (version "20190909")
1448 (source (origin
1449 (method git-fetch)
1450 (uri (git-reference
1451 (url "https://github.com/JohnCremona/eclib/")
1452 (commit (string-append "v" version))))
1453 (file-name (git-file-name name version))
1454 (sha256
1455 (base32
1456 "1gw27lqc3f525n8qdcmr2nyn16y9g10z9f6dnmckyyxcdzvhq35n"))))
1457 (build-system gnu-build-system)
1458 (native-inputs
1459 `(("autoconf" ,autoconf)
1460 ("automake" ,automake)
1461 ("libtool" ,libtool)))
1462 (inputs
1463 `(("ntl" ,ntl)
1464 ("pari-gp" ,pari-gp)))
1465 (synopsis "Ranks of elliptic curves and modular symbols")
1466 (description "The eclib package includes mwrank (for 2-descent on
1467 elliptic curves over Q) and modular symbol code; it has been written by
1468 John Cremona to compute his elliptic curve database.")
1469 (license license:gpl2+)
1470 (home-page (string-append "http://homepages.warwick.ac.uk/staff/"
1471 "J.E.Cremona/mwrank/index.html"))))
1472
1473 (define-public lrcalc
1474 (package
1475 (name "lrcalc")
1476 (version "1.2")
1477 (source (origin
1478 (method git-fetch)
1479 (uri (git-reference
1480 (url "https://bitbucket.org/asbuch/lrcalc")
1481 (commit (string-append "lrcalc-" version))))
1482 (file-name (git-file-name name version))
1483 (sha256
1484 (base32
1485 "1c12d04jdyxkkav4ak8d1aqrv594gzihwhpxvc6p9js0ry1fahss"))
1486 (patches (search-patches "lrcalc-includes.patch"))))
1487 (build-system gnu-build-system)
1488 (native-inputs
1489 `(("autoconf" ,autoconf)
1490 ("automake" ,automake)
1491 ("libtool" ,libtool)))
1492 (arguments
1493 `(#:phases
1494 (modify-phases %standard-phases
1495 (add-before 'build 'fix-permission
1496 (lambda _
1497 (chmod "lrcalc.maple.src" #o644)
1498 #t)))))
1499 (synopsis "Littlewood-Richardson calculator in algebraic combinatorics")
1500 (description "The Littlewood-Richardson Calculator (lrcalc) is a
1501 program designed to compute Littlewood-Richardson coefficients. It computes
1502 single Littlewood-Richardson coefficients, products of Schur functions, or
1503 skew Schur functions. In addition it computes products in the small quantum
1504 cohomology ring of a Grassmann variety. The software package also includes
1505 a program that performs fast computation of the more general multiplicative
1506 structure constants of Schubert polynomials.")
1507 (license license:gpl2+)
1508 (home-page "https://sites.math.rutgers.edu/~asbuch/lrcalc/")))
1509
1510 (define-public iml
1511 (package
1512 (name "iml")
1513 (version "1.0.5")
1514 (source
1515 (origin
1516 (method url-fetch)
1517 (uri (string-append "http://www.cs.uwaterloo.ca/~astorjoh/iml-"
1518 version ".tar.bz2"))
1519 (sha256
1520 (base32
1521 "0akwhhz9b40bz6lrfxpamp7r7wkk48p455qbn04mfnl9a1l6db8x"))))
1522 (build-system gnu-build-system)
1523 (inputs
1524 `(("gmp", gmp)
1525 ("cblas" ,openblas))) ; or any other BLAS library; the documentation
1526 ; mentions ATLAS in particular
1527 (arguments
1528 `(#:configure-flags
1529 (list
1530 "--enable-shared"
1531 (string-append "--with-gmp-include="
1532 (assoc-ref %build-inputs "gmp") "/include")
1533 (string-append "--with-gmp-lib="
1534 (assoc-ref %build-inputs "gmp") "/lib")
1535 "--with-cblas=-lopenblas"
1536 (string-append "--with-cblas-include="
1537 (assoc-ref %build-inputs "cblas") "/include")
1538 (string-append "--with-cblas-lib="
1539 (assoc-ref %build-inputs "cblas") "/lib"))))
1540 (home-page "https://cs.uwaterloo.ca/~astorjoh/iml.html")
1541 (synopsis
1542 "Solver for systems of linear equations over the integers")
1543 (description
1544 "IML is a C library implementing algorithms for computing exact
1545 solutions to dense systems of linear equations over the integers.
1546 Currently, IML provides the following functionality:
1547
1548 @itemize
1549 @item Nonsingular rational system solving:
1550 compute the unique rational solution X to the system AX=B, where A and B
1551 are integer matrices, A nonsingular.
1552 @item Compute the right nullspace or kernel of an integer matrix.
1553 @item Certified linear system solving:
1554 compute a minimal denominator solution x to a system Ax=b, where b is an
1555 integer vector and A is an integer matrix with arbitrary shape and
1556 rank profile.
1557 @end itemize
1558
1559 In addition, IML provides some low level routines for a variety of mod p
1560 matrix operations: computing the row-echelon form, determinant, rank
1561 profile, and inverse of a mod p matrix. These mod p routines are not
1562 general purpose; they require that p satisfy some preconditions based on
1563 the dimension of the input matrix (usually p should be prime and should be
1564 no more than about 20 bits long).")
1565 (license license:bsd-3)))