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