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