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>
7 ;;; This file is part of GNU Guix.
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages sagemath)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix build-system gnu)
25 #:use-module (guix build-system python)
26 #:use-module (guix download)
27 #:use-module (guix git-download)
28 #:use-module (guix packages)
29 #:use-module (guix utils)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages algebra)
32 #:use-module (gnu packages autotools)
33 #:use-module (gnu packages bdw-gc)
34 #:use-module (gnu packages boost)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages image)
37 #:use-module (gnu packages lisp)
38 #:use-module (gnu packages multiprecision)
39 #:use-module (gnu packages pkg-config)
40 #:use-module (gnu packages python)
41 #:use-module (gnu packages python-xyz))
44 (define-public python-cypari2
46 (name "python-cypari2")
51 (uri (pypi-uri "cypari2" version))
54 "1nwkzgqvbw6361x0rpggy1q5nx663fswhpvg8md6xhqyfwpgc7nz"))))
55 (build-system python-build-system)
57 `(("python-cython" ,python-cython)))
59 `(("python-cysignals" ,python-cysignals)))
62 ("pari-gp", pari-gp)))
63 (home-page "https://cypari2.readthedocs.io/")
65 "Python interface to the number theory library libpari")
67 "Cypari2 provides a Python interface to the number theory library
68 PARI/GP. It has been spun off from the SageMath mathematics software system,
69 but it can be used independently.")
70 (license license:gpl2+)))
72 (define-public python2-cypari2
73 (package-with-python2 python-cypari2))
75 ;; The stable version of the following package is not young enough to be
76 ;; used with Sage, since it does not support cython; so we use a beta
78 (define-public python-gmpy2
85 (url "https://github.com/aleaxit/gmpy")
86 (commit (string-append "gmpy2-" version))))
87 (file-name (git-file-name name version))
90 "0ljvnmhxqdfsp0yy4c2hynhk5sggm63kkqsq4iwq4k9vsnx2xm97"))))
91 (build-system python-build-system)
98 (home-page "https://github.com/aleaxit/gmpy")
100 "GMP/MPIR, MPFR, and MPC interface to Python 2.6+ and 3.x")
102 "This package provides a Python interface to the GNU multiprecision
103 libraries GMO, MPFR and MPC.")
104 (license license:lgpl3+)))
106 (define-public python2-gmpy2
107 (package-with-python2 python-gmpy2))
109 (define-public cliquer
113 ;; The original source package is available from the home page and
114 ;; has not seen any release since 2010; it comes with only a Makefile
115 ;; without an "install" target. Instead, there is an autotoolized
116 ;; tarball available from the Sage project.
120 (uri "http://users.ox.ac.uk/~coml0531/sage/cliquer-1.21.tar.gz")
123 "1hdzrmrx0nvvj8kbwxrs8swqgkd284khzl623jizixcv28xb77aq"))))
124 (build-system gnu-build-system)
125 (synopsis "C routines for finding cliques in weighted graphs")
126 (description "Cliquer is a set of reentrant C routines for finding
127 cliques in a weighted or unweighted graph. It uses an exact
128 branch-and-bound algorithm. It can search for maximum or maximum-weight
129 cliques or cliques with size or weight within a given range, restrict the
130 search to maximal cliques, store cliques in memory and call a user-defined
131 function for every found clique.")
132 (license license:gpl2+)
133 (home-page "https://users.aalto.fi/~pat/cliquer.html")))
135 (define-public libbraiding
143 (url (string-append "https://github.com/miguelmarco/"
146 (file-name (git-file-name name version))
149 "0l68rikfr7k2l547gb3pp3g8cj5zzxwipm79xrb5r8ffj466ydxg"))))
150 (build-system gnu-build-system)
152 `(("autoconf" ,autoconf)
153 ("automake" ,automake)
154 ("libtool" ,libtool)))
155 (synopsis "Computations with braid groups")
156 (description "libbraiding performs computations with braid groups,
157 in particular it computes normal forms of group elements.")
158 (license license:gpl2+)
159 (home-page "https://github.com/miguelmarco/libbraiding")))
161 (define-public libhomfly
169 (url (string-append "https://github.com/miguelmarco/"
172 (file-name (git-file-name name version))
175 "0sv3cwrf9v9sb5a8wbhjmarxvya13ma3j8y8592f9ymxlk5y0ldk"))))
176 (build-system gnu-build-system)
178 `(("autoconf" ,autoconf)
179 ("automake" ,automake)
180 ("libtool" ,libtool)))
183 (synopsis "Computation of homfly polynomials of links")
184 (description "libhomfly computes homfly polynomials of links,
185 represented as strings.")
186 (license license:public-domain)
187 (home-page "https://github.com/miguelmarco/libhomfly")))
189 ;; Sage 9.1 doesn't build with ECL 20. This won't be necessary once 9.2 is
190 ;; released. See https://trac.sagemath.org/ticket/22191
191 (define-public ecl-16
199 "https://common-lisp.net/project/ecl/static/files/release/ecl"
202 (base32 "0m0j24w5d5a9dwwqyrg0d35c0nys16ijb4r0nyk87yp82v38b9bn"))
203 (patches (search-patches
204 "ecl-16-libffi.patch"
205 "ecl-16-ignore-stderr-write-error.patch"
206 "ecl-16-format-directive-limit.patch"))))
207 ;; Current ECL uses LGPL 2.1+
208 (license license:lgpl2.0+)))
218 (url "https://github.com/pynac/pynac/")
219 (commit (string-append "pynac-" version))))
220 (file-name (git-file-name name version))
222 (base32 "09d2p74x1arkydlxy6pw4p4byi7r8q7f29w373h4d8a215kadc6d"))))
223 (build-system gnu-build-system)
225 `(("autoconf" ,autoconf)
226 ("automake" ,automake)
228 ("pkg-config" ,pkg-config)))
233 ("singular" ,singular)))
234 (synopsis "Sage fork of GiNaC")
235 (description "Pynac is a derivative of the C++ library GiNaC, which
236 allows manipulation of symbolic expressions. It currently provides the
237 backend for symbolic expressions in Sage. The main difference between
238 Pynac and GiNaC is that Pynac relies on Sage to provide the operations
239 on numerical types, while GiNaC depends on CLN for this purpose.")
240 (license license:gpl2+)
241 (home-page "http://pynac.org/")))
243 ;; Sage has become upstream of the following package.
244 (define-public zn-poly
252 (url (string-append "https://gitlab.com/sagemath/"
255 (file-name (git-file-name "zn_poly" version))
257 (base32 "1wbc3apxcldxfcw1dnwnn7fvlfb6bwvlr8glvgv6hf79p9r2s4j0"))))
258 (build-system gnu-build-system)
260 `(("python" ,python-2)))
265 (modify-phases %standard-phases
267 ;; The configure script chokes on --enable-fast-install.
268 (lambda* (#:key inputs outputs #:allow-other-keys)
269 (invoke "./configure"
270 (string-append "--prefix=" (assoc-ref outputs "out"))
271 "--cflags=-O3 -fPIC")))
272 (add-before 'build 'prepare-build
276 (add-after 'build 'build-so
278 (invoke "make" "libzn_poly.so")))
279 (add-after 'install 'install-so
280 (lambda* (#:key outputs #:allow-other-keys)
281 (let* ((out (assoc-ref outputs "out"))
282 (lib (string-append out "/lib"))
283 (soname (string-append "libzn_poly-" ,version ".so"))
284 (target (string-append lib "/" soname)))
285 (install-file "libzn_poly.a" lib)
286 (install-file soname lib)
288 (string-append lib "/libzn_poly.so"))
290 (string-append lib "/libzn_poly-"
291 ,(version-major+minor version)
294 (synopsis "Arithmetic for polynomials over Z/NZ")
295 (description "zn_poly implements the arithmetic of polynomials the
296 coefficients of which are modular integers.")
297 (license (list license:gpl2 license:gpl3)) ; dual licensed
298 (home-page "https://gitlab.com/sagemath/zn_poly")))
308 (url "https://github.com/BRiAl/BRiAl/")
310 (file-name (git-file-name name version))
312 (base32 "0qhgckd4fvbs40jw14mvw89rccv94d3df27kipd27hxd4cx7y80y"))))
313 (build-system gnu-build-system)
315 `(("autoconf" ,autoconf)
316 ("automake" ,automake)
318 ("pkg-config" ,pkg-config)))
324 ;; We are missing the boost unit test framework.
326 #:configure-flags (list "--without-boost-unit-test-framework")))
327 (synopsis "Arithmetic of polynomials over boolean rings")
328 (description "BRiAl is the successor to PolyBoRi maintained by the
329 Sage community. Its core is a C++ library, which provides high-level data
330 types for Boolean polynomials and monomials, exponent vectors, as well as
331 for the underlying polynomial rings and subsets of the powerset of the
332 Boolean variables. As a unique approach, binary decision diagrams are
333 used as internal storage type for polynomial structures.")
334 (license license:gpl2+)
335 (home-page "https://github.com/BRiAl/BRiAl/")))
341 ;; The original home page of the project has disappeared, as well as
342 ;; code hosted by the original author on Google Code. The latter has
343 ;; been copied to gitlab.com/sagemath and purportedly contains patches
344 ;; for a never released version 1.3, that supposedly follows 1.23.
345 ;; We use the tarball as well as the patches hosted inside the sage
346 ;; package system distributed with the sage tarball.
350 (uri (string-append "ftp://ftp.fu-berlin.de/unix/misc/sage/spkg/"
351 "upstream/lcalc/lcalc-1.23.tar.bz2"))
354 "1c6dsdshgxhqppjxvxhp8yhpxaqvnz3d1mlh26r571gkq8z2bm43"))
355 (patches (search-patches "lcalc-lcommon-h.patch"
356 "lcalc-default-parameters-1.patch"
357 "lcalc-default-parameters-2.patch"
358 "lcalc-using-namespace-std.patch"))))
359 (build-system gnu-build-system)
361 `(#:tests? #f ;no tests
363 (modify-phases %standard-phases
365 (add-before 'build 'prepare-build
366 (lambda* (#:key outputs #:allow-other-keys)
368 (let ((out (assoc-ref outputs "out")))
369 (substitute* "Makefile"
370 (("^INSTALL_DIR= /usr/local")
371 (string-append "INSTALL_DIR=" out))))
373 (add-before 'install 'make-output-dirs
374 (lambda* (#:key outputs #:allow-other-keys)
375 (let* ((out (assoc-ref outputs "out"))
376 (bin (string-append out "/bin"))
377 (lib (string-append out "/lib"))
378 (include (string-append out "/include")))
384 ;; We need to add pari-gp and probably pari related patches from the
385 ;; sage project, as well as uncomment the line setting PARI_DEFINE in
386 ;; the Makefile to get the full functionality of this package.
387 ;; For the time being, we hope that sage can be compiled without.
388 (synopsis "C++ library for L-functions")
389 (description "Lcalc computes L-functions, in particular the Riemann
390 zeta function and its twists by quadratic characters.")
391 (license license:gpl2+)
392 (home-page "https://gitlab.com/sagemath/sage")))
394 (define-public ratpoints
401 "http://www.mathe2.uni-bayreuth.de/stoll/programs/"
402 "ratpoints-" version ".tar.gz"))
405 "0zhad84sfds7izyksbqjmwpfw4rvyqk63yzdjd3ysd32zss5bgf4"))
408 ;; <https://git.sagemath.org/sage.git/plain/build/pkgs/ratpoints/patches/>
409 (search-patches "ratpoints-sturm_and_rp_private.patch"))))
410 (build-system gnu-build-system)
412 `(#:test-target "test"
414 (list (string-append "INSTALL_DIR=" (assoc-ref %outputs "out"))
417 (modify-phases %standard-phases
418 (delete 'configure) ;no configure script
419 (add-before 'install 'create-install-directories
420 (lambda* (#:key outputs #:allow-other-keys)
421 (let ((out (assoc-ref outputs "out")))
423 (with-directory-excursion out
424 (for-each (lambda (d) (mkdir-p d))
425 '("bin" "include" "lib"))))
429 (home-page "http://www.mathe2.uni-bayreuth.de/stoll/programs/")
430 (synopsis "Find rational points on hyperelliptic curves")
431 (description "Ratpoints tries to find all rational points within
432 a given height bound on a hyperelliptic curve in a very efficient way,
433 by using an optimized quadratic sieve algorithm.")
434 (license license:gpl2+)))