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