gnu: direnv: Change to the go-build-system.
[jackhill/guix/guix.git] / gnu / packages / algebra.scm
CommitLineData
233e7676 1;;; GNU Guix --- Functional package management for GNU
3f074a21 2;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Andreas Enge <andreas@enge.fr>
4b0bf990 3;;; Copyright © 2013, 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
7f055a0a 4;;; Copyright © 2016, 2017, 2018, 2019 Nicolas Goaziou <mail@nicolasgoaziou.fr>
69d5909e 5;;; Copyright © 2014, 2018 Mark H Weaver <mhw@netris.org>
67f39dd5 6;;; Copyright © 2016, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
ecc5bc33 7;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
ff6807dc 8;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
f71f29ca 9;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
eb6785cf 10;;; Copyright © 2017, 2019 Eric Bavier <bavier@member.fsf.org>
2ed139c4 11;;;
233e7676 12;;; This file is part of GNU Guix.
2ed139c4 13;;;
233e7676 14;;; GNU Guix is free software; you can redistribute it and/or modify it
2ed139c4
AE
15;;; under the terms of the GNU General Public License as published by
16;;; the Free Software Foundation; either version 3 of the License, or (at
17;;; your option) any later version.
18;;;
233e7676 19;;; GNU Guix is distributed in the hope that it will be useful, but
2ed139c4
AE
20;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22;;; GNU General Public License for more details.
23;;;
24;;; You should have received a copy of the GNU General Public License
233e7676 25;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
2ed139c4 26
1ffa7090 27(define-module (gnu packages algebra)
59a43334 28 #:use-module (gnu packages)
14e6520e 29 #:use-module (gnu packages autotools)
70770b93 30 #:use-module (gnu packages check)
10b1f688 31 #:use-module (gnu packages compression)
70770b93 32 #:use-module (gnu packages cpp)
99828fa7 33 #:use-module (gnu packages documentation)
f71f29ca 34 #:use-module (gnu packages ed)
5894b604 35 #:use-module (gnu packages flex)
57497c57
NG
36 #:use-module (gnu packages fltk)
37 #:use-module (gnu packages gl)
aae03c48 38 #:use-module (gnu packages graphviz)
57497c57 39 #:use-module (gnu packages image)
c8d99608 40 #:use-module (gnu packages java)
aae03c48 41 #:use-module (gnu packages maths)
0fc54d4b 42 #:use-module (gnu packages mpi)
5894b604 43 #:use-module (gnu packages multiprecision)
1ffa7090 44 #:use-module (gnu packages perl)
6d3896b9 45 #:use-module (gnu packages pulseaudio)
aae03c48 46 #:use-module (gnu packages python)
1d6589db 47 #:use-module (gnu packages python-xyz)
5894b604 48 #:use-module (gnu packages readline)
b7194849 49 #:use-module (gnu packages shells)
8f9ac901 50 #:use-module (gnu packages tex)
f71f29ca 51 #:use-module (gnu packages texinfo)
57497c57 52 #:use-module (gnu packages xiph)
fb8d1be8 53 #:use-module (gnu packages xorg)
c8d99608 54 #:use-module (guix build-system ant)
7569c5cb 55 #:use-module (guix build-system gnu)
8f4b1dfb 56 #:use-module (guix build-system cmake)
1d6589db 57 #:use-module (guix build-system python)
5894b604 58 #:use-module (guix download)
c8d99608 59 #:use-module (guix git-download)
697eb65d 60 #:use-module (guix hg-download)
5894b604
TGR
61 #:use-module ((guix licenses) #:prefix license:)
62 #:use-module (guix packages)
7569c5cb 63 #:use-module (guix utils))
2ed139c4
AE
64
65
66(define-public mpfrcx
67 (package
68 (name "mpfrcx")
43a776e2 69 (version "0.5")
2ed139c4
AE
70 (source (origin
71 (method url-fetch)
72 (uri (string-append
43a776e2 73 "http://www.multiprecision.org/downloads/mpfrcx-"
2ed139c4
AE
74 version ".tar.gz"))
75 (sha256
76 (base32
43a776e2 77 "1s968480ymv6w0rnvfp9mxvx98hvi29fkvw8nk4ggzc6azxgwybs"))))
2ed139c4 78 (build-system gnu-build-system)
878c8f3f
AE
79 (propagated-inputs
80 `(("gmp" ,gmp)
81 ("mpfr" ,mpfr)
82 ("mpc" ,mpc))) ; Header files are included by mpfrcx.h.
35b9e423 83 (synopsis "Arithmetic of polynomials over arbitrary precision numbers")
2ed139c4 84 (description
35b9e423 85 "Mpfrcx is a library for the arithmetic of univariate polynomials over
2ed139c4 86arbitrary precision real (mpfr) or complex (mpc) numbers, without control
35b9e423 87on the rounding. For the time being, only the few functions needed to
2ed139c4 88implement the floating point approach to complex multiplication are
35b9e423 89implemented. On the other hand, these comprise asymptotically fast
e881752c 90multiplication routines such as Toom–Cook and the FFT.")
43a776e2 91 (license license:lgpl3+)
2ed139c4
AE
92 (home-page "http://mpfrcx.multiprecision.org/")))
93
10b1f688
AE
94(define-public cm
95 (package
96 (name "cm")
81b55bf7 97 (version "0.3")
10b1f688
AE
98 (source (origin
99 (method url-fetch)
100 (uri (string-append
101 "http://www.multiprecision.org/cm/download/cm-"
102 version ".tar.gz"))
103 (sha256
104 (base32
81b55bf7 105 "1nf5kr0nqmhbzrsrinky18z0ighjpsmb5cr8zyg8jf04bfbyrfmc"))))
10b1f688
AE
106 (build-system gnu-build-system)
107 (propagated-inputs
108 `(("mpfrcx" ,mpfrcx)
109 ("zlib" ,zlib))) ; Header files included from cm_common.h.
110 (inputs
111 `(("pari-gp" ,pari-gp)))
112 (synopsis "CM constructions for elliptic curves")
113 (description
114 "The CM software implements the construction of ring class fields of
115imaginary quadratic number fields and of elliptic curves with complex
116multiplication via floating point approximations. It consists of libraries
117that can be called from within a C program and of executable command
118line applications.")
81b55bf7 119 (license license:gpl3+)
10b1f688
AE
120 (home-page "http://cm.multiprecision.org/")))
121
2ed139c4
AE
122(define-public fplll
123 (package
124 (name "fplll")
5a15ed50 125 (version "4.0.4")
2ed139c4
AE
126 (source (origin
127 (method url-fetch)
128 (uri (string-append
129 "http://perso.ens-lyon.fr/damien.stehle/fplll/libfplll-"
130 version ".tar.gz"))
131 (sha256 (base32
5a15ed50 132 "1cbiby7ykis4z84swclpysrljmqhfcllpkcbll1m08rzskgb1a6b"))))
2ed139c4
AE
133 (build-system gnu-build-system)
134 (inputs `(("gmp" ,gmp)
135 ("mpfr" ,mpfr)))
35b9e423 136 (synopsis "Library for LLL-reduction of euclidean lattices")
2ed139c4 137 (description
35b9e423 138 "fplll LLL-reduces euclidean lattices. Since version 3, it can also
2ed139c4 139solve the shortest vector problem.")
9f51293c 140 (license license:lgpl2.1+)
2ed139c4 141 (home-page "http://perso.ens-lyon.fr/damien.stehle/fplll/")))
4e6b699d 142
90a6d47c
AE
143(define-public pari-gp
144 (package
67f39dd5
RW
145 (name "pari-gp")
146 (version "2.11.1")
147 (source (origin
148 (method url-fetch)
149 (uri (string-append
150 "https://pari.math.u-bordeaux.fr/pub/pari/unix/pari-"
151 version ".tar.gz"))
152 (sha256
153 (base32
4ebfe99a 154 "1jfax92jpydjd02fwl30r6b8kfzqqd6sm4yx94gidyz9lqjb7a94"))))
67f39dd5
RW
155 (build-system gnu-build-system)
156 (native-inputs
157 `(("texlive" ,(texlive-union
158 (list texlive-fonts-amsfonts
159 texlive-latex-amsfonts)))))
160 (inputs `(("gmp" ,gmp)
161 ("libx11" ,libx11)
162 ("perl" ,perl)
163 ("readline" ,readline)))
164 (arguments
165 '(#:make-flags '("all")
166 #:test-target "dobench"
167 #:phases
168 (modify-phases %standard-phases
169 (replace 'configure
170 (lambda* (#:key outputs #:allow-other-keys)
171 (invoke "./Configure"
172 (string-append "--prefix="
173 (assoc-ref outputs "out"))))))))
174 (synopsis "PARI/GP, a computer algebra system for number theory")
175 (description
176 "PARI/GP is a widely used computer algebra system designed for fast
90a6d47c
AE
177computations in number theory (factorisations, algebraic number theory,
178elliptic curves...), but it also contains a large number of other useful
179functions to compute with mathematical entities such as matrices,
180polynomials, power series, algebraic numbers, etc., and a lot of
181transcendental functions.
182PARI is also available as a C library to allow for faster computations.")
67f39dd5
RW
183 (license license:gpl2+)
184 (home-page "https://pari.math.u-bordeaux.fr/")))
ed9f9a77 185
f854a8c1
AE
186(define-public gp2c
187 (package
188 (name "gp2c")
44ff80fc 189 (version "0.0.11pl1")
f854a8c1
AE
190 (source (origin
191 (method url-fetch)
192 (uri (string-append
eeb8b0e6 193 "https://pari.math.u-bordeaux.fr/pub/pari/GP2C/gp2c-"
f854a8c1 194 version ".tar.gz"))
324bdcd8
AE
195 (sha256
196 (base32
44ff80fc 197 "1c6f6vmncw032kfzrfyr8bynw6yd3faxpy2285r009fmr0zxfs5s"))))
f854a8c1 198 (build-system gnu-build-system)
c67ccedd 199 (native-inputs `(("perl" ,perl)))
f854a8c1
AE
200 (inputs `(("pari-gp" ,pari-gp)))
201 (arguments
202 '(#:configure-flags
203 (list (string-append "--with-paricfg="
204 (assoc-ref %build-inputs "pari-gp")
205 "/lib/pari/pari.cfg"))))
206 (synopsis "PARI/GP, a computer algebra system for number theory")
207 (description
208 "PARI/GP is a widely used computer algebra system designed for fast
209computations in number theory (factorisations, algebraic number theory,
210elliptic curves...), but it also contains a large number of other useful
211functions to compute with mathematical entities such as matrices,
212polynomials, power series, algebraic numbers, etc., and a lot of
213transcendental functions.
214PARI is also available as a C library to allow for faster computations.
215
216GP2C, the GP to C compiler, translates GP scripts to PARI programs.")
9f51293c 217 (license license:gpl2)
eeb8b0e6 218 (home-page "https://pari.math.u-bordeaux.fr/")))
f854a8c1 219
eea7cd75
AE
220(define-public cmh
221 (package
222 (name "cmh")
223 (version "1.0")
224 (source (origin
225 (method url-fetch)
226 (uri (string-append
227 "https://gforge.inria.fr/frs/download.php/33497/cmh-"
228 version ".tar.gz"))
229 (sha256
230 (base32
231 "1a28xr9bs0igms0ik99x0w8lnb0jyfcmvyi26pbyh9ggcdivd33p"))))
232 (build-system gnu-build-system)
233 (inputs
234 `(("gmp" ,gmp)
235 ("mpfr" ,mpfr)
236 ("mpc" ,mpc)
237 ("mpfrcx" ,mpfrcx)
238 ("fplll" ,fplll)
239 ("pari-gp" ,pari-gp)))
240 (synopsis "Igusa class polynomial computations")
241 (description
242 "The CMH software computes Igusa (genus 2) class polynomials, which
243parameterize the CM points in the moduli space of 2-dimensional abelian
244varieties, i.e. Jacobians of hyperelliptic curves.
245It can also be used to compute theta constants at arbitrary
246precision.")
247 (license license:gpl3+)
248 (home-page "http://cmh.gforge.inria.fr/")))
249
7fc0e3db 250(define-public giac
57497c57 251 (package
7fc0e3db 252 (name "giac")
5427db0d 253 (version "1.5.0-49")
57497c57
NG
254 (source (origin
255 (method url-fetch)
256 ;; "~parisse/giac" is not used because the maintainer regularly
257 ;; overwrites the release tarball there, introducing a checksum
258 ;; mismatch every time. See
259 ;; <https://www-fourier.ujf-grenoble.fr/~parisse/debian/dists/stable/main/source/README>
260 (uri (string-append "https://www-fourier.ujf-grenoble.fr/"
261 "~parisse/debian/dists/stable/main/"
262 "source/giac_" version ".tar.gz"))
263 (sha256
264 (base32
5427db0d 265 "0f4pkand9vmqfayw18jm5qxbhcwi1405qfd7ibzh9lwzz6amkm3l"))))
57497c57
NG
266 (build-system gnu-build-system)
267 (arguments
af90cc45
NG
268 `(#:modules ((ice-9 ftw)
269 (guix build utils)
270 (guix build gnu-build-system))
271 #:phases
57497c57
NG
272 (modify-phases %standard-phases
273 (add-after 'unpack 'patch-bin-cp
90d5ec55 274 ;; Some Makefiles contain hard-coded "/bin/cp".
57497c57 275 (lambda _
57497c57
NG
276 (substitute* (find-files "doc" "^Makefile")
277 (("/bin/cp") (which "cp")))
90d5ec55
NG
278 #t))
279 (add-after 'unpack 'disable-failing-test
280 ;; FIXME: Test failing. Not sure why.
281 (lambda _
282 (substitute* "check/Makefile.in"
283 (("chk_fhan11") ""))
af90cc45 284 #t))
9f73ac24 285 (add-after 'install 'fix-doc
af90cc45 286 (lambda* (#:key outputs #:allow-other-keys)
9f73ac24
NG
287 (let ((out (assoc-ref outputs "out")))
288 ;; Most French documentation has a non-commercial
289 ;; license, so we need to remove it.
290 (with-directory-excursion (string-append out "/share/giac/doc/fr")
291 (for-each delete-file-recursively
292 '("cascas" "casexo" "casgeo" "casrouge" "cassim"
293 "castor")))
294 ;; Remove duplicate documentation in
295 ;; "%out/share/doc/giac/", where Xcas does not expect
296 ;; to find it.
297 (delete-file-recursively (string-append out "/share/doc/giac"))
298 #t)))
299 (add-after 'install 'remove-unnecessary-executable
300 (lambda* (#:key outputs #:allow-other-keys)
301 (let ((out (assoc-ref outputs "out")))
302 (delete-file (string-append out "/bin/xcasnew"))
303 #t))))))
57497c57 304 (inputs
6d3896b9 305 ;;; TODO: Add libnauty.
57497c57 306 `(("fltk" ,fltk)
6d3896b9 307 ("glpk" ,glpk)
57497c57
NG
308 ("gmp" ,gmp)
309 ("gsl" ,gsl)
310 ("lapack" ,lapack)
311 ("libao" ,ao)
312 ("libjpeg" ,libjpeg)
313 ("libpng" ,libpng)
6d3896b9 314 ("libsamplerate" ,libsamplerate)
57497c57 315 ("libx11" ,libx11)
99a00446 316 ("libxinerama" ,libxinerama)
57497c57
NG
317 ("libxft" ,libxft)
318 ("libxt" ,libxt)
319 ("mesa" ,mesa)
320 ("mpfi" ,mpfi)
321 ("mpfr" ,mpfr)
322 ("ntl" ,ntl)
323 ("perl" ,perl)
324 ("pari-gp" ,pari-gp)
9f73ac24
NG
325 ("tcsh" ,tcsh)))
326 (native-inputs
6d3896b9
NG
327 `(("bison" ,bison)
328 ("flex" ,flex)
329 ("readline" ,readline)
a023ec6e 330 ("texlive" ,texlive-tiny)))
57497c57
NG
331 (home-page "https://www-fourier.ujf-grenoble.fr/~parisse/giac.html")
332 (synopsis "Computer algebra system")
333 (description
334 "Giac/Xcas is a computer algebra system. It has a compatibility mode for
335maple, mupad and the TI89. It is available as a standalone program (graphic
336or text interfaces) or as a C++ library.")
337 (license license:gpl3+)))
338
7fc0e3db 339(define-public giac-xcas
e0f3a4fe 340 (deprecated-package "giac-xcas" giac))
7fc0e3db 341
d7ab698a
AE
342(define-public flint
343 (package
344 (name "flint")
6c591c8e 345 (version "2.5.2")
d7ab698a
AE
346 (source (origin
347 (method url-fetch)
348 (uri (string-append
349 "http://flintlib.org/flint-"
350 version ".tar.gz"))
351 (sha256 (base32
6c591c8e 352 "11syazv1a8rrnac3wj3hnyhhflpqcmq02q8pqk2m6g2k6h0gxwfb"))
fc1adab1 353 (patches (search-patches "flint-ldconfig.patch"))))
d7ab698a 354 (build-system gnu-build-system)
df15d17d 355 (propagated-inputs
d7ab698a 356 `(("gmp" ,gmp)
df15d17d 357 ("mpfr" ,mpfr))) ; header files from both are included by flint/arith.h
d7ab698a 358 (arguments
ad11974e
AE
359 `(#:parallel-tests? #f ; seems to be necessary on arm
360 #:phases
91430de6
AE
361 (modify-phases %standard-phases
362 (replace 'configure
363 (lambda* (#:key inputs outputs #:allow-other-keys)
364 (let ((out (assoc-ref outputs "out"))
365 (gmp (assoc-ref inputs "gmp"))
366 (mpfr (assoc-ref inputs "mpfr")))
91430de6
AE
367 ;; do not pass "--enable-fast-install", which makes the
368 ;; homebrew configure process fail
50233d95 369 (invoke "./configure"
91430de6
AE
370 (string-append "--prefix=" out)
371 (string-append "--with-gmp=" gmp)
50233d95
RW
372 (string-append "--with-mpfr=" mpfr))
373 #t))))))
d7ab698a
AE
374 (synopsis "Fast library for number theory")
375 (description
376 "FLINT is a C library for number theory. It supports arithmetic
377with numbers, polynomials, power series and matrices over many base
378rings, including multiprecision integers and rationals, integers
379modulo n, p-adic numbers, finite fields (prime and non-prime order)
380and real and complex numbers (via the Arb extension library).
381
382Operations that can be performed include conversions, arithmetic,
383GCDs, factoring, solving linear systems, and evaluating special
384functions. In addition, FLINT provides various low-level routines for
385fast arithmetic.")
9f51293c 386 (license license:gpl2+)
d7ab698a
AE
387 (home-page "http://flintlib.org/")))
388
6b8e8285
AE
389(define-public arb
390 (package
6aa54e23 391 (name "arb")
402db511 392 (version "2.16.0")
6aa54e23
RW
393 (source (origin
394 (method git-fetch)
395 (uri (git-reference
396 (url "https://github.com/fredrik-johansson/arb.git")
397 (commit version)))
398 (file-name (git-file-name name version))
399 (sha256
400 (base32
402db511 401 "0478671wfwy3gl26sbxh1jq1ih36z4k72waa8y2y2lvn649gb7cd"))))
6aa54e23
RW
402 (build-system gnu-build-system)
403 (propagated-inputs
404 `(("flint" ,flint))) ; flint.h is included by arf.h
405 (inputs
406 `(("gmp" ,gmp)
407 ("mpfr" ,mpfr)))
408 (arguments
409 `(#:phases
410 (modify-phases %standard-phases
411 (replace 'configure
412 (lambda* (#:key inputs outputs #:allow-other-keys)
413 (let ((out (assoc-ref outputs "out"))
414 (flint (assoc-ref inputs "flint"))
415 (gmp (assoc-ref inputs "gmp"))
416 (mpfr (assoc-ref inputs "mpfr")))
417 ;; do not pass "--enable-fast-install", which makes the
418 ;; homebrew configure process fail
419 (invoke "./configure"
420 (string-append "--prefix=" out)
421 (string-append "--with-flint=" flint)
422 (string-append "--with-gmp=" gmp)
423 (string-append "--with-mpfr=" mpfr))))))))
424 (synopsis "Arbitrary precision floating-point ball arithmetic")
425 (description
426 "Arb is a C library for arbitrary-precision floating-point ball
6b8e8285
AE
427arithmetic. It supports efficient high-precision computation with
428polynomials, power series, matrices and special functions over the
429real and complex numbers, with automatic, rigorous error control.")
6aa54e23
RW
430 (license license:lgpl2.1+)
431 (home-page "http://fredrikj.net/arb/")))
6b8e8285 432
1d6589db
AE
433(define-public python-flint
434 (package
435 (name "python-flint")
436 (version "0.3.0")
437 (source (origin
438 (method git-fetch)
439 (uri (git-reference
440 (url "https://github.com/fredrik-johansson/python-flint.git")
441 (commit version)))
442 (file-name (git-file-name name version))
443 (sha256
444 (base32
445 "1v0anazbj1cfi68nl2j6dbd31kgkc1563xmr0zk5xk3xj78569pw"))
446 (patches (search-patches "python-flint-includes.patch"))))
447 (build-system python-build-system)
448 (native-inputs
449 `(("python-cython" ,python-cython)))
450 (propagated-inputs
451 `(("python-numpy" ,python-numpy)))
452 (inputs
453 `(("arb" ,arb)
454 ("flint" ,flint)))
455 (synopsis "Python module wrapping ARB and FLINT")
456 (description
457 "Python-flint is a Python extension module wrapping FLINT
458(Fast Library for Number Theory) and Arb (arbitrary-precision ball
459arithmetic). It supports integers, rationals, modular integers,
460real and complex ball arithmetic, polynomials and matrices over all
461these types and other mathematical functions.")
462 (license license:expat)
463 (home-page "http://fredrikj.net/python-flint/")))
464
14e6520e
AE
465(define-public ntl
466 (package
467 (name "ntl")
468 (version "9.7.0")
469 (source (origin
470 (method url-fetch)
471 (uri (string-append "http://shoup.net/ntl/ntl-"
472 version ".tar.gz"))
473 (sha256 (base32
474 "115frp5flyvw9wghz4zph1b3llmr5nbxk1skgsggckr81fh3gmxq"))))
475 (build-system gnu-build-system)
476 (native-inputs
477 `(("libtool" ,libtool)
478 ("perl" ,perl))) ; for configuration
479 ;; FIXME: Add optional input gf2x once available; then also add
480 ;; configure flag "NTL_GF2X_LIB=on".
481 (inputs
482 `(("gmp" ,gmp)))
483 (arguments
484 `(#:phases
485 (modify-phases %standard-phases
486 (replace 'configure
487 (lambda* (#:key outputs #:allow-other-keys)
488 (chdir "src")
489 (system* "./configure"
490 (string-append "PREFIX=" (assoc-ref outputs "out"))
491 ;; Do not build especially for the build machine.
492 "NATIVE=off"
493 ;; Also do not tune to the build machine.
494 "WIZARD=off"
495 "SHARED=on")
496 #t)))))
497 (synopsis "C++ library for number theory")
498 (description
499 "NTL is a C++ library providing data structures and algorithms
500for manipulating signed, arbitrary length integers, and for vectors,
501matrices, and polynomials over the integers and over finite fields.")
502 (license license:gpl2+)
503 (home-page "http://shoup.net/ntl/")))
504
aae03c48
AE
505(define-public singular
506 (package
507 (name "singular")
ff6807dc 508 (version "4.1.2p1")
f35c3bbb
KK
509 (source
510 (origin
511 (method url-fetch)
512 (uri
513 (string-append "http://www.mathematik.uni-kl.de/ftp/pub/Math/"
514 "Singular/SOURCES/"
515 (string-join
516 (string-split
517 (string-trim-right version #\p
518 0 (1- (string-length version)))
519 #\.) "-")
520 "/singular-" version ".tar.gz"))
521 (sha256 (base32
ff6807dc 522 "0kvd55353fiqyq1msmi0kka66n5h0aqs7m3km60r01b1w2f8085m"))))
aae03c48
AE
523 (build-system gnu-build-system)
524 (native-inputs
525 `(("doxygen" ,doxygen)
526 ("graphviz" ,graphviz)
527 ("perl" ,perl)))
528 (inputs
529 `(("cddlib" ,cddlib)
530 ("gmp" ,gmp)
531 ("flint" ,flint)
532 ("mpfr" ,mpfr)
533 ("ntl" ,ntl)
534 ("python" ,python-2)
535 ("readline" ,readline)))
536 (arguments
537 `(#:configure-flags
538 (list (string-append "--with-ntl="
539 (assoc-ref %build-inputs "ntl")))))
540 (synopsis "Computer algebra system for polynomial computations")
541 (description
542 "Singular is a computer algebra system for polynomial computations,
543with special emphasis on commutative and non-commutative algebra, algebraic
544geometry and singularity theory.")
545 ;; Singular itself is dual licensed gpl2 or gpl3, but some of the
546 ;; libraries with which it links are licensed under lgpl3+, so the
547 ;; combined work becomes gpl3. See COPYING in the source code.
548 (license license:gpl3)
549 (home-page "http://www.singular.uni-kl.de/index.php")))
550
57c9c349
AE
551(define-public gmp-ecm
552 (package
553 (name "gmp-ecm")
7d15cf17 554 (version "7.0.4")
57c9c349 555 (source (origin
7d15cf17
TGR
556 (method url-fetch)
557 ;; Use the ‘Latest version’ link for a stable URI across releases.
558 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
559 "latestfile/160/ecm-" version ".tar.gz"))
560 (sha256 (base32
561 "0hxs24c2m3mh0nq1zz63z3sb7dhy1rilg2s1igwwcb26x3pb7xqc"))))
57c9c349
AE
562 (build-system gnu-build-system)
563 (inputs
564 `(("gmp" ,gmp)))
565 (arguments
566 `(#:configure-flags '("--enable-shared"
567 ;; Disable specific assembly routines, which depend
568 ;; on the subarchitecture of the build machine,
569 ;; and use gmp instead.
570 "--disable-asm-redc")))
571 (synopsis "Integer factorization library using the elliptic curve method")
572 (description
573 "GMP-ECM factors integers using the elliptic curve method (ECM) as well
574as the P-1 and P+1 algorithms. It provides a library and a stand-alone
575binary.")
576 ;; Most files are under lgpl3+, but some are under gpl3+ or gpl2+,
577 ;; so the combined work is under gpl3+.
578 (license license:gpl3+)
579 (home-page "http://ecm.gforge.inria.fr/")))
580
ed9f9a77
LC
581(define-public bc
582 (package
583 (name "bc")
f71f29ca 584 (version "1.07.1")
ed9f9a77
LC
585 (source (origin
586 (method url-fetch)
587 (uri (string-append "mirror://gnu/bc/bc-" version ".tar.gz"))
588 (sha256
589 (base32
f71f29ca 590 "0amh9ik44jfg66csyvf4zz1l878c4755kjndq9j0270akflgrbb2"))))
ed9f9a77 591 (build-system gnu-build-system)
f71f29ca
MB
592 (native-inputs
593 `(("ed" ,ed)
594 ("flex" ,flex)
595 ("texinfo" ,texinfo)))
ed9f9a77 596 (arguments
f71f29ca 597 '(#:configure-flags
f0bacad6 598 (list "--with-readline")))
6fd52309 599 (home-page "https://www.gnu.org/software/bc/")
f50d2669 600 (synopsis "Arbitrary precision numeric processing language")
ed9f9a77 601 (description
a22dc0c4
LC
602 "bc is an arbitrary precision numeric processing language. It includes
603an interactive environment for evaluating mathematical statements. Its
604syntax is similar to that of C, so basic usage is familiar. It also includes
605\"dc\", a reverse-polish calculator.")
9f51293c 606 (license license:gpl2+)))
37e6cdcd 607
2a9b10c7
RW
608;; The original kiss-fft does not have a complete build system and does not
609;; build any shared libraries. This is a fork used by Extempore.
610(define-public kiss-fft-for-extempore
611 (package
612 (name "kiss-fft-for-extempore")
613 (version "1.3.0")
614 (source (origin
9774fac4
RW
615 (method git-fetch)
616 (uri (git-reference
617 (url "https://github.com/extemporelang/kiss_fft.git")
618 (commit version)))
619 (file-name (git-file-name name version))
2a9b10c7
RW
620 (sha256
621 (base32
9774fac4 622 "0jasbmqy4wkqrqx3w64s1dfmj34875xmsl72mb26aa4hpyn14bi2"))))
2a9b10c7
RW
623 (build-system cmake-build-system)
624 (arguments `(#:tests? #f)) ; no tests included
39162ee4
RW
625 ;; Extempore refuses to build on architectures other than x86_64
626 (supported-systems '("x86_64-linux"))
2a9b10c7
RW
627 (home-page "https://github.com/extemporelang/kiss_fft")
628 (synopsis "Mixed-radix Fast Fourier Transform")
629 (description
630 "Kiss FFT attempts to be a reasonably efficient, moderately useful FFT
631that can use fixed or floating data types and can easily be incorporated into
632a C program.")
633 (license license:bsd-3)))
634
37e6cdcd
LC
635(define-public fftw
636 (package
637 (name "fftw")
bdb74478 638 (version "3.3.8")
37e6cdcd
LC
639 (source (origin
640 (method url-fetch)
641 (uri (string-append "ftp://ftp.fftw.org/pub/fftw/fftw-"
642 version".tar.gz"))
643 (sha256
644 (base32
bdb74478 645 "00z3k8fq561wq2khssqg0kallk0504dzlx989x3vvicjdqpjc4v1"))))
37e6cdcd
LC
646 (build-system gnu-build-system)
647 (arguments
65bb2279 648 `(#:configure-flags
69d5909e
MW
649 '("--enable-shared" "--enable-openmp" "--enable-threads"
650 ,@(let ((system (or (%current-target-system) (%current-system))))
651 ;; Enable SIMD extensions for codelets. See details at:
652 ;; <http://fftw.org/fftw3_doc/Installation-on-Unix.html>.
653 (cond
654 ((string-prefix? "x86_64" system)
655 '("--enable-sse2" "--enable-avx" "--enable-avx2"
656 "--enable-avx512" "--enable-avx-128-fma"))
657 ((string-prefix? "i686" system)
658 '("--enable-sse2"))
659 ((string-prefix? "aarch64" system)
660 ;; Note that fftw supports NEON on 32-bit ARM only when
661 ;; compiled for single-precision.
662 '("--enable-neon"))
663 (else
664 '())))
65bb2279
EB
665 ;; By default '-mtune=native' is used. However, that may cause the
666 ;; use of ISA extensions (e.g. AVX) that are not necessarily
667 ;; available on the user's machine when that package is built on a
668 ;; different machine.
669 "ax_cv_c_flags__mtune_native=no")))
37e6cdcd
LC
670 (native-inputs `(("perl" ,perl)))
671 (home-page "http://fftw.org")
672 (synopsis "Computing the discrete Fourier transform")
673 (description
674 "FFTW is a C subroutine library for computing the discrete Fourier
675transform (DFT) in one or more dimensions, of arbitrary input size, and of
676both real and complex data (as well as of even/odd data---i.e. the discrete
677cosine/ sine transforms or DCT/DST).")
9f51293c 678 (license license:gpl2+)))
7569c5cb
EB
679
680(define-public fftwf
681 (package (inherit fftw)
682 (name "fftwf")
683 (arguments
684 (substitute-keyword-arguments (package-arguments fftw)
69d5909e
MW
685 ((#:configure-flags fftw-configure-flags)
686 `(cons* "--enable-single"
687 ,@(if (string-prefix? "arm" (or (%current-target-system)
688 (%current-system)))
689 ;; fftw supports NEON on 32-bit ARM only when compiled
690 ;; for single-precision, so add it here.
691 '("--enable-neon")
692 '())
693 ,fftw-configure-flags))))
7569c5cb
EB
694 (description
695 (string-append (package-description fftw)
696 " Single-precision version."))))
e5c66f8c
EB
697
698(define-public fftw-openmpi
699 (package (inherit fftw)
700 (name "fftw-openmpi")
701 (inputs
702 `(("openmpi" ,openmpi)
703 ,@(package-inputs fftw)))
704 (arguments
705 (substitute-keyword-arguments (package-arguments fftw)
706 ((#:configure-flags cf)
eb6785cf
EB
707 `(cons "--enable-mpi" ,cf))
708 ((#:phases phases '%standard-phases)
709 `(modify-phases ,phases
710 (add-before 'check 'mpi-setup
711 ,%openmpi-setup)))))
e5c66f8c
EB
712 (description
713 (string-append (package-description fftw)
714 " With OpenMPI parallelism support."))))
8f4b1dfb 715
c8d99608
RW
716(define-public java-la4j
717 (package
718 (name "java-la4j")
719 (version "0.6.0")
720 (source (origin
721 (method git-fetch)
722 (uri (git-reference
723 (url "https://github.com/vkostyukov/la4j.git")
724 (commit version)))
725 (file-name (string-append name "-" version "-checkout"))
726 (sha256
727 (base32
728 "1qir8dr978cfvz9k12m2kbdwpyf6cqdf1d0ilb7lnkhbgq5i53w3"))))
729 (build-system ant-build-system)
730 (arguments
731 `(#:jar-name "la4j.jar"
732 #:jdk ,icedtea-8
733 #:test-exclude (list "**/Abstract*.java"
734 "**/MatrixTest.java"
735 "**/DenseMatrixTest.java"
736 "**/SparseMatrixTest.java"
737 "**/VectorTest.java"
738 "**/SparseVectorTest.java"
739 "**/DenseVectorTest.java")))
740 (native-inputs
741 `(("java-junit" ,java-junit)
742 ("java-hamcrest-core" ,java-hamcrest-core)))
743 (home-page "http://la4j.org/")
744 (synopsis "Java library that provides Linear Algebra primitives and algorithms")
745 (description "The la4j library is a Java library that provides Linear
746Algebra primitives (matrices and vectors) and algorithms. The key features of
747the la4j library are:
748
749@itemize
750@item No dependencies and tiny size
751@item Fluent object-oriented/functional API
752@item Sparse (CRS, CCS) and dense (1D/2D arrays) matrices
753@item Linear systems solving (Gaussian, Jacobi, Zeidel, Square Root, Sweep and other)
754@item Matrices decomposition (Eigenvalues/Eigenvectors, SVD, QR, LU, Cholesky and other)
755@item MatrixMarket/CSV IO formats support for matrices and vectors
756@end itemize\n")
757 (license license:asl2.0)))
758
24074b0b
RW
759(define-public java-jlargearrays
760 (package
761 (name "java-jlargearrays")
762 (version "1.6")
763 (source (origin
764 (method url-fetch)
765 (uri (string-append "http://search.maven.org/remotecontent?"
766 "filepath=pl/edu/icm/JLargeArrays/"
767 version "/JLargeArrays-" version
768 "-sources.jar"))
769 (file-name (string-append name "-" version ".jar"))
770 (sha256
771 (base32
772 "0v05iphpxbjnd7f4jf1rlqq3m8hslhcm0imdbsgxr20pi3xkaf2a"))))
773 (build-system ant-build-system)
774 (arguments
775 `(#:jar-name "jlargearrays.jar"
776 #:tests? #f ; tests are not included in the release archive
777 #:jdk ,icedtea-8))
778 (propagated-inputs
779 `(("java-commons-math3" ,java-commons-math3)))
780 (home-page "https://gitlab.com/ICM-VisLab/JLargeArrays")
781 (synopsis "Library of one-dimensional arrays that can store up to 263 elements")
782 (description "JLargeArrays is a Java library of one-dimensional arrays
783that can store up to 263 elements.")
784 (license license:bsd-2)))
785
4e92911c
RW
786(define-public java-jtransforms
787 (package
788 (name "java-jtransforms")
789 (version "3.1")
790 (source (origin
791 (method url-fetch)
792 (uri (string-append "http://search.maven.org/remotecontent?"
793 "filepath=com/github/wendykierp/JTransforms/"
794 version "/JTransforms-" version "-sources.jar"))
795 (sha256
796 (base32
797 "1haw5m8shv5srgcpwkl853dz8bv6h90bzlhcps6mdpb4cixjirsg"))))
798 (build-system ant-build-system)
799 (arguments
800 `(#:jar-name "jtransforms.jar"
801 #:tests? #f ; tests are not included in the release archive
802 #:jdk ,icedtea-8))
803 (propagated-inputs
804 `(("java-commons-math3" ,java-commons-math3)
805 ("java-jlargearrays" ,java-jlargearrays)))
806 (home-page "https://github.com/wendykierp/JTransforms")
807 (synopsis "Multithreaded FFT library written in pure Java")
808 (description "JTransforms is a multithreaded FFT library written in pure
809Java. Currently, four types of transforms are available: @dfn{Discrete
810Fourier Transform} (DFT), @dfn{Discrete Cosine Transform} (DCT), @dfn{Discrete
811Sine Transform} (DST) and @dfn{Discrete Hartley Transform} (DHT).")
812 (license license:bsd-2)))
813
8f4b1dfb
LC
814(define-public eigen
815 (package
816 (name "eigen")
8cd80a4b 817 (version "3.3.5")
8f4b1dfb
LC
818 (source (origin
819 (method url-fetch)
820 (uri (string-append "https://bitbucket.org/eigen/eigen/get/"
9b268f12 821 version ".tar.bz2"))
8f4b1dfb
LC
822 (sha256
823 (base32
8cd80a4b 824 "1qh3yrwn78ms5yhwbpl5wvblk4gbz02cacdygxylr7i9xbrvylkk"))
2abcc935 825 (file-name (string-append name "-" version ".tar.bz2"))
8f4b1dfb
LC
826 (modules '((guix build utils)))
827 (snippet
828 ;; There are 3 test failures in the "unsupported" directory,
829 ;; but maintainers say it's a known issue and it's unsupported
830 ;; anyway, so just skip them.
1137d85b 831 '(begin
44884a9d
RW
832 (substitute* "unsupported/CMakeLists.txt"
833 (("add_subdirectory\\(test.*")
834 "# Do not build the tests for unsupported features.\n"))
6cbee49d 835 #t))))
8f4b1dfb
LC
836 (build-system cmake-build-system)
837 (arguments
838 '(;; Turn off debugging symbols to save space.
839 #:build-type "Release"
840
354f4fe2 841 #:phases (modify-phases %standard-phases
ef8742ea 842 (replace 'check
354f4fe2 843 (lambda _
354f4fe2
LC
844 (let* ((cores (parallel-job-count))
845 (dash-j (format #f "-j~a" cores)))
1137d85b 846 (setenv "EIGEN_SEED" "1") ;for reproducibility
ef8742ea
LC
847 ;; First build the tests, in parallel. See
848 ;; <http://eigen.tuxfamily.org/index.php?title=Tests>.
fbe9c80f 849 (invoke "make" "buildtests" dash-j)
8f4b1dfb 850
fbe9c80f
TGR
851 ;; Then run 'CTest' with -V so we get more
852 ;; details upon failure.
853 (invoke "ctest" "-V" dash-j)))))))
eeb8b0e6 854 (home-page "https://eigen.tuxfamily.org")
8f4b1dfb
LC
855 (synopsis "C++ template library for linear algebra")
856 (description
857 "Eigen is a C++ template library for linear algebra: matrices, vectors,
858numerical solvers, and related algorithms. It provides an elegant API based
859on \"expression templates\". It is versatile: it supports all matrix sizes,
860all standard numeric types, various matrix decompositions and geometry
861features, and more.")
862
863 ;; Most of the code is MPLv2, with a few files under LGPLv2.1+ or BSD-3.
864 ;; See 'COPYING.README' for details.
9f51293c 865 (license license:mpl2.0)))
70770b93 866
697eb65d
RW
867(define-public eigen-for-tensorflow
868 (let ((changeset "fd6845384b86")
869 (revision "1"))
870 (package (inherit eigen)
871 (name "eigen-for-tensorflow")
872 (version (string-append "3.3.5-" revision "." changeset))
873 (source (origin
874 (method hg-fetch)
875 (uri (hg-reference
876 (url "https://bitbucket.org/eigen/eigen")
877 (changeset changeset)))
878 (sha256
879 (base32
880 "12cwgah63wqwb66xji048hcxc1z5zjg8a7701zlia5zbilnnk1n5"))
881 (file-name (string-append name "-" version "-checkout"))
882 (modules '((guix build utils)))
883 (snippet
884 ;; There are 3 test failures in the "unsupported" directory,
885 ;; but maintainers say it's a known issue and it's unsupported
886 ;; anyway, so just skip them.
887 '(begin
888 (substitute* "unsupported/CMakeLists.txt"
889 (("add_subdirectory\\(test.*")
890 "# Do not build the tests for unsupported features.\n"))
891 #t)))))))
892
70770b93
FT
893(define-public xtensor
894 (package
895 (name "xtensor")
e1ecaa83 896 (version "0.17.1")
70770b93 897 (source (origin
e1ecaa83
KK
898 (method git-fetch)
899 (uri (git-reference
900 (url "https://github.com/QuantStack/xtensor.git")
901 (commit version)))
70770b93
FT
902 (sha256
903 (base32
e1ecaa83
KK
904 "0w40v5lp0hp8ihf8nnvak373sb5xx0768pxgiqh3nzn57wf8px4r"))
905 (file-name (git-file-name name version))))
70770b93
FT
906 (build-system cmake-build-system)
907 (native-inputs
908 `(("googletest" ,googletest)
909 ("xtl" ,xtl)))
910 (arguments
911 `(#:configure-flags
912 '("-DBUILD_TESTS=ON")
913 #:test-target "xtest"))
914 (home-page "http://quantstack.net/xtensor")
915 (synopsis "C++ tensors with broadcasting and lazy computing")
916 (description "xtensor is a C++ library meant for numerical analysis with
917multi-dimensional array expressions.
918
919xtensor provides:
920@itemize
921@item an extensible expression system enabling lazy broadcasting.
922@item an API following the idioms of the C++ standard library.
923@item tools to manipulate array expressions and build upon xtensor.
924@end itemize")
925 (license license:bsd-3)))
3f074a21
AE
926
927(define-public gap
928 (package
929 (name "gap")
930 (version "4.10.0")
931 (source
932 (origin
933 (method url-fetch)
934 (uri (string-append "https://www.gap-system.org/pub/gap/gap-"
935 (version-major+minor version)
936 "/tar.bz2/gap-"
937 version
938 ".tar.bz2"))
939 (sha256
940 (base32
941 "1dmb8v4p7j1nnf7sx8sg54b49yln36bi9acwp7w1d3a1nxj17ird"))
942 (modules '((guix build utils) (ice-9 ftw) (srfi srfi-1)))
943 (snippet
944 '(begin
945 ;; Delete the external gmp and zlib libraries
946 ;; and a subdirectory not needed for our build.
947 (for-each delete-file-recursively
948 '("extern" "hpcgap"))
949 ;; Delete a failing test.
950 ;; FIXME: This might be fixed in the next release, see
951 ;; https://github.com/gap-system/gap/issues/3292
952 (delete-file "tst/testinstall/dir.tst")
953 ;; Delete all packages except for a fixed list.
954 (with-directory-excursion "pkg"
955 (for-each delete-file-recursively
956 (lset-difference string=? (scandir ".")
957 '("." ".."
958 ;; Necessary packages.
959 "GAPDoc-1.6.2"
960 "primgrp-3.3.2"
961 "SmallGrp-1.3" ; artistic2.0
962 "transgrp" ; artistic2.0 for data,
963 ; gpl2 or gpl3 for code
964 ;; Recommanded package.
965 "io-4.5.4" ; gpl3+
966 ;; Optional packages, searched for at start,
967 ;; and their depedencies.
968 "alnuth-3.1.0"
969 "AutoDoc-2018.09.20"
970 "autpgrp-1.10"
971 "crisp-1.4.4" ; bsd-2
972 ; "ctbllib" ; no explicit license, drop
973 "FactInt-1.6.2"
974 "fga"
975 "irredsol-1.4" ; bsd-2
976 "laguna-3.9.0"
977 "polenta-1.3.8"
978 "polycyclic-2.14"
979 "radiroot-2.8"
980 "resclasses-4.7.1"
981 "sophus-1.24"
982 ; "tomlib-1.2.7" ; no explicit license, drop
983 "utils-0.59"))))
984 #t))))
985 (build-system gnu-build-system)
986 (inputs
987 `(("gmp" ,gmp)
988 ("zlib" ,zlib)))
989 (arguments
990 `(#:phases
991 (modify-phases %standard-phases
992 (add-after 'build 'build-packages
993 ;; Compile all packages that have not been deleted by the
994 ;; code snippet above.
995 (lambda _
996 (setenv "CONFIG_SHELL" (which "bash"))
997 (with-directory-excursion "pkg"
998 (invoke "../bin/BuildPackages.sh")
999 #t)))
1000 (add-after 'build-packages 'build-doc
1001 ;; The documentation is bundled, but we create it from source.
1002 (lambda _
1003 (with-directory-excursion "doc"
1004 (invoke "./make_doc"))
1005 #t))
1006 (replace 'check
1007 (lambda _
1008 ;; "make check" is expected to appear in gap-4.10.1
1009 (invoke "./gap" "tst/testinstall.g")
1010 #t))
1011 (replace 'install
1012 (lambda* (#:key outputs #:allow-other-keys)
1013 (let* ((out (assoc-ref outputs "out"))
1014 (bin (string-append out "/bin"))
1015 (prog (string-append bin "/gap"))
1016 (prog-real (string-append bin "/.gap-real"))
1017 (share (string-append out "/share/gap"))
1018 (include (string-append out "/include/gap")))
1019 ;; Install only the gap binary; the gac compiler is left
1020 ;; for maybe later. "Wrap" it in a shell script that calls
1021 ;; the binary with the correct parameter.
1022 (mkdir-p bin)
1023 (copy-file "gap" prog-real)
1024 (call-with-output-file prog
1025 (lambda (port)
1026 (format port
1027 "#!~a~%exec ~a -l ~a \"$@\"~%"
1028 (which "bash")
1029 prog-real
1030 share)))
1031 (chmod prog #o755)
1032 ;; Install the headers and the library, which are needed by
1033 ;; Sage. The Makefile targets are available in gap-4.10.0,
1034 ;; but planned to be removed in gap-4.10.1.
1035 (invoke "make" "install-headers")
1036 (invoke "make" "install-libgap")
1037 (install-file "gen/config.h" include)
1038 ;; Install a certain number of files and directories to
1039 ;; SHARE, where the wrapped shell script expects them.
1040 ;; Remove information on the build directory from sysinfo.gap.
1041 (substitute* "sysinfo.gap"
1042 (("GAP_BIN_DIR=\".*\"") "GAP_BIN_DIR=\"\"")
1043 (("GAP_LIB_DIR=\".*\"") "GAP_LIB_DIR=\"\"")
1044 (("GAP_CPPFLAGS=\".*\"") "GAP_CPPFLAGS=\"\""))
1045 (install-file "sysinfo.gap" share)
1046 (copy-recursively "grp" (string-append share "/grp"))
1047 (copy-recursively "pkg" (string-append share "/pkg"))
1048 ;; The following is not the C library libgap.so, but a
1049 ;; library of GAP code.
1050 (copy-recursively "lib" (string-append share "/lib"))
1051 ;; The gap binary looks for documentation inside SHARE.
1052 (copy-recursively "doc" (string-append share "/doc")))
1053 #t)))))
1054 (home-page "https://www.gap-system.org/")
1055 (synopsis
1056 "System for computational group theory")
1057 (description
1058 "GAP is a system for computational discrete algebra, with particular
1059emphasis on computational group theory. It provides a programming language,
1060a library of thousands of functions implementing algebraic algorithms
1061written in the GAP language as well as large data libraries of algebraic
1062objects.")
1063 ;; Some packages have different licenses (effectively forcing the
1064 ;; combined work to be licensed as gpl3+); if this is the case, this
1065 ;; is mentioned above next to their name.
1066 ;; Some packages have no license mentioned explicitly; supposedly this
1067 ;; means that the gpl2+ licence of GAP itself applies, but to be on the
1068 ;; safe side, we drop them for now.
1069 (license license:gpl2+)))