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