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