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