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