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>
5 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
6 ;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
8 ;;; This file is part of GNU Guix.
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23 (define-module (gnu packages sagemath)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (guix build-system gnu)
26 #:use-module (guix build-system python)
27 #:use-module (guix download)
28 #:use-module (guix git-download)
29 #:use-module (guix packages)
30 #:use-module (guix utils)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages algebra)
33 #:use-module (gnu packages autotools)
34 #:use-module (gnu packages bdw-gc)
35 #:use-module (gnu packages boost)
36 #:use-module (gnu packages compression)
37 #:use-module (gnu packages image)
38 #:use-module (gnu packages lisp)
39 #:use-module (gnu packages multiprecision)
40 #:use-module (gnu packages pkg-config)
41 #:use-module (gnu packages python)
42 #:use-module (gnu packages python-xyz))
45 (define-public python-cypari2
47 (name "python-cypari2")
52 (uri (pypi-uri "cypari2" version))
55 "0ymc4i9y60aazscc1blivirkr1rflzz6akkmvfzyn5l7mgnlbk83"))))
56 (build-system python-build-system)
58 `(("python-cython" ,python-cython)))
60 `(("python-cysignals" ,python-cysignals)))
63 ("pari-gp" ,pari-gp)))
64 (home-page "https://cypari2.readthedocs.io/")
66 "Python interface to the number theory library libpari")
68 "Cypari2 provides a Python interface to the number theory library
69 PARI/GP. It has been spun off from the SageMath mathematics software system,
70 but it can be used independently.")
71 (license license:gpl2+)))
73 (define-public python2-cypari2
74 (package-with-python2 python-cypari2))
76 ;; The stable version of the following package is not young enough to be
77 ;; used with Sage, since it does not support cython; so we use a beta
79 (define-public python-gmpy2
86 (url "https://github.com/aleaxit/gmpy")
87 (commit (string-append "gmpy2-" version))))
88 (file-name (git-file-name name version))
91 "0ljvnmhxqdfsp0yy4c2hynhk5sggm63kkqsq4iwq4k9vsnx2xm97"))))
92 (build-system python-build-system)
99 (home-page "https://github.com/aleaxit/gmpy")
101 "GMP/MPIR, MPFR, and MPC interface to Python 2.6+ and 3.x")
103 "This package provides a Python interface to the GNU multiprecision
104 libraries GMO, MPFR and MPC.")
105 (license license:lgpl3+)))
107 (define-public python2-gmpy2
108 (package-with-python2 python-gmpy2))
110 (define-public cliquer
114 ;; The original source package is available from the home page and
115 ;; has not seen any release since 2010; it comes with only a Makefile
116 ;; without an "install" target. Instead, there is an autotoolized
117 ;; tarball available from the Sage project.
121 (uri "http://users.ox.ac.uk/~coml0531/sage/cliquer-1.21.tar.gz")
124 "1hdzrmrx0nvvj8kbwxrs8swqgkd284khzl623jizixcv28xb77aq"))))
125 (build-system gnu-build-system)
126 (synopsis "C routines for finding cliques in weighted graphs")
127 (description "Cliquer is a set of reentrant C routines for finding
128 cliques in a weighted or unweighted graph. It uses an exact
129 branch-and-bound algorithm. It can search for maximum or maximum-weight
130 cliques or cliques with size or weight within a given range, restrict the
131 search to maximal cliques, store cliques in memory and call a user-defined
132 function for every found clique.")
133 (license license:gpl2+)
134 (home-page "https://users.aalto.fi/~pat/cliquer.html")))
136 (define-public libbraiding
144 (url (string-append "https://github.com/miguelmarco/"
147 (file-name (git-file-name name version))
150 "0l68rikfr7k2l547gb3pp3g8cj5zzxwipm79xrb5r8ffj466ydxg"))))
151 (build-system gnu-build-system)
153 `(("autoconf" ,autoconf)
154 ("automake" ,automake)
155 ("libtool" ,libtool)))
156 (synopsis "Computations with braid groups")
157 (description "libbraiding performs computations with braid groups,
158 in particular it computes normal forms of group elements.")
159 (license license:gpl2+)
160 (home-page "https://github.com/miguelmarco/libbraiding")))
162 (define-public libhomfly
170 (url (string-append "https://github.com/miguelmarco/"
173 (file-name (git-file-name name version))
176 "0sv3cwrf9v9sb5a8wbhjmarxvya13ma3j8y8592f9ymxlk5y0ldk"))))
177 (build-system gnu-build-system)
179 `(("autoconf" ,autoconf)
180 ("automake" ,automake)
181 ("libtool" ,libtool)))
184 (synopsis "Computation of homfly polynomials of links")
185 (description "libhomfly computes homfly polynomials of links,
186 represented as strings.")
187 (license license:public-domain)
188 (home-page "https://github.com/miguelmarco/libhomfly")))
190 ;; Sage 9.1 doesn't build with ECL 20. This won't be necessary once 9.2 is
191 ;; released. See https://trac.sagemath.org/ticket/22191
192 (define-public ecl-16
200 "https://common-lisp.net/project/ecl/static/files/release/ecl"
203 (base32 "0m0j24w5d5a9dwwqyrg0d35c0nys16ijb4r0nyk87yp82v38b9bn"))
204 (patches (search-patches
205 "ecl-16-libffi.patch"
206 "ecl-16-ignore-stderr-write-error.patch"
207 "ecl-16-format-directive-limit.patch"))))
208 ;; Current ECL uses LGPL 2.1+
209 (license license:lgpl2.0+)))
219 (url "https://github.com/pynac/pynac/")
220 (commit (string-append "pynac-" version))))
221 (file-name (git-file-name name version))
223 (base32 "09d2p74x1arkydlxy6pw4p4byi7r8q7f29w373h4d8a215kadc6d"))))
224 (build-system gnu-build-system)
226 `(("autoconf" ,autoconf)
227 ("automake" ,automake)
229 ("pkg-config" ,pkg-config)))
234 ("singular" ,singular)))
235 (synopsis "Sage fork of GiNaC")
236 (description "Pynac is a derivative of the C++ library GiNaC, which
237 allows manipulation of symbolic expressions. It currently provides the
238 backend for symbolic expressions in Sage. The main difference between
239 Pynac and GiNaC is that Pynac relies on Sage to provide the operations
240 on numerical types, while GiNaC depends on CLN for this purpose.")
241 (license license:gpl2+)
242 (home-page "http://pynac.org/")))
244 ;; Sage has become upstream of the following package.
245 (define-public zn-poly
253 (url (string-append "https://gitlab.com/sagemath/"
256 (file-name (git-file-name "zn_poly" version))
258 (base32 "1wbc3apxcldxfcw1dnwnn7fvlfb6bwvlr8glvgv6hf79p9r2s4j0"))))
259 (build-system gnu-build-system)
261 `(("python" ,python-2)))
266 (modify-phases %standard-phases
268 ;; The configure script chokes on --enable-fast-install.
269 (lambda* (#:key inputs outputs #:allow-other-keys)
270 (invoke "./configure"
271 (string-append "--prefix=" (assoc-ref outputs "out"))
272 "--cflags=-O3 -fPIC")))
273 (add-before 'build 'prepare-build
277 (add-after 'build 'build-so
279 (invoke "make" "libzn_poly.so")))
280 (add-after 'install 'install-so
281 (lambda* (#:key outputs #:allow-other-keys)
282 (let* ((out (assoc-ref outputs "out"))
283 (lib (string-append out "/lib"))
284 (soname (string-append "libzn_poly-" ,version ".so"))
285 (target (string-append lib "/" soname)))
286 (install-file "libzn_poly.a" lib)
287 (install-file soname lib)
289 (string-append lib "/libzn_poly.so"))
291 (string-append lib "/libzn_poly-"
292 ,(version-major+minor version)
295 (synopsis "Arithmetic for polynomials over Z/NZ")
296 (description "zn_poly implements the arithmetic of polynomials the
297 coefficients of which are modular integers.")
298 (license (list license:gpl2 license:gpl3)) ; dual licensed
299 (home-page "https://gitlab.com/sagemath/zn_poly")))
309 (url "https://github.com/BRiAl/BRiAl/")
311 (file-name (git-file-name name version))
313 (base32 "0qhgckd4fvbs40jw14mvw89rccv94d3df27kipd27hxd4cx7y80y"))))
314 (build-system gnu-build-system)
316 `(("autoconf" ,autoconf)
317 ("automake" ,automake)
319 ("pkg-config" ,pkg-config)))
325 ;; We are missing the boost unit test framework.
327 #:configure-flags (list "--without-boost-unit-test-framework")))
328 (synopsis "Arithmetic of polynomials over boolean rings")
329 (description "BRiAl is the successor to PolyBoRi maintained by the
330 Sage community. Its core is a C++ library, which provides high-level data
331 types for Boolean polynomials and monomials, exponent vectors, as well as
332 for the underlying polynomial rings and subsets of the powerset of the
333 Boolean variables. As a unique approach, binary decision diagrams are
334 used as internal storage type for polynomial structures.")
335 (license license:gpl2+)
336 (home-page "https://github.com/BRiAl/BRiAl/")))
342 ;; The original home page of the project has disappeared, as well as
343 ;; code hosted by the original author on Google Code. The latter has
344 ;; been copied to gitlab.com/sagemath and purportedly contains patches
345 ;; for a never released version 1.3, that supposedly follows 1.23.
346 ;; We use the tarball as well as the patches hosted inside the sage
347 ;; package system distributed with the sage tarball.
351 (uri (string-append "ftp://ftp.fu-berlin.de/unix/misc/sage/spkg/"
352 "upstream/lcalc/lcalc-1.23.tar.bz2"))
355 "1c6dsdshgxhqppjxvxhp8yhpxaqvnz3d1mlh26r571gkq8z2bm43"))
356 (patches (search-patches "lcalc-lcommon-h.patch"
357 "lcalc-default-parameters-1.patch"
358 "lcalc-default-parameters-2.patch"
359 "lcalc-using-namespace-std.patch"))))
360 (build-system gnu-build-system)
362 `(#:tests? #f ;no tests
364 (modify-phases %standard-phases
366 (add-before 'build 'prepare-build
367 (lambda* (#:key outputs #:allow-other-keys)
369 (let ((out (assoc-ref outputs "out")))
370 (substitute* "Makefile"
371 (("^INSTALL_DIR= /usr/local")
372 (string-append "INSTALL_DIR=" out))))
374 (add-before 'install 'make-output-dirs
375 (lambda* (#:key outputs #:allow-other-keys)
376 (let* ((out (assoc-ref outputs "out"))
377 (bin (string-append out "/bin"))
378 (lib (string-append out "/lib"))
379 (include (string-append out "/include")))
385 ;; We need to add pari-gp and probably pari related patches from the
386 ;; sage project, as well as uncomment the line setting PARI_DEFINE in
387 ;; the Makefile to get the full functionality of this package.
388 ;; For the time being, we hope that sage can be compiled without.
389 (synopsis "C++ library for L-functions")
390 (description "Lcalc computes L-functions, in particular the Riemann
391 zeta function and its twists by quadratic characters.")
392 (license license:gpl2+)
393 (home-page "https://gitlab.com/sagemath/sage")))
395 (define-public ratpoints
402 "http://www.mathe2.uni-bayreuth.de/stoll/programs/"
403 "ratpoints-" version ".tar.gz"))
406 "0zhad84sfds7izyksbqjmwpfw4rvyqk63yzdjd3ysd32zss5bgf4"))
409 ;; <https://git.sagemath.org/sage.git/plain/build/pkgs/ratpoints/patches/>
410 (search-patches "ratpoints-sturm_and_rp_private.patch"))))
411 (build-system gnu-build-system)
413 `(#:test-target "test"
415 (list (string-append "INSTALL_DIR=" (assoc-ref %outputs "out"))
418 (modify-phases %standard-phases
419 (delete 'configure) ;no configure script
420 (add-before 'install 'create-install-directories
421 (lambda* (#:key outputs #:allow-other-keys)
422 (let ((out (assoc-ref outputs "out")))
424 (with-directory-excursion out
425 (for-each (lambda (d) (mkdir-p d))
426 '("bin" "include" "lib"))))
430 (home-page "http://www.mathe2.uni-bayreuth.de/stoll/programs/")
431 (synopsis "Find rational points on hyperelliptic curves")
432 (description "Ratpoints tries to find all rational points within
433 a given height bound on a hyperelliptic curve in a very efficient way,
434 by using an optimized quadratic sieve algorithm.")
435 (license license:gpl2+)))