algebra.scm 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Andreas Enge <andreas@enge.fr>
  3. ;;; Copyright © 2013, 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
  4. ;;; Copyright © 2016, 2017, 2018, 2019 Nicolas Goaziou <mail@nicolasgoaziou.fr>
  5. ;;; Copyright © 2014, 2018 Mark H Weaver <mhw@netris.org>
  6. ;;; Copyright © 2016, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
  7. ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
  8. ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
  9. ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
  10. ;;; Copyright © 2017, 2019 Eric Bavier <bavier@member.fsf.org>
  11. ;;;
  12. ;;; This file is part of GNU Guix.
  13. ;;;
  14. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  15. ;;; under the terms of the GNU General Public License as published by
  16. ;;; the Free Software Foundation; either version 3 of the License, or (at
  17. ;;; your option) any later version.
  18. ;;;
  19. ;;; GNU Guix is distributed in the hope that it will be useful, but
  20. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  21. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. ;;; GNU General Public License for more details.
  23. ;;;
  24. ;;; You should have received a copy of the GNU General Public License
  25. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  26. (define-module (gnu packages algebra)
  27. #:use-module (gnu packages)
  28. #:use-module (gnu packages autotools)
  29. #:use-module (gnu packages check)
  30. #:use-module (gnu packages compression)
  31. #:use-module (gnu packages cpp)
  32. #:use-module (gnu packages documentation)
  33. #:use-module (gnu packages ed)
  34. #:use-module (gnu packages flex)
  35. #:use-module (gnu packages fltk)
  36. #:use-module (gnu packages gl)
  37. #:use-module (gnu packages graphviz)
  38. #:use-module (gnu packages image)
  39. #:use-module (gnu packages java)
  40. #:use-module (gnu packages maths)
  41. #:use-module (gnu packages mpi)
  42. #:use-module (gnu packages multiprecision)
  43. #:use-module (gnu packages perl)
  44. #:use-module (gnu packages python)
  45. #:use-module (gnu packages readline)
  46. #:use-module (gnu packages shells)
  47. #:use-module (gnu packages tex)
  48. #:use-module (gnu packages texinfo)
  49. #:use-module (gnu packages xiph)
  50. #:use-module (gnu packages xorg)
  51. #:use-module (guix build-system ant)
  52. #:use-module (guix build-system gnu)
  53. #:use-module (guix build-system cmake)
  54. #:use-module (guix download)
  55. #:use-module (guix git-download)
  56. #:use-module ((guix licenses) #:prefix license:)
  57. #:use-module (guix packages)
  58. #:use-module (guix utils))
  59. (define-public mpfrcx
  60. (package
  61. (name "mpfrcx")
  62. (version "0.5")
  63. (source (origin
  64. (method url-fetch)
  65. (uri (string-append
  66. "http://www.multiprecision.org/downloads/mpfrcx-"
  67. version ".tar.gz"))
  68. (sha256
  69. (base32
  70. "1s968480ymv6w0rnvfp9mxvx98hvi29fkvw8nk4ggzc6azxgwybs"))))
  71. (build-system gnu-build-system)
  72. (propagated-inputs
  73. `(("gmp" ,gmp)
  74. ("mpfr" ,mpfr)
  75. ("mpc" ,mpc))) ; Header files are included by mpfrcx.h.
  76. (synopsis "Arithmetic of polynomials over arbitrary precision numbers")
  77. (description
  78. "Mpfrcx is a library for the arithmetic of univariate polynomials over
  79. arbitrary precision real (mpfr) or complex (mpc) numbers, without control
  80. on the rounding. For the time being, only the few functions needed to
  81. implement the floating point approach to complex multiplication are
  82. implemented. On the other hand, these comprise asymptotically fast
  83. multiplication routines such as Toom–Cook and the FFT.")
  84. (license license:lgpl3+)
  85. (home-page "http://mpfrcx.multiprecision.org/")))
  86. (define-public cm
  87. (package
  88. (name "cm")
  89. (version "0.3")
  90. (source (origin
  91. (method url-fetch)
  92. (uri (string-append
  93. "http://www.multiprecision.org/cm/download/cm-"
  94. version ".tar.gz"))
  95. (sha256
  96. (base32
  97. "1nf5kr0nqmhbzrsrinky18z0ighjpsmb5cr8zyg8jf04bfbyrfmc"))))
  98. (build-system gnu-build-system)
  99. (propagated-inputs
  100. `(("mpfrcx" ,mpfrcx)
  101. ("zlib" ,zlib))) ; Header files included from cm_common.h.
  102. (inputs
  103. `(("pari-gp" ,pari-gp)))
  104. (synopsis "CM constructions for elliptic curves")
  105. (description
  106. "The CM software implements the construction of ring class fields of
  107. imaginary quadratic number fields and of elliptic curves with complex
  108. multiplication via floating point approximations. It consists of libraries
  109. that can be called from within a C program and of executable command
  110. line applications.")
  111. (license license:gpl3+)
  112. (home-page "http://cm.multiprecision.org/")))
  113. (define-public fplll
  114. (package
  115. (name "fplll")
  116. (version "4.0.4")
  117. (source (origin
  118. (method url-fetch)
  119. (uri (string-append
  120. "http://perso.ens-lyon.fr/damien.stehle/fplll/libfplll-"
  121. version ".tar.gz"))
  122. (sha256 (base32
  123. "1cbiby7ykis4z84swclpysrljmqhfcllpkcbll1m08rzskgb1a6b"))))
  124. (build-system gnu-build-system)
  125. (inputs `(("gmp" ,gmp)
  126. ("mpfr" ,mpfr)))
  127. (synopsis "Library for LLL-reduction of euclidean lattices")
  128. (description
  129. "fplll LLL-reduces euclidean lattices. Since version 3, it can also
  130. solve the shortest vector problem.")
  131. (license license:lgpl2.1+)
  132. (home-page "http://perso.ens-lyon.fr/damien.stehle/fplll/")))
  133. (define-public pari-gp
  134. (package
  135. (name "pari-gp")
  136. (version "2.11.1")
  137. (source (origin
  138. (method url-fetch)
  139. (uri (string-append
  140. "https://pari.math.u-bordeaux.fr/pub/pari/unix/pari-"
  141. version ".tar.gz"))
  142. (sha256
  143. (base32
  144. "1jfax92jpydjd02fwl30r6b8kfzqqd6sm4yx94gidyz9lqjb7a94"))))
  145. (build-system gnu-build-system)
  146. (native-inputs
  147. `(("texlive" ,(texlive-union
  148. (list texlive-fonts-amsfonts
  149. texlive-latex-amsfonts)))))
  150. (inputs `(("gmp" ,gmp)
  151. ("libx11" ,libx11)
  152. ("perl" ,perl)
  153. ("readline" ,readline)))
  154. (arguments
  155. '(#:make-flags '("all")
  156. #:test-target "dobench"
  157. #:phases
  158. (modify-phases %standard-phases
  159. (replace 'configure
  160. (lambda* (#:key outputs #:allow-other-keys)
  161. (invoke "./Configure"
  162. (string-append "--prefix="
  163. (assoc-ref outputs "out"))))))))
  164. (synopsis "PARI/GP, a computer algebra system for number theory")
  165. (description
  166. "PARI/GP is a widely used computer algebra system designed for fast
  167. computations in number theory (factorisations, algebraic number theory,
  168. elliptic curves...), but it also contains a large number of other useful
  169. functions to compute with mathematical entities such as matrices,
  170. polynomials, power series, algebraic numbers, etc., and a lot of
  171. transcendental functions.
  172. PARI is also available as a C library to allow for faster computations.")
  173. (license license:gpl2+)
  174. (home-page "https://pari.math.u-bordeaux.fr/")))
  175. (define-public gp2c
  176. (package
  177. (name "gp2c")
  178. (version "0.0.11pl1")
  179. (source (origin
  180. (method url-fetch)
  181. (uri (string-append
  182. "https://pari.math.u-bordeaux.fr/pub/pari/GP2C/gp2c-"
  183. version ".tar.gz"))
  184. (sha256
  185. (base32
  186. "1c6f6vmncw032kfzrfyr8bynw6yd3faxpy2285r009fmr0zxfs5s"))))
  187. (build-system gnu-build-system)
  188. (native-inputs `(("perl" ,perl)))
  189. (inputs `(("pari-gp" ,pari-gp)))
  190. (arguments
  191. '(#:configure-flags
  192. (list (string-append "--with-paricfg="
  193. (assoc-ref %build-inputs "pari-gp")
  194. "/lib/pari/pari.cfg"))))
  195. (synopsis "PARI/GP, a computer algebra system for number theory")
  196. (description
  197. "PARI/GP is a widely used computer algebra system designed for fast
  198. computations in number theory (factorisations, algebraic number theory,
  199. elliptic curves...), but it also contains a large number of other useful
  200. functions to compute with mathematical entities such as matrices,
  201. polynomials, power series, algebraic numbers, etc., and a lot of
  202. transcendental functions.
  203. PARI is also available as a C library to allow for faster computations.
  204. GP2C, the GP to C compiler, translates GP scripts to PARI programs.")
  205. (license license:gpl2)
  206. (home-page "https://pari.math.u-bordeaux.fr/")))
  207. (define-public cmh
  208. (package
  209. (name "cmh")
  210. (version "1.0")
  211. (source (origin
  212. (method url-fetch)
  213. (uri (string-append
  214. "https://gforge.inria.fr/frs/download.php/33497/cmh-"
  215. version ".tar.gz"))
  216. (sha256
  217. (base32
  218. "1a28xr9bs0igms0ik99x0w8lnb0jyfcmvyi26pbyh9ggcdivd33p"))))
  219. (build-system gnu-build-system)
  220. (inputs
  221. `(("gmp" ,gmp)
  222. ("mpfr" ,mpfr)
  223. ("mpc" ,mpc)
  224. ("mpfrcx" ,mpfrcx)
  225. ("fplll" ,fplll)
  226. ("pari-gp" ,pari-gp)))
  227. (synopsis "Igusa class polynomial computations")
  228. (description
  229. "The CMH software computes Igusa (genus 2) class polynomials, which
  230. parameterize the CM points in the moduli space of 2-dimensional abelian
  231. varieties, i.e. Jacobians of hyperelliptic curves.
  232. It can also be used to compute theta constants at arbitrary
  233. precision.")
  234. (license license:gpl3+)
  235. (home-page "http://cmh.gforge.inria.fr/")))
  236. (define-public giac-xcas
  237. (package
  238. (name "giac-xcas")
  239. (version "1.5.0-37")
  240. (source (origin
  241. (method url-fetch)
  242. ;; "~parisse/giac" is not used because the maintainer regularly
  243. ;; overwrites the release tarball there, introducing a checksum
  244. ;; mismatch every time. See
  245. ;; <https://www-fourier.ujf-grenoble.fr/~parisse/debian/dists/stable/main/source/README>
  246. (uri (string-append "https://www-fourier.ujf-grenoble.fr/"
  247. "~parisse/debian/dists/stable/main/"
  248. "source/giac_" version ".tar.gz"))
  249. (sha256
  250. (base32
  251. "1c6jmswv3ay13n6mjgh9w7nbpdgm5lbwdcmva5sli3vqn4chn3vq"))))
  252. (build-system gnu-build-system)
  253. (outputs '("out" "doc")) ;77MiB of documentation
  254. (arguments
  255. `(#:modules ((ice-9 ftw)
  256. (guix build utils)
  257. (guix build gnu-build-system))
  258. #:phases
  259. (modify-phases %standard-phases
  260. (add-after 'unpack 'patch-bin-cp
  261. ;; Some Makefiles contain hard-coded "/bin/cp".
  262. (lambda _
  263. (substitute* (find-files "doc" "^Makefile")
  264. (("/bin/cp") (which "cp")))
  265. #t))
  266. (add-after 'unpack 'disable-failing-test
  267. ;; FIXME: Test failing. Not sure why.
  268. (lambda _
  269. (substitute* "check/Makefile.in"
  270. (("chk_fhan11") ""))
  271. #t))
  272. (add-after 'install 'install-doc
  273. ;; Setting --docdir to "doc" output isn't sufficient as
  274. ;; documentation and examples are scattered throughout the source.
  275. (lambda* (#:key outputs #:allow-other-keys)
  276. (let* ((out (assoc-ref outputs "out"))
  277. (doc (assoc-ref outputs "doc"))
  278. (docdir (string-append doc
  279. "/share/doc/"
  280. (string-append ,name "-" ,version))))
  281. ;; For some reason, the install process moves
  282. ;; "share/giac/examples" instead of "share/giac/doc" to
  283. ;; "$(docdir)". Clean up the mess and start over.
  284. (delete-file-recursively (string-append doc "/share"))
  285. (mkdir-p docdir)
  286. (with-directory-excursion out
  287. (for-each (lambda (f)
  288. (unless (member f '("." ".."))
  289. (copy-recursively (string-append "share/giac/" f)
  290. (string-append docdir "/" f))))
  291. (scandir "share/giac"))
  292. (delete-file-recursively "share/giac")))
  293. #t)))))
  294. (inputs
  295. `(("fltk" ,fltk)
  296. ("gmp" ,gmp)
  297. ("gsl" ,gsl)
  298. ("lapack" ,lapack)
  299. ("libao" ,ao)
  300. ("libjpeg" ,libjpeg)
  301. ("libpng" ,libpng)
  302. ("libx11" ,libx11)
  303. ("libxinerama" ,libxinerama)
  304. ("libxft" ,libxft)
  305. ("libxt" ,libxt)
  306. ("mesa" ,mesa)
  307. ("mpfi" ,mpfi)
  308. ("mpfr" ,mpfr)
  309. ("ntl" ,ntl)
  310. ("perl" ,perl)
  311. ("pari-gp" ,pari-gp)
  312. ("tcsh" ,tcsh)
  313. ("texlive" ,texlive-tiny)))
  314. (native-inputs `(("readline" ,readline)))
  315. (home-page "https://www-fourier.ujf-grenoble.fr/~parisse/giac.html")
  316. (synopsis "Computer algebra system")
  317. (description
  318. "Giac/Xcas is a computer algebra system. It has a compatibility mode for
  319. maple, mupad and the TI89. It is available as a standalone program (graphic
  320. or text interfaces) or as a C++ library.")
  321. (license license:gpl3+)))
  322. (define-public flint
  323. (package
  324. (name "flint")
  325. (version "2.5.2")
  326. (source (origin
  327. (method url-fetch)
  328. (uri (string-append
  329. "http://flintlib.org/flint-"
  330. version ".tar.gz"))
  331. (sha256 (base32
  332. "11syazv1a8rrnac3wj3hnyhhflpqcmq02q8pqk2m6g2k6h0gxwfb"))
  333. (patches (search-patches "flint-ldconfig.patch"))))
  334. (build-system gnu-build-system)
  335. (propagated-inputs
  336. `(("gmp" ,gmp)
  337. ("mpfr" ,mpfr))) ; header files from both are included by flint/arith.h
  338. (arguments
  339. `(#:parallel-tests? #f ; seems to be necessary on arm
  340. #:phases
  341. (modify-phases %standard-phases
  342. (replace 'configure
  343. (lambda* (#:key inputs outputs #:allow-other-keys)
  344. (let ((out (assoc-ref outputs "out"))
  345. (gmp (assoc-ref inputs "gmp"))
  346. (mpfr (assoc-ref inputs "mpfr")))
  347. ;; do not pass "--enable-fast-install", which makes the
  348. ;; homebrew configure process fail
  349. (invoke "./configure"
  350. (string-append "--prefix=" out)
  351. (string-append "--with-gmp=" gmp)
  352. (string-append "--with-mpfr=" mpfr))
  353. #t))))))
  354. (synopsis "Fast library for number theory")
  355. (description
  356. "FLINT is a C library for number theory. It supports arithmetic
  357. with numbers, polynomials, power series and matrices over many base
  358. rings, including multiprecision integers and rationals, integers
  359. modulo n, p-adic numbers, finite fields (prime and non-prime order)
  360. and real and complex numbers (via the Arb extension library).
  361. Operations that can be performed include conversions, arithmetic,
  362. GCDs, factoring, solving linear systems, and evaluating special
  363. functions. In addition, FLINT provides various low-level routines for
  364. fast arithmetic.")
  365. (license license:gpl2+)
  366. (home-page "http://flintlib.org/")))
  367. (define-public arb
  368. (package
  369. (name "arb")
  370. (version "2.14.0")
  371. (source (origin
  372. (method git-fetch)
  373. (uri (git-reference
  374. (url "https://github.com/fredrik-johansson/arb.git")
  375. (commit version)))
  376. (file-name (git-file-name name version))
  377. (sha256
  378. (base32
  379. "1ndxg7h4xvccjgp5l9z2f8b66dsff6fhf86bn5n7f75a1ksd7554"))))
  380. (build-system gnu-build-system)
  381. (propagated-inputs
  382. `(("flint" ,flint))) ; flint.h is included by arf.h
  383. (inputs
  384. `(("gmp" ,gmp)
  385. ("mpfr" ,mpfr)))
  386. (arguments
  387. `(#:phases
  388. (modify-phases %standard-phases
  389. (replace 'configure
  390. (lambda* (#:key inputs outputs #:allow-other-keys)
  391. (let ((out (assoc-ref outputs "out"))
  392. (flint (assoc-ref inputs "flint"))
  393. (gmp (assoc-ref inputs "gmp"))
  394. (mpfr (assoc-ref inputs "mpfr")))
  395. ;; do not pass "--enable-fast-install", which makes the
  396. ;; homebrew configure process fail
  397. (invoke "./configure"
  398. (string-append "--prefix=" out)
  399. (string-append "--with-flint=" flint)
  400. (string-append "--with-gmp=" gmp)
  401. (string-append "--with-mpfr=" mpfr))))))))
  402. (synopsis "Arbitrary precision floating-point ball arithmetic")
  403. (description
  404. "Arb is a C library for arbitrary-precision floating-point ball
  405. arithmetic. It supports efficient high-precision computation with
  406. polynomials, power series, matrices and special functions over the
  407. real and complex numbers, with automatic, rigorous error control.")
  408. (license license:lgpl2.1+)
  409. (home-page "http://fredrikj.net/arb/")))
  410. (define-public ntl
  411. (package
  412. (name "ntl")
  413. (version "9.7.0")
  414. (source (origin
  415. (method url-fetch)
  416. (uri (string-append "http://shoup.net/ntl/ntl-"
  417. version ".tar.gz"))
  418. (sha256 (base32
  419. "115frp5flyvw9wghz4zph1b3llmr5nbxk1skgsggckr81fh3gmxq"))))
  420. (build-system gnu-build-system)
  421. (native-inputs
  422. `(("libtool" ,libtool)
  423. ("perl" ,perl))) ; for configuration
  424. ;; FIXME: Add optional input gf2x once available; then also add
  425. ;; configure flag "NTL_GF2X_LIB=on".
  426. (inputs
  427. `(("gmp" ,gmp)))
  428. (arguments
  429. `(#:phases
  430. (modify-phases %standard-phases
  431. (replace 'configure
  432. (lambda* (#:key outputs #:allow-other-keys)
  433. (chdir "src")
  434. (system* "./configure"
  435. (string-append "PREFIX=" (assoc-ref outputs "out"))
  436. ;; Do not build especially for the build machine.
  437. "NATIVE=off"
  438. ;; Also do not tune to the build machine.
  439. "WIZARD=off"
  440. "SHARED=on")
  441. #t)))))
  442. (synopsis "C++ library for number theory")
  443. (description
  444. "NTL is a C++ library providing data structures and algorithms
  445. for manipulating signed, arbitrary length integers, and for vectors,
  446. matrices, and polynomials over the integers and over finite fields.")
  447. (license license:gpl2+)
  448. (home-page "http://shoup.net/ntl/")))
  449. (define-public singular
  450. (package
  451. (name "singular")
  452. (version "4.1.1p3")
  453. (source
  454. (origin
  455. (method url-fetch)
  456. (uri
  457. (string-append "http://www.mathematik.uni-kl.de/ftp/pub/Math/"
  458. "Singular/SOURCES/"
  459. (string-join
  460. (string-split
  461. (string-trim-right version #\p
  462. 0 (1- (string-length version)))
  463. #\.) "-")
  464. "/singular-" version ".tar.gz"))
  465. (sha256 (base32
  466. "1qqj9bm9pkzm0iyycpvm8x6s79wws3nq60lz25h8x1q61h3426sm"))))
  467. (build-system gnu-build-system)
  468. (native-inputs
  469. `(("doxygen" ,doxygen)
  470. ("graphviz" ,graphviz)
  471. ("perl" ,perl)))
  472. (inputs
  473. `(("cddlib" ,cddlib)
  474. ("gmp" ,gmp)
  475. ("flint" ,flint)
  476. ("mpfr" ,mpfr)
  477. ("ntl" ,ntl)
  478. ("python" ,python-2)
  479. ("readline" ,readline)))
  480. (arguments
  481. `(#:configure-flags
  482. (list (string-append "--with-ntl="
  483. (assoc-ref %build-inputs "ntl")))))
  484. (synopsis "Computer algebra system for polynomial computations")
  485. (description
  486. "Singular is a computer algebra system for polynomial computations,
  487. with special emphasis on commutative and non-commutative algebra, algebraic
  488. geometry and singularity theory.")
  489. ;; Singular itself is dual licensed gpl2 or gpl3, but some of the
  490. ;; libraries with which it links are licensed under lgpl3+, so the
  491. ;; combined work becomes gpl3. See COPYING in the source code.
  492. (license license:gpl3)
  493. (home-page "http://www.singular.uni-kl.de/index.php")))
  494. (define-public gmp-ecm
  495. (package
  496. (name "gmp-ecm")
  497. (version "7.0.4")
  498. (source (origin
  499. (method url-fetch)
  500. ;; Use the ‘Latest version’ link for a stable URI across releases.
  501. (uri (string-append "https://gforge.inria.fr/frs/download.php/"
  502. "latestfile/160/ecm-" version ".tar.gz"))
  503. (sha256 (base32
  504. "0hxs24c2m3mh0nq1zz63z3sb7dhy1rilg2s1igwwcb26x3pb7xqc"))))
  505. (build-system gnu-build-system)
  506. (inputs
  507. `(("gmp" ,gmp)))
  508. (arguments
  509. `(#:configure-flags '("--enable-shared"
  510. ;; Disable specific assembly routines, which depend
  511. ;; on the subarchitecture of the build machine,
  512. ;; and use gmp instead.
  513. "--disable-asm-redc")))
  514. (synopsis "Integer factorization library using the elliptic curve method")
  515. (description
  516. "GMP-ECM factors integers using the elliptic curve method (ECM) as well
  517. as the P-1 and P+1 algorithms. It provides a library and a stand-alone
  518. binary.")
  519. ;; Most files are under lgpl3+, but some are under gpl3+ or gpl2+,
  520. ;; so the combined work is under gpl3+.
  521. (license license:gpl3+)
  522. (home-page "http://ecm.gforge.inria.fr/")))
  523. (define-public bc
  524. (package
  525. (name "bc")
  526. (version "1.07.1")
  527. (source (origin
  528. (method url-fetch)
  529. (uri (string-append "mirror://gnu/bc/bc-" version ".tar.gz"))
  530. (sha256
  531. (base32
  532. "0amh9ik44jfg66csyvf4zz1l878c4755kjndq9j0270akflgrbb2"))))
  533. (build-system gnu-build-system)
  534. (native-inputs
  535. `(("ed" ,ed)
  536. ("flex" ,flex)
  537. ("texinfo" ,texinfo)))
  538. (arguments
  539. '(#:configure-flags
  540. (list "--with-readline")))
  541. (home-page "https://www.gnu.org/software/bc/")
  542. (synopsis "Arbitrary precision numeric processing language")
  543. (description
  544. "bc is an arbitrary precision numeric processing language. It includes
  545. an interactive environment for evaluating mathematical statements. Its
  546. syntax is similar to that of C, so basic usage is familiar. It also includes
  547. \"dc\", a reverse-polish calculator.")
  548. (license license:gpl2+)))
  549. ;; The original kiss-fft does not have a complete build system and does not
  550. ;; build any shared libraries. This is a fork used by Extempore.
  551. (define-public kiss-fft-for-extempore
  552. (package
  553. (name "kiss-fft-for-extempore")
  554. (version "1.3.0")
  555. (source (origin
  556. (method git-fetch)
  557. (uri (git-reference
  558. (url "https://github.com/extemporelang/kiss_fft.git")
  559. (commit version)))
  560. (file-name (git-file-name name version))
  561. (sha256
  562. (base32
  563. "0jasbmqy4wkqrqx3w64s1dfmj34875xmsl72mb26aa4hpyn14bi2"))))
  564. (build-system cmake-build-system)
  565. (arguments `(#:tests? #f)) ; no tests included
  566. ;; Extempore refuses to build on architectures other than x86_64
  567. (supported-systems '("x86_64-linux"))
  568. (home-page "https://github.com/extemporelang/kiss_fft")
  569. (synopsis "Mixed-radix Fast Fourier Transform")
  570. (description
  571. "Kiss FFT attempts to be a reasonably efficient, moderately useful FFT
  572. that can use fixed or floating data types and can easily be incorporated into
  573. a C program.")
  574. (license license:bsd-3)))
  575. (define-public fftw
  576. (package
  577. (name "fftw")
  578. (version "3.3.8")
  579. (source (origin
  580. (method url-fetch)
  581. (uri (string-append "ftp://ftp.fftw.org/pub/fftw/fftw-"
  582. version".tar.gz"))
  583. (sha256
  584. (base32
  585. "00z3k8fq561wq2khssqg0kallk0504dzlx989x3vvicjdqpjc4v1"))))
  586. (build-system gnu-build-system)
  587. (arguments
  588. `(#:configure-flags
  589. '("--enable-shared" "--enable-openmp" "--enable-threads"
  590. ,@(let ((system (or (%current-target-system) (%current-system))))
  591. ;; Enable SIMD extensions for codelets. See details at:
  592. ;; <http://fftw.org/fftw3_doc/Installation-on-Unix.html>.
  593. (cond
  594. ((string-prefix? "x86_64" system)
  595. '("--enable-sse2" "--enable-avx" "--enable-avx2"
  596. "--enable-avx512" "--enable-avx-128-fma"))
  597. ((string-prefix? "i686" system)
  598. '("--enable-sse2"))
  599. ((string-prefix? "aarch64" system)
  600. ;; Note that fftw supports NEON on 32-bit ARM only when
  601. ;; compiled for single-precision.
  602. '("--enable-neon"))
  603. (else
  604. '())))
  605. ;; By default '-mtune=native' is used. However, that may cause the
  606. ;; use of ISA extensions (e.g. AVX) that are not necessarily
  607. ;; available on the user's machine when that package is built on a
  608. ;; different machine.
  609. "ax_cv_c_flags__mtune_native=no")))
  610. (native-inputs `(("perl" ,perl)))
  611. (home-page "http://fftw.org")
  612. (synopsis "Computing the discrete Fourier transform")
  613. (description
  614. "FFTW is a C subroutine library for computing the discrete Fourier
  615. transform (DFT) in one or more dimensions, of arbitrary input size, and of
  616. both real and complex data (as well as of even/odd data---i.e. the discrete
  617. cosine/ sine transforms or DCT/DST).")
  618. (license license:gpl2+)))
  619. (define-public fftwf
  620. (package (inherit fftw)
  621. (name "fftwf")
  622. (arguments
  623. (substitute-keyword-arguments (package-arguments fftw)
  624. ((#:configure-flags fftw-configure-flags)
  625. `(cons* "--enable-single"
  626. ,@(if (string-prefix? "arm" (or (%current-target-system)
  627. (%current-system)))
  628. ;; fftw supports NEON on 32-bit ARM only when compiled
  629. ;; for single-precision, so add it here.
  630. '("--enable-neon")
  631. '())
  632. ,fftw-configure-flags))))
  633. (description
  634. (string-append (package-description fftw)
  635. " Single-precision version."))))
  636. (define-public fftw-openmpi
  637. (package (inherit fftw)
  638. (name "fftw-openmpi")
  639. (inputs
  640. `(("openmpi" ,openmpi)
  641. ,@(package-inputs fftw)))
  642. (arguments
  643. (substitute-keyword-arguments (package-arguments fftw)
  644. ((#:configure-flags cf)
  645. `(cons "--enable-mpi" ,cf))
  646. ((#:phases phases '%standard-phases)
  647. `(modify-phases ,phases
  648. (add-before 'check 'mpi-setup
  649. ,%openmpi-setup)))))
  650. (description
  651. (string-append (package-description fftw)
  652. " With OpenMPI parallelism support."))))
  653. (define-public java-la4j
  654. (package
  655. (name "java-la4j")
  656. (version "0.6.0")
  657. (source (origin
  658. (method git-fetch)
  659. (uri (git-reference
  660. (url "https://github.com/vkostyukov/la4j.git")
  661. (commit version)))
  662. (file-name (string-append name "-" version "-checkout"))
  663. (sha256
  664. (base32
  665. "1qir8dr978cfvz9k12m2kbdwpyf6cqdf1d0ilb7lnkhbgq5i53w3"))))
  666. (build-system ant-build-system)
  667. (arguments
  668. `(#:jar-name "la4j.jar"
  669. #:jdk ,icedtea-8
  670. #:test-exclude (list "**/Abstract*.java"
  671. "**/MatrixTest.java"
  672. "**/DenseMatrixTest.java"
  673. "**/SparseMatrixTest.java"
  674. "**/VectorTest.java"
  675. "**/SparseVectorTest.java"
  676. "**/DenseVectorTest.java")))
  677. (native-inputs
  678. `(("java-junit" ,java-junit)
  679. ("java-hamcrest-core" ,java-hamcrest-core)))
  680. (home-page "http://la4j.org/")
  681. (synopsis "Java library that provides Linear Algebra primitives and algorithms")
  682. (description "The la4j library is a Java library that provides Linear
  683. Algebra primitives (matrices and vectors) and algorithms. The key features of
  684. the la4j library are:
  685. @itemize
  686. @item No dependencies and tiny size
  687. @item Fluent object-oriented/functional API
  688. @item Sparse (CRS, CCS) and dense (1D/2D arrays) matrices
  689. @item Linear systems solving (Gaussian, Jacobi, Zeidel, Square Root, Sweep and other)
  690. @item Matrices decomposition (Eigenvalues/Eigenvectors, SVD, QR, LU, Cholesky and other)
  691. @item MatrixMarket/CSV IO formats support for matrices and vectors
  692. @end itemize\n")
  693. (license license:asl2.0)))
  694. (define-public java-jlargearrays
  695. (package
  696. (name "java-jlargearrays")
  697. (version "1.6")
  698. (source (origin
  699. (method url-fetch)
  700. (uri (string-append "http://search.maven.org/remotecontent?"
  701. "filepath=pl/edu/icm/JLargeArrays/"
  702. version "/JLargeArrays-" version
  703. "-sources.jar"))
  704. (file-name (string-append name "-" version ".jar"))
  705. (sha256
  706. (base32
  707. "0v05iphpxbjnd7f4jf1rlqq3m8hslhcm0imdbsgxr20pi3xkaf2a"))))
  708. (build-system ant-build-system)
  709. (arguments
  710. `(#:jar-name "jlargearrays.jar"
  711. #:tests? #f ; tests are not included in the release archive
  712. #:jdk ,icedtea-8))
  713. (propagated-inputs
  714. `(("java-commons-math3" ,java-commons-math3)))
  715. (home-page "https://gitlab.com/ICM-VisLab/JLargeArrays")
  716. (synopsis "Library of one-dimensional arrays that can store up to 263 elements")
  717. (description "JLargeArrays is a Java library of one-dimensional arrays
  718. that can store up to 263 elements.")
  719. (license license:bsd-2)))
  720. (define-public java-jtransforms
  721. (package
  722. (name "java-jtransforms")
  723. (version "3.1")
  724. (source (origin
  725. (method url-fetch)
  726. (uri (string-append "http://search.maven.org/remotecontent?"
  727. "filepath=com/github/wendykierp/JTransforms/"
  728. version "/JTransforms-" version "-sources.jar"))
  729. (sha256
  730. (base32
  731. "1haw5m8shv5srgcpwkl853dz8bv6h90bzlhcps6mdpb4cixjirsg"))))
  732. (build-system ant-build-system)
  733. (arguments
  734. `(#:jar-name "jtransforms.jar"
  735. #:tests? #f ; tests are not included in the release archive
  736. #:jdk ,icedtea-8))
  737. (propagated-inputs
  738. `(("java-commons-math3" ,java-commons-math3)
  739. ("java-jlargearrays" ,java-jlargearrays)))
  740. (home-page "https://github.com/wendykierp/JTransforms")
  741. (synopsis "Multithreaded FFT library written in pure Java")
  742. (description "JTransforms is a multithreaded FFT library written in pure
  743. Java. Currently, four types of transforms are available: @dfn{Discrete
  744. Fourier Transform} (DFT), @dfn{Discrete Cosine Transform} (DCT), @dfn{Discrete
  745. Sine Transform} (DST) and @dfn{Discrete Hartley Transform} (DHT).")
  746. (license license:bsd-2)))
  747. (define-public eigen
  748. (package
  749. (name "eigen")
  750. (version "3.3.5")
  751. (source (origin
  752. (method url-fetch)
  753. (uri (string-append "https://bitbucket.org/eigen/eigen/get/"
  754. version ".tar.bz2"))
  755. (sha256
  756. (base32
  757. "1qh3yrwn78ms5yhwbpl5wvblk4gbz02cacdygxylr7i9xbrvylkk"))
  758. (file-name (string-append name "-" version ".tar.bz2"))
  759. (modules '((guix build utils)))
  760. (snippet
  761. ;; There are 3 test failures in the "unsupported" directory,
  762. ;; but maintainers say it's a known issue and it's unsupported
  763. ;; anyway, so just skip them.
  764. '(begin
  765. (substitute* "unsupported/CMakeLists.txt"
  766. (("add_subdirectory\\(test.*")
  767. "# Do not build the tests for unsupported features.\n"))
  768. #t))))
  769. (build-system cmake-build-system)
  770. (arguments
  771. '(;; Turn off debugging symbols to save space.
  772. #:build-type "Release"
  773. #:phases (modify-phases %standard-phases
  774. (replace 'check
  775. (lambda _
  776. (let* ((cores (parallel-job-count))
  777. (dash-j (format #f "-j~a" cores)))
  778. (setenv "EIGEN_SEED" "1") ;for reproducibility
  779. ;; First build the tests, in parallel. See
  780. ;; <http://eigen.tuxfamily.org/index.php?title=Tests>.
  781. (invoke "make" "buildtests" dash-j)
  782. ;; Then run 'CTest' with -V so we get more
  783. ;; details upon failure.
  784. (invoke "ctest" "-V" dash-j)))))))
  785. (home-page "https://eigen.tuxfamily.org")
  786. (synopsis "C++ template library for linear algebra")
  787. (description
  788. "Eigen is a C++ template library for linear algebra: matrices, vectors,
  789. numerical solvers, and related algorithms. It provides an elegant API based
  790. on \"expression templates\". It is versatile: it supports all matrix sizes,
  791. all standard numeric types, various matrix decompositions and geometry
  792. features, and more.")
  793. ;; Most of the code is MPLv2, with a few files under LGPLv2.1+ or BSD-3.
  794. ;; See 'COPYING.README' for details.
  795. (license license:mpl2.0)))
  796. (define-public xtensor
  797. (package
  798. (name "xtensor")
  799. (version "0.17.1")
  800. (source (origin
  801. (method git-fetch)
  802. (uri (git-reference
  803. (url "https://github.com/QuantStack/xtensor.git")
  804. (commit version)))
  805. (sha256
  806. (base32
  807. "0w40v5lp0hp8ihf8nnvak373sb5xx0768pxgiqh3nzn57wf8px4r"))
  808. (file-name (git-file-name name version))))
  809. (build-system cmake-build-system)
  810. (native-inputs
  811. `(("googletest" ,googletest)
  812. ("xtl" ,xtl)))
  813. (arguments
  814. `(#:configure-flags
  815. '("-DBUILD_TESTS=ON")
  816. #:test-target "xtest"))
  817. (home-page "http://quantstack.net/xtensor")
  818. (synopsis "C++ tensors with broadcasting and lazy computing")
  819. (description "xtensor is a C++ library meant for numerical analysis with
  820. multi-dimensional array expressions.
  821. xtensor provides:
  822. @itemize
  823. @item an extensible expression system enabling lazy broadcasting.
  824. @item an API following the idioms of the C++ standard library.
  825. @item tools to manipulate array expressions and build upon xtensor.
  826. @end itemize")
  827. (license license:bsd-3)))
  828. (define-public gap
  829. (package
  830. (name "gap")
  831. (version "4.10.0")
  832. (source
  833. (origin
  834. (method url-fetch)
  835. (uri (string-append "https://www.gap-system.org/pub/gap/gap-"
  836. (version-major+minor version)
  837. "/tar.bz2/gap-"
  838. version
  839. ".tar.bz2"))
  840. (sha256
  841. (base32
  842. "1dmb8v4p7j1nnf7sx8sg54b49yln36bi9acwp7w1d3a1nxj17ird"))
  843. (modules '((guix build utils) (ice-9 ftw) (srfi srfi-1)))
  844. (snippet
  845. '(begin
  846. ;; Delete the external gmp and zlib libraries
  847. ;; and a subdirectory not needed for our build.
  848. (for-each delete-file-recursively
  849. '("extern" "hpcgap"))
  850. ;; Delete a failing test.
  851. ;; FIXME: This might be fixed in the next release, see
  852. ;; https://github.com/gap-system/gap/issues/3292
  853. (delete-file "tst/testinstall/dir.tst")
  854. ;; Delete all packages except for a fixed list.
  855. (with-directory-excursion "pkg"
  856. (for-each delete-file-recursively
  857. (lset-difference string=? (scandir ".")
  858. '("." ".."
  859. ;; Necessary packages.
  860. "GAPDoc-1.6.2"
  861. "primgrp-3.3.2"
  862. "SmallGrp-1.3" ; artistic2.0
  863. "transgrp" ; artistic2.0 for data,
  864. ; gpl2 or gpl3 for code
  865. ;; Recommanded package.
  866. "io-4.5.4" ; gpl3+
  867. ;; Optional packages, searched for at start,
  868. ;; and their depedencies.
  869. "alnuth-3.1.0"
  870. "AutoDoc-2018.09.20"
  871. "autpgrp-1.10"
  872. "crisp-1.4.4" ; bsd-2
  873. ; "ctbllib" ; no explicit license, drop
  874. "FactInt-1.6.2"
  875. "fga"
  876. "irredsol-1.4" ; bsd-2
  877. "laguna-3.9.0"
  878. "polenta-1.3.8"
  879. "polycyclic-2.14"
  880. "radiroot-2.8"
  881. "resclasses-4.7.1"
  882. "sophus-1.24"
  883. ; "tomlib-1.2.7" ; no explicit license, drop
  884. "utils-0.59"))))
  885. #t))))
  886. (build-system gnu-build-system)
  887. (inputs
  888. `(("gmp" ,gmp)
  889. ("zlib" ,zlib)))
  890. (arguments
  891. `(#:phases
  892. (modify-phases %standard-phases
  893. (add-after 'build 'build-packages
  894. ;; Compile all packages that have not been deleted by the
  895. ;; code snippet above.
  896. (lambda _
  897. (setenv "CONFIG_SHELL" (which "bash"))
  898. (with-directory-excursion "pkg"
  899. (invoke "../bin/BuildPackages.sh")
  900. #t)))
  901. (add-after 'build-packages 'build-doc
  902. ;; The documentation is bundled, but we create it from source.
  903. (lambda _
  904. (with-directory-excursion "doc"
  905. (invoke "./make_doc"))
  906. #t))
  907. (replace 'check
  908. (lambda _
  909. ;; "make check" is expected to appear in gap-4.10.1
  910. (invoke "./gap" "tst/testinstall.g")
  911. #t))
  912. (replace 'install
  913. (lambda* (#:key outputs #:allow-other-keys)
  914. (let* ((out (assoc-ref outputs "out"))
  915. (bin (string-append out "/bin"))
  916. (prog (string-append bin "/gap"))
  917. (prog-real (string-append bin "/.gap-real"))
  918. (share (string-append out "/share/gap"))
  919. (include (string-append out "/include/gap")))
  920. ;; Install only the gap binary; the gac compiler is left
  921. ;; for maybe later. "Wrap" it in a shell script that calls
  922. ;; the binary with the correct parameter.
  923. (mkdir-p bin)
  924. (copy-file "gap" prog-real)
  925. (call-with-output-file prog
  926. (lambda (port)
  927. (format port
  928. "#!~a~%exec ~a -l ~a \"$@\"~%"
  929. (which "bash")
  930. prog-real
  931. share)))
  932. (chmod prog #o755)
  933. ;; Install the headers and the library, which are needed by
  934. ;; Sage. The Makefile targets are available in gap-4.10.0,
  935. ;; but planned to be removed in gap-4.10.1.
  936. (invoke "make" "install-headers")
  937. (invoke "make" "install-libgap")
  938. (install-file "gen/config.h" include)
  939. ;; Install a certain number of files and directories to
  940. ;; SHARE, where the wrapped shell script expects them.
  941. ;; Remove information on the build directory from sysinfo.gap.
  942. (substitute* "sysinfo.gap"
  943. (("GAP_BIN_DIR=\".*\"") "GAP_BIN_DIR=\"\"")
  944. (("GAP_LIB_DIR=\".*\"") "GAP_LIB_DIR=\"\"")
  945. (("GAP_CPPFLAGS=\".*\"") "GAP_CPPFLAGS=\"\""))
  946. (install-file "sysinfo.gap" share)
  947. (copy-recursively "grp" (string-append share "/grp"))
  948. (copy-recursively "pkg" (string-append share "/pkg"))
  949. ;; The following is not the C library libgap.so, but a
  950. ;; library of GAP code.
  951. (copy-recursively "lib" (string-append share "/lib"))
  952. ;; The gap binary looks for documentation inside SHARE.
  953. (copy-recursively "doc" (string-append share "/doc")))
  954. #t)))))
  955. (home-page "https://www.gap-system.org/")
  956. (synopsis
  957. "System for computational group theory")
  958. (description
  959. "GAP is a system for computational discrete algebra, with particular
  960. emphasis on computational group theory. It provides a programming language,
  961. a library of thousands of functions implementing algebraic algorithms
  962. written in the GAP language as well as large data libraries of algebraic
  963. objects.")
  964. ;; Some packages have different licenses (effectively forcing the
  965. ;; combined work to be licensed as gpl3+); if this is the case, this
  966. ;; is mentioned above next to their name.
  967. ;; Some packages have no license mentioned explicitly; supposedly this
  968. ;; means that the gpl2+ licence of GAP itself applies, but to be on the
  969. ;; safe side, we drop them for now.
  970. (license license:gpl2+)))