gnu: symmetrica: Generate position-independent code.
[jackhill/guix/guix.git] / gnu / packages / algebra.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2013, 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2016, 2017, 2018, 2019 Nicolas Goaziou <mail@nicolasgoaziou.fr>
5 ;;; Copyright © 2014, 2018 Mark H Weaver <mhw@netris.org>
6 ;;; Copyright © 2016, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
7 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
8 ;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
10 ;;; Copyright © 2017, 2019 Eric Bavier <bavier@member.fsf.org>
11 ;;;
12 ;;; This file is part of GNU Guix.
13 ;;;
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
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 ;;;
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
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
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27 (define-module (gnu packages algebra)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages autotools)
30 #:use-module (gnu packages bison)
31 #:use-module (gnu packages check)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages cpp)
34 #:use-module (gnu packages documentation)
35 #:use-module (gnu packages ed)
36 #:use-module (gnu packages flex)
37 #:use-module (gnu packages fltk)
38 #:use-module (gnu packages gl)
39 #:use-module (gnu packages graphviz)
40 #:use-module (gnu packages image)
41 #:use-module (gnu packages java)
42 #:use-module (gnu packages maths)
43 #:use-module (gnu packages mpi)
44 #:use-module (gnu packages multiprecision)
45 #:use-module (gnu packages perl)
46 #:use-module (gnu packages pkg-config)
47 #:use-module (gnu packages pulseaudio)
48 #:use-module (gnu packages python)
49 #:use-module (gnu packages python-xyz)
50 #:use-module (gnu packages readline)
51 #:use-module (gnu packages shells)
52 #:use-module (gnu packages tex)
53 #:use-module (gnu packages texinfo)
54 #:use-module (gnu packages xiph)
55 #:use-module (gnu packages xorg)
56 #:use-module (guix build-system ant)
57 #:use-module (guix build-system gnu)
58 #:use-module (guix build-system cmake)
59 #:use-module (guix build-system python)
60 #:use-module (guix download)
61 #:use-module (guix git-download)
62 #:use-module (guix hg-download)
63 #:use-module ((guix licenses) #:prefix license:)
64 #:use-module (guix packages)
65 #:use-module (guix utils))
66
67
68 (define-public mpfrcx
69 (package
70 (name "mpfrcx")
71 (version "0.5")
72 (source (origin
73 (method url-fetch)
74 (uri (string-append
75 "http://www.multiprecision.org/downloads/mpfrcx-"
76 version ".tar.gz"))
77 (sha256
78 (base32
79 "1s968480ymv6w0rnvfp9mxvx98hvi29fkvw8nk4ggzc6azxgwybs"))))
80 (build-system gnu-build-system)
81 (propagated-inputs
82 `(("gmp" ,gmp)
83 ("mpfr" ,mpfr)
84 ("mpc" ,mpc))) ; Header files are included by mpfrcx.h.
85 (synopsis "Arithmetic of polynomials over arbitrary precision numbers")
86 (description
87 "Mpfrcx is a library for the arithmetic of univariate polynomials over
88 arbitrary precision real (mpfr) or complex (mpc) numbers, without control
89 on the rounding. For the time being, only the few functions needed to
90 implement the floating point approach to complex multiplication are
91 implemented. On the other hand, these comprise asymptotically fast
92 multiplication routines such as Toom–Cook and the FFT.")
93 (license license:lgpl3+)
94 (home-page "http://mpfrcx.multiprecision.org/")))
95
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
112 of characteristic 2. It implements the multiplication, squaring and
113 greatest common divisor operations.")
114 (license license:gpl3+)
115 (home-page "https://gforge.inria.fr/projects/gf2x/")))
116
117 (define-public cm
118 (package
119 (name "cm")
120 (version "0.3")
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
128 "1nf5kr0nqmhbzrsrinky18z0ighjpsmb5cr8zyg8jf04bfbyrfmc"))))
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
138 imaginary quadratic number fields and of elliptic curves with complex
139 multiplication via floating point approximations. It consists of libraries
140 that can be called from within a C program and of executable command
141 line applications.")
142 (license license:gpl3+)
143 (home-page "http://cm.multiprecision.org/")))
144
145 (define-public fplll
146 (package
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.
170 The implementation relies on floating-point orthogonalization, and LLL
171 is central to the code, hence the name.
172
173 It includes implementations of floating-point LLL reduction
174 algorithms, offering different speed/guarantees ratios. It contains
175 a @emph{wrapper} choosing the estimated best sequence of variants in
176 order to provide a guaranteed output as fast as possible. In the case
177 of the wrapper, the succession of variants is oblivious to the user.
178
179 It includes an implementation of the BKZ reduction algorithm,
180 including the BKZ-2.0 improvements (extreme enumeration
181 pruning, pre-processing of blocks, early termination). Additionally,
182 Slide reduction and self dual BKZ are supported.
183
184 It also includes a floating-point implementation of the
185 Kannan-Fincke-Pohst algorithm that finds a shortest non-zero lattice
186 vector. For the same task, the GaussSieve algorithm is also available
187 in fplll. Finally, it contains a variant of the enumeration algorithm
188 that computes a lattice vector closest to a given vector belonging to
189 the real span of the lattice.")
190 (license license:lgpl2.1+)))
191
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
224 (define-public pari-gp
225 (package
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
235 "1jfax92jpydjd02fwl30r6b8kfzqqd6sm4yx94gidyz9lqjb7a94"))))
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
258 computations in number theory (factorisations, algebraic number theory,
259 elliptic curves...), but it also contains a large number of other useful
260 functions to compute with mathematical entities such as matrices,
261 polynomials, power series, algebraic numbers, etc., and a lot of
262 transcendental functions.
263 PARI is also available as a C library to allow for faster computations.")
264 (license license:gpl2+)
265 (home-page "https://pari.math.u-bordeaux.fr/")))
266
267 (define-public gp2c
268 (package
269 (name "gp2c")
270 (version "0.0.11pl1")
271 (source (origin
272 (method url-fetch)
273 (uri (string-append
274 "https://pari.math.u-bordeaux.fr/pub/pari/GP2C/gp2c-"
275 version ".tar.gz"))
276 (sha256
277 (base32
278 "1c6f6vmncw032kfzrfyr8bynw6yd3faxpy2285r009fmr0zxfs5s"))))
279 (build-system gnu-build-system)
280 (native-inputs `(("perl" ,perl)))
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
290 computations in number theory (factorisations, algebraic number theory,
291 elliptic curves...), but it also contains a large number of other useful
292 functions to compute with mathematical entities such as matrices,
293 polynomials, power series, algebraic numbers, etc., and a lot of
294 transcendental functions.
295 PARI is also available as a C library to allow for faster computations.
296
297 GP2C, the GP to C compiler, translates GP scripts to PARI programs.")
298 (license license:gpl2)
299 (home-page "https://pari.math.u-bordeaux.fr/")))
300
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
324 parameterize the CM points in the moduli space of 2-dimensional abelian
325 varieties, i.e. Jacobians of hyperelliptic curves.
326 It can also be used to compute theta constants at arbitrary
327 precision.")
328 (license license:gpl3+)
329 (home-page "http://cmh.gforge.inria.fr/")))
330
331 (define-public giac
332 (package
333 (name "giac")
334 (version "1.5.0-57")
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
346 "08c93knsisbk9dkyyrignw0wvqbr1sa5czlvk5l307ahxbbmqncf"))))
347 (build-system gnu-build-system)
348 (arguments
349 `(#:modules ((ice-9 ftw)
350 (guix build utils)
351 (guix build gnu-build-system))
352 #:phases
353 (modify-phases %standard-phases
354 (add-after 'unpack 'patch-bin-cp
355 ;; Some Makefiles contain hard-coded "/bin/cp".
356 (lambda _
357 (substitute* (find-files "doc" "^Makefile")
358 (("/bin/cp") (which "cp")))
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") ""))
365 #t))
366 (add-after 'install 'fix-doc
367 (lambda* (#:key outputs #:allow-other-keys)
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))))))
385 (inputs
386 ;;; TODO: Add libnauty.
387 `(("fltk" ,fltk)
388 ("glpk" ,glpk)
389 ("gmp" ,gmp)
390 ("gsl" ,gsl)
391 ("lapack" ,lapack)
392 ("libao" ,ao)
393 ("libjpeg" ,libjpeg)
394 ("libpng" ,libpng)
395 ("libsamplerate" ,libsamplerate)
396 ("libx11" ,libx11)
397 ("libxinerama" ,libxinerama)
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)
406 ("tcsh" ,tcsh)))
407 (native-inputs
408 `(("bison" ,bison)
409 ("flex" ,flex)
410 ("readline" ,readline)
411 ("texlive" ,texlive-tiny)))
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
416 maple, mupad and the TI89. It is available as a standalone program (graphic
417 or text interfaces) or as a C++ library.")
418 (license license:gpl3+)))
419
420 (define-public giac-xcas
421 (deprecated-package "giac-xcas" giac))
422
423 (define-public flint
424 (package
425 (name "flint")
426 (version "2.5.2")
427 (source (origin
428 (method url-fetch)
429 (uri (string-append
430 "http://flintlib.org/flint-"
431 version ".tar.gz"))
432 (sha256 (base32
433 "11syazv1a8rrnac3wj3hnyhhflpqcmq02q8pqk2m6g2k6h0gxwfb"))
434 (patches (search-patches "flint-ldconfig.patch"))))
435 (build-system gnu-build-system)
436 (propagated-inputs
437 `(("gmp" ,gmp)
438 ("mpfr" ,mpfr))) ; header files from both are included by flint/arith.h
439 (arguments
440 `(#:parallel-tests? #f ; seems to be necessary on arm
441 #:phases
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")))
448 ;; do not pass "--enable-fast-install", which makes the
449 ;; homebrew configure process fail
450 (invoke "./configure"
451 (string-append "--prefix=" out)
452 (string-append "--with-gmp=" gmp)
453 (string-append "--with-mpfr=" mpfr))
454 #t))))))
455 (synopsis "Fast library for number theory")
456 (description
457 "FLINT is a C library for number theory. It supports arithmetic
458 with numbers, polynomials, power series and matrices over many base
459 rings, including multiprecision integers and rationals, integers
460 modulo n, p-adic numbers, finite fields (prime and non-prime order)
461 and real and complex numbers (via the Arb extension library).
462
463 Operations that can be performed include conversions, arithmetic,
464 GCDs, factoring, solving linear systems, and evaluating special
465 functions. In addition, FLINT provides various low-level routines for
466 fast arithmetic.")
467 (license license:gpl2+)
468 (home-page "http://flintlib.org/")))
469
470 (define-public arb
471 (package
472 (name "arb")
473 (version "2.16.0")
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
482 "0478671wfwy3gl26sbxh1jq1ih36z4k72waa8y2y2lvn649gb7cd"))))
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
508 arithmetic. It supports efficient high-precision computation with
509 polynomials, power series, matrices and special functions over the
510 real and complex numbers, with automatic, rigorous error control.")
511 (license license:lgpl2.1+)
512 (home-page "http://fredrikj.net/arb/")))
513
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
540 arithmetic). It supports integers, rationals, modular integers,
541 real and complex ball arithmetic, polynomials and matrices over all
542 these types and other mathematical functions.")
543 (license license:expat)
544 (home-page "http://fredrikj.net/python-flint/")))
545
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
581 for manipulating signed, arbitrary length integers, and for vectors,
582 matrices, and polynomials over the integers and over finite fields.")
583 (license license:gpl2+)
584 (home-page "http://shoup.net/ntl/")))
585
586 (define-public singular
587 (package
588 (name "singular")
589 (version "4.1.2p1")
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
603 "0kvd55353fiqyq1msmi0kka66n5h0aqs7m3km60r01b1w2f8085m"))))
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,
624 with special emphasis on commutative and non-commutative algebra, algebraic
625 geometry 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
632 (define-public gmp-ecm
633 (package
634 (name "gmp-ecm")
635 (version "7.0.4")
636 (source (origin
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"))))
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
655 as the P-1 and P+1 algorithms. It provides a library and a stand-alone
656 binary.")
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
662 (define-public bc
663 (package
664 (name "bc")
665 (version "1.07.1")
666 (source (origin
667 (method url-fetch)
668 (uri (string-append "mirror://gnu/bc/bc-" version ".tar.gz"))
669 (sha256
670 (base32
671 "0amh9ik44jfg66csyvf4zz1l878c4755kjndq9j0270akflgrbb2"))))
672 (build-system gnu-build-system)
673 (native-inputs
674 `(("ed" ,ed)
675 ("flex" ,flex)
676 ("texinfo" ,texinfo)))
677 (arguments
678 '(#:configure-flags
679 (list "--with-readline")))
680 (home-page "https://www.gnu.org/software/bc/")
681 (synopsis "Arbitrary precision numeric processing language")
682 (description
683 "bc is an arbitrary precision numeric processing language. It includes
684 an interactive environment for evaluating mathematical statements. Its
685 syntax is similar to that of C, so basic usage is familiar. It also includes
686 \"dc\", a reverse-polish calculator.")
687 (license license:gpl2+)))
688
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
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))
701 (sha256
702 (base32
703 "0jasbmqy4wkqrqx3w64s1dfmj34875xmsl72mb26aa4hpyn14bi2"))))
704 (build-system cmake-build-system)
705 (arguments `(#:tests? #f)) ; no tests included
706 ;; Extempore refuses to build on architectures other than x86_64
707 (supported-systems '("x86_64-linux"))
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
712 that can use fixed or floating data types and can easily be incorporated into
713 a C program.")
714 (license license:bsd-3)))
715
716 (define-public fftw
717 (package
718 (name "fftw")
719 (version "3.3.8")
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
726 "00z3k8fq561wq2khssqg0kallk0504dzlx989x3vvicjdqpjc4v1"))))
727 (build-system gnu-build-system)
728 (arguments
729 `(#:configure-flags
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 '())))
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")))
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
756 transform (DFT) in one or more dimensions, of arbitrary input size, and of
757 both real and complex data (as well as of even/odd data---i.e. the discrete
758 cosine/ sine transforms or DCT/DST).")
759 (license license:gpl2+)))
760
761 (define-public fftwf
762 (package (inherit fftw)
763 (name "fftwf")
764 (arguments
765 (substitute-keyword-arguments (package-arguments fftw)
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))))
775 (description
776 (string-append (package-description fftw)
777 " Single-precision version."))))
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)
788 `(cons "--enable-mpi" ,cf))
789 ((#:phases phases '%standard-phases)
790 `(modify-phases ,phases
791 (add-before 'check 'mpi-setup
792 ,%openmpi-setup)))))
793 (description
794 (string-append (package-description fftw)
795 " With OpenMPI parallelism support."))))
796
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
827 Algebra primitives (matrices and vectors) and algorithms. The key features of
828 the 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
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
864 that can store up to 263 elements.")
865 (license license:bsd-2)))
866
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
890 Java. Currently, four types of transforms are available: @dfn{Discrete
891 Fourier Transform} (DFT), @dfn{Discrete Cosine Transform} (DCT), @dfn{Discrete
892 Sine Transform} (DST) and @dfn{Discrete Hartley Transform} (DHT).")
893 (license license:bsd-2)))
894
895 (define-public eigen
896 (package
897 (name "eigen")
898 (version "3.3.5")
899 (source (origin
900 (method url-fetch)
901 (uri (string-append "https://bitbucket.org/eigen/eigen/get/"
902 version ".tar.bz2"))
903 (sha256
904 (base32
905 "1qh3yrwn78ms5yhwbpl5wvblk4gbz02cacdygxylr7i9xbrvylkk"))
906 (file-name (string-append name "-" version ".tar.bz2"))
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.
912 '(begin
913 (substitute* "unsupported/CMakeLists.txt"
914 (("add_subdirectory\\(test.*")
915 "# Do not build the tests for unsupported features.\n"))
916 #t))))
917 (build-system cmake-build-system)
918 (arguments
919 '(;; Turn off debugging symbols to save space.
920 #:build-type "Release"
921
922 #:phases (modify-phases %standard-phases
923 (replace 'check
924 (lambda _
925 (let* ((cores (parallel-job-count))
926 (dash-j (format #f "-j~a" cores)))
927 (setenv "EIGEN_SEED" "1") ;for reproducibility
928 ;; First build the tests, in parallel. See
929 ;; <http://eigen.tuxfamily.org/index.php?title=Tests>.
930 (invoke "make" "buildtests" dash-j)
931
932 ;; Then run 'CTest' with -V so we get more
933 ;; details upon failure.
934 (invoke "ctest" "-V" dash-j)))))))
935 (home-page "https://eigen.tuxfamily.org")
936 (synopsis "C++ template library for linear algebra")
937 (description
938 "Eigen is a C++ template library for linear algebra: matrices, vectors,
939 numerical solvers, and related algorithms. It provides an elegant API based
940 on \"expression templates\". It is versatile: it supports all matrix sizes,
941 all standard numeric types, various matrix decompositions and geometry
942 features, 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.
946 (license license:mpl2.0)))
947
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
974 (define-public xtensor
975 (package
976 (name "xtensor")
977 (version "0.20.5")
978 (source (origin
979 (method git-fetch)
980 (uri (git-reference
981 (url "https://github.com/QuantStack/xtensor.git")
982 (commit version)))
983 (sha256
984 (base32
985 "0kkc4ar7p2d94jnclmrh46dwv7ldy9lx630vm9gci3pp4hnhbj9f"))
986 (file-name (git-file-name name version))))
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
998 multi-dimensional array expressions.
999
1000 xtensor 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)))
1007
1008 (define-public gap
1009 (package
1010 (name "gap")
1011 (version "4.10.1")
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
1022 "136s0zvhcw41fshj5zgsrjcy2kd58cdh2m3ddp5rdizi4rx54f10"))
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"
1050 "autpgrp-1.10"
1051 "crisp-1.4.4" ; bsd-2
1052 "ctbllib" ; gpl3+ according to doc/chap0.txt
1053 "FactInt-1.6.2"
1054 "fga"
1055 "irredsol-1.4" ; bsd-2
1056 "laguna-3.9.2"
1057 "polenta-1.3.8"
1058 "polycyclic-2.14"
1059 "radiroot-2.8"
1060 "resclasses-4.7.1"
1061 "sophus-1.24"
1062 "tomlib-1.2.7" ; gpl2+, clarified in the git repository
1063 ; and the next release
1064 "utils-0.59"))))
1065 #t))))
1066 (build-system gnu-build-system)
1067 (inputs
1068 `(("gmp" ,gmp)
1069 ("zlib" ,zlib)))
1070 (arguments
1071 `(#:modules ((ice-9 ftw)
1072 (srfi srfi-26)
1073 (guix build gnu-build-system)
1074 (guix build utils))
1075 #:phases
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))
1091 (replace 'install
1092 (lambda* (#:key outputs #:allow-other-keys)
1093 (let* ((out (assoc-ref outputs "out"))
1094 (bin (string-append out "/bin"))
1095 (lib (string-append out "/lib"))
1096 (prog (string-append bin "/gap"))
1097 (prog-real (string-append bin "/.gap-real"))
1098 (share (string-append out "/share/gap"))
1099 (include (string-append out "/include/gap"))
1100 (include-hpc (string-append include "/hpc")))
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)
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)
1118 (install-file "gen/config.h" include)
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"))
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
1166 emphasis on computational group theory. It provides a programming language,
1167 a library of thousands of functions implementing algebraic algorithms
1168 written in the GAP language as well as large data libraries of algebraic
1169 objects.")
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+)))
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
1210 algebraic objects: prime fields, extension fields, finite fields, finite
1211 rings, polynomials, algebraic numbers, arbitrary precision integers and
1212 rationals (C++ wrappers over gmp), fixed precision integers. It also
1213 provides data-structures and templated classes for the manipulation of
1214 compound objects, such as vectors, matrices and univariate polynomials.")
1215 (license license:cecill-b)
1216 (home-page "https://github.com/linbox-team/givaro")))
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
1257 operations over a finite field.
1258 FFLAS (Finite Field Linear Algebra Subprograms) provides the implementation
1259 of a subset of routines of the numerical BLAS; it also supports sparse
1260 matrix-vector products.
1261 FFPACK (Finite Field Linear Algebra Package) is inspired by the LAPACK
1262 library to provide functionalities of higher level, using the kernel
1263 of a BLAS. Additionally, it provides routines specific to exact linear
1264 algebra, such as the row echelon form.")
1265 (license license:lgpl2.1+)
1266 (home-page "https://linbox-team.github.io/fflas-ffpack/")))
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
1301 with dense, sparse, and structured matrices over the integers and over
1302 finite fields.")
1303 (license license:lgpl2.1+)
1304 (home-page "https://linbox-team.github.io/linbox/")))
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
1329 over F2. The name M4RI comes from the first implemented algorithm: The
1330 Method of the Four Russians inversion algorithm published by Gregory Bard.
1331 This algorithm in turn is named after the Method of the Four Russians
1332 multiplication algorithm.")
1333 (license license:gpl2+)
1334 (home-page "https://bitbucket.org/malb/m4ri/")))
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
1373 a given height bound on a hyperelliptic curve in a very efficient way,
1374 by using an optimized quadratic sieve algorithm.")
1375 (license license:gpl2+)))
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 -fPIC"))
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
1432 for the representation theory of the symmetric group and related groups,
1433 combinatorics of tableaux, symmetric functions and polynomials, Schubert
1434 polynomials, and the representation theory of Hecke algebras of type A_n.")
1435 (license license:public-domain)))
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
1459 over finite fields of characteristic 2. So it extends the functionality
1460 of M4RI from F_2 to F_{2^e}.")
1461 (license license:gpl2+)
1462 (home-page "https://bitbucket.org/malb/m4rie/")))
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
1488 elliptic curves over Q) and modular symbol code; it has been written by
1489 John 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"))))
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 (patches (search-patches "lrcalc-includes.patch"))))
1508 (build-system gnu-build-system)
1509 (native-inputs
1510 `(("autoconf" ,autoconf)
1511 ("automake" ,automake)
1512 ("libtool" ,libtool)))
1513 (arguments
1514 `(#:phases
1515 (modify-phases %standard-phases
1516 (add-before 'build 'fix-permission
1517 (lambda _
1518 (chmod "lrcalc.maple.src" #o644)
1519 #t)))))
1520 (synopsis "Littlewood-Richardson calculator in algebraic combinatorics")
1521 (description "The Littlewood-Richardson Calculator (lrcalc) is a
1522 program designed to compute Littlewood-Richardson coefficients. It computes
1523 single Littlewood-Richardson coefficients, products of Schur functions, or
1524 skew Schur functions. In addition it computes products in the small quantum
1525 cohomology ring of a Grassmann variety. The software package also includes
1526 a program that performs fast computation of the more general multiplicative
1527 structure constants of Schubert polynomials.")
1528 (license license:gpl2+)
1529 (home-page "http://sites.math.rutgers.edu/~asbuch/lrcalc/")))
1530
1531 (define-public iml
1532 (package
1533 (name "iml")
1534 (version "1.0.5")
1535 (source
1536 (origin
1537 (method url-fetch)
1538 (uri (string-append "http://www.cs.uwaterloo.ca/~astorjoh/iml-"
1539 version ".tar.bz2"))
1540 (sha256
1541 (base32
1542 "0akwhhz9b40bz6lrfxpamp7r7wkk48p455qbn04mfnl9a1l6db8x"))))
1543 (build-system gnu-build-system)
1544 (inputs
1545 `(("gmp", gmp)
1546 ("cblas" ,openblas))) ; or any other BLAS library; the documentation
1547 ; mentions ATLAS in particular
1548 (arguments
1549 `(#:configure-flags
1550 (list
1551 "--enable-shared"
1552 (string-append "--with-gmp-include="
1553 (assoc-ref %build-inputs "gmp") "/include")
1554 (string-append "--with-gmp-lib="
1555 (assoc-ref %build-inputs "gmp") "/lib")
1556 "--with-cblas=-lopenblas"
1557 (string-append "--with-cblas-include="
1558 (assoc-ref %build-inputs "cblas") "/include")
1559 (string-append "--with-cblas-lib="
1560 (assoc-ref %build-inputs "cblas") "/lib"))))
1561 (home-page "https://cs.uwaterloo.ca/~astorjoh/iml.html")
1562 (synopsis
1563 "Solver for systems of linear equations over the integers")
1564 (description
1565 "IML is a C library implementing algorithms for computing exact
1566 solutions to dense systems of linear equations over the integers.
1567 Currently, IML provides the following functionality:
1568
1569 @itemize
1570 @item Nonsingular rational system solving:
1571 compute the unique rational solution X to the system AX=B, where A and B
1572 are integer matrices, A nonsingular.
1573 @item Compute the right nullspace or kernel of an integer matrix.
1574 @item Certified linear system solving:
1575 compute a minimal denominator solution x to a system Ax=b, where b is an
1576 integer vector and A is an integer matrix with arbitrary shape and
1577 rank profile.
1578 @end itemize
1579
1580 In addition, IML provides some low level routines for a variety of mod p
1581 matrix operations: computing the row-echelon form, determinant, rank
1582 profile, and inverse of a mod p matrix. These mod p routines are not
1583 general purpose; they require that p satisfy some preconditions based on
1584 the dimension of the input matrix (usually p should be prime and should be
1585 no more than about 20 bits long).")
1586 (license license:bsd-3)))