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