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