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