gnu: linux-libre: Update to 4.15, while retaining 4.14 LTS.
[jackhill/guix/guix.git] / gnu / packages / algebra.scm
CommitLineData
233e7676 1;;; GNU Guix --- Functional package management for GNU
21abf092 2;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Andreas Enge <andreas@enge.fr>
7355634d 3;;; Copyright © 2013, 2015, 2017 Ludovic Courtès <ludo@gnu.org>
47fefe98 4;;; Copyright © 2016, 2017, 2018 Nicolas Goaziou <mail@nicolasgoaziou.fr>
e2ca23c5 5;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
3b13c3c0 6;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
ecc5bc33 7;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
f0bacad6 8;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
f71f29ca 9;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
1137d85b 10;;; Copyright © 2017 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)
10b1f688 30 #:use-module (gnu packages compression)
99828fa7 31 #:use-module (gnu packages documentation)
f71f29ca 32 #:use-module (gnu packages ed)
5894b604 33 #:use-module (gnu packages flex)
57497c57
NG
34 #:use-module (gnu packages fltk)
35 #:use-module (gnu packages gl)
aae03c48 36 #:use-module (gnu packages graphviz)
57497c57 37 #:use-module (gnu packages image)
aae03c48 38 #:use-module (gnu packages maths)
0fc54d4b 39 #:use-module (gnu packages mpi)
5894b604 40 #:use-module (gnu packages multiprecision)
1ffa7090 41 #:use-module (gnu packages perl)
aae03c48 42 #:use-module (gnu packages python)
5894b604 43 #:use-module (gnu packages readline)
b7194849 44 #:use-module (gnu packages shells)
8f9ac901 45 #:use-module (gnu packages tex)
f71f29ca 46 #:use-module (gnu packages texinfo)
57497c57 47 #:use-module (gnu packages xiph)
fb8d1be8 48 #:use-module (gnu packages xorg)
7569c5cb 49 #:use-module (guix build-system gnu)
8f4b1dfb 50 #:use-module (guix build-system cmake)
5894b604
TGR
51 #:use-module (guix download)
52 #:use-module ((guix licenses) #:prefix license:)
53 #:use-module (guix packages)
7569c5cb 54 #:use-module (guix utils))
2ed139c4
AE
55
56
57(define-public mpfrcx
58 (package
59 (name "mpfrcx")
9c68798d 60 (version "0.4.2")
2ed139c4
AE
61 (source (origin
62 (method url-fetch)
63 (uri (string-append
64 "http://www.multiprecision.org/mpfrcx/download/mpfrcx-"
65 version ".tar.gz"))
66 (sha256
67 (base32
9c68798d 68 "0grw66b255r574lvll1bqccm5myj2m8ajzsjaygcyq9zjnnbnhhy"))))
2ed139c4 69 (build-system gnu-build-system)
878c8f3f
AE
70 (propagated-inputs
71 `(("gmp" ,gmp)
72 ("mpfr" ,mpfr)
73 ("mpc" ,mpc))) ; Header files are included by mpfrcx.h.
35b9e423 74 (synopsis "Arithmetic of polynomials over arbitrary precision numbers")
2ed139c4 75 (description
35b9e423 76 "Mpfrcx is a library for the arithmetic of univariate polynomials over
2ed139c4 77arbitrary precision real (mpfr) or complex (mpc) numbers, without control
35b9e423 78on the rounding. For the time being, only the few functions needed to
2ed139c4 79implement the floating point approach to complex multiplication are
35b9e423 80implemented. On the other hand, these comprise asymptotically fast
e881752c 81multiplication routines such as Toom–Cook and the FFT.")
9f51293c 82 (license license:lgpl2.1+)
2ed139c4
AE
83 (home-page "http://mpfrcx.multiprecision.org/")))
84
10b1f688
AE
85(define-public cm
86 (package
87 (name "cm")
81b55bf7 88 (version "0.3")
10b1f688
AE
89 (source (origin
90 (method url-fetch)
91 (uri (string-append
92 "http://www.multiprecision.org/cm/download/cm-"
93 version ".tar.gz"))
94 (sha256
95 (base32
81b55bf7 96 "1nf5kr0nqmhbzrsrinky18z0ighjpsmb5cr8zyg8jf04bfbyrfmc"))))
10b1f688
AE
97 (build-system gnu-build-system)
98 (propagated-inputs
99 `(("mpfrcx" ,mpfrcx)
100 ("zlib" ,zlib))) ; Header files included from cm_common.h.
101 (inputs
102 `(("pari-gp" ,pari-gp)))
103 (synopsis "CM constructions for elliptic curves")
104 (description
105 "The CM software implements the construction of ring class fields of
106imaginary quadratic number fields and of elliptic curves with complex
107multiplication via floating point approximations. It consists of libraries
108that can be called from within a C program and of executable command
109line applications.")
81b55bf7 110 (license license:gpl3+)
10b1f688
AE
111 (home-page "http://cm.multiprecision.org/")))
112
2ed139c4
AE
113(define-public fplll
114 (package
115 (name "fplll")
5a15ed50 116 (version "4.0.4")
2ed139c4
AE
117 (source (origin
118 (method url-fetch)
119 (uri (string-append
120 "http://perso.ens-lyon.fr/damien.stehle/fplll/libfplll-"
121 version ".tar.gz"))
122 (sha256 (base32
5a15ed50 123 "1cbiby7ykis4z84swclpysrljmqhfcllpkcbll1m08rzskgb1a6b"))))
2ed139c4
AE
124 (build-system gnu-build-system)
125 (inputs `(("gmp" ,gmp)
126 ("mpfr" ,mpfr)))
35b9e423 127 (synopsis "Library for LLL-reduction of euclidean lattices")
2ed139c4 128 (description
35b9e423 129 "fplll LLL-reduces euclidean lattices. Since version 3, it can also
2ed139c4 130solve the shortest vector problem.")
9f51293c 131 (license license:lgpl2.1+)
2ed139c4 132 (home-page "http://perso.ens-lyon.fr/damien.stehle/fplll/")))
4e6b699d 133
90a6d47c
AE
134(define-public pari-gp
135 (package
136 (name "pari-gp")
9054bbfe 137 (version "2.9.4")
90a6d47c
AE
138 (source (origin
139 (method url-fetch)
140 (uri (string-append
141 "http://pari.math.u-bordeaux.fr/pub/pari/unix/pari-"
142 version ".tar.gz"))
f78c66aa
AE
143 (sha256
144 (base32
9054bbfe 145 "0ir6m3a8r46md5x6zk4xf159qra7aqparby9zk03k81hjrrxr72g"))))
90a6d47c 146 (build-system gnu-build-system)
a8b0948b 147 (native-inputs `(("texlive" ,texlive-tiny)))
90a6d47c 148 (inputs `(("gmp" ,gmp)
fb8d1be8 149 ("libx11" ,libx11)
90a6d47c
AE
150 ("perl" ,perl)
151 ("readline" ,readline)))
152 (arguments
9bd9486d 153 '(#:make-flags '("all")
12abb19d 154 #:test-target "dobench"
08595262
AE
155 #:phases (modify-phases %standard-phases
156 (replace 'configure
157 (lambda* (#:key outputs #:allow-other-keys)
158 (let ((out (assoc-ref outputs "out")))
159 (zero?
160 (system* "./Configure"
161 (string-append "--prefix=" out)))))))))
90a6d47c
AE
162 (synopsis "PARI/GP, a computer algebra system for number theory")
163 (description
164 "PARI/GP is a widely used computer algebra system designed for fast
165computations in number theory (factorisations, algebraic number theory,
166elliptic curves...), but it also contains a large number of other useful
167functions to compute with mathematical entities such as matrices,
168polynomials, power series, algebraic numbers, etc., and a lot of
169transcendental functions.
170PARI is also available as a C library to allow for faster computations.")
9f51293c 171 (license license:gpl2+)
90a6d47c 172 (home-page "http://pari.math.u-bordeaux.fr/")))
ed9f9a77 173
f854a8c1
AE
174(define-public gp2c
175 (package
176 (name "gp2c")
0a77fdf4 177 (version "0.0.10")
f854a8c1
AE
178 (source (origin
179 (method url-fetch)
180 (uri (string-append
181 "http://pari.math.u-bordeaux.fr/pub/pari/GP2C/gp2c-"
182 version ".tar.gz"))
324bdcd8
AE
183 (sha256
184 (base32
0a77fdf4 185 "1xhpz5p81iw261ay1kip283ggr0ir8ydz8qx3v24z8jfms1r3y70"))))
f854a8c1 186 (build-system gnu-build-system)
c67ccedd 187 (native-inputs `(("perl" ,perl)))
f854a8c1
AE
188 (inputs `(("pari-gp" ,pari-gp)))
189 (arguments
190 '(#:configure-flags
191 (list (string-append "--with-paricfg="
192 (assoc-ref %build-inputs "pari-gp")
193 "/lib/pari/pari.cfg"))))
194 (synopsis "PARI/GP, a computer algebra system for number theory")
195 (description
196 "PARI/GP is a widely used computer algebra system designed for fast
197computations in number theory (factorisations, algebraic number theory,
198elliptic curves...), but it also contains a large number of other useful
199functions to compute with mathematical entities such as matrices,
200polynomials, power series, algebraic numbers, etc., and a lot of
201transcendental functions.
202PARI is also available as a C library to allow for faster computations.
203
204GP2C, the GP to C compiler, translates GP scripts to PARI programs.")
9f51293c 205 (license license:gpl2)
f854a8c1
AE
206 (home-page "http://pari.math.u-bordeaux.fr/")))
207
57497c57
NG
208(define-public giac-xcas
209 (package
210 (name "giac-xcas")
47fefe98 211 (version "1.4.9-43")
57497c57
NG
212 (source (origin
213 (method url-fetch)
214 ;; "~parisse/giac" is not used because the maintainer regularly
215 ;; overwrites the release tarball there, introducing a checksum
216 ;; mismatch every time. See
217 ;; <https://www-fourier.ujf-grenoble.fr/~parisse/debian/dists/stable/main/source/README>
218 (uri (string-append "https://www-fourier.ujf-grenoble.fr/"
219 "~parisse/debian/dists/stable/main/"
220 "source/giac_" version ".tar.gz"))
221 (sha256
222 (base32
47fefe98 223 "1zhbyw4mrgf78fz55cf65650zqld156qa40s4ps69bas8jh61hci"))))
57497c57
NG
224 (build-system gnu-build-system)
225 (arguments
226 `(#:phases
227 (modify-phases %standard-phases
228 (add-after 'unpack 'patch-bin-cp
229 (lambda _
230 ;; Some Makefiles contain hard-coded "/bin/cp".
231 (substitute* (find-files "doc" "^Makefile")
232 (("/bin/cp") (which "cp")))
57497c57
NG
233 #t)))))
234 (inputs
235 `(("fltk" ,fltk)
236 ("gmp" ,gmp)
237 ("gsl" ,gsl)
238 ("lapack" ,lapack)
239 ("libao" ,ao)
240 ("libjpeg" ,libjpeg)
241 ("libpng" ,libpng)
242 ("libx11" ,libx11)
99a00446 243 ("libxinerama" ,libxinerama)
57497c57
NG
244 ("libxft" ,libxft)
245 ("libxt" ,libxt)
246 ("mesa" ,mesa)
247 ("mpfi" ,mpfi)
248 ("mpfr" ,mpfr)
249 ("ntl" ,ntl)
250 ("perl" ,perl)
251 ("pari-gp" ,pari-gp)
252 ("tcsh" ,tcsh)
a023ec6e 253 ("texlive" ,texlive-tiny)))
57497c57
NG
254 (native-inputs `(("readline" ,readline)))
255 (home-page "https://www-fourier.ujf-grenoble.fr/~parisse/giac.html")
256 (synopsis "Computer algebra system")
257 (description
258 "Giac/Xcas is a computer algebra system. It has a compatibility mode for
259maple, mupad and the TI89. It is available as a standalone program (graphic
260or text interfaces) or as a C++ library.")
261 (license license:gpl3+)))
262
d7ab698a
AE
263(define-public flint
264 (package
265 (name "flint")
6c591c8e 266 (version "2.5.2")
d7ab698a
AE
267 (source (origin
268 (method url-fetch)
269 (uri (string-append
270 "http://flintlib.org/flint-"
271 version ".tar.gz"))
272 (sha256 (base32
6c591c8e 273 "11syazv1a8rrnac3wj3hnyhhflpqcmq02q8pqk2m6g2k6h0gxwfb"))
fc1adab1 274 (patches (search-patches "flint-ldconfig.patch"))))
d7ab698a 275 (build-system gnu-build-system)
df15d17d 276 (propagated-inputs
d7ab698a 277 `(("gmp" ,gmp)
df15d17d 278 ("mpfr" ,mpfr))) ; header files from both are included by flint/arith.h
d7ab698a 279 (arguments
ad11974e
AE
280 `(#:parallel-tests? #f ; seems to be necessary on arm
281 #:phases
91430de6
AE
282 (modify-phases %standard-phases
283 (replace 'configure
284 (lambda* (#:key inputs outputs #:allow-other-keys)
285 (let ((out (assoc-ref outputs "out"))
286 (gmp (assoc-ref inputs "gmp"))
287 (mpfr (assoc-ref inputs "mpfr")))
91430de6
AE
288 ;; do not pass "--enable-fast-install", which makes the
289 ;; homebrew configure process fail
290 (zero? (system*
291 "./configure"
292 (string-append "--prefix=" out)
293 (string-append "--with-gmp=" gmp)
294 (string-append "--with-mpfr=" mpfr)))))))))
d7ab698a
AE
295 (synopsis "Fast library for number theory")
296 (description
297 "FLINT is a C library for number theory. It supports arithmetic
298with numbers, polynomials, power series and matrices over many base
299rings, including multiprecision integers and rationals, integers
300modulo n, p-adic numbers, finite fields (prime and non-prime order)
301and real and complex numbers (via the Arb extension library).
302
303Operations that can be performed include conversions, arithmetic,
304GCDs, factoring, solving linear systems, and evaluating special
305functions. In addition, FLINT provides various low-level routines for
306fast arithmetic.")
9f51293c 307 (license license:gpl2+)
d7ab698a
AE
308 (home-page "http://flintlib.org/")))
309
6b8e8285
AE
310(define-public arb
311 (package
312 (name "arb")
b1225dd3 313 (version "2.12.0")
6b8e8285
AE
314 (source (origin
315 (method url-fetch)
316 (uri (string-append
317 "https://github.com/fredrik-johansson/arb/archive/"
318 version ".tar.gz"))
f586c877 319 (file-name (string-append name "-" version ".tar.gz"))
424ce93d
AE
320 (sha256
321 (base32
b1225dd3 322 "0j37xkxbqpra4sf0a96x4sqbl5fkal8d7c94bi9wdsqqj6kgcsil"))))
6b8e8285 323 (build-system gnu-build-system)
480d19e6
AE
324 (propagated-inputs
325 `(("flint" ,flint))) ; flint.h is included by arf.h
6b8e8285 326 (inputs
480d19e6 327 `(("gmp" ,gmp)
6b8e8285
AE
328 ("mpfr" ,mpfr)))
329 (arguments
330 `(#:phases
dc1d3cde
KK
331 (modify-phases %standard-phases
332 (replace 'configure
333 (lambda* (#:key inputs outputs #:allow-other-keys)
334 (let ((out (assoc-ref outputs "out"))
335 (flint (assoc-ref inputs "flint"))
336 (gmp (assoc-ref inputs "gmp"))
337 (mpfr (assoc-ref inputs "mpfr")))
338 ;; do not pass "--enable-fast-install", which makes the
339 ;; homebrew configure process fail
340 (zero? (system*
341 "./configure"
342 (string-append "--prefix=" out)
343 (string-append "--with-flint=" flint)
344 (string-append "--with-gmp=" gmp)
345 (string-append "--with-mpfr=" mpfr)))))))))
6b8e8285
AE
346 (synopsis "Arbitrary precision floating-point ball arithmetic")
347 (description
348 "Arb is a C library for arbitrary-precision floating-point ball
349arithmetic. It supports efficient high-precision computation with
350polynomials, power series, matrices and special functions over the
351real and complex numbers, with automatic, rigorous error control.")
9f51293c 352 (license license:gpl2+)
6b8e8285
AE
353 (home-page "http://fredrikj.net/arb/")))
354
14e6520e
AE
355(define-public ntl
356 (package
357 (name "ntl")
358 (version "9.7.0")
359 (source (origin
360 (method url-fetch)
361 (uri (string-append "http://shoup.net/ntl/ntl-"
362 version ".tar.gz"))
363 (sha256 (base32
364 "115frp5flyvw9wghz4zph1b3llmr5nbxk1skgsggckr81fh3gmxq"))))
365 (build-system gnu-build-system)
366 (native-inputs
367 `(("libtool" ,libtool)
368 ("perl" ,perl))) ; for configuration
369 ;; FIXME: Add optional input gf2x once available; then also add
370 ;; configure flag "NTL_GF2X_LIB=on".
371 (inputs
372 `(("gmp" ,gmp)))
373 (arguments
374 `(#:phases
375 (modify-phases %standard-phases
376 (replace 'configure
377 (lambda* (#:key outputs #:allow-other-keys)
378 (chdir "src")
379 (system* "./configure"
380 (string-append "PREFIX=" (assoc-ref outputs "out"))
381 ;; Do not build especially for the build machine.
382 "NATIVE=off"
383 ;; Also do not tune to the build machine.
384 "WIZARD=off"
385 "SHARED=on")
386 #t)))))
387 (synopsis "C++ library for number theory")
388 (description
389 "NTL is a C++ library providing data structures and algorithms
390for manipulating signed, arbitrary length integers, and for vectors,
391matrices, and polynomials over the integers and over finite fields.")
392 (license license:gpl2+)
393 (home-page "http://shoup.net/ntl/")))
394
aae03c48
AE
395(define-public singular
396 (package
397 (name "singular")
398 (version "4.0.3")
399 (source (origin
400 (method url-fetch)
401 (uri (string-append "http://www.mathematik.uni-kl.de/ftp/pub/"
402 "Math/Singular/SOURCES/"
403 (string-join (string-split version #\.) "-")
404 "/singular-" version ".tar.gz"))
405 (sha256 (base32
7d4c6ee8 406 "0viidy2fz62rln9p0s9qfs7fnm55c6fw1agydd1py26gxylp1ksc"))))
aae03c48
AE
407 (build-system gnu-build-system)
408 (native-inputs
409 `(("doxygen" ,doxygen)
410 ("graphviz" ,graphviz)
411 ("perl" ,perl)))
412 (inputs
413 `(("cddlib" ,cddlib)
414 ("gmp" ,gmp)
415 ("flint" ,flint)
416 ("mpfr" ,mpfr)
417 ("ntl" ,ntl)
418 ("python" ,python-2)
419 ("readline" ,readline)))
420 (arguments
421 `(#:configure-flags
422 (list (string-append "--with-ntl="
423 (assoc-ref %build-inputs "ntl")))))
424 (synopsis "Computer algebra system for polynomial computations")
425 (description
426 "Singular is a computer algebra system for polynomial computations,
427with special emphasis on commutative and non-commutative algebra, algebraic
428geometry and singularity theory.")
429 ;; Singular itself is dual licensed gpl2 or gpl3, but some of the
430 ;; libraries with which it links are licensed under lgpl3+, so the
431 ;; combined work becomes gpl3. See COPYING in the source code.
432 (license license:gpl3)
433 (home-page "http://www.singular.uni-kl.de/index.php")))
434
57c9c349
AE
435(define-public gmp-ecm
436 (package
437 (name "gmp-ecm")
438 (version "7.0")
439 (source (origin
440 (method url-fetch)
441 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
442 "file/35642/ecm-"
443 version ".tar.gz"))
444 (sha256 (base32
445 "00jzzwqp49m01vwsr9z1w7bvm8lb69l3f62x7qr8sfz0xiczxnpm"))))
446 (build-system gnu-build-system)
447 (inputs
448 `(("gmp" ,gmp)))
449 (arguments
450 `(#:configure-flags '("--enable-shared"
451 ;; Disable specific assembly routines, which depend
452 ;; on the subarchitecture of the build machine,
453 ;; and use gmp instead.
454 "--disable-asm-redc")))
455 (synopsis "Integer factorization library using the elliptic curve method")
456 (description
457 "GMP-ECM factors integers using the elliptic curve method (ECM) as well
458as the P-1 and P+1 algorithms. It provides a library and a stand-alone
459binary.")
460 ;; Most files are under lgpl3+, but some are under gpl3+ or gpl2+,
461 ;; so the combined work is under gpl3+.
462 (license license:gpl3+)
463 (home-page "http://ecm.gforge.inria.fr/")))
464
ed9f9a77
LC
465(define-public bc
466 (package
467 (name "bc")
f71f29ca 468 (version "1.07.1")
ed9f9a77
LC
469 (source (origin
470 (method url-fetch)
471 (uri (string-append "mirror://gnu/bc/bc-" version ".tar.gz"))
472 (sha256
473 (base32
f71f29ca 474 "0amh9ik44jfg66csyvf4zz1l878c4755kjndq9j0270akflgrbb2"))))
ed9f9a77 475 (build-system gnu-build-system)
f71f29ca
MB
476 (native-inputs
477 `(("ed" ,ed)
478 ("flex" ,flex)
479 ("texinfo" ,texinfo)))
ed9f9a77 480 (arguments
f71f29ca 481 '(#:configure-flags
f0bacad6 482 (list "--with-readline")))
6fd52309 483 (home-page "https://www.gnu.org/software/bc/")
f50d2669 484 (synopsis "Arbitrary precision numeric processing language")
ed9f9a77 485 (description
a22dc0c4
LC
486 "bc is an arbitrary precision numeric processing language. It includes
487an interactive environment for evaluating mathematical statements. Its
488syntax is similar to that of C, so basic usage is familiar. It also includes
489\"dc\", a reverse-polish calculator.")
9f51293c 490 (license license:gpl2+)))
37e6cdcd 491
2a9b10c7
RW
492;; The original kiss-fft does not have a complete build system and does not
493;; build any shared libraries. This is a fork used by Extempore.
494(define-public kiss-fft-for-extempore
495 (package
496 (name "kiss-fft-for-extempore")
497 (version "1.3.0")
498 (source (origin
499 (method url-fetch)
500 (uri (string-append "https://github.com/extemporelang/kiss_fft/archive/"
501 version ".tar.gz"))
502 (file-name (string-append name "-" version ".tar.gz"))
503 (sha256
504 (base32
505 "0hkp9l6l4c92fb1l2sh6a6zv1hynpvb2s4d03vd8vxyvybc0l4pv"))))
506 (build-system cmake-build-system)
507 (arguments `(#:tests? #f)) ; no tests included
39162ee4
RW
508 ;; Extempore refuses to build on architectures other than x86_64
509 (supported-systems '("x86_64-linux"))
2a9b10c7
RW
510 (home-page "https://github.com/extemporelang/kiss_fft")
511 (synopsis "Mixed-radix Fast Fourier Transform")
512 (description
513 "Kiss FFT attempts to be a reasonably efficient, moderately useful FFT
514that can use fixed or floating data types and can easily be incorporated into
515a C program.")
516 (license license:bsd-3)))
517
37e6cdcd
LC
518(define-public fftw
519 (package
520 (name "fftw")
1ebb9a27 521 (version "3.3.5")
37e6cdcd
LC
522 (source (origin
523 (method url-fetch)
524 (uri (string-append "ftp://ftp.fftw.org/pub/fftw/fftw-"
525 version".tar.gz"))
526 (sha256
527 (base32
1ebb9a27 528 "1kwbx92ps0r7s2mqy7lxbxanslxdzj7dp7r7gmdkzv1j8yqf3kwf"))))
37e6cdcd
LC
529 (build-system gnu-build-system)
530 (arguments
86f4e9d7
RW
531 '(#:configure-flags
532 '("--enable-shared" "--enable-openmp" "--enable-threads")
37e6cdcd
LC
533 #:phases (alist-cons-before
534 'build 'no-native
535 (lambda _
536 ;; By default '-mtune=native' is used. However, that may
537 ;; cause the use of ISA extensions (SSE2, etc.) that are
538 ;; not necessarily available on the user's machine when
539 ;; that package is built on a different machine.
540 (substitute* (find-files "." "Makefile$")
541 (("-mtune=native") "")))
542 %standard-phases)))
543 (native-inputs `(("perl" ,perl)))
544 (home-page "http://fftw.org")
545 (synopsis "Computing the discrete Fourier transform")
546 (description
547 "FFTW is a C subroutine library for computing the discrete Fourier
548transform (DFT) in one or more dimensions, of arbitrary input size, and of
549both real and complex data (as well as of even/odd data---i.e. the discrete
550cosine/ sine transforms or DCT/DST).")
9f51293c 551 (license license:gpl2+)))
7569c5cb
EB
552
553(define-public fftwf
554 (package (inherit fftw)
555 (name "fftwf")
556 (arguments
557 (substitute-keyword-arguments (package-arguments fftw)
558 ((#:configure-flags cf)
559 `(cons "--enable-float" ,cf))))
560 (description
561 (string-append (package-description fftw)
562 " Single-precision version."))))
e5c66f8c
EB
563
564(define-public fftw-openmpi
565 (package (inherit fftw)
566 (name "fftw-openmpi")
567 (inputs
568 `(("openmpi" ,openmpi)
569 ,@(package-inputs fftw)))
570 (arguments
571 (substitute-keyword-arguments (package-arguments fftw)
572 ((#:configure-flags cf)
573 `(cons "--enable-mpi" ,cf))))
574 (description
575 (string-append (package-description fftw)
576 " With OpenMPI parallelism support."))))
8f4b1dfb
LC
577
578(define-public eigen
579 (package
580 (name "eigen")
1137d85b 581 (version "3.3.4")
8f4b1dfb
LC
582 (source (origin
583 (method url-fetch)
584 (uri (string-append "https://bitbucket.org/eigen/eigen/get/"
9b268f12 585 version ".tar.bz2"))
8f4b1dfb
LC
586 (sha256
587 (base32
1137d85b 588 "19m4406jvqnwh7kpcvx1lfx2vdc5zwia5q9ayv89bimg1gmln9fx"))
2abcc935 589 (file-name (string-append name "-" version ".tar.bz2"))
1137d85b 590 (patches (search-patches "eigen-arm-neon-fixes.patch"))
8f4b1dfb
LC
591 (modules '((guix build utils)))
592 (snippet
593 ;; There are 3 test failures in the "unsupported" directory,
594 ;; but maintainers say it's a known issue and it's unsupported
595 ;; anyway, so just skip them.
1137d85b
EB
596 '(begin
597 (substitute* "CMakeLists.txt"
598 (("add_subdirectory\\(unsupported\\)")
599 "# Do not build the tests for unsupported features.\n")
600 ;; Work around
601 ;; <http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1114>.
602 (("\"include/eigen3\"")
603 "\"${CMAKE_INSTALL_PREFIX}/include/eigen3\""))
604 (substitute* "test/bdcsvd.cpp"
605 ;; See
606 ;; https://bitbucket.org/eigen/eigen/commits/ea8c22ce6920e982d15245ee41d0531a46a28e5d
607 ((".*svd_preallocate[^\n]*" &)
608 (string-append "//" & " // Not supported by BDCSVD")))))))
8f4b1dfb
LC
609 (build-system cmake-build-system)
610 (arguments
611 '(;; Turn off debugging symbols to save space.
612 #:build-type "Release"
613
354f4fe2 614 #:phases (modify-phases %standard-phases
ef8742ea 615 (replace 'check
354f4fe2 616 (lambda _
354f4fe2
LC
617 (let* ((cores (parallel-job-count))
618 (dash-j (format #f "-j~a" cores)))
1137d85b 619 (setenv "EIGEN_SEED" "1") ;for reproducibility
ef8742ea
LC
620 ;; First build the tests, in parallel. See
621 ;; <http://eigen.tuxfamily.org/index.php?title=Tests>.
622 (and (zero? (system* "make" "buildtests" dash-j))
8f4b1dfb 623
ef8742ea
LC
624 ;; Then run 'CTest' with -V so we get more
625 ;; details upon failure.
626 (zero? (system* "ctest" "-V" dash-j)))))))))
8f4b1dfb
LC
627 (home-page "http://eigen.tuxfamily.org")
628 (synopsis "C++ template library for linear algebra")
629 (description
630 "Eigen is a C++ template library for linear algebra: matrices, vectors,
631numerical solvers, and related algorithms. It provides an elegant API based
632on \"expression templates\". It is versatile: it supports all matrix sizes,
633all standard numeric types, various matrix decompositions and geometry
634features, and more.")
635
636 ;; Most of the code is MPLv2, with a few files under LGPLv2.1+ or BSD-3.
637 ;; See 'COPYING.README' for details.
9f51293c 638 (license license:mpl2.0)))