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, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
6 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
42 (define-public python-cypari2
44 (name "python-cypari2")
49 (uri (pypi-uri "cypari2" version))
52 "1nwkzgqvbw6361x0rpggy1q5nx663fswhpvg8md6xhqyfwpgc7nz"))))
53 (build-system python-build-system)
55 `(("python-cython" ,python-cython)))
57 `(("python-cysignals" ,python-cysignals)))
60 ("pari-gp", pari-gp)))
61 (home-page "https://cypari2.readthedocs.io/")
63 "Python interface to the number theory library libpari")
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+)))
70 (define-public python2-cypari2
71 (package-with-python2 python-cypari2))
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
76 (define-public python-gmpy2
83 (url "https://github.com/aleaxit/gmpy")
84 (commit (string-append "gmpy2-" version))))
85 (file-name (git-file-name name version))
88 "0ljvnmhxqdfsp0yy4c2hynhk5sggm63kkqsq4iwq4k9vsnx2xm97"))))
89 (build-system python-build-system)
96 (home-page "https://github.com/aleaxit/gmpy")
98 "GMP/MPIR, MPFR, and MPC interface to Python 2.6+ and 3.x")
100 "This package provides a Python interface to the GNU multiprecision
101 libraries GMO, MPFR and MPC.")
102 (license license:lgpl3+)))
104 (define-public python2-gmpy2
105 (package-with-python2 python-gmpy2))
107 (define-public cliquer
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.
118 (uri "http://users.ox.ac.uk/~coml0531/sage/cliquer-1.21.tar.gz")
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")))
133 (define-public libbraiding
141 (url (string-append "https://github.com/miguelmarco/"
144 (file-name (git-file-name name version))
147 "0l68rikfr7k2l547gb3pp3g8cj5zzxwipm79xrb5r8ffj466ydxg"))))
148 (build-system gnu-build-system)
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")))
159 (define-public libhomfly
167 (url (string-append "https://github.com/miguelmarco/"
170 (file-name (git-file-name name version))
173 "0sv3cwrf9v9sb5a8wbhjmarxvya13ma3j8y8592f9ymxlk5y0ldk"))))
174 (build-system gnu-build-system)
176 `(("autoconf" ,autoconf)
177 ("automake" ,automake)
178 ("libtool" ,libtool)))
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")))
195 (url "https://github.com/pynac/pynac/")
196 (commit (string-append "pynac-" version))))
197 (file-name (git-file-name name version))
199 (base32 "09d2p74x1arkydlxy6pw4p4byi7r8q7f29w373h4d8a215kadc6d"))))
200 (build-system gnu-build-system)
202 `(("autoconf" ,autoconf)
203 ("automake" ,automake)
205 ("pkg-config" ,pkg-config)))
210 ("singular" ,singular)))
211 (synopsis "Sage fork of GiNaC")
212 (description "Pynac is a derivative of the C++ library GiNaC, which
213 allows manipulation of symbolic expressions. It currently provides the
214 backend for symbolic expressions in Sage. The main difference between
215 Pynac and GiNaC is that Pynac relies on Sage to provide the operations
216 on numerical types, while GiNaC depends on CLN for this purpose.")
217 (license license:gpl2+)
218 (home-page "http://pynac.org/")))
220 ;; Sage has become upstream of the following package.
221 (define-public zn-poly
229 (url (string-append "https://gitlab.com/sagemath/"
232 (file-name (git-file-name "zn_poly" version))
234 (base32 "1wbc3apxcldxfcw1dnwnn7fvlfb6bwvlr8glvgv6hf79p9r2s4j0"))))
235 (build-system gnu-build-system)
237 `(("python" ,python-2)))
242 (modify-phases %standard-phases
244 ;; The configure script chokes on --enable-fast-install.
245 (lambda* (#:key inputs outputs #:allow-other-keys)
246 (invoke "./configure"
247 (string-append "--prefix=" (assoc-ref outputs "out"))
248 "--cflags=-O3 -fPIC")))
249 (add-before 'build 'prepare-build
253 (add-after 'build 'build-so
255 (invoke "make" "libzn_poly.so")))
256 (add-after 'install 'install-so
257 (lambda* (#:key outputs #:allow-other-keys)
258 (let* ((out (assoc-ref outputs "out"))
259 (lib (string-append out "/lib"))
260 (soname (string-append "libzn_poly-" ,version ".so"))
261 (target (string-append lib "/" soname)))
262 (install-file "libzn_poly.a" lib)
263 (install-file soname lib)
265 (string-append lib "/libzn_poly.so"))
267 (string-append lib "/libzn_poly-"
268 ,(version-major+minor version)
271 (synopsis "Arithmetic for polynomials over Z/NZ")
272 (description "zn_poly implements the arithmetic of polynomials the
273 coefficients of which are modular integers.")
274 (license (list license:gpl2 license:gpl3)) ; dual licensed
275 (home-page "https://gitlab.com/sagemath/zn_poly")))
285 (url "https://github.com/BRiAl/BRiAl/")
287 (file-name (git-file-name name version))
289 (base32 "0qhgckd4fvbs40jw14mvw89rccv94d3df27kipd27hxd4cx7y80y"))))
290 (build-system gnu-build-system)
292 `(("autoconf" ,autoconf)
293 ("automake" ,automake)
295 ("pkg-config" ,pkg-config)))
301 ;; We are missing the boost unit test framework.
303 #:configure-flags (list "--without-boost-unit-test-framework")))
304 (synopsis "Arithmetic of polynomials over boolean rings")
305 (description "BRiAl is the successor to PolyBoRi maintained by the
306 Sage community. Its core is a C++ library, which provides high-level data
307 types for Boolean polynomials and monomials, exponent vectors, as well as
308 for the underlying polynomial rings and subsets of the powerset of the
309 Boolean variables. As a unique approach, binary decision diagrams are
310 used as internal storage type for polynomial structures.")
311 (license license:gpl2+)
312 (home-page "https://github.com/BRiAl/BRiAl/")))
318 ;; The original home page of the project has disappeared, as well as
319 ;; code hosted by the original author on Google Code. The latter has
320 ;; been copied to gitlab.com/sagemath and purportedly contains patches
321 ;; for a never released version 1.3, that supposedly follows 1.23.
322 ;; We use the tarball as well as the patches hosted inside the sage
323 ;; package system distributed with the sage tarball.
327 (uri (string-append "ftp://ftp.fu-berlin.de/unix/misc/sage/spkg/"
328 "upstream/lcalc/lcalc-1.23.tar.bz2"))
331 "1c6dsdshgxhqppjxvxhp8yhpxaqvnz3d1mlh26r571gkq8z2bm43"))
332 (patches (search-patches "lcalc-lcommon-h.patch"
333 "lcalc-default-parameters-1.patch"
334 "lcalc-default-parameters-2.patch"
335 "lcalc-using-namespace-std.patch"))))
336 (build-system gnu-build-system)
338 `(#:tests? #f ;no tests
340 (modify-phases %standard-phases
342 (add-before 'build 'prepare-build
343 (lambda* (#:key outputs #:allow-other-keys)
345 (let ((out (assoc-ref outputs "out")))
346 (substitute* "Makefile"
347 (("^INSTALL_DIR= /usr/local")
348 (string-append "INSTALL_DIR=" out))
349 ;; Sage renames the include directory, so we do it also.
350 (("include/Lfunction")
351 "include/libLfunction")))
353 (add-before 'install 'make-output-dirs
354 (lambda* (#:key outputs #:allow-other-keys)
355 (let* ((out (assoc-ref outputs "out"))
356 (bin (string-append out "/bin"))
357 (lib (string-append out "/lib"))
358 (include (string-append out "/include")))
364 ;; We need to add pari-gp and probably pari related patches from the
365 ;; sage project, as well as uncomment the line setting PARI_DEFINE in
366 ;; the Makefile to get the full functionality of this package.
367 ;; For the time being, we hope that sage can be compiled without.
368 (synopsis "C++ library for L-functions")
369 (description "Lcalc computes L-functions, in particular the Riemann
370 zeta function and its twists by quadratic characters.")
371 (license license:gpl2+)
372 (home-page "https://gitlab.com/sagemath/sage")))
374 (define-public ratpoints
381 "http://www.mathe2.uni-bayreuth.de/stoll/programs/"
382 "ratpoints-" version ".tar.gz"))
385 "0zhad84sfds7izyksbqjmwpfw4rvyqk63yzdjd3ysd32zss5bgf4"))
388 ;; <https://git.sagemath.org/sage.git/plain/build/pkgs/ratpoints/patches/>
389 (search-patches "ratpoints-sturm_and_rp_private.patch"))))
390 (build-system gnu-build-system)
392 `(#:test-target "test"
394 (list (string-append "INSTALL_DIR=" (assoc-ref %outputs "out"))
397 (modify-phases %standard-phases
398 (delete 'configure) ;no configure script
399 (add-before 'install 'create-install-directories
400 (lambda* (#:key outputs #:allow-other-keys)
401 (let ((out (assoc-ref outputs "out")))
403 (with-directory-excursion out
404 (for-each (lambda (d) (mkdir-p d))
405 '("bin" "include" "lib"))))
409 (home-page "http://www.mathe2.uni-bayreuth.de/stoll/programs/")
410 (synopsis "Find rational points on hyperelliptic curves")
411 (description "Ratpoints tries to find all rational points within
412 a given height bound on a hyperelliptic curve in a very efficient way,
413 by using an optimized quadratic sieve algorithm.")
414 (license license:gpl2+)))