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