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