gnu: ruby-pandoc-ruby: Use pandoc instead of ghc-pandoc.
[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, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
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.
13 ;;;
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.
18 ;;;
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/>.
21
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))
42
43
44 (define-public python-cypari2
45 (package
46 (name "python-cypari2")
47 (version "2.1.1")
48 (source
49 (origin
50 (method url-fetch)
51 (uri (pypi-uri "cypari2" version))
52 (sha256
53 (base32
54 "1nwkzgqvbw6361x0rpggy1q5nx663fswhpvg8md6xhqyfwpgc7nz"))))
55 (build-system python-build-system)
56 (native-inputs
57 `(("python-cython" ,python-cython)))
58 (propagated-inputs
59 `(("python-cysignals" ,python-cysignals)))
60 (inputs
61 `(("gmp" ,gmp)
62 ("pari-gp", pari-gp)))
63 (home-page "https://cypari2.readthedocs.io/")
64 (synopsis
65 "Python interface to the number theory library libpari")
66 (description
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+)))
71
72 (define-public python2-cypari2
73 (package-with-python2 python-cypari2))
74
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
77 ;; release.
78 (define-public python-gmpy2
79 (package
80 (name "python-gmpy2")
81 (version "2.1.0b1")
82 (source (origin
83 (method git-fetch)
84 (uri (git-reference
85 (url "https://github.com/aleaxit/gmpy")
86 (commit (string-append "gmpy2-" version))))
87 (file-name (git-file-name name version))
88 (sha256
89 (base32
90 "0ljvnmhxqdfsp0yy4c2hynhk5sggm63kkqsq4iwq4k9vsnx2xm97"))))
91 (build-system python-build-system)
92 (native-inputs
93 `(("unzip" ,unzip)))
94 (inputs
95 `(("gmp" ,gmp)
96 ("mpfr" ,mpfr)
97 ("mpc" ,mpc)))
98 (home-page "https://github.com/aleaxit/gmpy")
99 (synopsis
100 "GMP/MPIR, MPFR, and MPC interface to Python 2.6+ and 3.x")
101 (description
102 "This package provides a Python interface to the GNU multiprecision
103 libraries GMO, MPFR and MPC.")
104 (license license:lgpl3+)))
105
106 (define-public python2-gmpy2
107 (package-with-python2 python-gmpy2))
108
109 (define-public cliquer
110 (package
111 (name "cliquer")
112 (version "1.21")
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.
117 (source
118 (origin
119 (method url-fetch)
120 (uri "http://users.ox.ac.uk/~coml0531/sage/cliquer-1.21.tar.gz")
121 (sha256
122 (base32
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")))
134
135 (define-public libbraiding
136 (package
137 (name "libbraiding")
138 (version "1.0")
139 (source
140 (origin
141 (method git-fetch)
142 (uri (git-reference
143 (url (string-append "https://github.com/miguelmarco/"
144 name))
145 (commit version)))
146 (file-name (git-file-name name version))
147 (sha256
148 (base32
149 "0l68rikfr7k2l547gb3pp3g8cj5zzxwipm79xrb5r8ffj466ydxg"))))
150 (build-system gnu-build-system)
151 (native-inputs
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")))
160
161 (define-public libhomfly
162 (package
163 (name "libhomfly")
164 (version "1.02r6")
165 (source
166 (origin
167 (method git-fetch)
168 (uri (git-reference
169 (url (string-append "https://github.com/miguelmarco/"
170 name))
171 (commit version)))
172 (file-name (git-file-name name version))
173 (sha256
174 (base32
175 "0sv3cwrf9v9sb5a8wbhjmarxvya13ma3j8y8592f9ymxlk5y0ldk"))))
176 (build-system gnu-build-system)
177 (native-inputs
178 `(("autoconf" ,autoconf)
179 ("automake" ,automake)
180 ("libtool" ,libtool)))
181 (inputs
182 `(("libgc" ,libgc)))
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")))
188
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
192 (package
193 (inherit ecl)
194 (version "16.1.3")
195 (source
196 (origin
197 (method url-fetch)
198 (uri (string-append
199 "https://common-lisp.net/project/ecl/static/files/release/ecl"
200 "-" version ".tgz"))
201 (sha256
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+)))
209
210 (define-public pynac
211 (package
212 (name "pynac")
213 (version "0.7.26")
214 (source
215 (origin
216 (method git-fetch)
217 (uri (git-reference
218 (url "https://github.com/pynac/pynac/")
219 (commit (string-append "pynac-" version))))
220 (file-name (git-file-name name version))
221 (sha256
222 (base32 "09d2p74x1arkydlxy6pw4p4byi7r8q7f29w373h4d8a215kadc6d"))))
223 (build-system gnu-build-system)
224 (native-inputs
225 `(("autoconf" ,autoconf)
226 ("automake" ,automake)
227 ("libtool" ,libtool)
228 ("pkg-config" ,pkg-config)))
229 (inputs
230 `(("flint" ,flint)
231 ("gmp" ,gmp)
232 ("python" ,python)
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/")))
242
243 ;; Sage has become upstream of the following package.
244 (define-public zn-poly
245 (package
246 (name "zn-poly")
247 (version "0.9.2")
248 (source
249 (origin
250 (method git-fetch)
251 (uri (git-reference
252 (url (string-append "https://gitlab.com/sagemath/"
253 "zn_poly.git/"))
254 (commit version)))
255 (file-name (git-file-name "zn_poly" version))
256 (sha256
257 (base32 "1wbc3apxcldxfcw1dnwnn7fvlfb6bwvlr8glvgv6hf79p9r2s4j0"))))
258 (build-system gnu-build-system)
259 (native-inputs
260 `(("python" ,python-2)))
261 (inputs
262 `(("gmp" ,gmp)))
263 (arguments
264 `(#:phases
265 (modify-phases %standard-phases
266 (replace 'configure
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
273 (lambda _
274 (setenv "CC" "gcc")
275 #t))
276 (add-after 'build 'build-so
277 (lambda _
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)
287 (symlink target
288 (string-append lib "/libzn_poly.so"))
289 (symlink target
290 (string-append lib "/libzn_poly-"
291 ,(version-major+minor version)
292 ".so")))
293 #t)))))
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")))
299
300 (define-public brial
301 (package
302 (name "brial")
303 (version "1.2.8")
304 (source
305 (origin
306 (method git-fetch)
307 (uri (git-reference
308 (url "https://github.com/BRiAl/BRiAl/")
309 (commit version)))
310 (file-name (git-file-name name version))
311 (sha256
312 (base32 "0qhgckd4fvbs40jw14mvw89rccv94d3df27kipd27hxd4cx7y80y"))))
313 (build-system gnu-build-system)
314 (native-inputs
315 `(("autoconf" ,autoconf)
316 ("automake" ,automake)
317 ("libtool" ,libtool)
318 ("pkg-config" ,pkg-config)))
319 (inputs
320 `(("boost" ,boost)
321 ("libpng" ,libpng)
322 ("m4ri" ,m4ri)))
323 (arguments
324 ;; We are missing the boost unit test framework.
325 `(#:tests? #f
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/")))
336
337 (define-public lcalc
338 (package
339 (name "lcalc")
340 (version "1.23")
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.
347 (source
348 (origin
349 (method url-fetch)
350 (uri (string-append "ftp://ftp.fu-berlin.de/unix/misc/sage/spkg/"
351 "upstream/lcalc/lcalc-1.23.tar.bz2"))
352 (sha256
353 (base32
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)
360 (arguments
361 `(#:tests? #f ;no tests
362 #:phases
363 (modify-phases %standard-phases
364 (delete 'configure)
365 (add-before 'build 'prepare-build
366 (lambda* (#:key outputs #:allow-other-keys)
367 (chdir "src")
368 (let ((out (assoc-ref outputs "out")))
369 (substitute* "Makefile"
370 (("^INSTALL_DIR= /usr/local")
371 (string-append "INSTALL_DIR=" out))))
372 #t))
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")))
379 (mkdir-p bin)
380 (mkdir-p lib)
381 (mkdir-p include))
382 #t)))))
383 ;; FIXME:
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")))
393
394 (define-public ratpoints
395 (package
396 (name "ratpoints")
397 (version "2.1.3")
398 (source (origin
399 (method url-fetch)
400 (uri (string-append
401 "http://www.mathe2.uni-bayreuth.de/stoll/programs/"
402 "ratpoints-" version ".tar.gz"))
403 (sha256
404 (base32
405 "0zhad84sfds7izyksbqjmwpfw4rvyqk63yzdjd3ysd32zss5bgf4"))
406 (patches
407 ;; Taken from
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)
411 (arguments
412 `(#:test-target "test"
413 #:make-flags
414 (list (string-append "INSTALL_DIR=" (assoc-ref %outputs "out"))
415 "CCFLAGS=-fPIC")
416 #:phases
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")))
422 (mkdir-p out)
423 (with-directory-excursion out
424 (for-each (lambda (d) (mkdir-p d))
425 '("bin" "include" "lib"))))
426 #t)))))
427 (inputs
428 `(("gmp" ,gmp)))
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+)))