gnu: deutex: Update to 5.2.1.
[jackhill/guix/guix.git] / gnu / packages / sagemath.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2019 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2019 Nicolas Goaziou <mail@nicolasgoaziou.fr>
4 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
12 ;;;
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
17 ;;;
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21 (define-module (gnu packages sagemath)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix build-system gnu)
24 #:use-module (guix build-system python)
25 #:use-module (guix download)
26 #:use-module (guix git-download)
27 #:use-module (guix packages)
28 #:use-module (guix utils)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages algebra)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages bdw-gc)
33 #:use-module (gnu packages boost)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages image)
36 #:use-module (gnu packages multiprecision)
37 #:use-module (gnu packages pkg-config)
38 #:use-module (gnu packages python)
39 #:use-module (gnu packages python-xyz))
40
41
42 (define-public python-cypari2
43 (package
44 (name "python-cypari2")
45 (version "2.1.1")
46 (source
47 (origin
48 (method url-fetch)
49 (uri (pypi-uri "cypari2" version))
50 (sha256
51 (base32
52 "1nwkzgqvbw6361x0rpggy1q5nx663fswhpvg8md6xhqyfwpgc7nz"))))
53 (build-system python-build-system)
54 (native-inputs
55 `(("python-cython" ,python-cython)))
56 (propagated-inputs
57 `(("python-cysignals" ,python-cysignals)))
58 (inputs
59 `(("gmp" ,gmp)
60 ("pari-gp", pari-gp)))
61 (home-page "https://cypari2.readthedocs.io/")
62 (synopsis
63 "Python interface to the number theory library libpari")
64 (description
65 "Cypari2 provides a Python interface to the number theory library
66 PARI/GP. It has been spun off from the SageMath mathematics software system,
67 but it can be used independently.")
68 (license license:gpl2+)))
69
70 (define-public python2-cypari2
71 (package-with-python2 python-cypari2))
72
73 ;; The stable version of the following package is not young enough to be
74 ;; used with Sage, since it does not support cython; so we use a beta
75 ;; release.
76 (define-public python-gmpy2
77 (package
78 (name "python-gmpy2")
79 (version "2.1.0b1")
80 (source (origin
81 (method git-fetch)
82 (uri (git-reference
83 (url "https://github.com/aleaxit/gmpy")
84 (commit (string-append "gmpy2-" version))))
85 (file-name (git-file-name name version))
86 (sha256
87 (base32
88 "0ljvnmhxqdfsp0yy4c2hynhk5sggm63kkqsq4iwq4k9vsnx2xm97"))))
89 (build-system python-build-system)
90 (native-inputs
91 `(("unzip" ,unzip)))
92 (inputs
93 `(("gmp" ,gmp)
94 ("mpfr" ,mpfr)
95 ("mpc" ,mpc)))
96 (home-page "https://github.com/aleaxit/gmpy")
97 (synopsis
98 "GMP/MPIR, MPFR, and MPC interface to Python 2.6+ and 3.x")
99 (description
100 "This package provides a Python interface to the GNU multiprecision
101 libraries GMO, MPFR and MPC.")
102 (license license:lgpl3+)))
103
104 (define-public python2-gmpy2
105 (package-with-python2 python-gmpy2))
106
107 (define-public cliquer
108 (package
109 (name "cliquer")
110 (version "1.21")
111 ;; The original source package is available from the home page and
112 ;; has not seen any release since 2010; it comes with only a Makefile
113 ;; without an "install" target. Instead, there is an autotoolized
114 ;; tarball available from the Sage project.
115 (source
116 (origin
117 (method url-fetch)
118 (uri "http://users.ox.ac.uk/~coml0531/sage/cliquer-1.21.tar.gz")
119 (sha256
120 (base32
121 "1hdzrmrx0nvvj8kbwxrs8swqgkd284khzl623jizixcv28xb77aq"))))
122 (build-system gnu-build-system)
123 (synopsis "C routines for finding cliques in weighted graphs")
124 (description "Cliquer is a set of reentrant C routines for finding
125 cliques in a weighted or unweighted graph. It uses an exact
126 branch-and-bound algorithm. It can search for maximum or maximum-weight
127 cliques or cliques with size or weight within a given range, restrict the
128 search to maximal cliques, store cliques in memory and call a user-defined
129 function for every found clique.")
130 (license license:gpl2+)
131 (home-page "https://users.aalto.fi/~pat/cliquer.html")))
132
133 (define-public libbraiding
134 (package
135 (name "libbraiding")
136 (version "1.0")
137 (source
138 (origin
139 (method git-fetch)
140 (uri (git-reference
141 (url (string-append "https://github.com/miguelmarco/"
142 name))
143 (commit version)))
144 (file-name (git-file-name name version))
145 (sha256
146 (base32
147 "0l68rikfr7k2l547gb3pp3g8cj5zzxwipm79xrb5r8ffj466ydxg"))))
148 (build-system gnu-build-system)
149 (native-inputs
150 `(("autoconf" ,autoconf)
151 ("automake" ,automake)
152 ("libtool" ,libtool)))
153 (synopsis "Computations with braid groups")
154 (description "libbraiding performs computations with braid groups,
155 in particular it computes normal forms of group elements.")
156 (license license:gpl2+)
157 (home-page "https://github.com/miguelmarco/libbraiding")))
158
159 (define-public libhomfly
160 (package
161 (name "libhomfly")
162 (version "1.02r6")
163 (source
164 (origin
165 (method git-fetch)
166 (uri (git-reference
167 (url (string-append "https://github.com/miguelmarco/"
168 name))
169 (commit version)))
170 (file-name (git-file-name name version))
171 (sha256
172 (base32
173 "0sv3cwrf9v9sb5a8wbhjmarxvya13ma3j8y8592f9ymxlk5y0ldk"))))
174 (build-system gnu-build-system)
175 (native-inputs
176 `(("autoconf" ,autoconf)
177 ("automake" ,automake)
178 ("libtool" ,libtool)))
179 (inputs
180 `(("libgc" ,libgc)))
181 (synopsis "Computation of homfly polynomials of links")
182 (description "libhomfly computes homfly polynomials of links,
183 represented as strings.")
184 (license license:public-domain)
185 (home-page "https://github.com/miguelmarco/libhomfly")))
186
187 ;; The following three packages from the Linbox group are needed in
188 ;; an outdated version for Sage.
189
190 (define-public givaro-4.0.4
191 (package (inherit givaro)
192 (name "givaro")
193 (version "4.0.4")
194 (source (origin
195 (method git-fetch)
196 (uri (git-reference
197 (url "https://github.com/linbox-team/givaro")
198 (commit (string-append "v" version))))
199 (file-name (git-file-name name version))
200 (sha256
201 (base32
202 "199p8wyj5i63jbnk7j8qbdbfp5rm2lpmcxyk3mdjy9bz7ygx3hhy"))))))
203
204 (define-public fflas-ffpack-2.3.2
205 (package (inherit fflas-ffpack)
206 (name "fflas-ffpack")
207 (version "2.3.2")
208 (source (origin
209 (method git-fetch)
210 (uri (git-reference
211 (url "https://github.com/linbox-team/fflas-ffpack")
212 (commit (string-append "v" version))))
213 (file-name (git-file-name name version))
214 (sha256
215 (base32
216 "1cqhassj2dny3gx0iywvmnpq8ca0d6m82xl5rz4mb8gaxr2kwddl"))))
217 (propagated-inputs
218 `(("givaro" ,givaro-4.0.4)))
219 ;; A test fails, but since all tests pass in the latest version,
220 ;; there is not much point in investigating.
221 (arguments
222 (substitute-keyword-arguments (package-arguments fflas-ffpack)
223 ((#:tests? _ #f) #f)))))
224
225 (define-public linbox-1.5.2
226 (package (inherit linbox)
227 (version "1.5.2")
228 (name "linbox")
229 (source (origin
230 (method git-fetch)
231 (uri (git-reference
232 (url "https://github.com/linbox-team/linbox")
233 (commit (string-append "v" version))))
234 (file-name (git-file-name name version))
235 (sha256
236 (base32
237 "1wfivlwp30mzdy1697w7rzb8caajim50mc8h27k82yipn2qc5n4i"))))
238 (inputs
239 `(("fflas-ffpack" ,fflas-ffpack-2.3.2)))))
240
241 (define-public pynac
242 (package
243 (name "pynac")
244 (version "0.7.26")
245 (source
246 (origin
247 (method git-fetch)
248 (uri (git-reference
249 (url "https://github.com/pynac/pynac/")
250 (commit (string-append "pynac-" version))))
251 (file-name (git-file-name name version))
252 (sha256
253 (base32 "09d2p74x1arkydlxy6pw4p4byi7r8q7f29w373h4d8a215kadc6d"))))
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
267 allows manipulation of symbolic expressions. It currently provides the
268 backend for symbolic expressions in Sage. The main difference between
269 Pynac and GiNaC is that Pynac relies on Sage to provide the operations
270 on numerical types, while GiNaC depends on CLN for this purpose.")
271 (license license:gpl2+)
272 (home-page "http://pynac.org/")))
273
274 ;; Sage has become upstream of the following package.
275 (define-public zn-poly
276 (package
277 (name "zn-poly")
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/"
284 "zn_poly.git/"))
285 (commit version)))
286 (file-name (git-file-name "zn_poly" version))
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)
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)))))
326 (synopsis "Arithmetic for polynomials over Z/NZ")
327 (description "zn_poly implements the arithmetic of polynomials the
328 coefficients of which are modular integers.")
329 (license (list license:gpl2 license:gpl3)) ; dual licensed
330 (home-page "https://gitlab.com/sagemath/zn_poly")))
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
362 Sage community. Its core is a C++ library, which provides high-level data
363 types for Boolean polynomials and monomials, exponent vectors, as well as
364 for the underlying polynomial rings and subsets of the powerset of the
365 Boolean variables. As a unique approach, binary decision diagrams are
366 used as internal storage type for polynomial structures.")
367 (license license:gpl2+)
368 (home-page "https://gitlab.com/sagemath/zn_poly")))
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 #t))
409 (add-before 'install 'make-output-dirs
410 (lambda* (#:key outputs #:allow-other-keys)
411 (let* ((out (assoc-ref outputs "out"))
412 (bin (string-append out "/bin"))
413 (lib (string-append out "/lib"))
414 (include (string-append out "/include")))
415 (mkdir-p bin)
416 (mkdir-p lib)
417 (mkdir-p include))
418 #t)))))
419 ;; FIXME:
420 ;; We need to add pari-gp and probably pari related patches from the
421 ;; sage project, as well as uncomment the line setting PARI_DEFINE in
422 ;; the Makefile to get the full functionality of this package.
423 ;; For the time being, we hope that sage can be compiled without.
424 (synopsis "C++ library for L-functions")
425 (description "Lcalc computes L-functions, in particular the Riemann
426 zeta function and its twists by quadratic characters.")
427 (license license:gpl2+)
428 (home-page "https://gitlab.com/sagemath/sage")))
429
430 (define-public ratpoints
431 (package
432 (name "ratpoints")
433 (version "2.1.3")
434 (source (origin
435 (method url-fetch)
436 (uri (string-append
437 "http://www.mathe2.uni-bayreuth.de/stoll/programs/"
438 "ratpoints-" version ".tar.gz"))
439 (sha256
440 (base32
441 "0zhad84sfds7izyksbqjmwpfw4rvyqk63yzdjd3ysd32zss5bgf4"))
442 (patches
443 ;; Taken from
444 ;; <https://git.sagemath.org/sage.git/plain/build/pkgs/ratpoints/patches/>
445 (search-patches "ratpoints-sturm_and_rp_private.patch"))))
446 (build-system gnu-build-system)
447 (arguments
448 `(#:test-target "test"
449 #:make-flags
450 (list (string-append "INSTALL_DIR=" (assoc-ref %outputs "out"))
451 "CCFLAGS=-fPIC")
452 #:phases
453 (modify-phases %standard-phases
454 (delete 'configure) ;no configure script
455 (add-before 'install 'create-install-directories
456 (lambda* (#:key outputs #:allow-other-keys)
457 (let ((out (assoc-ref outputs "out")))
458 (mkdir-p out)
459 (with-directory-excursion out
460 (for-each (lambda (d) (mkdir-p d))
461 '("bin" "include" "lib"))))
462 #t)))))
463 (inputs
464 `(("gmp" ,gmp)))
465 (home-page "http://www.mathe2.uni-bayreuth.de/stoll/programs/")
466 (synopsis "Find rational points on hyperelliptic curves")
467 (description "Ratpoints tries to find all rational points within
468 a given height bound on a hyperelliptic curve in a very efficient way,
469 by using an optimized quadratic sieve algorithm.")
470 (license license:gpl2+)))