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