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