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