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