gnu: Add amtk.
[jackhill/guix/guix.git] / gnu / packages / sagemath.scm
CommitLineData
adba6466
AE
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2019 Andreas Enge <andreas@enge.fr>
a65f1e8e 3;;; Copyright © 2019 Nicolas Goaziou <mail@nicolasgoaziou.fr>
adba6466
AE
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (gnu packages sagemath)
21 #:use-module ((guix licenses) #:prefix license:)
20caeea4 22 #:use-module (guix build-system gnu)
adba6466 23 #:use-module (guix build-system python)
972ef8f5
AE
24 #:use-module (guix download)
25 #:use-module (guix git-download)
26 #:use-module (guix packages)
9fafb0d2 27 #:use-module (guix utils)
fedb9571 28 #:use-module (gnu packages)
adba6466 29 #:use-module (gnu packages algebra)
972ef8f5 30 #:use-module (gnu packages autotools)
4c32f116 31 #:use-module (gnu packages bdw-gc)
a1dcaacb 32 #:use-module (gnu packages boost)
5e388a6e 33 #:use-module (gnu packages compression)
a1dcaacb 34 #:use-module (gnu packages image)
adba6466 35 #:use-module (gnu packages multiprecision)
3923e9d9 36 #:use-module (gnu packages pkg-config)
adba6466
AE
37 #:use-module (gnu packages python)
38 #:use-module (gnu packages python-xyz))
39
40
41(define-public python-cypari2
ff33c38c
AE
42 (package
43 (name "python-cypari2")
1e1a65a6 44 (version "2.1.1")
ff33c38c 45 (source
adba6466
AE
46 (origin
47 (method url-fetch)
48 (uri (pypi-uri "cypari2" version))
49 (sha256
ff33c38c 50 (base32
1e1a65a6 51 "1nwkzgqvbw6361x0rpggy1q5nx663fswhpvg8md6xhqyfwpgc7nz"))))
ff33c38c
AE
52 (build-system python-build-system)
53 (native-inputs
adba6466 54 `(("python-cython" ,python-cython)))
ff33c38c 55 (propagated-inputs
adba6466 56 `(("python-cysignals" ,python-cysignals)))
ff33c38c 57 (inputs
adba6466
AE
58 `(("gmp" ,gmp)
59 ("pari-gp", pari-gp)))
ff33c38c
AE
60 (home-page "https://cypari2.readthedocs.io/")
61 (synopsis
adba6466 62 "Python interface to the number theory library libpari")
ff33c38c 63 (description
adba6466
AE
64 "Cypari2 provides a Python interface to the number theory library
65PARI/GP. It has been spun off from the SageMath mathematics software system,
66but it can be used independently.")
ff33c38c 67 (license license:gpl2+)))
adba6466
AE
68
69(define-public python2-cypari2
70 (package-with-python2 python-cypari2))
71
5e388a6e 72;; The stable version of the following package is not young enough to be
538230c9
AE
73;; used with Sage, since it does not support cython; so we use a beta
74;; release.
5e388a6e
AE
75(define-public python-gmpy2
76 (package
af5ead8b 77 (name "python-gmpy2")
538230c9 78 (version "2.1.0b1")
af5ead8b 79 (source (origin
538230c9
AE
80 (method git-fetch)
81 (uri (git-reference
82 (url "https://github.com/aleaxit/gmpy")
83 (commit (string-append "gmpy2-" version))))
84 (file-name (git-file-name name version))
af5ead8b
MB
85 (sha256
86 (base32
538230c9 87 "0ljvnmhxqdfsp0yy4c2hynhk5sggm63kkqsq4iwq4k9vsnx2xm97"))))
af5ead8b
MB
88 (build-system python-build-system)
89 (native-inputs
90 `(("unzip" ,unzip)))
91 (inputs
92 `(("gmp" ,gmp)
93 ("mpfr" ,mpfr)
94 ("mpc" ,mpc)))
95 (home-page "https://github.com/aleaxit/gmpy")
96 (synopsis
5e388a6e 97 "GMP/MPIR, MPFR, and MPC interface to Python 2.6+ and 3.x")
af5ead8b 98 (description
ec6f1a0e
AE
99 "This package provides a Python interface to the GNU multiprecision
100libraries GMO, MPFR and MPC.")
af5ead8b 101 (license license:lgpl3+)))
5e388a6e
AE
102
103(define-public python2-gmpy2
104 (package-with-python2 python-gmpy2))
20caeea4
AE
105
106(define-public cliquer
107 (package
108 (name "cliquer")
109 (version "1.21")
110 ;; The original source package is available from the home page and
111 ;; has not seen any release since 2010; it comes with only a Makefile
112 ;; without an "install" target. Instead, there is an autotoolized
113 ;; tarball available from the Sage project.
114 (source
115 (origin
116 (method url-fetch)
117 (uri "http://users.ox.ac.uk/~coml0531/sage/cliquer-1.21.tar.gz")
118 (sha256
119 (base32
120 "1hdzrmrx0nvvj8kbwxrs8swqgkd284khzl623jizixcv28xb77aq"))))
121 (build-system gnu-build-system)
122 (synopsis "C routines for finding cliques in weighted graphs")
123 (description "Cliquer is a set of reentrant C routines for finding
124cliques in a weighted or unweighted graph. It uses an exact
125branch-and-bound algorithm. It can search for maximum or maximum-weight
126cliques or cliques with size or weight within a given range, restrict the
127search to maximal cliques, store cliques in memory and call a user-defined
128function for every found clique.")
129 (license license:gpl2+)
130 (home-page "https://users.aalto.fi/~pat/cliquer.html")))
972ef8f5
AE
131
132(define-public libbraiding
133 (package
134 (name "libbraiding")
135 (version "1.0")
136 (source
137 (origin
138 (method git-fetch)
139 (uri (git-reference
140 (url (string-append "https://github.com/miguelmarco/"
141 name))
142 (commit version)))
143 (file-name (git-file-name name version))
144 (sha256
145 (base32
146 "0l68rikfr7k2l547gb3pp3g8cj5zzxwipm79xrb5r8ffj466ydxg"))))
147 (build-system gnu-build-system)
148 (native-inputs
149 `(("autoconf" ,autoconf)
150 ("automake" ,automake)
151 ("libtool" ,libtool)))
152 (synopsis "Computations with braid groups")
153 (description "libbraiding performs computations with braid groups,
154in particular it computes normal forms of group elements.")
155 (license license:gpl2+)
156 (home-page "https://github.com/miguelmarco/libbraiding")))
4c32f116
AE
157
158(define-public libhomfly
159 (package
160 (name "libhomfly")
161 (version "1.02r6")
162 (source
163 (origin
164 (method git-fetch)
165 (uri (git-reference
166 (url (string-append "https://github.com/miguelmarco/"
167 name))
168 (commit version)))
169 (file-name (git-file-name name version))
170 (sha256
171 (base32
172 "0sv3cwrf9v9sb5a8wbhjmarxvya13ma3j8y8592f9ymxlk5y0ldk"))))
173 (build-system gnu-build-system)
174 (native-inputs
175 `(("autoconf" ,autoconf)
176 ("automake" ,automake)
177 ("libtool" ,libtool)))
178 (inputs
179 `(("libgc" ,libgc)))
180 (synopsis "Computation of homfly polynomials of links")
181 (description "libhomfly computes homfly polynomials of links,
182represented as strings.")
183 (license license:public-domain)
184 (home-page "https://github.com/miguelmarco/libhomfly")))
80a70da7
AE
185
186;; The following three packages from the Linbox group are needed in
187;; an outdated version for Sage.
188
189(define-public givaro-4.0.4
190 (package (inherit givaro)
191 (name "givaro")
192 (version "4.0.4")
193 (source (origin
194 (method git-fetch)
195 (uri (git-reference
196 (url "https://github.com/linbox-team/givaro")
197 (commit (string-append "v" version))))
198 (file-name (git-file-name name version))
199 (sha256
200 (base32
201 "199p8wyj5i63jbnk7j8qbdbfp5rm2lpmcxyk3mdjy9bz7ygx3hhy"))))))
9fafb0d2
AE
202
203(define-public fflas-ffpack-2.3.2
204 (package (inherit fflas-ffpack)
205 (name "fflas-ffpack")
206 (version "2.3.2")
207 (source (origin
208 (method git-fetch)
209 (uri (git-reference
210 (url "https://github.com/linbox-team/fflas-ffpack")
211 (commit (string-append "v" version))))
212 (file-name (git-file-name name version))
213 (sha256
214 (base32
215 "1cqhassj2dny3gx0iywvmnpq8ca0d6m82xl5rz4mb8gaxr2kwddl"))))
216 (propagated-inputs
217 `(("givaro" ,givaro-4.0.4)))
218 ;; A test fails, but since all tests pass in the latest version,
219 ;; there is not much point in investigating.
220 (arguments
221 (substitute-keyword-arguments (package-arguments fflas-ffpack)
222 ((#:tests? _ #f) #f)))))
e27ae2db
AE
223
224(define-public linbox-1.5.2
225 (package (inherit linbox)
226 (version "1.5.2")
227 (name "linbox")
228 (source (origin
229 (method git-fetch)
230 (uri (git-reference
231 (url "https://github.com/linbox-team/linbox")
232 (commit (string-append "v" version))))
233 (file-name (git-file-name name version))
234 (sha256
235 (base32
236 "1wfivlwp30mzdy1697w7rzb8caajim50mc8h27k82yipn2qc5n4i"))))
237 (inputs
238 `(("fflas-ffpack" ,fflas-ffpack-2.3.2)))))
3923e9d9
AE
239
240(define-public pynac
241 (package
242 (name "pynac")
243 (version "0.7.25")
244 (source
245 (origin
246 (method git-fetch)
247 (uri (git-reference
248 (url "https://github.com/pynac/pynac/")
249 (commit (string-append "pynac-" version))))
250 (file-name (git-file-name name version))
251 (sha256
252 (base32
253 "0nnifvg6kzx0lq6gz7znind8g30v3d2pjfwgsdiks3vv9kv9nbj3"))))
254 (build-system gnu-build-system)
255 (native-inputs
256 `(("autoconf" ,autoconf)
257 ("automake" ,automake)
258 ("libtool" ,libtool)
259 ("pkg-config" ,pkg-config)))
260 (inputs
261 `(("flint" ,flint)
262 ("gmp" ,gmp)
263 ("python" ,python)
264 ("singular" ,singular)))
265 (synopsis "Sage fork of GiNaC")
266 (description "Pynac is a derivative of the C++ library GiNaC, which
267allows manipulation of symbolic expressions. It currently provides the
268backend for symbolic expressions in Sage. The main difference between
269Pynac and GiNaC is that Pynac relies on Sage to provide the operations
270on numerical types, while GiNaC depends on CLN for this purpose.")
271 (license license:gpl2+)
272 (home-page "http://pynac.org/")))
01822e3e
AE
273
274;; Sage has become upstream of the following package.
80ee7c4a 275(define-public zn-poly
01822e3e 276 (package
80ee7c4a 277 (name "zn-poly")
01822e3e
AE
278 (version "0.9.1")
279 (source
280 (origin
281 (method git-fetch)
282 (uri (git-reference
283 (url (string-append "https://gitlab.com/sagemath/"
80ee7c4a 284 "zn_poly.git/"))
01822e3e 285 (commit version)))
80ee7c4a 286 (file-name (git-file-name "zn_poly" version))
01822e3e
AE
287 (sha256
288 (base32
289 "0ra5vy585bqq7g3317iw6fp44iqgqvds3j0l1va6mswimypq4vxb"))))
290 (build-system gnu-build-system)
291 (native-inputs
292 `(("python" ,python-2)))
293 (inputs
294 `(("gmp" ,gmp)))
295 (arguments
296 `(#:phases
297 (modify-phases %standard-phases
298 (replace 'configure
299 ;; The configure script chokes on --enable-fast-install.
300 (lambda* (#:key inputs outputs #:allow-other-keys)
301 (invoke "./configure"
302 (string-append "--prefix=" (assoc-ref outputs "out"))
303 "--cflags=-O3 -fPIC")))
304 (add-before 'build 'prepare-build
305 (lambda _
306 (setenv "CC" "gcc")
307 #t))
308 (add-after 'build 'build-so
309 (lambda _
310 (invoke "make" "libzn_poly.so")))
311 (add-after 'install 'install-so
312 (lambda* (#:key outputs #:allow-other-keys)
e6049c84
AE
313 (let* ((out (assoc-ref outputs "out"))
314 (lib (string-append out "/lib"))
315 (soname (string-append "libzn_poly-" ,version ".so"))
316 (target (string-append lib "/" soname)))
317 (install-file "libzn_poly.a" lib)
318 (install-file soname lib)
319 (symlink target
320 (string-append lib "/libzn_poly.so"))
321 (symlink target
322 (string-append lib "/libzn_poly-"
323 ,(version-major+minor version)
324 ".so")))
325 #t)))))
01822e3e
AE
326 (synopsis "Arithmetic for polynomials over Z/NZ")
327 (description "zn_poly implements the arithmetic of polynomials the
328coefficients of which are modular integers.")
329 (license (list license:gpl2 license:gpl3)) ; dual licensed
330 (home-page "https://gitlab.com/sagemath/zn_poly")))
a1dcaacb
AE
331
332(define-public brial
333 (package
334 (name "brial")
335 (version "1.2.5")
336 (source
337 (origin
338 (method git-fetch)
339 (uri (git-reference
340 (url "https://github.com/BRiAl/BRiAl/")
341 (commit version)))
342 (file-name (git-file-name name version))
343 (sha256
344 (base32
345 "1nv56fp3brpzanxj7vwvxqdafqfsfhdgq5imr3m94psw5gdfqwja"))))
346 (build-system gnu-build-system)
347 (native-inputs
348 `(("autoconf" ,autoconf)
349 ("automake" ,automake)
350 ("libtool" ,libtool)
351 ("pkg-config" ,pkg-config)))
352 (inputs
353 `(("boost" ,boost)
354 ("libpng" ,libpng)
355 ("m4ri" ,m4ri)))
356 (arguments
357 ;; We are missing the boost unit test framework.
358 `(#:tests? #f
359 #:configure-flags (list "--without-boost-unit-test-framework")))
360 (synopsis "Arithmetic of polynomials over boolean rings")
361 (description "BRiAl is the successor to PolyBoRi maintained by the
362Sage community. Its core is a C++ library, which provides high-level data
363types for Boolean polynomials and monomials, exponent vectors, as well as
364for the underlying polynomial rings and subsets of the powerset of the
365Boolean variables. As a unique approach, binary decision diagrams are
366used as internal storage type for polynomial structures.")
367 (license license:gpl2+)
368 (home-page "https://gitlab.com/sagemath/zn_poly")))
fedb9571
AE
369
370(define-public lcalc
371 (package
372 (name "lcalc")
373 (version "1.23")
374 ;; The original home page of the project has disappeared, as well as
375 ;; code hosted by the original author on Google Code. The latter has
376 ;; been copied to gitlab.com/sagemath and purportedly contains patches
377 ;; for a never released version 1.3, that supposedly follows 1.23.
378 ;; We use the tarball as well as the patches hosted inside the sage
379 ;; package system distributed with the sage tarball.
380 (source
381 (origin
382 (method url-fetch)
383 (uri (string-append "ftp://ftp.fu-berlin.de/unix/misc/sage/spkg/"
384 "upstream/lcalc/lcalc-1.23.tar.bz2"))
385 (sha256
386 (base32
387 "1c6dsdshgxhqppjxvxhp8yhpxaqvnz3d1mlh26r571gkq8z2bm43"))
388 (patches (search-patches "lcalc-lcommon-h.patch"
389 "lcalc-default-parameters-1.patch"
390 "lcalc-default-parameters-2.patch"
391 "lcalc-using-namespace-std.patch"))))
392 (build-system gnu-build-system)
393 (arguments
394 `(#:tests? #f ;no tests
395 #:phases
396 (modify-phases %standard-phases
397 (delete 'configure)
398 (add-before 'build 'prepare-build
399 (lambda* (#:key outputs #:allow-other-keys)
400 (chdir "src")
401 (let ((out (assoc-ref outputs "out")))
402 (substitute* "Makefile"
403 (("^INSTALL_DIR= /usr/local")
404 (string-append "INSTALL_DIR=" out))
405 ;; Sage renames the include directory, so we do it also.
406 (("include/Lfunction")
407 "include/libLfunction")
408 ;; Add --std=c++11 to be compatible with the "auto" keyword
409 ;; introduced by lcalc-using-namespace-std.patch.
410 (("^#EXTRA= -pg")
411 "EXTRA=--std=c++11")))
412 #t))
413 (add-before 'install 'make-output-dirs
414 (lambda* (#:key outputs #:allow-other-keys)
415 (let* ((out (assoc-ref outputs "out"))
416 (bin (string-append out "/bin"))
417 (lib (string-append out "/lib"))
418 (include (string-append out "/include")))
419 (mkdir-p bin)
420 (mkdir-p lib)
421 (mkdir-p include))
422 #t)))))
423 ;; FIXME:
424 ;; We need to add pari-gp and probably pari related patches from the
425 ;; sage project, as well as uncomment the line setting PARI_DEFINE in
426 ;; the Makefile to get the full functionality of this package.
427 ;; For the time being, we hope that sage can be compiled without.
428 (synopsis "C++ library for L-functions")
429 (description "Lcalc computes L-functions, in particular the Riemann
430zeta function and its twists by quadratic characters.")
431 (license license:gpl2+)
432 (home-page "https://gitlab.com/sagemath/sage")))
a65f1e8e
NG
433
434(define-public ratpoints
435 (package
436 (name "ratpoints")
437 (version "2.1.3")
438 (source (origin
439 (method url-fetch)
440 (uri (string-append
441 "http://www.mathe2.uni-bayreuth.de/stoll/programs/"
442 "ratpoints-" version ".tar.gz"))
443 (sha256
444 (base32
445 "0zhad84sfds7izyksbqjmwpfw4rvyqk63yzdjd3ysd32zss5bgf4"))
446 (patches
447 ;; Taken from
448 ;; <https://git.sagemath.org/sage.git/plain/build/pkgs/ratpoints/patches/>
449 (search-patches "ratpoints-sturm_and_rp_private.patch"))))
450 (build-system gnu-build-system)
451 (arguments
452 `(#:test-target "test"
453 #:make-flags
454 (list (string-append "INSTALL_DIR=" (assoc-ref %outputs "out"))
455 "CCFLAGS=-fPIC")
456 #:phases
457 (modify-phases %standard-phases
458 (delete 'configure) ;no configure script
459 (add-before 'install 'create-install-directories
460 (lambda* (#:key outputs #:allow-other-keys)
461 (let ((out (assoc-ref outputs "out")))
462 (mkdir-p out)
463 (with-directory-excursion out
464 (for-each (lambda (d) (mkdir-p d))
465 '("bin" "include" "lib"))))
466 #t)))))
467 (inputs
468 `(("gmp" ,gmp)))
469 (home-page "http://www.mathe2.uni-bayreuth.de/stoll/programs/")
470 (synopsis "Find rational points on hyperelliptic curves")
471 (description "Ratpoints tries to find all rational points within
472a given height bound on a hyperelliptic curve in a very efficient way,
473by using an optimized quadratic sieve algorithm.")
474 (license license:gpl2+)))