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