gnu: nnn: Don't use NAME in source URI.
[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 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 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.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
150 "1jfax92jpydjd02fwl30r6b8kfzqqd6sm4yx94gidyz9lqjb7a94"))))
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
173 computations in number theory (factorisations, algebraic number theory,
174 elliptic curves...), but it also contains a large number of other useful
175 functions to compute with mathematical entities such as matrices,
176 polynomials, power series, algebraic numbers, etc., and a lot of
177 transcendental functions.
178 PARI is also available as a C library to allow for faster computations.")
179 (license license:gpl2+)
180 (home-page "https://pari.math.u-bordeaux.fr/")))
181
182 (define-public gp2c
183 (package
184 (name "gp2c")
185 (version "0.0.11pl1")
186 (source (origin
187 (method url-fetch)
188 (uri (string-append
189 "https://pari.math.u-bordeaux.fr/pub/pari/GP2C/gp2c-"
190 version ".tar.gz"))
191 (sha256
192 (base32
193 "1c6f6vmncw032kfzrfyr8bynw6yd3faxpy2285r009fmr0zxfs5s"))))
194 (build-system gnu-build-system)
195 (native-inputs `(("perl" ,perl)))
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
205 computations in number theory (factorisations, algebraic number theory,
206 elliptic curves...), but it also contains a large number of other useful
207 functions to compute with mathematical entities such as matrices,
208 polynomials, power series, algebraic numbers, etc., and a lot of
209 transcendental functions.
210 PARI is also available as a C library to allow for faster computations.
211
212 GP2C, the GP to C compiler, translates GP scripts to PARI programs.")
213 (license license:gpl2)
214 (home-page "https://pari.math.u-bordeaux.fr/")))
215
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
239 parameterize the CM points in the moduli space of 2-dimensional abelian
240 varieties, i.e. Jacobians of hyperelliptic curves.
241 It can also be used to compute theta constants at arbitrary
242 precision.")
243 (license license:gpl3+)
244 (home-page "http://cmh.gforge.inria.fr/")))
245
246 (define-public giac-xcas
247 (package
248 (name "giac-xcas")
249 (version "1.5.0-37")
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
261 "1c6jmswv3ay13n6mjgh9w7nbpdgm5lbwdcmva5sli3vqn4chn3vq"))))
262 (build-system gnu-build-system)
263 (outputs '("out" "doc")) ;77MiB of documentation
264 (arguments
265 `(#:modules ((ice-9 ftw)
266 (guix build utils)
267 (guix build gnu-build-system))
268 #:phases
269 (modify-phases %standard-phases
270 (add-after 'unpack 'patch-bin-cp
271 ;; Some Makefiles contain hard-coded "/bin/cp".
272 (lambda _
273 (substitute* (find-files "doc" "^Makefile")
274 (("/bin/cp") (which "cp")))
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") ""))
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")))
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)
313 ("libxinerama" ,libxinerama)
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)
323 ("texlive" ,texlive-tiny)))
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
329 maple, mupad and the TI89. It is available as a standalone program (graphic
330 or text interfaces) or as a C++ library.")
331 (license license:gpl3+)))
332
333 (define-public flint
334 (package
335 (name "flint")
336 (version "2.5.2")
337 (source (origin
338 (method url-fetch)
339 (uri (string-append
340 "http://flintlib.org/flint-"
341 version ".tar.gz"))
342 (sha256 (base32
343 "11syazv1a8rrnac3wj3hnyhhflpqcmq02q8pqk2m6g2k6h0gxwfb"))
344 (patches (search-patches "flint-ldconfig.patch"))))
345 (build-system gnu-build-system)
346 (propagated-inputs
347 `(("gmp" ,gmp)
348 ("mpfr" ,mpfr))) ; header files from both are included by flint/arith.h
349 (arguments
350 `(#:parallel-tests? #f ; seems to be necessary on arm
351 #:phases
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")))
358 ;; do not pass "--enable-fast-install", which makes the
359 ;; homebrew configure process fail
360 (invoke "./configure"
361 (string-append "--prefix=" out)
362 (string-append "--with-gmp=" gmp)
363 (string-append "--with-mpfr=" mpfr))
364 #t))))))
365 (synopsis "Fast library for number theory")
366 (description
367 "FLINT is a C library for number theory. It supports arithmetic
368 with numbers, polynomials, power series and matrices over many base
369 rings, including multiprecision integers and rationals, integers
370 modulo n, p-adic numbers, finite fields (prime and non-prime order)
371 and real and complex numbers (via the Arb extension library).
372
373 Operations that can be performed include conversions, arithmetic,
374 GCDs, factoring, solving linear systems, and evaluating special
375 functions. In addition, FLINT provides various low-level routines for
376 fast arithmetic.")
377 (license license:gpl2+)
378 (home-page "http://flintlib.org/")))
379
380 (define-public arb
381 (package
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
418 arithmetic. It supports efficient high-precision computation with
419 polynomials, power series, matrices and special functions over the
420 real and complex numbers, with automatic, rigorous error control.")
421 (license license:lgpl2.1+)
422 (home-page "http://fredrikj.net/arb/")))
423
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
459 for manipulating signed, arbitrary length integers, and for vectors,
460 matrices, and polynomials over the integers and over finite fields.")
461 (license license:gpl2+)
462 (home-page "http://shoup.net/ntl/")))
463
464 (define-public singular
465 (package
466 (name "singular")
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"))))
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,
502 with special emphasis on commutative and non-commutative algebra, algebraic
503 geometry 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
510 (define-public gmp-ecm
511 (package
512 (name "gmp-ecm")
513 (version "7.0.4")
514 (source (origin
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"))))
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
533 as the P-1 and P+1 algorithms. It provides a library and a stand-alone
534 binary.")
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
540 (define-public bc
541 (package
542 (name "bc")
543 (version "1.07.1")
544 (source (origin
545 (method url-fetch)
546 (uri (string-append "mirror://gnu/bc/bc-" version ".tar.gz"))
547 (sha256
548 (base32
549 "0amh9ik44jfg66csyvf4zz1l878c4755kjndq9j0270akflgrbb2"))))
550 (build-system gnu-build-system)
551 (native-inputs
552 `(("ed" ,ed)
553 ("flex" ,flex)
554 ("texinfo" ,texinfo)))
555 (arguments
556 '(#:configure-flags
557 (list "--with-readline")))
558 (home-page "https://www.gnu.org/software/bc/")
559 (synopsis "Arbitrary precision numeric processing language")
560 (description
561 "bc is an arbitrary precision numeric processing language. It includes
562 an interactive environment for evaluating mathematical statements. Its
563 syntax is similar to that of C, so basic usage is familiar. It also includes
564 \"dc\", a reverse-polish calculator.")
565 (license license:gpl2+)))
566
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
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))
579 (sha256
580 (base32
581 "0jasbmqy4wkqrqx3w64s1dfmj34875xmsl72mb26aa4hpyn14bi2"))))
582 (build-system cmake-build-system)
583 (arguments `(#:tests? #f)) ; no tests included
584 ;; Extempore refuses to build on architectures other than x86_64
585 (supported-systems '("x86_64-linux"))
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
590 that can use fixed or floating data types and can easily be incorporated into
591 a C program.")
592 (license license:bsd-3)))
593
594 (define-public fftw
595 (package
596 (name "fftw")
597 (version "3.3.8")
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
604 "00z3k8fq561wq2khssqg0kallk0504dzlx989x3vvicjdqpjc4v1"))))
605 (build-system gnu-build-system)
606 (arguments
607 `(#:configure-flags
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 '())))
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")))
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
634 transform (DFT) in one or more dimensions, of arbitrary input size, and of
635 both real and complex data (as well as of even/odd data---i.e. the discrete
636 cosine/ sine transforms or DCT/DST).")
637 (license license:gpl2+)))
638
639 (define-public fftwf
640 (package (inherit fftw)
641 (name "fftwf")
642 (arguments
643 (substitute-keyword-arguments (package-arguments fftw)
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))))
653 (description
654 (string-append (package-description fftw)
655 " Single-precision version."))))
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)
666 `(cons "--enable-mpi" ,cf))
667 ((#:phases phases '%standard-phases)
668 `(modify-phases ,phases
669 (add-before 'check 'mpi-setup
670 ,%openmpi-setup)))))
671 (description
672 (string-append (package-description fftw)
673 " With OpenMPI parallelism support."))))
674
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
705 Algebra primitives (matrices and vectors) and algorithms. The key features of
706 the 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
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
742 that can store up to 263 elements.")
743 (license license:bsd-2)))
744
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
768 Java. Currently, four types of transforms are available: @dfn{Discrete
769 Fourier Transform} (DFT), @dfn{Discrete Cosine Transform} (DCT), @dfn{Discrete
770 Sine Transform} (DST) and @dfn{Discrete Hartley Transform} (DHT).")
771 (license license:bsd-2)))
772
773 (define-public eigen
774 (package
775 (name "eigen")
776 (version "3.3.5")
777 (source (origin
778 (method url-fetch)
779 (uri (string-append "https://bitbucket.org/eigen/eigen/get/"
780 version ".tar.bz2"))
781 (sha256
782 (base32
783 "1qh3yrwn78ms5yhwbpl5wvblk4gbz02cacdygxylr7i9xbrvylkk"))
784 (file-name (string-append name "-" version ".tar.bz2"))
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.
790 '(begin
791 (substitute* "unsupported/CMakeLists.txt"
792 (("add_subdirectory\\(test.*")
793 "# Do not build the tests for unsupported features.\n"))
794 #t))))
795 (build-system cmake-build-system)
796 (arguments
797 '(;; Turn off debugging symbols to save space.
798 #:build-type "Release"
799
800 #:phases (modify-phases %standard-phases
801 (replace 'check
802 (lambda _
803 (let* ((cores (parallel-job-count))
804 (dash-j (format #f "-j~a" cores)))
805 (setenv "EIGEN_SEED" "1") ;for reproducibility
806 ;; First build the tests, in parallel. See
807 ;; <http://eigen.tuxfamily.org/index.php?title=Tests>.
808 (invoke "make" "buildtests" dash-j)
809
810 ;; Then run 'CTest' with -V so we get more
811 ;; details upon failure.
812 (invoke "ctest" "-V" dash-j)))))))
813 (home-page "https://eigen.tuxfamily.org")
814 (synopsis "C++ template library for linear algebra")
815 (description
816 "Eigen is a C++ template library for linear algebra: matrices, vectors,
817 numerical solvers, and related algorithms. It provides an elegant API based
818 on \"expression templates\". It is versatile: it supports all matrix sizes,
819 all standard numeric types, various matrix decompositions and geometry
820 features, 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.
824 (license license:mpl2.0)))
825
826 (define-public xtensor
827 (package
828 (name "xtensor")
829 (version "0.17.1")
830 (source (origin
831 (method git-fetch)
832 (uri (git-reference
833 (url "https://github.com/QuantStack/xtensor.git")
834 (commit version)))
835 (sha256
836 (base32
837 "0w40v5lp0hp8ihf8nnvak373sb5xx0768pxgiqh3nzn57wf8px4r"))
838 (file-name (git-file-name name version))))
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
850 multi-dimensional array expressions.
851
852 xtensor 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)))