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