You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

434 lines
16 KiB

  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. (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 lisp)
  37. #:use-module (gnu packages multiprecision)
  38. #:use-module (gnu packages pkg-config)
  39. #:use-module (gnu packages python)
  40. #:use-module (gnu packages python-xyz))
  41. (define-public python-cypari2
  42. (package
  43. (name "python-cypari2")
  44. (version "2.1.1")
  45. (source
  46. (origin
  47. (method url-fetch)
  48. (uri (pypi-uri "cypari2" version))
  49. (sha256
  50. (base32
  51. "1nwkzgqvbw6361x0rpggy1q5nx663fswhpvg8md6xhqyfwpgc7nz"))))
  52. (build-system python-build-system)
  53. (native-inputs
  54. `(("python-cython" ,python-cython)))
  55. (propagated-inputs
  56. `(("python-cysignals" ,python-cysignals)))
  57. (inputs
  58. `(("gmp" ,gmp)
  59. ("pari-gp", pari-gp)))
  60. (home-page "https://cypari2.readthedocs.io/")
  61. (synopsis
  62. "Python interface to the number theory library libpari")
  63. (description
  64. "Cypari2 provides a Python interface to the number theory library
  65. PARI/GP. It has been spun off from the SageMath mathematics software system,
  66. but it can be used independently.")
  67. (license license:gpl2+)))
  68. (define-public python2-cypari2
  69. (package-with-python2 python-cypari2))
  70. ;; The stable version of the following package is not young enough to be
  71. ;; used with Sage, since it does not support cython; so we use a beta
  72. ;; release.
  73. (define-public python-gmpy2
  74. (package
  75. (name "python-gmpy2")
  76. (version "2.1.0b1")
  77. (source (origin
  78. (method git-fetch)
  79. (uri (git-reference
  80. (url "https://github.com/aleaxit/gmpy")
  81. (commit (string-append "gmpy2-" version))))
  82. (file-name (git-file-name name version))
  83. (sha256
  84. (base32
  85. "0ljvnmhxqdfsp0yy4c2hynhk5sggm63kkqsq4iwq4k9vsnx2xm97"))))
  86. (build-system python-build-system)
  87. (native-inputs
  88. `(("unzip" ,unzip)))
  89. (inputs
  90. `(("gmp" ,gmp)
  91. ("mpfr" ,mpfr)
  92. ("mpc" ,mpc)))
  93. (home-page "https://github.com/aleaxit/gmpy")
  94. (synopsis
  95. "GMP/MPIR, MPFR, and MPC interface to Python 2.6+ and 3.x")
  96. (description
  97. "This package provides a Python interface to the GNU multiprecision
  98. libraries GMO, MPFR and MPC.")
  99. (license license:lgpl3+)))
  100. (define-public python2-gmpy2
  101. (package-with-python2 python-gmpy2))
  102. (define-public cliquer
  103. (package
  104. (name "cliquer")
  105. (version "1.21")
  106. ;; The original source package is available from the home page and
  107. ;; has not seen any release since 2010; it comes with only a Makefile
  108. ;; without an "install" target. Instead, there is an autotoolized
  109. ;; tarball available from the Sage project.
  110. (source
  111. (origin
  112. (method url-fetch)
  113. (uri "http://users.ox.ac.uk/~coml0531/sage/cliquer-1.21.tar.gz")
  114. (sha256
  115. (base32
  116. "1hdzrmrx0nvvj8kbwxrs8swqgkd284khzl623jizixcv28xb77aq"))))
  117. (build-system gnu-build-system)
  118. (synopsis "C routines for finding cliques in weighted graphs")
  119. (description "Cliquer is a set of reentrant C routines for finding
  120. cliques in a weighted or unweighted graph. It uses an exact
  121. branch-and-bound algorithm. It can search for maximum or maximum-weight
  122. cliques or cliques with size or weight within a given range, restrict the
  123. search to maximal cliques, store cliques in memory and call a user-defined
  124. function for every found clique.")
  125. (license license:gpl2+)
  126. (home-page "https://users.aalto.fi/~pat/cliquer.html")))
  127. (define-public libbraiding
  128. (package
  129. (name "libbraiding")
  130. (version "1.0")
  131. (source
  132. (origin
  133. (method git-fetch)
  134. (uri (git-reference
  135. (url (string-append "https://github.com/miguelmarco/"
  136. name))
  137. (commit version)))
  138. (file-name (git-file-name name version))
  139. (sha256
  140. (base32
  141. "0l68rikfr7k2l547gb3pp3g8cj5zzxwipm79xrb5r8ffj466ydxg"))))
  142. (build-system gnu-build-system)
  143. (native-inputs
  144. `(("autoconf" ,autoconf)
  145. ("automake" ,automake)
  146. ("libtool" ,libtool)))
  147. (synopsis "Computations with braid groups")
  148. (description "libbraiding performs computations with braid groups,
  149. in particular it computes normal forms of group elements.")
  150. (license license:gpl2+)
  151. (home-page "https://github.com/miguelmarco/libbraiding")))
  152. (define-public libhomfly
  153. (package
  154. (name "libhomfly")
  155. (version "1.02r6")
  156. (source
  157. (origin
  158. (method git-fetch)
  159. (uri (git-reference
  160. (url (string-append "https://github.com/miguelmarco/"
  161. name))
  162. (commit version)))
  163. (file-name (git-file-name name version))
  164. (sha256
  165. (base32
  166. "0sv3cwrf9v9sb5a8wbhjmarxvya13ma3j8y8592f9ymxlk5y0ldk"))))
  167. (build-system gnu-build-system)
  168. (native-inputs
  169. `(("autoconf" ,autoconf)
  170. ("automake" ,automake)
  171. ("libtool" ,libtool)))
  172. (inputs
  173. `(("libgc" ,libgc)))
  174. (synopsis "Computation of homfly polynomials of links")
  175. (description "libhomfly computes homfly polynomials of links,
  176. represented as strings.")
  177. (license license:public-domain)
  178. (home-page "https://github.com/miguelmarco/libhomfly")))
  179. ;; Sage 9.1 doesn't build with ECL 20. This won't be necessary once 9.2 is
  180. ;; released. See https://trac.sagemath.org/ticket/22191
  181. (define-public ecl-16
  182. (package
  183. (inherit ecl)
  184. (version "16.1.3")
  185. (source
  186. (origin
  187. (method url-fetch)
  188. (uri (string-append
  189. "https://common-lisp.net/project/ecl/static/files/release/ecl"
  190. "-" version ".tgz"))
  191. (sha256
  192. (base32 "0m0j24w5d5a9dwwqyrg0d35c0nys16ijb4r0nyk87yp82v38b9bn"))
  193. (patches (search-patches
  194. "ecl-16-libffi.patch"
  195. "ecl-16-ignore-stderr-write-error.patch"
  196. "ecl-16-format-directive-limit.patch"))))
  197. ;; Current ECL uses LGPL 2.1+
  198. (license license:lgpl2.0+)))
  199. (define-public pynac
  200. (package
  201. (name "pynac")
  202. (version "0.7.26")
  203. (source
  204. (origin
  205. (method git-fetch)
  206. (uri (git-reference
  207. (url "https://github.com/pynac/pynac/")
  208. (commit (string-append "pynac-" version))))
  209. (file-name (git-file-name name version))
  210. (sha256
  211. (base32 "09d2p74x1arkydlxy6pw4p4byi7r8q7f29w373h4d8a215kadc6d"))))
  212. (build-system gnu-build-system)
  213. (native-inputs
  214. `(("autoconf" ,autoconf)
  215. ("automake" ,automake)
  216. ("libtool" ,libtool)
  217. ("pkg-config" ,pkg-config)))
  218. (inputs
  219. `(("flint" ,flint)
  220. ("gmp" ,gmp)
  221. ("python" ,python)
  222. ("singular" ,singular)))
  223. (synopsis "Sage fork of GiNaC")
  224. (description "Pynac is a derivative of the C++ library GiNaC, which
  225. allows manipulation of symbolic expressions. It currently provides the
  226. backend for symbolic expressions in Sage. The main difference between
  227. Pynac and GiNaC is that Pynac relies on Sage to provide the operations
  228. on numerical types, while GiNaC depends on CLN for this purpose.")
  229. (license license:gpl2+)
  230. (home-page "http://pynac.org/")))
  231. ;; Sage has become upstream of the following package.
  232. (define-public zn-poly
  233. (package
  234. (name "zn-poly")
  235. (version "0.9.2")
  236. (source
  237. (origin
  238. (method git-fetch)
  239. (uri (git-reference
  240. (url (string-append "https://gitlab.com/sagemath/"
  241. "zn_poly.git/"))
  242. (commit version)))
  243. (file-name (git-file-name "zn_poly" version))
  244. (sha256
  245. (base32 "1wbc3apxcldxfcw1dnwnn7fvlfb6bwvlr8glvgv6hf79p9r2s4j0"))))
  246. (build-system gnu-build-system)
  247. (native-inputs
  248. `(("python" ,python-2)))
  249. (inputs
  250. `(("gmp" ,gmp)))
  251. (arguments
  252. `(#:phases
  253. (modify-phases %standard-phases
  254. (replace 'configure
  255. ;; The configure script chokes on --enable-fast-install.
  256. (lambda* (#:key inputs outputs #:allow-other-keys)
  257. (invoke "./configure"
  258. (string-append "--prefix=" (assoc-ref outputs "out"))
  259. "--cflags=-O3 -fPIC")))
  260. (add-before 'build 'prepare-build
  261. (lambda _
  262. (setenv "CC" "gcc")
  263. #t))
  264. (add-after 'build 'build-so
  265. (lambda _
  266. (invoke "make" "libzn_poly.so")))
  267. (add-after 'install 'install-so
  268. (lambda* (#:key outputs #:allow-other-keys)
  269. (let* ((out (assoc-ref outputs "out"))
  270. (lib (string-append out "/lib"))
  271. (soname (string-append "libzn_poly-" ,version ".so"))
  272. (target (string-append lib "/" soname)))
  273. (install-file "libzn_poly.a" lib)
  274. (install-file soname lib)
  275. (symlink target
  276. (string-append lib "/libzn_poly.so"))
  277. (symlink target
  278. (string-append lib "/libzn_poly-"
  279. ,(version-major+minor version)
  280. ".so")))
  281. #t)))))
  282. (synopsis "Arithmetic for polynomials over Z/NZ")
  283. (description "zn_poly implements the arithmetic of polynomials the
  284. coefficients of which are modular integers.")
  285. (license (list license:gpl2 license:gpl3)) ; dual licensed
  286. (home-page "https://gitlab.com/sagemath/zn_poly")))
  287. (define-public brial
  288. (package
  289. (name "brial")
  290. (version "1.2.8")
  291. (source
  292. (origin
  293. (method git-fetch)
  294. (uri (git-reference
  295. (url "https://github.com/BRiAl/BRiAl/")
  296. (commit version)))
  297. (file-name (git-file-name name version))
  298. (sha256
  299. (base32 "0qhgckd4fvbs40jw14mvw89rccv94d3df27kipd27hxd4cx7y80y"))))
  300. (build-system gnu-build-system)
  301. (native-inputs
  302. `(("autoconf" ,autoconf)
  303. ("automake" ,automake)
  304. ("libtool" ,libtool)
  305. ("pkg-config" ,pkg-config)))
  306. (inputs
  307. `(("boost" ,boost)
  308. ("libpng" ,libpng)
  309. ("m4ri" ,m4ri)))
  310. (arguments
  311. ;; We are missing the boost unit test framework.
  312. `(#:tests? #f
  313. #:configure-flags (list "--without-boost-unit-test-framework")))
  314. (synopsis "Arithmetic of polynomials over boolean rings")
  315. (description "BRiAl is the successor to PolyBoRi maintained by the
  316. Sage community. Its core is a C++ library, which provides high-level data
  317. types for Boolean polynomials and monomials, exponent vectors, as well as
  318. for the underlying polynomial rings and subsets of the powerset of the
  319. Boolean variables. As a unique approach, binary decision diagrams are
  320. used as internal storage type for polynomial structures.")
  321. (license license:gpl2+)
  322. (home-page "https://github.com/BRiAl/BRiAl/")))
  323. (define-public lcalc
  324. (package
  325. (name "lcalc")
  326. (version "1.23")
  327. ;; The original home page of the project has disappeared, as well as
  328. ;; code hosted by the original author on Google Code. The latter has
  329. ;; been copied to gitlab.com/sagemath and purportedly contains patches
  330. ;; for a never released version 1.3, that supposedly follows 1.23.
  331. ;; We use the tarball as well as the patches hosted inside the sage
  332. ;; package system distributed with the sage tarball.
  333. (source
  334. (origin
  335. (method url-fetch)
  336. (uri (string-append "ftp://ftp.fu-berlin.de/unix/misc/sage/spkg/"
  337. "upstream/lcalc/lcalc-1.23.tar.bz2"))
  338. (sha256
  339. (base32
  340. "1c6dsdshgxhqppjxvxhp8yhpxaqvnz3d1mlh26r571gkq8z2bm43"))
  341. (patches (search-patches "lcalc-lcommon-h.patch"
  342. "lcalc-default-parameters-1.patch"
  343. "lcalc-default-parameters-2.patch"
  344. "lcalc-using-namespace-std.patch"))))
  345. (build-system gnu-build-system)
  346. (arguments
  347. `(#:tests? #f ;no tests
  348. #:phases
  349. (modify-phases %standard-phases
  350. (delete 'configure)
  351. (add-before 'build 'prepare-build
  352. (lambda* (#:key outputs #:allow-other-keys)
  353. (chdir "src")
  354. (let ((out (assoc-ref outputs "out")))
  355. (substitute* "Makefile"
  356. (("^INSTALL_DIR= /usr/local")
  357. (string-append "INSTALL_DIR=" out))))
  358. #t))
  359. (add-before 'install 'make-output-dirs
  360. (lambda* (#:key outputs #:allow-other-keys)
  361. (let* ((out (assoc-ref outputs "out"))
  362. (bin (string-append out "/bin"))
  363. (lib (string-append out "/lib"))
  364. (include (string-append out "/include")))
  365. (mkdir-p bin)
  366. (mkdir-p lib)
  367. (mkdir-p include))
  368. #t)))))
  369. ;; FIXME:
  370. ;; We need to add pari-gp and probably pari related patches from the
  371. ;; sage project, as well as uncomment the line setting PARI_DEFINE in
  372. ;; the Makefile to get the full functionality of this package.
  373. ;; For the time being, we hope that sage can be compiled without.
  374. (synopsis "C++ library for L-functions")
  375. (description "Lcalc computes L-functions, in particular the Riemann
  376. zeta function and its twists by quadratic characters.")
  377. (license license:gpl2+)
  378. (home-page "https://gitlab.com/sagemath/sage")))
  379. (define-public ratpoints
  380. (package
  381. (name "ratpoints")
  382. (version "2.1.3")
  383. (source (origin
  384. (method url-fetch)
  385. (uri (string-append
  386. "http://www.mathe2.uni-bayreuth.de/stoll/programs/"
  387. "ratpoints-" version ".tar.gz"))
  388. (sha256
  389. (base32
  390. "0zhad84sfds7izyksbqjmwpfw4rvyqk63yzdjd3ysd32zss5bgf4"))
  391. (patches
  392. ;; Taken from
  393. ;; <https://git.sagemath.org/sage.git/plain/build/pkgs/ratpoints/patches/>
  394. (search-patches "ratpoints-sturm_and_rp_private.patch"))))
  395. (build-system gnu-build-system)
  396. (arguments
  397. `(#:test-target "test"
  398. #:make-flags
  399. (list (string-append "INSTALL_DIR=" (assoc-ref %outputs "out"))
  400. "CCFLAGS=-fPIC")
  401. #:phases
  402. (modify-phases %standard-phases
  403. (delete 'configure) ;no configure script
  404. (add-before 'install 'create-install-directories
  405. (lambda* (#:key outputs #:allow-other-keys)
  406. (let ((out (assoc-ref outputs "out")))
  407. (mkdir-p out)
  408. (with-directory-excursion out
  409. (for-each (lambda (d) (mkdir-p d))
  410. '("bin" "include" "lib"))))
  411. #t)))))
  412. (inputs
  413. `(("gmp" ,gmp)))
  414. (home-page "http://www.mathe2.uni-bayreuth.de/stoll/programs/")
  415. (synopsis "Find rational points on hyperelliptic curves")
  416. (description "Ratpoints tries to find all rational points within
  417. a given height bound on a hyperelliptic curve in a very efficient way,
  418. by using an optimized quadratic sieve algorithm.")
  419. (license license:gpl2+)))