packages: Change 'guile-for-grafts' back to 2.0.
[jackhill/guix/guix.git] / gnu / packages / algebra.scm
CommitLineData
233e7676 1;;; GNU Guix --- Functional package management for GNU
3f074a21 2;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Andreas Enge <andreas@enge.fr>
4b0bf990 3;;; Copyright © 2013, 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
a733253b 4;;; Copyright © 2016, 2017, 2018, 2019, 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
69d5909e 5;;; Copyright © 2014, 2018 Mark H Weaver <mhw@netris.org>
67f39dd5 6;;; Copyright © 2016, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
ecc5bc33 7;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
5144e314 8;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
f71f29ca 9;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
eb6785cf 10;;; Copyright © 2017, 2019 Eric Bavier <bavier@member.fsf.org>
4c877704 11;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
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
d7ab698a
AE
435(define-public flint
436 (package
437 (name "flint")
6c591c8e 438 (version "2.5.2")
d7ab698a
AE
439 (source (origin
440 (method url-fetch)
441 (uri (string-append
442 "http://flintlib.org/flint-"
443 version ".tar.gz"))
444 (sha256 (base32
6c591c8e 445 "11syazv1a8rrnac3wj3hnyhhflpqcmq02q8pqk2m6g2k6h0gxwfb"))
fc1adab1 446 (patches (search-patches "flint-ldconfig.patch"))))
d7ab698a 447 (build-system gnu-build-system)
df15d17d 448 (propagated-inputs
d7ab698a 449 `(("gmp" ,gmp)
df15d17d 450 ("mpfr" ,mpfr))) ; header files from both are included by flint/arith.h
d7ab698a 451 (arguments
ad11974e
AE
452 `(#:parallel-tests? #f ; seems to be necessary on arm
453 #:phases
91430de6
AE
454 (modify-phases %standard-phases
455 (replace 'configure
456 (lambda* (#:key inputs outputs #:allow-other-keys)
457 (let ((out (assoc-ref outputs "out"))
458 (gmp (assoc-ref inputs "gmp"))
459 (mpfr (assoc-ref inputs "mpfr")))
91430de6
AE
460 ;; do not pass "--enable-fast-install", which makes the
461 ;; homebrew configure process fail
50233d95 462 (invoke "./configure"
91430de6
AE
463 (string-append "--prefix=" out)
464 (string-append "--with-gmp=" gmp)
50233d95
RW
465 (string-append "--with-mpfr=" mpfr))
466 #t))))))
d7ab698a
AE
467 (synopsis "Fast library for number theory")
468 (description
469 "FLINT is a C library for number theory. It supports arithmetic
470with numbers, polynomials, power series and matrices over many base
471rings, including multiprecision integers and rationals, integers
472modulo n, p-adic numbers, finite fields (prime and non-prime order)
473and real and complex numbers (via the Arb extension library).
474
475Operations that can be performed include conversions, arithmetic,
476GCDs, factoring, solving linear systems, and evaluating special
477functions. In addition, FLINT provides various low-level routines for
478fast arithmetic.")
9f51293c 479 (license license:gpl2+)
d7ab698a
AE
480 (home-page "http://flintlib.org/")))
481
6b8e8285
AE
482(define-public arb
483 (package
6aa54e23 484 (name "arb")
faefa2ed 485 (version "2.17.0")
6aa54e23
RW
486 (source (origin
487 (method git-fetch)
488 (uri (git-reference
489 (url "https://github.com/fredrik-johansson/arb.git")
490 (commit version)))
491 (file-name (git-file-name name version))
492 (sha256
493 (base32
faefa2ed 494 "05lpy3hkl5f8ik19aw40cqydrb932xaf2n8hbq9ib5dnk7f010p1"))))
6aa54e23
RW
495 (build-system gnu-build-system)
496 (propagated-inputs
497 `(("flint" ,flint))) ; flint.h is included by arf.h
498 (inputs
499 `(("gmp" ,gmp)
500 ("mpfr" ,mpfr)))
501 (arguments
502 `(#:phases
503 (modify-phases %standard-phases
504 (replace 'configure
505 (lambda* (#:key inputs outputs #:allow-other-keys)
506 (let ((out (assoc-ref outputs "out"))
507 (flint (assoc-ref inputs "flint"))
508 (gmp (assoc-ref inputs "gmp"))
509 (mpfr (assoc-ref inputs "mpfr")))
faefa2ed
TGR
510 ;; Do not pass "--enable-fast-install", which makes the
511 ;; homebrew configure process fail.
6aa54e23
RW
512 (invoke "./configure"
513 (string-append "--prefix=" out)
514 (string-append "--with-flint=" flint)
515 (string-append "--with-gmp=" gmp)
516 (string-append "--with-mpfr=" mpfr))))))))
517 (synopsis "Arbitrary precision floating-point ball arithmetic")
518 (description
519 "Arb is a C library for arbitrary-precision floating-point ball
6b8e8285
AE
520arithmetic. It supports efficient high-precision computation with
521polynomials, power series, matrices and special functions over the
522real and complex numbers, with automatic, rigorous error control.")
6aa54e23 523 (license license:lgpl2.1+)
faefa2ed 524 (home-page "http://arblib.org")))
6b8e8285 525
1d6589db
AE
526(define-public python-flint
527 (package
528 (name "python-flint")
529 (version "0.3.0")
530 (source (origin
531 (method git-fetch)
532 (uri (git-reference
533 (url "https://github.com/fredrik-johansson/python-flint.git")
534 (commit version)))
535 (file-name (git-file-name name version))
536 (sha256
537 (base32
538 "1v0anazbj1cfi68nl2j6dbd31kgkc1563xmr0zk5xk3xj78569pw"))
539 (patches (search-patches "python-flint-includes.patch"))))
540 (build-system python-build-system)
541 (native-inputs
542 `(("python-cython" ,python-cython)))
543 (propagated-inputs
544 `(("python-numpy" ,python-numpy)))
545 (inputs
546 `(("arb" ,arb)
547 ("flint" ,flint)))
548 (synopsis "Python module wrapping ARB and FLINT")
549 (description
550 "Python-flint is a Python extension module wrapping FLINT
551(Fast Library for Number Theory) and Arb (arbitrary-precision ball
552arithmetic). It supports integers, rationals, modular integers,
553real and complex ball arithmetic, polynomials and matrices over all
554these types and other mathematical functions.")
555 (license license:expat)
556 (home-page "http://fredrikj.net/python-flint/")))
557
14e6520e
AE
558(define-public ntl
559 (package
560 (name "ntl")
561 (version "9.7.0")
562 (source (origin
563 (method url-fetch)
564 (uri (string-append "http://shoup.net/ntl/ntl-"
565 version ".tar.gz"))
566 (sha256 (base32
567 "115frp5flyvw9wghz4zph1b3llmr5nbxk1skgsggckr81fh3gmxq"))))
568 (build-system gnu-build-system)
569 (native-inputs
570 `(("libtool" ,libtool)
571 ("perl" ,perl))) ; for configuration
572 ;; FIXME: Add optional input gf2x once available; then also add
573 ;; configure flag "NTL_GF2X_LIB=on".
574 (inputs
575 `(("gmp" ,gmp)))
576 (arguments
577 `(#:phases
578 (modify-phases %standard-phases
579 (replace 'configure
580 (lambda* (#:key outputs #:allow-other-keys)
581 (chdir "src")
582 (system* "./configure"
583 (string-append "PREFIX=" (assoc-ref outputs "out"))
584 ;; Do not build especially for the build machine.
585 "NATIVE=off"
586 ;; Also do not tune to the build machine.
587 "WIZARD=off"
588 "SHARED=on")
589 #t)))))
590 (synopsis "C++ library for number theory")
591 (description
592 "NTL is a C++ library providing data structures and algorithms
593for manipulating signed, arbitrary length integers, and for vectors,
594matrices, and polynomials over the integers and over finite fields.")
595 (license license:gpl2+)
596 (home-page "http://shoup.net/ntl/")))
597
aae03c48
AE
598(define-public singular
599 (package
600 (name "singular")
ff6807dc 601 (version "4.1.2p1")
f35c3bbb
KK
602 (source
603 (origin
604 (method url-fetch)
605 (uri
606 (string-append "http://www.mathematik.uni-kl.de/ftp/pub/Math/"
607 "Singular/SOURCES/"
608 (string-join
609 (string-split
610 (string-trim-right version #\p
611 0 (1- (string-length version)))
612 #\.) "-")
613 "/singular-" version ".tar.gz"))
614 (sha256 (base32
ff6807dc 615 "0kvd55353fiqyq1msmi0kka66n5h0aqs7m3km60r01b1w2f8085m"))))
aae03c48
AE
616 (build-system gnu-build-system)
617 (native-inputs
618 `(("doxygen" ,doxygen)
619 ("graphviz" ,graphviz)
620 ("perl" ,perl)))
621 (inputs
622 `(("cddlib" ,cddlib)
623 ("gmp" ,gmp)
624 ("flint" ,flint)
625 ("mpfr" ,mpfr)
626 ("ntl" ,ntl)
627 ("python" ,python-2)
628 ("readline" ,readline)))
629 (arguments
630 `(#:configure-flags
631 (list (string-append "--with-ntl="
632 (assoc-ref %build-inputs "ntl")))))
633 (synopsis "Computer algebra system for polynomial computations")
634 (description
635 "Singular is a computer algebra system for polynomial computations,
636with special emphasis on commutative and non-commutative algebra, algebraic
637geometry and singularity theory.")
638 ;; Singular itself is dual licensed gpl2 or gpl3, but some of the
639 ;; libraries with which it links are licensed under lgpl3+, so the
640 ;; combined work becomes gpl3. See COPYING in the source code.
641 (license license:gpl3)
642 (home-page "http://www.singular.uni-kl.de/index.php")))
643
57c9c349
AE
644(define-public gmp-ecm
645 (package
646 (name "gmp-ecm")
7d15cf17 647 (version "7.0.4")
57c9c349 648 (source (origin
7d15cf17
TGR
649 (method url-fetch)
650 ;; Use the ‘Latest version’ link for a stable URI across releases.
651 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
652 "latestfile/160/ecm-" version ".tar.gz"))
653 (sha256 (base32
654 "0hxs24c2m3mh0nq1zz63z3sb7dhy1rilg2s1igwwcb26x3pb7xqc"))))
57c9c349
AE
655 (build-system gnu-build-system)
656 (inputs
657 `(("gmp" ,gmp)))
658 (arguments
659 `(#:configure-flags '("--enable-shared"
660 ;; Disable specific assembly routines, which depend
661 ;; on the subarchitecture of the build machine,
662 ;; and use gmp instead.
663 "--disable-asm-redc")))
664 (synopsis "Integer factorization library using the elliptic curve method")
665 (description
666 "GMP-ECM factors integers using the elliptic curve method (ECM) as well
667as the P-1 and P+1 algorithms. It provides a library and a stand-alone
668binary.")
669 ;; Most files are under lgpl3+, but some are under gpl3+ or gpl2+,
670 ;; so the combined work is under gpl3+.
671 (license license:gpl3+)
672 (home-page "http://ecm.gforge.inria.fr/")))
673
ed9f9a77
LC
674(define-public bc
675 (package
676 (name "bc")
f71f29ca 677 (version "1.07.1")
ed9f9a77
LC
678 (source (origin
679 (method url-fetch)
680 (uri (string-append "mirror://gnu/bc/bc-" version ".tar.gz"))
681 (sha256
682 (base32
f71f29ca 683 "0amh9ik44jfg66csyvf4zz1l878c4755kjndq9j0270akflgrbb2"))))
ed9f9a77 684 (build-system gnu-build-system)
f71f29ca
MB
685 (native-inputs
686 `(("ed" ,ed)
687 ("flex" ,flex)
688 ("texinfo" ,texinfo)))
ed9f9a77 689 (arguments
f71f29ca 690 '(#:configure-flags
f0bacad6 691 (list "--with-readline")))
6fd52309 692 (home-page "https://www.gnu.org/software/bc/")
f50d2669 693 (synopsis "Arbitrary precision numeric processing language")
ed9f9a77 694 (description
a22dc0c4
LC
695 "bc is an arbitrary precision numeric processing language. It includes
696an interactive environment for evaluating mathematical statements. Its
697syntax is similar to that of C, so basic usage is familiar. It also includes
698\"dc\", a reverse-polish calculator.")
9f51293c 699 (license license:gpl2+)))
37e6cdcd 700
2a9b10c7
RW
701;; The original kiss-fft does not have a complete build system and does not
702;; build any shared libraries. This is a fork used by Extempore.
703(define-public kiss-fft-for-extempore
704 (package
705 (name "kiss-fft-for-extempore")
706 (version "1.3.0")
707 (source (origin
9774fac4
RW
708 (method git-fetch)
709 (uri (git-reference
710 (url "https://github.com/extemporelang/kiss_fft.git")
711 (commit version)))
712 (file-name (git-file-name name version))
2a9b10c7
RW
713 (sha256
714 (base32
9774fac4 715 "0jasbmqy4wkqrqx3w64s1dfmj34875xmsl72mb26aa4hpyn14bi2"))))
2a9b10c7
RW
716 (build-system cmake-build-system)
717 (arguments `(#:tests? #f)) ; no tests included
39162ee4
RW
718 ;; Extempore refuses to build on architectures other than x86_64
719 (supported-systems '("x86_64-linux"))
2a9b10c7
RW
720 (home-page "https://github.com/extemporelang/kiss_fft")
721 (synopsis "Mixed-radix Fast Fourier Transform")
722 (description
723 "Kiss FFT attempts to be a reasonably efficient, moderately useful FFT
724that can use fixed or floating data types and can easily be incorporated into
725a C program.")
726 (license license:bsd-3)))
727
37e6cdcd
LC
728(define-public fftw
729 (package
730 (name "fftw")
bdb74478 731 (version "3.3.8")
37e6cdcd
LC
732 (source (origin
733 (method url-fetch)
734 (uri (string-append "ftp://ftp.fftw.org/pub/fftw/fftw-"
735 version".tar.gz"))
736 (sha256
737 (base32
bdb74478 738 "00z3k8fq561wq2khssqg0kallk0504dzlx989x3vvicjdqpjc4v1"))))
37e6cdcd
LC
739 (build-system gnu-build-system)
740 (arguments
65bb2279 741 `(#:configure-flags
69d5909e
MW
742 '("--enable-shared" "--enable-openmp" "--enable-threads"
743 ,@(let ((system (or (%current-target-system) (%current-system))))
744 ;; Enable SIMD extensions for codelets. See details at:
745 ;; <http://fftw.org/fftw3_doc/Installation-on-Unix.html>.
746 (cond
747 ((string-prefix? "x86_64" system)
748 '("--enable-sse2" "--enable-avx" "--enable-avx2"
749 "--enable-avx512" "--enable-avx-128-fma"))
750 ((string-prefix? "i686" system)
751 '("--enable-sse2"))
752 ((string-prefix? "aarch64" system)
753 ;; Note that fftw supports NEON on 32-bit ARM only when
754 ;; compiled for single-precision.
755 '("--enable-neon"))
756 (else
757 '())))
65bb2279
EB
758 ;; By default '-mtune=native' is used. However, that may cause the
759 ;; use of ISA extensions (e.g. AVX) that are not necessarily
760 ;; available on the user's machine when that package is built on a
761 ;; different machine.
762 "ax_cv_c_flags__mtune_native=no")))
37e6cdcd
LC
763 (native-inputs `(("perl" ,perl)))
764 (home-page "http://fftw.org")
765 (synopsis "Computing the discrete Fourier transform")
766 (description
767 "FFTW is a C subroutine library for computing the discrete Fourier
768transform (DFT) in one or more dimensions, of arbitrary input size, and of
769both real and complex data (as well as of even/odd data---i.e. the discrete
770cosine/ sine transforms or DCT/DST).")
9f51293c 771 (license license:gpl2+)))
7569c5cb
EB
772
773(define-public fftwf
774 (package (inherit fftw)
775 (name "fftwf")
776 (arguments
777 (substitute-keyword-arguments (package-arguments fftw)
69d5909e
MW
778 ((#:configure-flags fftw-configure-flags)
779 `(cons* "--enable-single"
780 ,@(if (string-prefix? "arm" (or (%current-target-system)
781 (%current-system)))
782 ;; fftw supports NEON on 32-bit ARM only when compiled
783 ;; for single-precision, so add it here.
784 '("--enable-neon")
785 '())
786 ,fftw-configure-flags))))
7569c5cb
EB
787 (description
788 (string-append (package-description fftw)
789 " Single-precision version."))))
e5c66f8c
EB
790
791(define-public fftw-openmpi
792 (package (inherit fftw)
793 (name "fftw-openmpi")
794 (inputs
795 `(("openmpi" ,openmpi)
796 ,@(package-inputs fftw)))
797 (arguments
798 (substitute-keyword-arguments (package-arguments fftw)
799 ((#:configure-flags cf)
eb6785cf
EB
800 `(cons "--enable-mpi" ,cf))
801 ((#:phases phases '%standard-phases)
802 `(modify-phases ,phases
803 (add-before 'check 'mpi-setup
804 ,%openmpi-setup)))))
e5c66f8c
EB
805 (description
806 (string-append (package-description fftw)
807 " With OpenMPI parallelism support."))))
8f4b1dfb 808
c8d99608
RW
809(define-public java-la4j
810 (package
811 (name "java-la4j")
812 (version "0.6.0")
813 (source (origin
814 (method git-fetch)
815 (uri (git-reference
816 (url "https://github.com/vkostyukov/la4j.git")
817 (commit version)))
818 (file-name (string-append name "-" version "-checkout"))
819 (sha256
820 (base32
821 "1qir8dr978cfvz9k12m2kbdwpyf6cqdf1d0ilb7lnkhbgq5i53w3"))))
822 (build-system ant-build-system)
823 (arguments
824 `(#:jar-name "la4j.jar"
825 #:jdk ,icedtea-8
826 #:test-exclude (list "**/Abstract*.java"
827 "**/MatrixTest.java"
828 "**/DenseMatrixTest.java"
829 "**/SparseMatrixTest.java"
830 "**/VectorTest.java"
831 "**/SparseVectorTest.java"
832 "**/DenseVectorTest.java")))
833 (native-inputs
834 `(("java-junit" ,java-junit)
835 ("java-hamcrest-core" ,java-hamcrest-core)))
836 (home-page "http://la4j.org/")
837 (synopsis "Java library that provides Linear Algebra primitives and algorithms")
838 (description "The la4j library is a Java library that provides Linear
839Algebra primitives (matrices and vectors) and algorithms. The key features of
840the la4j library are:
841
842@itemize
843@item No dependencies and tiny size
844@item Fluent object-oriented/functional API
845@item Sparse (CRS, CCS) and dense (1D/2D arrays) matrices
846@item Linear systems solving (Gaussian, Jacobi, Zeidel, Square Root, Sweep and other)
847@item Matrices decomposition (Eigenvalues/Eigenvectors, SVD, QR, LU, Cholesky and other)
848@item MatrixMarket/CSV IO formats support for matrices and vectors
849@end itemize\n")
850 (license license:asl2.0)))
851
24074b0b
RW
852(define-public java-jlargearrays
853 (package
854 (name "java-jlargearrays")
855 (version "1.6")
856 (source (origin
857 (method url-fetch)
9f5eeb87
BH
858 (uri (string-append "https://repo1.maven.org/maven2/"
859 "pl/edu/icm/JLargeArrays/"
24074b0b
RW
860 version "/JLargeArrays-" version
861 "-sources.jar"))
862 (file-name (string-append name "-" version ".jar"))
863 (sha256
864 (base32
865 "0v05iphpxbjnd7f4jf1rlqq3m8hslhcm0imdbsgxr20pi3xkaf2a"))))
866 (build-system ant-build-system)
867 (arguments
868 `(#:jar-name "jlargearrays.jar"
869 #:tests? #f ; tests are not included in the release archive
870 #:jdk ,icedtea-8))
871 (propagated-inputs
872 `(("java-commons-math3" ,java-commons-math3)))
873 (home-page "https://gitlab.com/ICM-VisLab/JLargeArrays")
874 (synopsis "Library of one-dimensional arrays that can store up to 263 elements")
875 (description "JLargeArrays is a Java library of one-dimensional arrays
876that can store up to 263 elements.")
877 (license license:bsd-2)))
878
4e92911c
RW
879(define-public java-jtransforms
880 (package
881 (name "java-jtransforms")
882 (version "3.1")
883 (source (origin
884 (method url-fetch)
4c877704
BH
885 (uri (string-append "https://repo1.maven.org/maven2/"
886 "com/github/wendykierp/JTransforms/"
4e92911c
RW
887 version "/JTransforms-" version "-sources.jar"))
888 (sha256
889 (base32
890 "1haw5m8shv5srgcpwkl853dz8bv6h90bzlhcps6mdpb4cixjirsg"))))
891 (build-system ant-build-system)
892 (arguments
893 `(#:jar-name "jtransforms.jar"
894 #:tests? #f ; tests are not included in the release archive
895 #:jdk ,icedtea-8))
896 (propagated-inputs
897 `(("java-commons-math3" ,java-commons-math3)
898 ("java-jlargearrays" ,java-jlargearrays)))
899 (home-page "https://github.com/wendykierp/JTransforms")
900 (synopsis "Multithreaded FFT library written in pure Java")
901 (description "JTransforms is a multithreaded FFT library written in pure
902Java. Currently, four types of transforms are available: @dfn{Discrete
903Fourier Transform} (DFT), @dfn{Discrete Cosine Transform} (DCT), @dfn{Discrete
904Sine Transform} (DST) and @dfn{Discrete Hartley Transform} (DHT).")
905 (license license:bsd-2)))
906
8f4b1dfb
LC
907(define-public eigen
908 (package
909 (name "eigen")
5144e314 910 (version "3.3.7")
8f4b1dfb
LC
911 (source (origin
912 (method url-fetch)
913 (uri (string-append "https://bitbucket.org/eigen/eigen/get/"
9b268f12 914 version ".tar.bz2"))
8f4b1dfb
LC
915 (sha256
916 (base32
5144e314 917 "1km3fyfzyqfdvmnl79drps3fjwnz3zbh0c7l34mfbqyvvs8cy4wz"))
2abcc935 918 (file-name (string-append name "-" version ".tar.bz2"))
5144e314 919 (patches (search-patches "eigen-stabilise-sparseqr-test.patch"))
8f4b1dfb
LC
920 (modules '((guix build utils)))
921 (snippet
922 ;; There are 3 test failures in the "unsupported" directory,
923 ;; but maintainers say it's a known issue and it's unsupported
924 ;; anyway, so just skip them.
1137d85b 925 '(begin
44884a9d
RW
926 (substitute* "unsupported/CMakeLists.txt"
927 (("add_subdirectory\\(test.*")
928 "# Do not build the tests for unsupported features.\n"))
6cbee49d 929 #t))))
8f4b1dfb
LC
930 (build-system cmake-build-system)
931 (arguments
932 '(;; Turn off debugging symbols to save space.
933 #:build-type "Release"
934
354f4fe2 935 #:phases (modify-phases %standard-phases
ef8742ea 936 (replace 'check
354f4fe2 937 (lambda _
354f4fe2
LC
938 (let* ((cores (parallel-job-count))
939 (dash-j (format #f "-j~a" cores)))
1137d85b 940 (setenv "EIGEN_SEED" "1") ;for reproducibility
ef8742ea
LC
941 ;; First build the tests, in parallel. See
942 ;; <http://eigen.tuxfamily.org/index.php?title=Tests>.
fbe9c80f 943 (invoke "make" "buildtests" dash-j)
8f4b1dfb 944
fbe9c80f
TGR
945 ;; Then run 'CTest' with -V so we get more
946 ;; details upon failure.
947 (invoke "ctest" "-V" dash-j)))))))
eeb8b0e6 948 (home-page "https://eigen.tuxfamily.org")
8f4b1dfb
LC
949 (synopsis "C++ template library for linear algebra")
950 (description
951 "Eigen is a C++ template library for linear algebra: matrices, vectors,
952numerical solvers, and related algorithms. It provides an elegant API based
953on \"expression templates\". It is versatile: it supports all matrix sizes,
954all standard numeric types, various matrix decompositions and geometry
955features, and more.")
956
957 ;; Most of the code is MPLv2, with a few files under LGPLv2.1+ or BSD-3.
958 ;; See 'COPYING.README' for details.
9f51293c 959 (license license:mpl2.0)))
70770b93 960
697eb65d
RW
961(define-public eigen-for-tensorflow
962 (let ((changeset "fd6845384b86")
963 (revision "1"))
964 (package (inherit eigen)
965 (name "eigen-for-tensorflow")
966 (version (string-append "3.3.5-" revision "." changeset))
967 (source (origin
968 (method hg-fetch)
969 (uri (hg-reference
970 (url "https://bitbucket.org/eigen/eigen")
971 (changeset changeset)))
972 (sha256
973 (base32
974 "12cwgah63wqwb66xji048hcxc1z5zjg8a7701zlia5zbilnnk1n5"))
975 (file-name (string-append name "-" version "-checkout"))
976 (modules '((guix build utils)))
977 (snippet
978 ;; There are 3 test failures in the "unsupported" directory,
979 ;; but maintainers say it's a known issue and it's unsupported
980 ;; anyway, so just skip them.
981 '(begin
982 (substitute* "unsupported/CMakeLists.txt"
983 (("add_subdirectory\\(test.*")
984 "# Do not build the tests for unsupported features.\n"))
985 #t)))))))
986
70770b93
FT
987(define-public xtensor
988 (package
989 (name "xtensor")
4e6568ce 990 (version "0.20.10")
70770b93 991 (source (origin
e1ecaa83
KK
992 (method git-fetch)
993 (uri (git-reference
994 (url "https://github.com/QuantStack/xtensor.git")
995 (commit version)))
70770b93
FT
996 (sha256
997 (base32
4e6568ce 998 "1fmv2hpx610xwhxrndfsfvlbqfyk4l3gi5q5d7pa9m82kblxjj9l"))
e1ecaa83 999 (file-name (git-file-name name version))))
70770b93
FT
1000 (build-system cmake-build-system)
1001 (native-inputs
1002 `(("googletest" ,googletest)
1003 ("xtl" ,xtl)))
1004 (arguments
1005 `(#:configure-flags
1006 '("-DBUILD_TESTS=ON")
1007 #:test-target "xtest"))
3b1ccad0 1008 (home-page "https://quantstack.net/xtensor")
70770b93
FT
1009 (synopsis "C++ tensors with broadcasting and lazy computing")
1010 (description "xtensor is a C++ library meant for numerical analysis with
1011multi-dimensional array expressions.
1012
1013xtensor provides:
1014@itemize
1015@item an extensible expression system enabling lazy broadcasting.
1016@item an API following the idioms of the C++ standard library.
1017@item tools to manipulate array expressions and build upon xtensor.
1018@end itemize")
1019 (license license:bsd-3)))
3f074a21
AE
1020
1021(define-public gap
1022 (package
1023 (name "gap")
c8a227df 1024 (version "4.10.2")
3f074a21
AE
1025 (source
1026 (origin
1027 (method url-fetch)
1028 (uri (string-append "https://www.gap-system.org/pub/gap/gap-"
1029 (version-major+minor version)
1030 "/tar.bz2/gap-"
1031 version
1032 ".tar.bz2"))
1033 (sha256
c8a227df 1034 (base32 "0cp6ddk0469zzv1m1vair6gm27ic6c5m77ri8rn0znq3gaps6x94"))
3f074a21
AE
1035 (modules '((guix build utils) (ice-9 ftw) (srfi srfi-1)))
1036 (snippet
1037 '(begin
1038 ;; Delete the external gmp and zlib libraries
1039 ;; and a subdirectory not needed for our build.
1040 (for-each delete-file-recursively
1041 '("extern" "hpcgap"))
1042 ;; Delete a failing test.
1043 ;; FIXME: This might be fixed in the next release, see
1044 ;; https://github.com/gap-system/gap/issues/3292
1045 (delete-file "tst/testinstall/dir.tst")
1046 ;; Delete all packages except for a fixed list.
1047 (with-directory-excursion "pkg"
1048 (for-each delete-file-recursively
1049 (lset-difference string=? (scandir ".")
1050 '("." ".."
1051 ;; Necessary packages.
1052 "GAPDoc-1.6.2"
1053 "primgrp-3.3.2"
1054 "SmallGrp-1.3" ; artistic2.0
1055 "transgrp" ; artistic2.0 for data,
1056 ; gpl2 or gpl3 for code
1057 ;; Recommanded package.
1058 "io-4.5.4" ; gpl3+
1059 ;; Optional packages, searched for at start,
1060 ;; and their depedencies.
1061 "alnuth-3.1.0"
3f074a21
AE
1062 "autpgrp-1.10"
1063 "crisp-1.4.4" ; bsd-2
bf95a142 1064 "ctbllib" ; gpl3+ according to doc/chap0.txt
3f074a21
AE
1065 "FactInt-1.6.2"
1066 "fga"
1067 "irredsol-1.4" ; bsd-2
bf95a142 1068 "laguna-3.9.2"
3f074a21
AE
1069 "polenta-1.3.8"
1070 "polycyclic-2.14"
1071 "radiroot-2.8"
1072 "resclasses-4.7.1"
1073 "sophus-1.24"
bf95a142
AE
1074 "tomlib-1.2.7" ; gpl2+, clarified in the git repository
1075 ; and the next release
3f074a21
AE
1076 "utils-0.59"))))
1077 #t))))
1078 (build-system gnu-build-system)
1079 (inputs
1080 `(("gmp" ,gmp)
1081 ("zlib" ,zlib)))
1082 (arguments
bf95a142
AE
1083 `(#:modules ((ice-9 ftw)
1084 (srfi srfi-26)
1085 (guix build gnu-build-system)
1086 (guix build utils))
1087 #:phases
3f074a21
AE
1088 (modify-phases %standard-phases
1089 (add-after 'build 'build-packages
1090 ;; Compile all packages that have not been deleted by the
1091 ;; code snippet above.
1092 (lambda _
1093 (setenv "CONFIG_SHELL" (which "bash"))
1094 (with-directory-excursion "pkg"
1095 (invoke "../bin/BuildPackages.sh")
1096 #t)))
1097 (add-after 'build-packages 'build-doc
1098 ;; The documentation is bundled, but we create it from source.
1099 (lambda _
1100 (with-directory-excursion "doc"
1101 (invoke "./make_doc"))
1102 #t))
3f074a21
AE
1103 (replace 'install
1104 (lambda* (#:key outputs #:allow-other-keys)
1105 (let* ((out (assoc-ref outputs "out"))
1106 (bin (string-append out "/bin"))
bf95a142 1107 (lib (string-append out "/lib"))
3f074a21
AE
1108 (prog (string-append bin "/gap"))
1109 (prog-real (string-append bin "/.gap-real"))
1110 (share (string-append out "/share/gap"))
bf95a142
AE
1111 (include (string-append out "/include/gap"))
1112 (include-hpc (string-append include "/hpc")))
3f074a21
AE
1113 ;; Install only the gap binary; the gac compiler is left
1114 ;; for maybe later. "Wrap" it in a shell script that calls
1115 ;; the binary with the correct parameter.
1116 (mkdir-p bin)
1117 (copy-file "gap" prog-real)
1118 (call-with-output-file prog
1119 (lambda (port)
1120 (format port
1121 "#!~a~%exec ~a -l ~a \"$@\"~%"
1122 (which "bash")
1123 prog-real
1124 share)))
1125 (chmod prog #o755)
bf95a142
AE
1126 ;; Install the headers, which are needed by Sage. The
1127 ;; Makefile target "install-headers" was available in
1128 ;; gap-4.10.0, but has been commented out in gap-4.10.1.
1129 (mkdir-p include-hpc)
3f074a21 1130 (install-file "gen/config.h" include)
bf95a142
AE
1131 (let ((file-name-predicate-without-stat
1132 (lambda (regex)
1133 (cut (file-name-predicate regex) <> #f))))
1134 (with-directory-excursion "src"
1135 (for-each
1136 (cut install-file <> include)
1137 (scandir "."
1138 (file-name-predicate-without-stat ".*\\.h$"))))
1139 (with-directory-excursion "src/hpc"
1140 (for-each
1141 (cut install-file <> include-hpc)
1142 (scandir "."
1143 (file-name-predicate-without-stat ".*\\.h$")))))
1144 ;; Install the library, which is needed by Sage. The
1145 ;; Makefile target "install-libgap" was available in
1146 ;; gap-4.10.0, but has been commented out in gap-4.10.1.
1147 ;; Compared to the Makefile, which used libtool, the
1148 ;; following approach of copying files and making symlinks
1149 ;; is rather pedestrian. There is hope that some later
1150 ;; version of gap reinstates and completes the install
1151 ;; targets.
1152 (invoke "make" "libgap.la")
1153 (install-file "libgap.la" lib)
1154 (install-file ".libs/libgap.so.0.0.0" lib)
1155 (symlink "libgap.so.0.0.0" (string-append lib "/libgap.so"))
1156 (symlink "libgap.so.0.0.0" (string-append lib "/libgap.so.0"))
3f074a21
AE
1157 ;; Install a certain number of files and directories to
1158 ;; SHARE, where the wrapped shell script expects them.
1159 ;; Remove information on the build directory from sysinfo.gap.
1160 (substitute* "sysinfo.gap"
1161 (("GAP_BIN_DIR=\".*\"") "GAP_BIN_DIR=\"\"")
1162 (("GAP_LIB_DIR=\".*\"") "GAP_LIB_DIR=\"\"")
1163 (("GAP_CPPFLAGS=\".*\"") "GAP_CPPFLAGS=\"\""))
1164 (install-file "sysinfo.gap" share)
1165 (copy-recursively "grp" (string-append share "/grp"))
1166 (copy-recursively "pkg" (string-append share "/pkg"))
1167 ;; The following is not the C library libgap.so, but a
1168 ;; library of GAP code.
1169 (copy-recursively "lib" (string-append share "/lib"))
1170 ;; The gap binary looks for documentation inside SHARE.
1171 (copy-recursively "doc" (string-append share "/doc")))
1172 #t)))))
1173 (home-page "https://www.gap-system.org/")
1174 (synopsis
1175 "System for computational group theory")
1176 (description
1177 "GAP is a system for computational discrete algebra, with particular
1178emphasis on computational group theory. It provides a programming language,
1179a library of thousands of functions implementing algebraic algorithms
1180written in the GAP language as well as large data libraries of algebraic
1181objects.")
1182 ;; Some packages have different licenses (effectively forcing the
1183 ;; combined work to be licensed as gpl3+); if this is the case, this
1184 ;; is mentioned above next to their name.
1185 ;; Some packages have no license mentioned explicitly; supposedly this
1186 ;; means that the gpl2+ licence of GAP itself applies, but to be on the
1187 ;; safe side, we drop them for now.
1188 (license license:gpl2+)))
f0fbb31d
AE
1189
1190(define-public givaro
1191 (package
1192 (name "givaro")
1193 (version "4.1.1")
1194 (source (origin
1195 (method git-fetch)
1196 (uri (git-reference
1197 (url "https://github.com/linbox-team/givaro")
1198 (commit (string-append "v" version))))
1199 (file-name (git-file-name name version))
1200 (sha256
1201 (base32
1202 "11wz57q6ijsvfs5r82masxgr319as92syi78lnl9lgdblpc6xigk"))))
1203 (build-system gnu-build-system)
1204 (native-inputs
1205 `(("autoconf" ,autoconf)
1206 ("automake" ,automake)
1207 ("libtool" ,libtool)))
1208 (propagated-inputs
1209 `(("gmp" ,gmp))) ; gmp++.h includes gmpxx.h
1210 (arguments
1211 `(#:phases
1212 (modify-phases %standard-phases
1213 (add-before 'bootstrap 'setenv
1214 ;; Prevent the autogen.sh script to carry out the configure
1215 ;; script, which has not yet been patched to replace /bin/sh.
1216 (lambda _
1217 (setenv "NOCONFIGURE" "yes")
1218 #t)))))
1219 (synopsis "Algebraic computations with exact rings and fields")
1220 (description
1221 "Givaro is a C++ library implementing the basic arithmetic of various
1222algebraic objects: prime fields, extension fields, finite fields, finite
1223rings, polynomials, algebraic numbers, arbitrary precision integers and
1224rationals (C++ wrappers over gmp), fixed precision integers. It also
1225provides data-structures and templated classes for the manipulation of
1226compound objects, such as vectors, matrices and univariate polynomials.")
1227 (license license:cecill-b)
1228 (home-page "https://github.com/linbox-team/givaro")))
4bf9cb40
AE
1229
1230(define-public fflas-ffpack
1231 (package
1232 (name "fflas-ffpack")
1233 (version "2.4.3")
1234 (source (origin
1235 (method git-fetch)
1236 (uri (git-reference
1237 (url "https://github.com/linbox-team/fflas-ffpack")
1238 (commit version)))
1239 (file-name (git-file-name name version))
1240 (sha256
1241 (base32
1242 "1ynbjd72qrwp0b4kpn0p5d7gddpvj8dlb5fwdxajr5pvkvi3if74"))))
1243 (build-system gnu-build-system)
1244 (native-inputs
1245 `(("autoconf" ,autoconf)
1246 ("automake" ,automake)
1247 ("libtool" ,libtool)
1248 ("pkg-config" ,pkg-config)))
1249 (inputs
1250 `(("openblas" ,openblas)))
1251 (propagated-inputs
1252 `(("givaro" ,givaro))) ; required according to the .pc file
1253 (arguments
1254 `(#:configure-flags
1255 (list (string-append "--with-blas-libs="
1256 (assoc-ref %build-inputs "openblas")
1257 "/lib/libopenblas.so"))
1258 #:phases
1259 (modify-phases %standard-phases
1260 (add-before 'bootstrap 'setenv
1261 ;; Prevent the autogen.sh script to carry out the configure
1262 ;; script, which has not yet been patched to replace /bin/sh.
1263 (lambda _
1264 (setenv "NOCONFIGURE" "yes")
1265 #t)))))
1266 (synopsis "C++ library for linear algebra over finite fields")
1267 (description
1268 "FFLAS-FFPACK is a C++ template library for basic linear algebra
1269operations over a finite field.
1270FFLAS (Finite Field Linear Algebra Subprograms) provides the implementation
1271of a subset of routines of the numerical BLAS; it also supports sparse
1272matrix-vector products.
1273FFPACK (Finite Field Linear Algebra Package) is inspired by the LAPACK
1274library to provide functionalities of higher level, using the kernel
1275of a BLAS. Additionally, it provides routines specific to exact linear
1276algebra, such as the row echelon form.")
1277 (license license:lgpl2.1+)
1278 (home-page "https://linbox-team.github.io/fflas-ffpack/")))
a612f866
AE
1279
1280(define-public linbox
1281 (package
1282 (name "linbox")
1283 (version "1.6.3")
1284 (source (origin
1285 (method git-fetch)
1286 (uri (git-reference
1287 (url "https://github.com/linbox-team/linbox")
1288 (commit (string-append "v" version))))
1289 (file-name (git-file-name name version))
1290 (sha256
1291 (base32
1292 "10j6dspbsq7d2l4q3y0c1l1xwmaqqba2fxg59q5bhgk9h5d7q571"))))
1293 (build-system gnu-build-system)
1294 (native-inputs
1295 `(("autoconf" ,autoconf)
1296 ("automake" ,automake)
1297 ("libtool" ,libtool)
1298 ("pkg-config" ,pkg-config)))
1299 (inputs
1300 `(("fflas-ffpack" ,fflas-ffpack)))
1301 (arguments
1302 `(#:phases
1303 (modify-phases %standard-phases
1304 (add-before 'bootstrap 'setenv
1305 ;; Prevent the autogen.sh script to carry out the configure
1306 ;; script, which has not yet been patched to replace /bin/sh.
1307 (lambda _
1308 (setenv "NOCONFIGURE" "yes")
1309 #t)))))
1310 (synopsis "C++ library for linear algebra over exact rings")
1311 (description
1312 "LinBox is a C++ template library for exact linear algebra computation
1313with dense, sparse, and structured matrices over the integers and over
1314finite fields.")
1315 (license license:lgpl2.1+)
1316 (home-page "https://linbox-team.github.io/linbox/")))
37edfb0f
AE
1317
1318(define-public m4ri
1319 (package
1320 (name "m4ri")
1321 (version "20140914")
1322 (source (origin
1323 (method git-fetch)
1324 (uri (git-reference
1325 (url "https://bitbucket.org/malb/m4ri")
1326 (commit (string-append "release-" version))))
1327 (file-name (git-file-name name version))
1328 (sha256
1329 (base32
1330 "0xfg6pffbn8r1s0y7bn9b8i55l00d41dkmhrpf7pwk53qa3achd3"))))
1331 (build-system gnu-build-system)
1332 (native-inputs
1333 `(("autoconf" ,autoconf)
1334 ("automake" ,automake)
1335 ("libtool" ,libtool)
1336 ("pkg-config" ,pkg-config)))
1337 (inputs
1338 `(("libpng" ,libpng)))
1339 (synopsis "Arithmetic of dense matrices over F_2")
1340 (description "M4RI is a library for fast arithmetic with dense matrices
1341over F2. The name M4RI comes from the first implemented algorithm: The
1342Method of the Four Russians inversion algorithm published by Gregory Bard.
1343This algorithm in turn is named after the Method of the Four Russians
1344multiplication algorithm.")
1345 (license license:gpl2+)
1346 (home-page "https://bitbucket.org/malb/m4ri/")))
ab398380 1347
75a73bb0
NG
1348(define-public symmetrica
1349 (package
1350 (name "symmetrica")
1351 (version "2.0")
1352 (source (origin
1353 (method url-fetch/tarbomb)
1354 (uri (let ((v (string-join (string-split version #\.) "_")))
1355 (string-append "http://www.algorithm.uni-bayreuth.de/"
1356 "en/research/SYMMETRICA/"
1357 "SYM" v "_tar.gz")))
1358 (sha256
1359 (base32
1360 "1qhfrbd5ybb0sinl9pad64rscr08qvlfzrzmi4p4hk61xn6phlmz"))
1361 ;; Taken from <https://git.sagemath.org/sage.git/plain/build/pkgs/symmetrica/patches/>
1362 (patches (search-patches "symmetrica-bruch.patch"
1363 "symmetrica-int32.patch"
1364 "symmetrica-return_values.patch"
1365 "symmetrica-sort_sum_rename.patch"))))
1366 (build-system gnu-build-system)
1367 (arguments
1368 `(#:tests? #f ;no test
1369 #:phases
1370 (modify-phases %standard-phases
1371 (add-after 'unpack 'fix-makefile
1372 (lambda _
1373 (substitute* "makefile"
e6eafd42 1374 (("cc -c") "gcc -c -fPIC"))
75a73bb0
NG
1375 #t))
1376 (add-after 'fix-makefile 'turn-off-banner
1377 (lambda _
1378 (substitute* "de.c"
1379 (("(INT no_banner = )FALSE" _ pre) (string-append pre "TRUE")))
1380 #t))
1381 (delete 'configure) ;no configure script
1382 (replace 'install ;no install target
1383 (lambda* (#:key outputs #:allow-other-keys)
1384 (let* ((out (assoc-ref outputs "out"))
1385 (lib (string-append out "/lib"))
1386 (inc (string-append out "/include/symmetrica"))
1387 (doc (string-append out "/share/doc/symmetrica-" ,version))
1388 (static "libsymmetrica.a"))
1389 ;; Build static library.
1390 (apply invoke "ar" "crs" static (find-files "." "\\.o$"))
1391 (invoke "ranlib" static)
1392 ;; Install static library and headers.
1393 (for-each (lambda (f) (install-file f inc))
1394 (find-files "." "\\.h$"))
1395 (install-file "libsymmetrica.a" lib)
1396 ;; Install documentation.
1397 (for-each (lambda (f) (install-file f doc))
1398 (find-files "." "\\.doc$"))
1399 #t))))))
1400 (home-page "http://www.algorithm.uni-bayreuth.de/en/research/SYMMETRICA/")
1401 (synopsis "Combinatoric C Library")
1402 (description "Symmetrica is a library for combinatorics. It has support
1403for the representation theory of the symmetric group and related groups,
1404combinatorics of tableaux, symmetric functions and polynomials, Schubert
1405polynomials, and the representation theory of Hecke algebras of type A_n.")
1406 (license license:public-domain)))
6cbedbd2
AE
1407
1408(define-public m4rie
1409 (package
1410 (name "m4rie")
1411 (version "20150908")
1412 (source (origin
1413 (method git-fetch)
1414 (uri (git-reference
1415 (url "https://bitbucket.org/malb/m4rie")
1416 (commit (string-append "release-" version))))
1417 (file-name (git-file-name name version))
1418 (sha256
1419 (base32
1420 "0r8lv46qx5mkz5kp3ay2jnsp0mbhlqr5z2z220wdk73wdshcznss"))))
1421 (build-system gnu-build-system)
1422 (native-inputs
1423 `(("autoconf" ,autoconf)
1424 ("automake" ,automake)
1425 ("libtool" ,libtool)))
1426 (inputs
1427 `(("m4ri" ,m4ri)))
1428 (synopsis "Arithmetic of dense matrices over F_{2^e}")
1429 (description "M4RI is a library for fast arithmetic with dense matrices
1430over finite fields of characteristic 2. So it extends the functionality
1431of M4RI from F_2 to F_{2^e}.")
1432 (license license:gpl2+)
1433 (home-page "https://bitbucket.org/malb/m4rie/")))
66c67e7b
AE
1434
1435(define-public eclib
1436 (package
1437 (name "eclib")
9a5f35fe 1438 (version "20190909")
66c67e7b
AE
1439 (source (origin
1440 (method git-fetch)
1441 (uri (git-reference
1442 (url "https://github.com/JohnCremona/eclib/")
1443 (commit (string-append "v" version))))
1444 (file-name (git-file-name name version))
1445 (sha256
1446 (base32
9a5f35fe 1447 "1gw27lqc3f525n8qdcmr2nyn16y9g10z9f6dnmckyyxcdzvhq35n"))))
66c67e7b
AE
1448 (build-system gnu-build-system)
1449 (native-inputs
1450 `(("autoconf" ,autoconf)
1451 ("automake" ,automake)
1452 ("libtool" ,libtool)))
1453 (inputs
1454 `(("gmp" ,gmp)
1455 ("ntl" ,ntl)
1456 ("pari-gp" ,pari-gp)))
1457 (synopsis "Ranks of elliptic curves and modular symbols")
1458 (description "The eclib package includes mwrank (for 2-descent on
1459elliptic curves over Q) and modular symbol code; it has been written by
1460John Cremona to compute his elliptic curve database.")
1461 (license license:gpl2+)
1462 (home-page (string-append "http://homepages.warwick.ac.uk/staff/"
1463 "J.E.Cremona/mwrank/index.html"))))
197ebc36
AE
1464
1465(define-public lrcalc
1466 (package
1467 (name "lrcalc")
1468 (version "1.2")
1469 (source (origin
1470 (method git-fetch)
1471 (uri (git-reference
1472 (url "https://bitbucket.org/asbuch/lrcalc")
1473 (commit (string-append "lrcalc-" version))))
1474 (file-name (git-file-name name version))
1475 (sha256
1476 (base32
88f913e8
AE
1477 "1c12d04jdyxkkav4ak8d1aqrv594gzihwhpxvc6p9js0ry1fahss"))
1478 (patches (search-patches "lrcalc-includes.patch"))))
197ebc36
AE
1479 (build-system gnu-build-system)
1480 (native-inputs
1481 `(("autoconf" ,autoconf)
1482 ("automake" ,automake)
1483 ("libtool" ,libtool)))
1484 (arguments
1485 `(#:phases
1486 (modify-phases %standard-phases
1487 (add-before 'build 'fix-permission
1488 (lambda _
1489 (chmod "lrcalc.maple.src" #o644)
1490 #t)))))
1491 (synopsis "Littlewood-Richardson calculator in algebraic combinatorics")
1492 (description "The Littlewood-Richardson Calculator (lrcalc) is a
1493program designed to compute Littlewood-Richardson coefficients. It computes
1494single Littlewood-Richardson coefficients, products of Schur functions, or
1495skew Schur functions. In addition it computes products in the small quantum
1496cohomology ring of a Grassmann variety. The software package also includes
1497a program that performs fast computation of the more general multiplicative
1498structure constants of Schubert polynomials.")
1499 (license license:gpl2+)
1e30dff3 1500 (home-page "https://sites.math.rutgers.edu/~asbuch/lrcalc/")))
eacf2983
AE
1501
1502(define-public iml
1503 (package
1504 (name "iml")
1505 (version "1.0.5")
1506 (source
1507 (origin
1508 (method url-fetch)
1509 (uri (string-append "http://www.cs.uwaterloo.ca/~astorjoh/iml-"
1510 version ".tar.bz2"))
1511 (sha256
1512 (base32
1513 "0akwhhz9b40bz6lrfxpamp7r7wkk48p455qbn04mfnl9a1l6db8x"))))
1514 (build-system gnu-build-system)
1515 (inputs
1516 `(("gmp", gmp)
1517 ("cblas" ,openblas))) ; or any other BLAS library; the documentation
1518 ; mentions ATLAS in particular
1519 (arguments
1520 `(#:configure-flags
1521 (list
c68ec87c 1522 "--enable-shared"
eacf2983
AE
1523 (string-append "--with-gmp-include="
1524 (assoc-ref %build-inputs "gmp") "/include")
1525 (string-append "--with-gmp-lib="
1526 (assoc-ref %build-inputs "gmp") "/lib")
1527 "--with-cblas=-lopenblas"
1528 (string-append "--with-cblas-include="
1529 (assoc-ref %build-inputs "cblas") "/include")
1530 (string-append "--with-cblas-lib="
1531 (assoc-ref %build-inputs "cblas") "/lib"))))
1532 (home-page "https://cs.uwaterloo.ca/~astorjoh/iml.html")
1533 (synopsis
1534 "Solver for systems of linear equations over the integers")
1535 (description
1536 "IML is a C library implementing algorithms for computing exact
1537solutions to dense systems of linear equations over the integers.
1538Currently, IML provides the following functionality:
1539
1540@itemize
1541@item Nonsingular rational system solving:
1542compute the unique rational solution X to the system AX=B, where A and B
1543are integer matrices, A nonsingular.
1544@item Compute the right nullspace or kernel of an integer matrix.
1545@item Certified linear system solving:
1546compute a minimal denominator solution x to a system Ax=b, where b is an
1547integer vector and A is an integer matrix with arbitrary shape and
1548rank profile.
1549@end itemize
1550
1551In addition, IML provides some low level routines for a variety of mod p
1552matrix operations: computing the row-echelon form, determinant, rank
1553profile, and inverse of a mod p matrix. These mod p routines are not
1554general purpose; they require that p satisfy some preconditions based on
1555the dimension of the input matrix (usually p should be prime and should be
1556no more than about 20 bits long).")
1557 (license license:bsd-3)))