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