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