projects/guix·blob python-team · refs

2400 lines · 94.9 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2022, 2023, 2024, 2025 Andreas Enge <[email protected]>
3;;; Copyright © 2013, 2015, 2017, 2018, 2021 Ludovic Courtès <[email protected]>
4;;; Copyright © 2016-2026 Nicolas Goaziou <[email protected]>
5;;; Copyright © 2014, 2018 Mark H Weaver <[email protected]>
6;;; Copyright © 2016, 2018, 2019, 2021, 2023 Ricardo Wurmus <[email protected]>
7;;; Copyright © 2017, 2020-2022 Efraim Flashner <[email protected]>
8;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <[email protected]>
9;;; Copyright © 2017 Marius Bakke <[email protected]>
10;;; Copyright © 2017, 2019, 2021, 2022 Eric Bavier <[email protected]>
11;;; Copyright © 2019 Mathieu Othacehe <[email protected]>
12;;; Copyright © 2020 Björn Höfling <[email protected]>
13;;; Copyright © 2020 Jakub Kądziołka <[email protected]>
14;;; Copyright © 2020 Vincent Legoll <[email protected]>
15;;; Copyright © 2020, 2021, 2023, 2024, 2025 Vinicius Monego <[email protected]>
16;;; Copyright © 2021 Lars-Dominik Braun <[email protected]>
17;;; Copyright © 2022 宋文武 <[email protected]>
18;;; Copyright © 2022 Maxim Cournoyer <[email protected]>
19;;; Copyright © 2023 Mehmet Tekman <[email protected]>
20;;; Copyright © 2025-2026 Sharlatan Hellseher <[email protected]>
21;;; Copyright © 2025 Nigko Yerden <[email protected]>
22;;; Copyright © 2025 Skylar Hill <[email protected]>
23;;; Copyright © 2025 Janneke Nieuwenhuizen <[email protected]>
24;;; Copyright © 2025 Andy Tai <[email protected]>
25;;;
26;;; This file is part of GNU Guix.
27;;;
28;;; GNU Guix is free software; you can redistribute it and/or modify it
29;;; under the terms of the GNU General Public License as published by
30;;; the Free Software Foundation; either version 3 of the License, or (at
31;;; your option) any later version.
32;;;
33;;; GNU Guix is distributed in the hope that it will be useful, but
34;;; WITHOUT ANY WARRANTY; without even the implied warranty of
35;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36;;; GNU General Public License for more details.
37;;;
38;;; You should have received a copy of the GNU General Public License
39;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
40
41(define-module (gnu packages algebra)
42 #:use-module (gnu packages)
43 #:use-module (gnu packages autotools)
44 #:use-module (gnu packages base)
45 #:use-module (gnu packages bash)
46 #:use-module (gnu packages bison)
47 #:use-module (gnu packages boost)
48 #:use-module (gnu packages build-tools)
49 #:use-module (gnu packages check)
50 #:use-module (gnu packages cmake)
51 #:use-module (gnu packages compression)
52 #:use-module (gnu packages cpp)
53 #:use-module (gnu packages curl)
54 #:use-module (gnu packages documentation)
55 #:use-module (gnu packages compiler-tools)
56 #:use-module (gnu packages toolkits)
57 #:use-module (gnu packages fontutils)
58 #:use-module (gnu packages gcc)
59 #:use-module (gnu packages gl)
60 #:use-module (gnu packages graphviz)
61 #:use-module (gnu packages image)
62 #:use-module (gnu packages java)
63 #:use-module (gnu packages libffi)
64 #:use-module (gnu packages linux)
65 #:use-module (gnu packages maths)
66 #:use-module (gnu packages mpi)
67 #:use-module (gnu packages multiprecision)
68 #:use-module (gnu packages ncurses)
69 #:use-module (gnu packages networking)
70 #:use-module (gnu packages ocaml)
71 #:use-module (gnu packages perl)
72 #:use-module (gnu packages pkg-config)
73 #:use-module (gnu packages pretty-print)
74 #:use-module (gnu packages pulseaudio)
75 #:use-module (gnu packages python)
76 #:use-module (gnu packages python-build)
77 #:use-module (gnu packages python-xyz)
78 #:use-module (gnu packages readline)
79 #:use-module (gnu packages ruby)
80 #:use-module (gnu packages shells)
81 #:use-module (gnu packages tex)
82 #:use-module (gnu packages texinfo)
83 #:use-module (gnu packages text-editors)
84 #:use-module (gnu packages xiph)
85 #:use-module (gnu packages xml)
86 #:use-module (gnu packages xorg)
87 #:use-module (guix build-system ant)
88 #:use-module (guix build-system gnu)
89 #:use-module (guix build-system cmake)
90 #:use-module (guix build-system pyproject)
91 #:use-module (guix build-system r)
92 #:use-module (guix download)
93 #:use-module (guix gexp)
94 #:use-module (guix git-download)
95 #:use-module (guix hg-download)
96 #:use-module (guix svn-download)
97 #:use-module ((guix licenses) #:prefix license:)
98 #:use-module (guix packages)
99 #:use-module (guix utils)
100 #:use-module (ice-9 match))
101
102
103(define-public mpfrcx
104 (package
105 (name "mpfrcx")
106 (version "0.6.3")
107 (source (origin
108 (method url-fetch)
109 (uri (string-append
110 "http://www.multiprecision.org/downloads/mpfrcx-"
111 version ".tar.gz"))
112 (sha256
113 (base32
114 "1545vgizpypqi2rrriad0ybqv0qwbn9zr0ibxpk00gha9ihv7acx"))))
115 (build-system gnu-build-system)
116 (propagated-inputs
117 (list gmp mpfr mpc)) ; Header files are included by mpfrcx.h.
118 (synopsis "Arithmetic of polynomials over arbitrary precision numbers")
119 (description
120 "Mpfrcx is a library for the arithmetic of univariate polynomials over
121arbitrary precision real (mpfr) or complex (mpc) numbers, without control
122on the rounding. For the time being, only the few functions needed to
123implement the floating point approach to complex multiplication are
124implemented. On the other hand, these comprise asymptotically fast
125multiplication routines such as Toom–Cook and the FFT.")
126 (license license:lgpl3+)
127 (home-page "https://www.multiprecision.org/mpfrcx/")))
128
129(define-public gf2x
130 (package
131 (name "gf2x")
132 (version "1.3.0")
133 (source (origin
134 (method git-fetch)
135 (uri (git-reference
136 (url "https://gitlab.inria.fr/gf2x/gf2x")
137 (commit (string-append name "-" version))))
138 (file-name (git-file-name name version))
139 (sha256
140 (base32
141 "04g5jg0i4vz46b4w2dvbmahwzi3k6b8g515mfw7im1inc78s14id"))))
142 (build-system gnu-build-system)
143 (arguments
144 (list
145 #:configure-flags
146 #~(list "CFLAGS=-g -O2 -Wno-error=implicit-function-declaration")))
147 (native-inputs (list autoconf automake libtool))
148 (synopsis "Arithmetic of polynomials over binary finite fields")
149 (description
150 "The gf2x library provides arithmetic of polynomials over finite fields
151of characteristic 2. It implements the multiplication, squaring and
152greatest common divisor operations.")
153 (home-page "https://gitlab.inria.fr/gf2x/gf2x")
154 (license license:gpl3+)))
155
156(define-public cm
157 (package
158 (name "cm")
159 (version "0.4.4")
160 (source (origin
161 (method url-fetch)
162 (uri (string-append
163 "https://www.multiprecision.org/downloads/cm-"
164 version ".tar.gz"))
165 (sha256
166 (base32
167 "0zkdl4cka32jclhajm7wdpkyzjq1335l58janjisv88a1di9gyy6"))))
168 (build-system gnu-build-system)
169 (propagated-inputs
170 (list mpfrcx zlib)) ; Header files included from lib/cm.h.
171 (inputs
172 (list flint pari-gp))
173 (synopsis "CM constructions for elliptic curves")
174 (description
175 "The CM software implements the construction of ring class fields of
176imaginary quadratic number fields and of elliptic curves with complex
177multiplication via floating point approximations, and the elliptic curve
178primality proving algorithm (ECPP). It consists of libraries
179that can be called from within a C program and of executable command
180line applications.")
181 (license license:gpl3+)
182 (home-page "https://www.multiprecision.org/cm/")))
183
184(define-public fplll
185 (package
186 (name "fplll")
187 (version "5.5.0")
188 (source (origin
189 (method git-fetch)
190 (uri (git-reference
191 (url "https://github.com/fplll/fplll")
192 (commit version)))
193 (file-name (git-file-name name version))
194 (sha256
195 (base32
196 "0m38c1h5586aykac1yy5753a2ygggasrhmmrk092lcnl55ldgy2s"))))
197 (build-system gnu-build-system)
198 (native-inputs
199 (list autoconf automake libtool pkg-config))
200 (propagated-inputs ; header files pulled in by fplll/defs.h
201 (list gmp mpfr))
202 (home-page "https://github.com/fplll/fplll")
203 (synopsis "Library for LLL-reduction of euclidean lattices")
204 (description
205 "fplll contains implementations of several lattice algorithms.
206The implementation relies on floating-point orthogonalization, and LLL
207is central to the code, hence the name.
208
209It includes implementations of floating-point LLL reduction
210algorithms, offering different speed/guarantees ratios. It contains
211a @emph{wrapper} choosing the estimated best sequence of variants in
212order to provide a guaranteed output as fast as possible. In the case
213of the wrapper, the succession of variants is oblivious to the user.
214
215It includes an implementation of the BKZ reduction algorithm,
216including the BKZ-2.0 improvements (extreme enumeration
217pruning, pre-processing of blocks, early termination). Additionally,
218Slide reduction and self dual BKZ are supported.
219
220It also includes a floating-point implementation of the
221Kannan-Fincke-Pohst algorithm that finds a shortest non-zero lattice
222vector. For the same task, the GaussSieve algorithm is also available
223in fplll. Finally, it contains a variant of the enumeration algorithm
224that computes a lattice vector closest to a given vector belonging to
225the real span of the lattice.")
226 (license license:lgpl2.1+)))
227
228(define-public python-fpylll
229 (package
230 (name "python-fpylll")
231 (version "0.6.4")
232 (source
233 (origin
234 (method url-fetch)
235 (uri (pypi-uri "fpylll" version))
236 (sha256
237 (base32
238 "1k9fcfcf0p0z0szd1f5973mg9ixl51vmhifc684l2sm4mpc607bi"))))
239 (build-system pyproject-build-system)
240 (native-inputs (list python-pytest python-setuptools))
241 (inputs
242 (list fplll gmp mpfr pari-gp))
243 (propagated-inputs
244 (list python-cysignals python-cython python-flake8 python-numpy))
245 (home-page "https://github.com/fplll/fpylll")
246 (synopsis "Python interface for fplll")
247 (description "fpylll is a Python wrapper for fplll.")
248 (license license:gpl2+)))
249
250(define pari-galdata
251 ;; version from 2008-04-12
252 (origin
253 (method url-fetch)
254 ;; no versioning, old files seem to be moved to `old/...' on update
255 (uri "https://pari.math.u-bordeaux.fr/pub/pari/packages/galdata.tgz")
256 (sha256
257 (base32
258 "1pch6bk76f1i6cwwgm7hhxi5h71m52lqayp4mnyj0jmjk406bhdp"))))
259
260(define pari-seadata-small
261 ;; version from 2009-06-18
262 (origin
263 (method url-fetch)
264 (uri "https://pari.math.u-bordeaux.fr/pub/pari/packages/seadata-small.tgz")
265 (sha256
266 (base32
267 "13qafribxwkz8h3haa0cng7arz0kh7398br4y7vqs9ib8w9yjnxz"))))
268
269(define-public pari-gp
270 (package
271 (name "pari-gp")
272 (version "2.17.4")
273 (source (origin
274 (method url-fetch)
275 (uri (string-append
276 "https://pari.math.u-bordeaux.fr/pub/pari/unix/pari-"
277 version ".tar.gz"))
278 (sha256
279 (base32
280 "0lsbra48dkp9k5n4k7kg0dvnp4f6mchbrb9z9cw7s04iqfcisr82"))))
281 (build-system gnu-build-system)
282 (native-inputs (list (texlive-local-tree)))
283 (inputs (list gmp libx11 perl readline))
284 (arguments
285 (list
286 #:test-target "dobench"
287 #:phases
288 #~(modify-phases %standard-phases
289 (replace 'configure
290 (lambda _
291 (invoke "./Configure"
292 "--mt=pthread"
293 (string-append "--prefix=" #$output))))
294 (add-after 'install 'install-data
295 (lambda _
296 (invoke "tar" "-xvf" #$pari-galdata)
297 (invoke "tar" "-xvf" #$pari-seadata-small)
298 (copy-recursively "data/" (string-append
299 #$output
300 "/share/pari")))))))
301 (synopsis "PARI/GP, a computer algebra system for number theory")
302 (description
303 "PARI/GP is a widely used computer algebra system designed for fast
304computations in number theory (factorisations, algebraic number theory,
305elliptic curves...), but it also contains a large number of other useful
306functions to compute with mathematical entities such as matrices,
307polynomials, power series, algebraic numbers, etc., and a lot of
308transcendental functions.
309PARI is also available as a C library to allow for faster computations.")
310 (license license:gpl2+)
311 (home-page "https://pari.math.u-bordeaux.fr/")))
312
313(define-public gp2c
314 (package
315 (name "gp2c")
316 (version "0.0.14pl1")
317 (source (origin
318 (method url-fetch)
319 (uri (string-append
320 "https://pari.math.u-bordeaux.fr/pub/pari/GP2C/gp2c-"
321 version ".tar.gz"))
322 (sha256
323 (base32
324 "1g160xg8p624vg1ms7mz34zrb9132ppwwrpqi4ldqqkqzlhf0p14"))))
325 (build-system gnu-build-system)
326 (native-inputs (list perl))
327 (inputs (list pari-gp))
328 (arguments
329 '(#:configure-flags
330 (list (string-append "--with-paricfg="
331 (assoc-ref %build-inputs "pari-gp")
332 "/lib/pari/pari.cfg"))))
333 (synopsis "PARI/GP, a computer algebra system for number theory")
334 (description
335 "PARI/GP is a widely used computer algebra system designed for fast
336computations in number theory (factorisations, algebraic number theory,
337elliptic curves...), but it also contains a large number of other useful
338functions to compute with mathematical entities such as matrices,
339polynomials, power series, algebraic numbers, etc., and a lot of
340transcendental functions.
341PARI is also available as a C library to allow for faster computations.
342
343GP2C, the GP to C compiler, translates GP scripts to PARI programs.")
344 (license license:gpl2)
345 (home-page "https://pari.math.u-bordeaux.fr/")))
346
347(define-public paritwine
348 (package
349 (name "paritwine")
350 (version "0.2.2")
351 (source (origin
352 (method url-fetch)
353 (uri (string-append
354 "https://www.multiprecision.org/downloads/" name
355 "-" version
356 ".tar.gz"))
357 (sha256
358 (base32
359 "0hkn18qkg4ssg1rg6k95ff7yvywacvhwqq9gj06wix4xb7nw4yzz"))))
360 (build-system gnu-build-system)
361 (propagated-inputs (list pari-gp
362 gmp
363 mpfr
364 mpc
365 cmh
366 flint)) ; referenced in src/paritwine.h
367 (synopsis "Glue library between PARI/GP and other mathematics libraries")
368 (description
369 "PariTwine is a glue library between the system for computer algebra
370and number theory PARI/GP and a number of other mathematics libraries,
371currently GMP, GNU MPFR, GNU MPC, FLINT and CMH.")
372 (license license:gpl2+)
373 (home-page "https://www.multiprecision.org/paritwine/index.html")))
374
375(define-public cmh
376 (package
377 (name "cmh")
378 (version "1.1.1")
379 (source (origin
380 (method url-fetch)
381 ;; Git repo at <https://gitlab.inria.fr/cmh/cmh>.
382 (uri (string-append
383 "https://www.multiprecision.org/downloads/cmh-" version
384 ".tar.gz"))
385 (sha256
386 (base32
387 "0nadvqfmidgks1s7aljsf8dp32pz7vjaxyaym36m9bx4zr8msk91"))))
388 (build-system gnu-build-system)
389 (inputs (list gmp
390 mpfr
391 mpc
392 mpfrcx
393 fplll
394 pari-gp))
395 (synopsis "Igusa class polynomial computations")
396 (description
397 "The CMH software computes Igusa (genus 2) class polynomials, which
398parameterize the CM points in the moduli space of 2-dimensional abelian
399varieties, i.e. Jacobians of hyperelliptic curves.
400It can also be used to compute theta constants at arbitrary
401precision.")
402 (license license:gpl3+)
403 (home-page "https://www.multiprecision.org/cmh/home.html")))
404
405(define-public giac
406 (package
407 (name "giac")
408 (version "2.0.0-21")
409 (source
410 (origin
411 (method url-fetch)
412 ;; "~parisse/giac" is not used because the maintainer regularly
413 ;; overwrites the release tarball there, introducing a checksum
414 ;; mismatch every time. See
415 ;; <https://www-fourier.ujf-grenoble.fr/~parisse/debian/dists/stable/main/source/README>
416 (uri (string-append
417 "https://www-fourier.ujf-grenoble.fr/~parisse/debian/dists/"
418 "stable/main/source/giac_" version ".tar.gz"))
419 (sha256
420 (base32 "1j6bip76hhqvycapf7xy26y0b8g5zzx4gwkfsr7bf6m2h71a2zry"))))
421 (build-system gnu-build-system)
422 (arguments
423 (list
424 #:modules '((ice-9 ftw)
425 (guix build utils)
426 (guix build gnu-build-system))
427 #:phases
428 #~(modify-phases %standard-phases
429 (add-after 'unpack 'patch-bin-cp
430 ;; Some Makefiles contain hard-coded "/bin/cp".
431 (lambda _
432 (substitute* (cons "micropython-1.12/xcas/Makefile"
433 (find-files "doc" "^Makefile"))
434 (("/bin/cp") (which "cp")))))
435 (replace 'bootstrap
436 (lambda _
437 ;; XXX: Regenerate "src/mkjs" to avoid a build error because
438 ;; the default file is bogus in a Guix environment.
439 (delete-file "src/mkjs")
440 (invoke "autoreconf" "-vfi")))
441 (add-after 'install 'fix-doc
442 (lambda _
443 ;; Most French documentation has a non-commercial license, so we
444 ;; need to remove it.
445 (with-directory-excursion
446 (string-append #$output "/share/giac/doc/fr")
447 (for-each delete-file-recursively
448 '("cascas" "casexo" "casgeo" "casrouge" "cassim"
449 "castor")))
450 ;; Remove duplicate documentation in "%out/share/doc/giac/",
451 ;; where Xcas does not expect to find it.
452 (delete-file-recursively
453 (string-append #$output "/share/doc/giac"))))
454 (add-after 'install 'remove-unnecessary-executable
455 (lambda _
456 (delete-file (string-append #$output "/bin/xcasnew")))))))
457 (inputs
458 ;; TODO: Unbundle "libmicropython.a".
459 (list ao
460 fltk
461 glpk
462 gmp
463 gsl
464 libjpeg-turbo
465 libpng
466 libsamplerate
467 libx11
468 libxft
469 libxinerama
470 libxt
471 mesa
472 mpfi
473 mpfr
474 (list nauty "lib")
475 ntl
476 openblas
477 pari-gp
478 perl
479 tcsh))
480 (native-inputs
481 (list autoconf
482 automake
483 bison
484 flex
485 hevea
486 libtool
487 python-wrapper
488 readline
489 (texlive-local-tree)))
490 (home-page "https://www-fourier.ujf-grenoble.fr/~parisse/giac.html")
491 (synopsis "Computer algebra system")
492 (description
493 "Giac/Xcas is a computer algebra system. It has a compatibility mode for
494maple, mupad and the TI89. It is available as a standalone program (graphic
495or text interfaces) or as a C++ library.")
496 (license license:gpl3+)))
497
498(define-public flint
499 (package
500 (name "flint")
501 (version "3.6.0")
502 (source
503 (origin
504 (method url-fetch)
505 (uri (string-append "https://flintlib.org/download/flint-"
506 version ".tar.gz"))
507 (sha256
508 (base32 "0sy3nk4zspgbjnr9982p5s1mcis3k102rm6jr2hs9vpmj9vjqpmr"))))
509 (build-system gnu-build-system)
510 (propagated-inputs
511 (list gmp mpfr)) ; header files included by flint.h or mpfr_mat.h
512 (arguments
513 ;; Prevent build machine specifics from ending up in the binary.
514 '(#:configure-flags '("--disable-assembly")))
515 (synopsis "Fast library for number theory")
516 (description
517 "FLINT is a C library for number theory. It supports arithmetic
518with numbers, polynomials, power series and matrices over many base
519rings, including multiprecision integers and rationals, integers
520modulo n, p-adic numbers, finite fields (prime and non-prime order)
521and real and complex numbers (via the Arb extension library).
522
523Operations that can be performed include conversions, arithmetic,
524GCDs, factoring, solving linear systems, and evaluating special
525functions. In addition, FLINT provides various low-level routines for
526fast arithmetic.")
527 (license license:lgpl3+)
528 (home-page "https://flintlib.org/")
529 (properties
530 '((release-monitoring-url . "http://flintlib.org/downloads.html")))))
531
532(define-public python-flint
533 (package
534 (name "python-flint")
535 (version "0.9.0")
536 (source
537 (origin
538 (method git-fetch)
539 (uri (git-reference
540 (url "https://github.com/fredrik-johansson/python-flint")
541 (commit version)))
542 (file-name (git-file-name name version))
543 (sha256
544 (base32 "1i1lp7ir8r0jykbakirfkz1za0285806lbc7r6rsygydv22021vs"))))
545 (build-system pyproject-build-system)
546 (arguments
547 (list
548 ;; tests: 905 passed
549 #:test-flags #~(list "--pyargs" "flint")))
550 (native-inputs
551 (list pkg-config
552 python-meson
553 python-pytest))
554 (inputs
555 (list gmp
556 flint))
557 (propagated-inputs
558 (list python-numpy))
559 (home-page "https://fredrikj.net/python-flint/")
560 (synopsis "Python module wrapping ARB and FLINT")
561 (description
562 "Python-flint is a Python extension module wrapping FLINT
563(Fast Library for Number Theory) and Arb (arbitrary-precision ball
564arithmetic). It supports integers, rationals, modular integers, real and
565complex ball arithmetic, polynomials and matrices over all these types and
566other mathematical functions.")
567 (license license:expat)))
568
569(define-public ntl
570 (package
571 (name "ntl")
572 (version "11.5.1")
573 (source (origin
574 (method url-fetch)
575 (uri (string-append "https://shoup.net/ntl/ntl-"
576 version ".tar.gz"))
577 (sha256
578 (base32
579 "12ka3hym4skg63mp8vgkin79svbpdk2m6i41yvmcdjq62g1hc391"))
580 (modules '((guix build utils)))
581 (snippet
582 '(begin
583 (delete-file-recursively "src/libtool-origin")))))
584 (build-system gnu-build-system)
585 (native-inputs
586 (list libtool perl)) ; for configuration
587 (inputs
588 (list gmp gf2x))
589 (arguments
590 `(#:phases
591 (modify-phases %standard-phases
592 (replace 'configure
593 (lambda* (#:key inputs outputs #:allow-other-keys)
594 (chdir "src")
595 (invoke "./configure"
596 (string-append "PREFIX=" (assoc-ref outputs "out"))
597 (string-append "LIBTOOL=" (assoc-ref inputs "libtool") "/bin/libtool")
598 ;; set the library prefixes explicitly so that they get
599 ;; embedded in the .la file
600 (string-append "GMP_PREFIX=" (assoc-ref inputs "gmp"))
601 (string-append "GF2X_PREFIX=" (assoc-ref inputs "gf2x"))
602 ;; Do not build especially for the build machine.
603 "NATIVE=off"
604 "NTL_GF2X_LIB=on"
605 "SHARED=on"))))))
606 (synopsis "C++ library for number theory")
607 (description
608 "NTL is a C++ library providing data structures and algorithms
609for manipulating signed, arbitrary length integers, and for vectors,
610matrices, and polynomials over the integers and over finite fields.")
611 (license license:lgpl2.1+) ; Linking with gf2x makes the distributed
612 ; binary de facto gpl3+.
613 (home-page "https://shoup.net/ntl/")))
614
615(define-public singular
616 (package
617 (name "singular")
618 (version "4.4.1p5")
619 (source
620 (origin
621 (method url-fetch)
622 (uri
623 (string-append "https://www.singular.uni-kl.de/ftp/pub/Math/"
624 "Singular/SOURCES/"
625 (string-join
626 (string-split
627 (let ((index (string-index version #\p)))
628 (if index (string-take version index)
629 version))
630 #\.) "-")
631 "/singular-" version ".tar.gz"))
632 (sha256
633 (base32
634 "1pwygpmhf4sddf1v5x5fr1kbbkb29wlfd5yyj7lryvhbs45s9rdw"))))
635 (build-system gnu-build-system)
636 (arguments
637 (list
638 #:configure-flags #~(list (string-append "--with-ntl="
639 #$(this-package-input "ntl")))))
640 (native-inputs
641 (list doxygen graphviz perl))
642 (inputs
643 (list cddlib
644 gmp
645 flint
646 mpfr
647 ntl
648 readline))
649 (synopsis "Computer algebra system for polynomial computations")
650 (description
651 "Singular is a computer algebra system for polynomial computations,
652with special emphasis on commutative and non-commutative algebra, algebraic
653geometry and singularity theory.")
654 ;; Singular itself is dual licensed gpl2 or gpl3, but some of the
655 ;; libraries with which it links are licensed under lgpl3+, so the
656 ;; combined work becomes gpl3. See COPYING in the source code.
657 (license license:gpl3)
658 (home-page "https://www.singular.uni-kl.de/index.html")))
659
660(define-public python-pysingular
661 (package
662 (name "python-pysingular")
663 (version "0.9.7")
664 (source
665 (origin
666 (method url-fetch)
667 (uri (pypi-uri "PySingular" version))
668 (sha256
669 (base32 "037n3s1l08g75k22saki6813wi3ciiq45zxca11izilgagbx20ya"))))
670 (build-system pyproject-build-system)
671 (arguments
672 (list #:tests? #f)) ; there are no tests
673 (native-inputs (list python-setuptools))
674 ;; XXX: GMP failed to be loaded from Singular. Pass it here for now.
675 (inputs (list gmp singular))
676 (home-page "https://github.com/sebasguts/PySingular")
677 (synopsis "Simple interface to Singular")
678 (description "This package provides a simple Python interface to the
679Singular computer algebra system.")
680 (license license:gpl2+)))
681
682(define-public gmp-ecm
683 (package
684 (name "gmp-ecm")
685 (version "7.0.5")
686 (source (origin
687 (method git-fetch)
688 (uri (git-reference
689 (url "https://gitlab.inria.fr/zimmerma/ecm")
690 (commit (string-append "git-" version))))
691 (file-name (git-file-name name version))
692 (sha256
693 (base32
694 "013sfsd5kyh7phhf4namcdndpcp2jnibzxf10f4g89qabr8av63m"))))
695 (build-system gnu-build-system)
696 (inputs
697 (list gmp))
698 (arguments
699 (list
700 #:configure-flags #~(list "--enable-shared"
701 ;; Disable specific assembly routines, which
702 ;; depend on the subarchitecture of the build
703 ;; machine, and use gmp instead.
704 "--disable-asm-redc")
705 #:phases #~(modify-phases %standard-phases
706 (add-after 'unpack 'patch-paths
707 (lambda _
708 (substitute* "test.ecm"
709 (("/bin/rm") (which "rm"))))))))
710 (native-inputs (list autoconf automake libtool))
711 (synopsis "Integer factorization library using the elliptic curve method")
712 (description
713 "GMP-ECM factors integers using the elliptic curve method (ECM) as well
714as the P-1 and P+1 algorithms. It provides a library and a stand-alone
715binary.")
716 (home-page "https://gitlab.inria.fr/zimmerma/ecm")
717 ;; Most files are under lgpl3+, but some are under gpl3+ or gpl2+, so the
718 ;; combined work is under gpl3+.
719 (license license:gpl3+)))
720
721(define-public bc
722 (package
723 (name "bc")
724 (version "1.08.2")
725 (source (origin
726 (method url-fetch)
727 (uri (string-append "mirror://gnu/bc/bc-" version ".tar.gz"))
728 (sha256
729 (base32
730 "11jzg23ks39k58bnb5y55wxqqz6h534ys5900hz6axcp8bn0yixf"))))
731 (build-system gnu-build-system)
732 (native-inputs
733 (list automake autoconf ed flex readline texinfo))
734 (inputs
735 (list readline ncurses))
736 (arguments
737 '(#:configure-flags
738 (list "--with-readline")
739 #:phases
740 (modify-phases %standard-phases
741 (replace 'bootstrap
742 (lambda _
743 (invoke "autoreconf" "-vif"))))))
744 (home-page "https://www.gnu.org/software/bc/")
745 (synopsis "Arbitrary precision numeric processing language")
746 (description
747 "bc is an arbitrary precision numeric processing language. It includes
748an interactive environment for evaluating mathematical statements. Its
749syntax is similar to that of C, so basic usage is familiar. It also includes
750\"dc\", a reverse-polish calculator.")
751 (license license:gpl3+)))
752
753(define-public gavinhoward-bc
754 (package
755 (name "gavinhoward-bc")
756 (version "7.1.0")
757 (source
758 (origin
759 (method git-fetch)
760 (uri (git-reference
761 (url "https://github.com/gavinhoward/bc")
762 (commit version)))
763 (file-name (git-file-name name version))
764 (sha256
765 (base32 "1n2cz4jxy05n04a70szx50l8czyncf8hx8lgpd4vvk6lgk82913c"))
766 (patches
767 (search-patches "gavinhoward-bc-7.1.0-fix-memleak.patch"))))
768 (build-system gnu-build-system)
769 (arguments
770 (list
771 #:test-target "test"
772 #:configure-flags
773 #~(list
774 ;; INFO: These tests require GNU bc.
775 "--disable-generated-tests")
776 #:phases
777 #~(modify-phases %standard-phases
778 (add-before 'configure 'set-environment-variables
779 (lambda _
780 (setenv "CC" #$(cc-for-target))))
781 (replace 'configure
782 ;; INFO: Most certainly the custom-made configure.sh script
783 ;; silently breaks when called with unrecognized arguments.
784 (lambda* (#:key configure-flags #:allow-other-keys)
785 (apply invoke "./configure.sh"
786 (string-append "--prefix=" #$output)
787 configure-flags))))))
788 (home-page "https://github.com/gavinhoward/bc")
789 (synopsis "Alternative POSIX-compliant implementation of bc")
790 (description
791 "This package provides an alternative implementation of bc calculator.")
792 (license
793 (list license:bsd-2
794 ;; src/rand.c, include/rand.h, scripts/safe-install.sh
795 license:expat
796 ;; scripts/ministat.c; Beer-ware
797 (license:non-copyleft "file://LICENSE.md"
798 "See LICENSE.md for details.")))))
799
800;; The original kiss-fft does not have a complete build system and does not
801;; build any shared libraries. This is a fork used by Extempore.
802(define-public kiss-fft-for-extempore
803 (package
804 (name "kiss-fft-for-extempore")
805 (version "1.3.0")
806 (source (origin
807 (method git-fetch)
808 (uri (git-reference
809 (url "https://github.com/extemporelang/kiss_fft")
810 (commit version)))
811 (file-name (git-file-name name version))
812 (sha256
813 (base32
814 "0jasbmqy4wkqrqx3w64s1dfmj34875xmsl72mb26aa4hpyn14bi2"))))
815 (build-system cmake-build-system)
816 (arguments `(#:tests? #f)) ; no tests included
817 ;; Extempore refuses to build on architectures other than x86_64
818 (supported-systems '("x86_64-linux"))
819 (home-page "https://github.com/extemporelang/kiss_fft")
820 (synopsis "Mixed-radix Fast Fourier Transform")
821 (description
822 "Kiss FFT attempts to be a reasonably efficient, moderately useful FFT
823that can use fixed or floating data types and can easily be incorporated into
824a C program.")
825 (license license:bsd-3)))
826
827(define-public kissfft
828 (package
829 (name "kissfft")
830 (version "131.1.0")
831 (source
832 (origin
833 (method git-fetch)
834 (uri (git-reference
835 (url "https://github.com/mborgerding/kissfft")
836 (commit version)))
837 (file-name (git-file-name name version))
838 (sha256 "1yfws5bn4kh62yk6hdyp9h9775l6iz7wsfisbn58jap6b56s8j5s")))
839 (build-system cmake-build-system)
840 (native-inputs
841 (list googletest
842 pkg-config
843 python-numpy
844 python-wrapper))
845 (inputs
846 (list fftw
847 libpng))
848 (home-page "https://github.com/mborgerding/kissfft")
849 (synopsis "Simple @acronym{FFT, Fast Fourier Transform} library")
850 (description
851 "Kiss FFT is a mixed-radix Fast Fourier Transform based up on the
852principle, 'Keep It Simple, Stupid.'")
853 (license license:bsd-3)))
854
855(define-public kissfft-for-tflite-micro
856 (package
857 (inherit kissfft)
858 (name "kissfft-for-tflite-micro")
859 (version "130")
860 (source
861 (origin
862 (method git-fetch)
863 (uri (git-reference
864 (url "https://github.com/mborgerding/kissfft")
865 (commit (string-append "v" version))))
866 (file-name (git-file-name name version))
867 (sha256
868 "137h3pkn6jmc3pcgnqsq481f6jjblx7ygw9gyipgcdysmnhrwiv2")
869 (patches (search-patches "kissfft-tflite-micro.patch"))))
870 (build-system gnu-build-system)
871 (arguments
872 (list
873 #:phases
874 #~(modify-phases %standard-phases
875 (delete 'configure)
876 (delete 'build)
877 (replace 'install
878 (lambda _
879 (for-each (lambda (f)
880 (install-file f
881 (string-append #$output "/include")))
882 '("kiss_fft.h" "kissfft.hh"))
883 (for-each (lambda (f)
884 (install-file f
885 (string-append #$output
886 "/include/tools")))
887 (find-files "tools"))))
888 (replace 'check
889 (lambda* (#:key tests? #:allow-other-keys)
890 (when tests?
891 (invoke "make" "CC=gcc" "testall")))))))
892 (native-inputs (list procps))
893 (inputs (list fftw))))
894
895(define-public clac
896 (package
897 (name "clac")
898 (version "0.3.4")
899 (source
900 (origin
901 (method git-fetch)
902 (uri (git-reference
903 (url "https://github.com/soveran/clac")
904 (commit version)))
905 (file-name (git-file-name name version))
906 (sha256
907 "0crpm5rxxipiz6kqs5ip900d77vvnslyjn5f6nj0lrc86bkbgi8d")))
908 (build-system gnu-build-system)
909 (arguments
910 (list
911 #:test-target "test"
912 #:phases
913 #~(modify-phases %standard-phases
914 (delete 'configure)
915 (add-before 'build 'set-env
916 (lambda _
917 (setenv "CC" "gcc")
918 (setenv "PREFIX" #$output))))))
919 (home-page "https://github.com/soveran/clac")
920 (synopsis "Command-line, stack-based calculator with postfix notation")
921 (description
922 "Clac is a command line, stack-based calculator with postfix notation
923that displays the stack contents at all times. As you type, the stack
924changes are reflected immediately.")
925 ;; Bundles two dependencies, both also BSD-2. SDS is not yet packaged.
926 ;; linenoise is packaged, but the package doesn't provide shared
927 ;; object files so we have to build it anyway.
928 (license license:bsd-2)))
929
930(define-public fftw
931 (package
932 (name "fftw")
933 (version "3.3.10")
934 (source (origin
935 (method url-fetch)
936 (uri (string-append "ftp://ftp.fftw.org/pub/fftw/fftw-"
937 version".tar.gz"))
938 (sha256
939 (base32
940 "0rv4w90b65b2kvjpj8g9bdkl4xqc42q20f5bzpxdrkajk1a35jan"))))
941 (build-system gnu-build-system)
942 (arguments
943 `(#:configure-flags
944 '("--enable-shared" "--enable-openmp" "--enable-threads"
945 ,@(let ((system (or (%current-target-system) (%current-system))))
946 ;; Enable SIMD extensions for codelets. See details at:
947 ;; <http://fftw.org/fftw3_doc/Installation-on-Unix.html>.
948 (cond
949 ((string-prefix? "x86_64" system)
950 '("--enable-sse2" "--enable-avx" "--enable-avx2"
951 "--enable-avx512" "--enable-avx-128-fma"))
952 ((string-prefix? "i686" system)
953 '("--enable-sse2"))
954 ((string-prefix? "aarch64" system)
955 ;; Note that fftw supports NEON on 32-bit ARM only when
956 ;; compiled for single-precision.
957 '("--enable-neon"))
958 (else
959 '())))
960 ;; By default '-mtune=native' is used. However, that may cause the
961 ;; use of ISA extensions (e.g. AVX) that are not necessarily
962 ;; available on the user's machine when that package is built on a
963 ;; different machine.
964 "ax_cv_c_flags__mtune_native=no")))
965 (native-inputs (list perl))
966 (home-page "https://fftw.org")
967 (synopsis "Computing the discrete Fourier transform")
968 (description
969 "FFTW is a C subroutine library for computing the discrete Fourier
970transform (DFT) in one or more dimensions, of arbitrary input size, and of
971both real and complex data (as well as of even/odd data---i.e. the discrete
972cosine/ sine transforms or DCT/DST).")
973 (license license:gpl2+)))
974
975(define-public fftw-cmake
976 (package/inherit fftw
977 ;; Cmake compiling is experimental since 2017, and it is not clear if this
978 ;; build has the same target-specific optimizations as the fftw gnu build.
979 ;; See: https://fftw.org/release-notes.html
980 (name "fftw-cmake")
981 (build-system cmake-build-system)
982 (arguments '(#:tests? #f))
983 (description (string-append (package-description fftw)
984 " This CMake build offers the file
985FFTW3LibraryDepends.cmake required by some dependent packages, absent in the
986gnu build version."))))
987
988(define-public fftwf
989 (package/inherit fftw
990 (name "fftwf")
991 (arguments
992 (substitute-keyword-arguments arguments
993 ((#:configure-flags fftw-configure-flags)
994 `(cons* "--enable-single"
995 ,@(if (string-prefix? "arm" (or (%current-target-system)
996 (%current-system)))
997 ;; fftw supports NEON on 32-bit ARM only when compiled
998 ;; for single-precision, so add it here.
999 '("--enable-neon")
1000 '())
1001 ,fftw-configure-flags))))
1002 (description
1003 (string-append (package-description fftw)
1004 " Single-precision version."))))
1005
1006(define-public fftw-openmpi
1007 (package/inherit fftw
1008 (name "fftw-openmpi")
1009 (inputs
1010 `(("openmpi" ,openmpi)
1011 ,@(package-inputs fftw)))
1012 (arguments
1013 (substitute-keyword-arguments arguments
1014 ((#:configure-flags cf)
1015 `(cons "--enable-mpi" ,cf))
1016 ((#:phases phases '%standard-phases)
1017 `(modify-phases ,phases
1018 (add-before 'check 'mpi-setup
1019 ,%openmpi-setup)))))
1020 (description
1021 (string-append (package-description fftw)
1022 " With OpenMPI parallelism support."))))
1023
1024(define-public python-pyflct
1025 (package
1026 (name "python-pyflct")
1027 (version "0.3.1")
1028 (source
1029 (origin
1030 (method url-fetch)
1031 (uri (pypi-uri "pyflct" version))
1032 (sha256
1033 (base32 "1xv4h1a4f8y3ww97g2vc7fg2scfi142vwjz556nx0r1nnpgggj41"))))
1034 (build-system pyproject-build-system)
1035 (arguments
1036 (list
1037 ;; tests: 6 passed
1038 #:test-flags
1039 #~(list "--pyargs" "pyflct")
1040 #:phases
1041 #~(modify-phases %standard-phases
1042 (add-before 'check 'remove-local-source
1043 (lambda _
1044 (delete-file-recursively "pyflct"))))))
1045 (native-inputs
1046 (list python-cython
1047 python-extension-helpers
1048 python-pytest
1049 python-setuptools
1050 python-setuptools-scm))
1051 (inputs
1052 (list fftw))
1053 (propagated-inputs
1054 (list python-numpy
1055 python-packaging))
1056 (home-page "https://docs.sunpy.org/projects/pyflct/")
1057 (synopsis "Python wrapper for Fourier Local Correlation Tracking")
1058 (description
1059 "This package provides a Python wrapper for Fourier Local Correlation Tracking.")
1060 (license license:lgpl2.1)))
1061
1062(define-public java-la4j
1063 (package
1064 (name "java-la4j")
1065 (version "0.6.0")
1066 (source (origin
1067 (method git-fetch)
1068 (uri (git-reference
1069 (url "https://github.com/vkostyukov/la4j")
1070 (commit version)))
1071 (file-name (string-append name "-" version "-checkout"))
1072 (sha256
1073 (base32
1074 "1qir8dr978cfvz9k12m2kbdwpyf6cqdf1d0ilb7lnkhbgq5i53w3"))))
1075 (build-system ant-build-system)
1076 (arguments
1077 `(#:jar-name "la4j.jar"
1078 #:jdk ,icedtea-8
1079 #:test-exclude (list "**/Abstract*.java"
1080 "**/MatrixTest.java"
1081 "**/DenseMatrixTest.java"
1082 "**/SparseMatrixTest.java"
1083 "**/VectorTest.java"
1084 "**/SparseVectorTest.java"
1085 "**/DenseVectorTest.java")))
1086 (native-inputs
1087 (list java-junit java-hamcrest-core))
1088 (home-page "http://la4j.org/")
1089 (synopsis "Java library that provides Linear Algebra primitives and algorithms")
1090 (description "The la4j library is a Java library that provides Linear
1091Algebra primitives (matrices and vectors) and algorithms. The key features of
1092the la4j library are:
1093
1094@itemize
1095@item No dependencies and tiny size
1096@item Fluent object-oriented/functional API
1097@item Sparse (CRS, CCS) and dense (1D/2D arrays) matrices
1098@item Linear systems solving (Gaussian, Jacobi, Zeidel, Square Root, Sweep and other)
1099@item Matrices decomposition (Eigenvalues/Eigenvectors, SVD, QR, LU, Cholesky and other)
1100@item MatrixMarket/CSV IO formats support for matrices and vectors
1101@end itemize\n")
1102 (license license:asl2.0)))
1103
1104(define-public java-jlargearrays
1105 (package
1106 (name "java-jlargearrays")
1107 (version "1.6")
1108 (source (origin
1109 (method url-fetch)
1110 (uri (string-append "https://repo1.maven.org/maven2/"
1111 "pl/edu/icm/JLargeArrays/"
1112 version "/JLargeArrays-" version
1113 "-sources.jar"))
1114 (file-name (string-append name "-" version ".jar"))
1115 (sha256
1116 (base32
1117 "0v05iphpxbjnd7f4jf1rlqq3m8hslhcm0imdbsgxr20pi3xkaf2a"))))
1118 (build-system ant-build-system)
1119 (arguments
1120 `(#:jar-name "jlargearrays.jar"
1121 #:tests? #f ; tests are not included in the release archive
1122 #:jdk ,icedtea-8))
1123 (propagated-inputs
1124 (list java-commons-math3))
1125 (home-page "https://gitlab.com/ICM-VisLab/JLargeArrays")
1126 (synopsis "Library of one-dimensional arrays that can store up to 263 elements")
1127 (description "JLargeArrays is a Java library of one-dimensional arrays
1128that can store up to 263 elements.")
1129 (license license:bsd-2)))
1130
1131(define-public java-jtransforms
1132 (package
1133 (name "java-jtransforms")
1134 (version "3.1")
1135 (source (origin
1136 (method url-fetch)
1137 (uri (string-append "https://repo1.maven.org/maven2/"
1138 "com/github/wendykierp/JTransforms/"
1139 version "/JTransforms-" version "-sources.jar"))
1140 (sha256
1141 (base32
1142 "1haw5m8shv5srgcpwkl853dz8bv6h90bzlhcps6mdpb4cixjirsg"))))
1143 (build-system ant-build-system)
1144 (arguments
1145 `(#:jar-name "jtransforms.jar"
1146 #:tests? #f ; tests are not included in the release archive
1147 #:jdk ,icedtea-8))
1148 (propagated-inputs
1149 (list java-commons-math3 java-jlargearrays))
1150 (home-page "https://github.com/wendykierp/JTransforms")
1151 (synopsis "Multithreaded FFT library written in pure Java")
1152 (description "JTransforms is a multithreaded FFT library written in pure
1153Java. Currently, four types of transforms are available: @dfn{Discrete
1154Fourier Transform} (DFT), @dfn{Discrete Cosine Transform} (DCT), @dfn{Discrete
1155Sine Transform} (DST) and @dfn{Discrete Hartley Transform} (DHT).")
1156 (license license:bsd-2)))
1157
1158(define-public lmfit
1159 (package
1160 (name "lmfit")
1161 (version "8.2.2")
1162 (source (origin
1163 (method git-fetch)
1164 (uri (git-reference
1165 (url "https://jugit.fz-juelich.de/mlz/lmfit.git")
1166 (commit (string-append "v" version))))
1167 (file-name (git-file-name name version))
1168 (sha256
1169 (base32
1170 "00bch77a6qgnw6vzsjn2a42n8n683ih3xm0wpr454jxa15hw78vf"))))
1171 (build-system cmake-build-system)
1172 (native-inputs
1173 (list perl)) ; for pod2man
1174 (home-page "https://jugit.fz-juelich.de/mlz/lmfit")
1175 (synopsis "Levenberg-Marquardt minimization and least-squares fitting")
1176 (description "lmfit is a C library for Levenberg-Marquardt least-squares
1177minimization and curve fitting. It is mature code, based on decades-old
1178algorithms from the FORTRAN library MINPACK.")
1179 (license license:bsd-2)))
1180
1181(define-public symengine
1182 (package
1183 (name "symengine")
1184 (version "0.15.0")
1185 (source
1186 (origin
1187 (method git-fetch)
1188 (uri (git-reference
1189 (url "https://github.com/symengine/symengine")
1190 (commit (string-append "v" version))))
1191 (file-name (git-file-name name version))
1192 (sha256
1193 (base32 "0v3p2kzva05wgcpbx242djhfdj594i6zzq0dspj308ci7nlcw97q"))))
1194 (build-system cmake-build-system)
1195 (arguments
1196 '(#:configure-flags
1197 ;; These are the suggested build options in the README.
1198 '("-DCMAKE_BUILD_TYPE=Release"
1199 "-DWITH_GMP=on"
1200 "-DWITH_MPFR=on"
1201 "-DWITH_MPC=on"
1202 "-DINTEGER_CLASS=flint"
1203 "-DWITH_SYMENGINE_THREAD_SAFE=on"
1204 "-DBUILD_SHARED_LIBS=on"))) ;also build libsymengine
1205 (inputs
1206 (list flint gmp mpc mpfr))
1207 (home-page "https://github.com/symengine/symengine")
1208 (synopsis "Fast symbolic manipulation library")
1209 (description
1210 "SymEngine is a standalone fast C++ symbolic manipulation library.
1211Optional thin wrappers allow usage of the library from other languages.")
1212 (license (list license:expat ;SymEngine
1213 license:bsd-3)))) ;3rd party code
1214
1215(define-public python-symengine
1216 (package
1217 (name "python-symengine")
1218 (version "0.14.1")
1219 (source
1220 (origin
1221 (method url-fetch)
1222 (uri (pypi-uri "symengine" version))
1223 (sha256
1224 (base32 "1w7hwavbxgikljy9m3p89k3x2zdhv81h9bh330aw4wb3qm74p7jf"))))
1225 (build-system pyproject-build-system)
1226 (arguments
1227 (list
1228 #:test-flags #~(list "--pyargs" "symengine")))
1229 (native-inputs
1230 (list cmake-minimal
1231 python-cython
1232 python-pytest
1233 python-setuptools))
1234 (inputs
1235 (list symengine))
1236 (home-page "https://github.com/symengine/symengine.py")
1237 (synopsis "Python library providing wrappers to SymEngine")
1238 (description
1239 "This library provides a Python wrapper to SymEngine, a fast C++ symbolic
1240manipulation library.")
1241 (license license:expat)))
1242
1243(define-public ginac
1244 (package
1245 (name "ginac")
1246 (version "1.8.1")
1247 (source
1248 (origin
1249 (method url-fetch)
1250 (uri (string-append "https://www.ginac.de/ginac-"
1251 version ".tar.bz2"))
1252 (sha256
1253 (base32 "1az1ypfcny4jdz0mic1kywwa9nynr547cl5s7zpn2w0qdfymssgi"))))
1254 (build-system gnu-build-system)
1255 (arguments
1256 `(#:configure-flags (list "--disable-static")))
1257 (native-inputs
1258 `(("bison" ,bison)
1259 ("flex" ,flex)
1260 ("pkg-config" ,pkg-config)
1261 ("python" ,python-wrapper))) ; Python is required
1262 (inputs
1263 (list cln readline))
1264 (home-page "https://www.ginac.de/")
1265 (synopsis "Library for symbolic computation")
1266 (description "GiNaC is a C++ library for symbolic computation. Contrary
1267to other CAS it does not try to provide extensive algebraic capabilities and a
1268simple programming language but instead accepts a given language (C++) and
1269extends it by a set of algebraic capabilities.")
1270 (license license:gpl2+)))
1271
1272(define-public normaliz
1273 (package
1274 (name "normaliz")
1275 (version "3.11.1")
1276 (source (origin
1277 (method git-fetch)
1278 (uri (git-reference
1279 (url "https://github.com/normaliz/Normaliz")
1280 (commit (string-append "v" version))))
1281 (file-name (git-file-name name version))
1282 (sha256
1283 (base32
1284 "1i4qkc9103m4v33jhaicz45wqvilvck4z6pymqyyx7zdca1am6zs"))))
1285 (build-system gnu-build-system)
1286 (native-inputs (list autoconf automake libtool pkg-config))
1287 ;; Flint is optional. TODO: Try to build with nauty and cocoalib support.
1288 ;; The configure script fails to find nauty.h.
1289 (inputs (list flint gmp))
1290 (home-page "https://www.normaliz.uni-osnabrueck.de/")
1291 (synopsis "Tool for discrete convex geometry")
1292 (description "Normaliz is a tool for computations in affine monoids,
1293vector configurations, rational polyhedra and rational cones. Normaliz now
1294computes rational and algebraic polyhedra, i.e., polyhedra defined over real
1295algebraic extensions of QQ.")
1296 (license license:gpl3+)))
1297
1298(define-public python-pynormaliz
1299 (package
1300 (name "python-pynormaliz")
1301 (version "2.24")
1302 (source
1303 (origin
1304 (method url-fetch)
1305 (uri (pypi-uri "pynormaliz" version))
1306 (sha256
1307 (base32 "1749z0wn57qpnqac53jrgpy6d0qy0klhy5zhp0n4gi2p9krcv48y"))))
1308 (build-system pyproject-build-system)
1309 (arguments
1310 (list
1311 #:tests? #f ; tests need normaliz to be built with nauty support
1312 #:phases #~(modify-phases %standard-phases
1313 (replace 'check
1314 (lambda* (#:key tests? #:allow-other-keys)
1315 (if tests?
1316 (invoke "python" "tests/runtests.py")))))))
1317 (native-inputs (list python-setuptools))
1318 (inputs (list flint gmp normaliz))
1319 (home-page "https://github.com/Normaliz/PyNormaliz")
1320 (synopsis "Python interface to Normaliz")
1321 (description
1322 "PyNormaliz provides an interface to Normaliz via libNormaliz. It offers
1323the complete functionality of Normaliz, and can be used interactively from
1324Python.")
1325 (license license:gpl2+)))
1326
1327(define-public eigen
1328 (package
1329 (name "eigen")
1330 (version "3.4.0")
1331 (source (origin
1332 (method git-fetch)
1333 (uri (git-reference
1334 (url "https://gitlab.com/libeigen/eigen.git")
1335 (commit version)))
1336 (sha256
1337 (base32
1338 "0k1c4qnymwwvm68rv6s0cyk08xbw65ixvwqccsh36c2axcqk3znp"))
1339 (file-name (git-file-name name version))
1340 (patches (search-patches "eigen-fix-strict-aliasing-bug.patch"))
1341 (modules '((guix build utils)))
1342 (snippet
1343 ;; There are 3 test failures in the "unsupported" directory,
1344 ;; but maintainers say it's a known issue and it's unsupported
1345 ;; anyway, so just skip them.
1346 '(begin
1347 (substitute* "unsupported/CMakeLists.txt"
1348 (("add_subdirectory\\(test.*")
1349 "# Do not build the tests for unsupported features.\n"))
1350 #t))))
1351 (build-system cmake-build-system)
1352 (arguments
1353 `(;; Turn off debugging symbols to save space.
1354 #:build-type "Release"
1355
1356 #:modules ((ice-9 match)
1357 (guix build utils)
1358 (guix build cmake-build-system))
1359
1360 #:phases
1361 (modify-phases %standard-phases
1362 (add-after 'unpack 'disable-some-tests
1363 ;; Not all platforms are well supported by the test suite.
1364 (lambda _
1365 ,@(match (%current-system)
1366 ("i686-linux"
1367 `((substitute* "test/CMakeLists.txt"
1368 ((".*packetmath.*") ""))))
1369 ("aarch64-linux"
1370 `((substitute* "test/CMakeLists.txt"
1371 ((".*array_cwise.*") "")
1372 ((".*vectorization_logic.*") ""))))
1373 ("armhf-linux"
1374 `((substitute* "test/CMakeLists.txt"
1375 ((".*geo_quaternion.*") "")
1376 ((".*jacobisvd.*") "")
1377 ((".*packetmath.*") "")
1378 ((".*prec_inverse.*") "")
1379 ((".*qr_colpivoting.*") "")
1380 ((".*vectorization_logic.*") ""))))
1381 ("riscv64-linux"
1382 `((substitute* "test/CMakeLists.txt"
1383 ((".*array_cwise.*") "")
1384 ((".*geo_quaternion.*") ""))))
1385 (_
1386 '((display "No tests to disable on this architecture.\n"))))))
1387 (replace 'check
1388 (lambda* (#:key tests? #:allow-other-keys)
1389 (let* ((cores (parallel-job-count))
1390 (dash-j (format #f "-j~a" cores)))
1391 (when tests?
1392 (setenv "EIGEN_SEED" "1") ;for reproducibility
1393 ;; First build the tests, in parallel. See
1394 ;; <http://eigen.tuxfamily.org/index.php?title=Tests>.
1395 (invoke "make" "buildtests" dash-j)
1396
1397 ;; Then run 'CTest' with -V so we get more
1398 ;; details upon failure.
1399 (invoke "ctest" "-V" dash-j))))))))
1400 (home-page "https://eigen.tuxfamily.org/index.php?title=Main_Page")
1401 (synopsis "C++ template library for linear algebra")
1402 (description
1403 "Eigen is a C++ template library for linear algebra: matrices, vectors,
1404numerical solvers, and related algorithms. It provides an elegant API based
1405on \"expression templates\". It is versatile: it supports all matrix sizes,
1406all standard numeric types, various matrix decompositions and geometry
1407features, and more.")
1408
1409 ;; Most of the code is MPLv2, with a few files under LGPLv2.1+ or BSD-3.
1410 ;; See 'COPYING.README' for details.
1411 (license license:mpl2.0)))
1412
1413(define-public eigen-benchmarks
1414 (package
1415 (inherit eigen)
1416 (name "eigen-benchmarks")
1417 (arguments
1418 '(#:tests? #f ; no tests
1419 #:phases (modify-phases %standard-phases
1420 (delete 'configure)
1421 (replace 'build
1422 (lambda* (#:key outputs #:allow-other-keys)
1423 (let* ((out (assoc-ref outputs "out"))
1424 (bin (string-append out "/bin")))
1425 (define (compile file)
1426 (format #t "compiling '~a'...~%" file)
1427 (let ((target
1428 (string-append bin "/"
1429 (basename file ".cpp"))))
1430 (invoke "c++" "-o" target file
1431 "-I" ".." "-O2" "-g"
1432 "-lopenblas" "-Wl,--as-needed")))
1433
1434 (mkdir-p bin)
1435 (with-directory-excursion "bench"
1436 ;; There are more benchmarks, of varying quality.
1437 ;; Here we pick some that appear to be useful.
1438 (for-each compile
1439 '("benchBlasGemm.cpp"
1440 "benchCholesky.cpp"
1441 ;;"benchEigenSolver.cpp"
1442 "benchFFT.cpp"
1443 "benchmark-blocking-sizes.cpp"))))))
1444 (delete 'install))))
1445 (inputs (list boost openblas))
1446
1447 ;; Mark as tunable to take advantage of SIMD code in Eigen.
1448 (properties '((tunable? . #t)))
1449
1450 (synopsis "Micro-benchmarks of the Eigen linear algebra library")))
1451
1452(define-public eigen-for-onnxruntime
1453 (let ((commit "1d8b82b0740839c0de7f1242a3585e3390ff5f33")
1454 (revision "0"))
1455 (hidden-package
1456 (package
1457 (inherit eigen)
1458 (name "eigen-for-onnxruntime")
1459 (version (git-version "3.4.0" revision commit))
1460 (source
1461 (origin
1462 (method git-fetch)
1463 (uri (git-reference
1464 (url "https://gitlab.com/libeigen/eigen")
1465 (commit commit)))
1466 (file-name (git-file-name name version))
1467 (sha256
1468 (base32 "0pxh81jjnz97ndwaanla6zch1128bfdrf2kgqxgxyjvqbdg1vqwi"))))
1469 ;; XXX: Some tests fail, but onnxruntime will move on to the next
1470 ;; release soon enough.
1471 (arguments
1472 (substitute-keyword-arguments arguments
1473 ((#:tests? tests? #t)
1474 #f)))))))
1475
1476;; XXX: python-ml-dtypes uses this commit specifically since at least version
1477;; 0.2.0. It's not compiling with another eigen, so build this one for now.
1478(define-public eigen-for-python-ml-dtypes
1479 (let ((commit "7bf2968fed5f246c0589e1111004cb420fcd7c71")
1480 (revision "0"))
1481 (hidden-package
1482 (package
1483 (inherit eigen)
1484 (name "eigen-for-python-ml-dtypes")
1485 (version (git-version "3.4.0" revision commit))
1486 (source
1487 (origin
1488 (inherit (package-source eigen))
1489 (method git-fetch)
1490 (uri (git-reference
1491 (url "https://gitlab.com/libeigen/eigen")
1492 (commit commit)))
1493 (file-name (git-file-name name version))
1494 (sha256
1495 (base32 "0yq69h7pasbzq5r83d974xi031r0z2y2x0my1rz5crky54i1j0r7"))
1496 (patches '())))
1497 ;; XXX: Tests stable_norm_5 and stable_norm_6 are failing due to
1498 ;; EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE.
1499 (arguments
1500 (substitute-keyword-arguments arguments
1501 ((#:tests? flag #f) #false)))))))
1502
1503(define-public xtensor
1504 (package
1505 (name "xtensor")
1506 (version "0.25.0")
1507 (source
1508 (origin
1509 (method git-fetch)
1510 (uri (git-reference
1511 (url "https://github.com/xtensor-stack/xtensor")
1512 (commit version)))
1513 (sha256
1514 (base32 "0ziqybfm0fh6kr8qwxqacr04m9gm0njbn520izm6rsh9hysxsmw5"))
1515 (file-name (git-file-name name version))))
1516 (build-system cmake-build-system)
1517 (arguments
1518 (list #:configure-flags #~(list "-DBUILD_TESTS=ON")))
1519 (native-inputs
1520 (list doctest
1521 googletest
1522 nlohmann-json
1523 xtl))
1524 (home-page "https://xtensor.readthedocs.io/en/latest/")
1525 (synopsis "C++ tensors with broadcasting and lazy computing")
1526 (description "xtensor is a C++ library meant for numerical analysis with
1527multi-dimensional array expressions.
1528
1529xtensor provides:
1530@itemize
1531@item an extensible expression system enabling lazy broadcasting.
1532@item an API following the idioms of the C++ standard library.
1533@item tools to manipulate array expressions and build upon xtensor.
1534@end itemize")
1535 (license license:bsd-3)))
1536
1537(define-public xtensor-benchmark
1538 (package
1539 (inherit xtensor)
1540 (name "xtensor-benchmark")
1541 (arguments
1542 `(#:configure-flags (list "-DBUILD_BENCHMARK=ON"
1543 "-DDOWNLOAD_GBENCHMARK=OFF")
1544 #:tests? #f
1545 #:phases (modify-phases %standard-phases
1546 (add-after 'unpack 'remove-march=native
1547 (lambda _
1548 (substitute* "benchmark/CMakeLists.txt"
1549 (("-march=native\"") "\""))))
1550 (add-after 'unpack 'link-with-googlebenchmark
1551 (lambda _
1552 (substitute* "benchmark/CMakeLists.txt"
1553 (("find_package\\(benchmark.*" all)
1554 (string-append
1555 all "\n"
1556 "set(GBENCHMARK_LIBRARIES benchmark)\n")))))
1557 (replace 'build
1558 (lambda _
1559 (invoke "make" "benchmark_xtensor" "-j"
1560 (number->string (parallel-job-count)))))
1561 (replace 'install
1562 (lambda* (#:key outputs #:allow-other-keys)
1563 ;; Install nothing but the executable.
1564 (let ((out (assoc-ref outputs "out")))
1565 (install-file "benchmark/benchmark_xtensor"
1566 (string-append out "/bin"))))))))
1567 (synopsis "Benchmarks of the xtensor library")
1568 (native-inputs '())
1569 (inputs
1570 (modify-inputs (package-native-inputs xtensor)
1571 (prepend googlebenchmark xsimd)))
1572
1573 ;; Mark as tunable to take advantage of SIMD code in xsimd/xtensor.
1574 (properties '((tunable? . #t)))))
1575
1576(define-public gap
1577 (package
1578 (name "gap")
1579 (version "4.14.0")
1580 (source
1581 (origin
1582 (method url-fetch)
1583 (uri (string-append "https://files.gap-system.org/gap-"
1584 (version-major+minor version)
1585 "/tar.gz/gap-" version ".tar.gz"))
1586 (sha256
1587 (base32 "11v4a3cpjpf6pc0hd6x1wlglq9jzakq4naggp671psvgq9r54pw4"))
1588 (modules '((guix build utils) (ice-9 ftw) (srfi srfi-1)))
1589 (snippet
1590 '(begin
1591 ;; Delete bundled external libraries.
1592 (for-each delete-file-recursively
1593 '("extern" "hpcgap/extern"))))))
1594 (build-system gnu-build-system)
1595 (native-inputs (list (texlive-local-tree
1596 (list texlive-enumitem
1597 texlive-etoolbox
1598 texlive-fancyvrb
1599 texlive-helvetic
1600 texlive-rsfs
1601 texlive-times))))
1602 (inputs
1603 (list gmp readline zlib
1604 cddlib ; for the cddinterface package
1605 curl ; for the curlinterface package
1606 libx11 libxaw libxt ; for the xgap package
1607 zeromq ; for the zeromqinterface package
1608 ))
1609 (arguments
1610 `(#:configure-flags
1611 (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
1612 #:phases
1613 (modify-phases %standard-phases
1614 (add-after 'unpack 'prepare-package-source
1615 (lambda _
1616 (with-directory-excursion "pkg"
1617 ;; Unpack package tarball, so that shebangs can be modified.
1618 (with-directory-excursion "caratinterface"
1619 (invoke "tar" "xvf" "carat.tgz"))
1620 ;; Replace paths and adapt configuration.
1621 (with-directory-excursion "xgap"
1622 (substitute* '("Makefile.in" "cnf/Makegap.in")
1623 (("/bin/sh")
1624 (string-append
1625 (assoc-ref %build-inputs "bash") "/bin/bash")))
1626 (substitute* "xgap.sh.in"
1627 (("\"@gapdir@\"")
1628 (string-append %output "/share/gap"))
1629 (("^XGAP=.*$")
1630 (string-append "XGAP=" %output
1631 "/share/gap/pkg/xgap/bin/$XGAP_PRG\n"))
1632 (("^GAP=.*$")
1633 (string-append "GAP=" %output "/bin/gap\n"))
1634 (("VERBOSE=\"NO\"") "VERBOSE=\"YES\""))))))
1635 ;; The following phases are executed after 'build, apparently in
1636 ;; reverse order. So we carry out 'build, then 'build-doc, then
1637 ;; 'remove-packages, then 'build-packages.
1638 (add-after 'build 'build-packages
1639 (lambda _
1640 (setenv "CONFIG_SHELL" (which "bash"))
1641 (setenv "CC" "gcc")
1642 (with-directory-excursion "pkg"
1643 (invoke "../bin/BuildPackages.sh"))))
1644 (add-after 'build 'remove-packages
1645 ;; Delete packages that are known not to build.
1646 ;; TODO: Investigate.
1647 (lambda _
1648 (with-directory-excursion "pkg"
1649 (for-each delete-file-recursively
1650 '("normalizinterface" ; tries to download normaliz even when it is available
1651 "semigroups" ; bundled dependency libsemigroups
1652 )))))
1653 (add-after 'build 'build-doc
1654 ;; The documentation is bundled, but we create it from source.
1655 ;; This needs to be done before 'remove-packages, since
1656 ;; otherwise this phase fails due to missing cross references.
1657 ;; Otherwise said, the documentation will include that of
1658 ;; removed packages. It needs to be done after 'build since
1659 ;; it requires the gap binary.
1660 (lambda _
1661 (setenv "TEXMFVAR" "/tmp") ;required to generate fonts
1662 (with-directory-excursion "doc"
1663 (invoke "./make_doc"))))
1664 (add-after 'install 'install-packages
1665 (lambda* (#:key outputs #:allow-other-keys)
1666 (let* ((out (assoc-ref outputs "out"))
1667 (bin (string-append out "/bin"))
1668 (share (string-append out "/share/gap"))
1669 (xgap-sh (string-append share "/pkg/xgap/xgap.sh"))
1670 (xgap (string-append bin "/xgap")))
1671 (copy-recursively "pkg" (string-append share "/pkg"))
1672 (chmod xgap-sh #o744)
1673 (symlink xgap-sh xgap)))))))
1674 (home-page "https://www.gap-system.org/")
1675 (synopsis
1676 "System for computational group theory")
1677 (description
1678 "GAP is a system for computational discrete algebra, with particular
1679emphasis on computational group theory. It provides a programming language,
1680a library of thousands of functions implementing algebraic algorithms
1681written in the GAP language as well as large data libraries of algebraic
1682objects.")
1683 ;; gap itself is gpl2+, but some packages have different licenses,
1684 ;; effectively forcing the combined work to be licensed as gpl3+.
1685 (license license:gpl3+)))
1686
1687(define-public spectra
1688 (package
1689 (name "spectra")
1690 (version "1.2.0")
1691 (source (origin
1692 (method git-fetch)
1693 (uri (git-reference
1694 (url "https://github.com/yixuan/spectra")
1695 (commit (string-append "v" version))))
1696 (file-name (git-file-name name version))
1697 (sha256
1698 (base32
1699 "1npf7ki37g3lp0ip3as0ihf49fv62wivfzskzz6nmp6gfk1cxxlm"))))
1700 (build-system cmake-build-system)
1701 (arguments
1702 (list #:configure-flags #~(list "-DBUILD_TESTS=ON")))
1703 (inputs (list eigen))
1704 (home-page "https://spectralib.org/")
1705 (synopsis "C++ library for large scale eigenvalue problems")
1706 (description "Spectra stands for Sparse Eigenvalue Computation Toolkit as
1707a Redesigned ARPACK. It is a C++ library for large scale eigenvalue problems,
1708built on top of Eigen. It is implemented as a header-only C++ library and can
1709be easily embedded in C++ projects that require calculating eigenvalues of
1710large matrices.")
1711 (properties `((lint-hidden-cpe-vendors . ("brainstormforce" "wpspectra"))))
1712 (license license:mpl2.0)))
1713
1714(define-public gappa
1715 (package
1716 (name "gappa")
1717 (version "1.4.1")
1718 (source (origin
1719 (method git-fetch)
1720 (uri (git-reference
1721 (url "https://gitlab.inria.fr/gappa/gappa")
1722 (commit (string-append name "-" version))))
1723 (file-name (git-file-name name version))
1724 (sha256
1725 (base32
1726 "0vfggzilc0gicrhqypmlx30ccrdkmyg22zzn46988c28xi9rcicj"))))
1727 (build-system gnu-build-system)
1728 (arguments
1729 (list #:phases
1730 #~(modify-phases %standard-phases
1731 (add-after 'unpack 'patch-remake-shell
1732 (lambda _
1733 (substitute* "remake.cpp"
1734 (("/bin/sh") (which "sh")))))
1735 (replace 'build
1736 (lambda _ (invoke "./remake" "-s" "-d")))
1737 (replace 'install
1738 (lambda _ (invoke "./remake" "-s" "-d" "install")))
1739 (replace 'check
1740 (lambda* (#:key tests? #:allow-other-keys)
1741 (when tests?
1742 (invoke "./remake" "check")))))))
1743 (native-inputs (list autoconf automake bison flex libtool))
1744 (inputs (list boost gmp mpfr))
1745 (home-page "https://gitlab.inria.fr/gappa/gappa")
1746 (synopsis "Proof generator for arithmetic properties")
1747 (description "Gappa is a tool intended to help verifying and formally
1748proving properties on numerical programs dealing with floating-point or
1749fixed-point arithmetic. It has been used to write robust floating-point
1750filters for CGAL and it is used to certify elementary functions in CRlibm.
1751While Gappa is intended to be used directly, it can also act as a backend
1752prover for the Why3 software verification platform or as an automatic tactic
1753for the Coq proof assistant.")
1754 (license (list license:gpl3+ license:cecill)))) ; either/or
1755
1756(define-public givaro
1757 (package
1758 (name "givaro")
1759 (version "4.2.1")
1760 (source (origin
1761 (method git-fetch)
1762 (uri (git-reference
1763 (url "https://github.com/linbox-team/givaro")
1764 (commit (string-append "v" version))))
1765 (file-name (git-file-name name version))
1766 (sha256
1767 (base32
1768 "1nmfn9g859c9lwyifqbr0mi3xfhpx970janvm4smjvd9mac1cadx"))))
1769 (build-system gnu-build-system)
1770 (native-inputs
1771 (list autoconf automake libtool))
1772 (propagated-inputs
1773 (list gmp)) ; gmp++.h includes gmpxx.h
1774 (synopsis "Algebraic computations with exact rings and fields")
1775 (description
1776 "Givaro is a C++ library implementing the basic arithmetic of various
1777algebraic objects: prime fields, extension fields, finite fields, finite
1778rings, polynomials, algebraic numbers, arbitrary precision integers and
1779rationals (C++ wrappers over gmp), fixed precision integers. It also
1780provides data-structures and templated classes for the manipulation of
1781compound objects, such as vectors, matrices and univariate polynomials.")
1782 (license license:cecill-b)
1783 (home-page "https://github.com/linbox-team/givaro")))
1784
1785(define-public fflas-ffpack
1786 (package
1787 (name "fflas-ffpack")
1788 (version "2.5.0")
1789 (source (origin
1790 (method git-fetch)
1791 (uri (git-reference
1792 (url "https://github.com/linbox-team/fflas-ffpack")
1793 (commit (string-append "v" version))))
1794 (file-name (git-file-name name version))
1795 (sha256
1796 (base32
1797 "1iv8jpiv5k3gcmvnry1jyaw06y8li0gi464ri5a1aa9j6pd5qfqk"))))
1798 (build-system gnu-build-system)
1799 (native-inputs
1800 (list autoconf automake libtool pkg-config))
1801 (inputs
1802 (list openblas))
1803 (propagated-inputs
1804 (list givaro)) ; required according to the .pc file
1805 (arguments
1806 `(#:configure-flags
1807 (list (string-append "--with-blas-libs="
1808 (assoc-ref %build-inputs "openblas")
1809 "/lib/libopenblas.so"))))
1810 (synopsis "C++ library for linear algebra over finite fields")
1811 (description
1812 "FFLAS-FFPACK is a C++ template library for basic linear algebra
1813operations over a finite field.
1814FFLAS (Finite Field Linear Algebra Subprograms) provides the implementation
1815of a subset of routines of the numerical BLAS; it also supports sparse
1816matrix-vector products.
1817FFPACK (Finite Field Linear Algebra Package) is inspired by the LAPACK
1818library to provide functionalities of higher level, using the kernel
1819of a BLAS. Additionally, it provides routines specific to exact linear
1820algebra, such as the row echelon form.")
1821 (license license:lgpl2.1+)
1822 (home-page "https://linbox-team.github.io/fflas-ffpack/")))
1823
1824(define-public linbox
1825 (package
1826 (name "linbox")
1827 (version "1.7.1")
1828 (source (origin
1829 (method git-fetch)
1830 (uri (git-reference
1831 (url "https://github.com/linbox-team/linbox")
1832 (commit (string-append "v" version))))
1833 (file-name (git-file-name name version))
1834 (sha256
1835 (base32
1836 "0la7qffj128rbiy1n2mhs8am3j2wfqhqr0fm9v1vmi9gvcir0i2r"))))
1837 (build-system gnu-build-system)
1838 (native-inputs
1839 (list autoconf automake libtool pkg-config))
1840 (propagated-inputs
1841 (list fflas-ffpack))
1842 (synopsis "C++ library for linear algebra over exact rings")
1843 (description
1844 "LinBox is a C++ template library for exact linear algebra computation
1845with dense, sparse, and structured matrices over the integers and over
1846finite fields.")
1847 (license license:lgpl2.1+)
1848 (home-page "https://linbox-team.github.io/linbox/")))
1849
1850(define-public m4ri
1851 (package
1852 (name "m4ri")
1853 (version "20250128")
1854 (source (origin
1855 (method git-fetch)
1856 (uri (git-reference
1857 (url "https://bitbucket.org/malb/m4ri")
1858 (commit version)))
1859 (file-name (git-file-name name version))
1860 (sha256
1861 (base32
1862 "1nrxylpwjv0b8nqjb93x83il8v6c13l3cwhjp5qxxjsbhwir7032"))))
1863 (build-system gnu-build-system)
1864 (native-inputs
1865 (list autoconf automake libtool pkg-config))
1866 (propagated-inputs
1867 (list zlib)) ;required by libm4ri.la
1868 (inputs
1869 (list libpng))
1870 (synopsis "Arithmetic of dense matrices over F_2")
1871 (description "M4RI is a library for fast arithmetic with dense matrices
1872over F2. The name M4RI comes from the first implemented algorithm: The
1873Method of the Four Russians inversion algorithm published by Gregory Bard.
1874This algorithm in turn is named after the Method of the Four Russians
1875multiplication algorithm.")
1876 (license license:gpl2+)
1877 (home-page "https://bitbucket.org/malb/m4ri/")))
1878
1879(define-public symmetrica
1880 (package
1881 (name "symmetrica")
1882 (version "3.1.0")
1883 (source (origin
1884 (method git-fetch)
1885 (uri (git-reference
1886 (url "https://gitlab.com/sagemath/symmetrica/")
1887 (commit version)))
1888 (file-name (git-file-name name version))
1889 (sha256
1890 (base32
1891 "0yirh2rhvih515442pr7nfx1wdwjhjvnnr0a51a02wc3z50qsxms"))))
1892 (build-system gnu-build-system)
1893 (native-inputs (list autoconf automake libtool pkg-config))
1894 (home-page "https://gitlab.com/sagemath/symmetrica/")
1895 (synopsis "Combinatoric C Library")
1896 (description "Symmetrica is a library for combinatorics. It has support
1897for the representation theory of the symmetric group and related groups,
1898combinatorics of tableaux, symmetric functions and polynomials, Schubert
1899polynomials, and the representation theory of Hecke algebras of type A_n.")
1900 (license license:isc)))
1901
1902(define-public m4rie
1903 (package
1904 (name "m4rie")
1905 (version "20250128")
1906 (source (origin
1907 (method git-fetch)
1908 (uri (git-reference
1909 (url "https://bitbucket.org/malb/m4rie")
1910 (commit version)))
1911 (file-name (git-file-name name version))
1912 (sha256
1913 (base32
1914 "1la0x8r7ymn9b36rrsjphr6j8abmnpirwxmi81qbyzjar1grj3mp"))))
1915 (build-system gnu-build-system)
1916 (native-inputs
1917 (list autoconf automake libtool pkg-config))
1918 (inputs
1919 (list m4ri))
1920 (synopsis "Arithmetic of dense matrices over F_{2^e}")
1921 (description "M4RI is a library for fast arithmetic with dense matrices
1922over finite fields of characteristic 2. So it extends the functionality
1923of M4RI from F_2 to F_{2^e}.")
1924 (license license:gpl2+)
1925 (home-page "https://bitbucket.org/malb/m4rie/")))
1926
1927(define-public eclib
1928 (package
1929 (name "eclib")
1930 (version "20250627")
1931 (source (origin
1932 (method git-fetch)
1933 (uri (git-reference
1934 (url "https://github.com/JohnCremona/eclib/")
1935 (commit version)))
1936 (file-name (git-file-name name version))
1937 (sha256
1938 (base32
1939 "1nnvx2bxid7lbqpypjacci65zn4fzmlnp8anm6f21b6vy3l9mg82"))))
1940 (build-system gnu-build-system)
1941 (native-inputs
1942 (list autoconf automake libtool))
1943 (inputs
1944 (list ntl pari-gp))
1945 (synopsis "Ranks of elliptic curves and modular symbols")
1946 (description "The eclib package includes mwrank (for 2-descent on
1947elliptic curves over Q) and modular symbol code; it has been written by
1948John Cremona to compute his elliptic curve database.")
1949 (license license:gpl2+)
1950 (home-page "https://johncremona.github.io/mwrank/index.html")))
1951
1952(define-public lrcalc
1953 (package
1954 (name "lrcalc")
1955 (version "2.1")
1956 (source (origin
1957 (method git-fetch)
1958 (uri (git-reference
1959 (url "https://bitbucket.org/asbuch/lrcalc")
1960 (commit (string-append "lrcalc-" version))))
1961 (file-name (git-file-name name version))
1962 (sha256
1963 (base32
1964 "0s3amf3z75hnrjyszdndrvk4wp5p630dcgyj341i6l57h43d1p4k"))))
1965 (build-system gnu-build-system)
1966 (native-inputs
1967 (list autoconf automake libtool))
1968 (synopsis "Littlewood-Richardson calculator in algebraic combinatorics")
1969 (description "The Littlewood-Richardson Calculator (lrcalc) is a
1970program designed to compute Littlewood-Richardson coefficients. It computes
1971single Littlewood-Richardson coefficients, products of Schur functions, or
1972skew Schur functions. In addition it computes products in the small quantum
1973cohomology ring of a Grassmann variety. The software package also includes
1974a program that performs fast computation of the more general multiplicative
1975structure constants of Schubert polynomials.")
1976 (license license:gpl2+)
1977 (home-page "https://sites.math.rutgers.edu/~asbuch/lrcalc/")))
1978
1979(define-public python-lrcalc
1980 (package
1981 (name "python-lrcalc")
1982 (version "2.1")
1983 (source
1984 (origin
1985 (method url-fetch)
1986 (uri (pypi-uri "lrcalc" version))
1987 (sha256
1988 (base32 "1adassfjalsdsngy01c37835qsx3gj0jx9cinc9b91x4xnd51873"))))
1989 (build-system pyproject-build-system)
1990 (arguments
1991 (list #:tests? #f)) ; there are no tests
1992 (native-inputs (list python-cython python-setuptools))
1993 (inputs (list lrcalc))
1994 (home-page "https://math.rutgers.edu/~asbuch/lrcalc")
1995 (synopsis "Python bindings for the Littlewood-Richardson Calculator")
1996 (description
1997 "This package provides Python bindings for the Littlewood-Richardson
1998Calculator.")
1999 (license license:gpl3+)))
2000
2001(define-public iml
2002 (package
2003 (name "iml")
2004 (version "1.0.5")
2005 (source
2006 (origin
2007 (method url-fetch)
2008 (uri (string-append "http://www.cs.uwaterloo.ca/~astorjoh/iml-"
2009 version ".tar.bz2"))
2010 (sha256
2011 (base32
2012 "0akwhhz9b40bz6lrfxpamp7r7wkk48p455qbn04mfnl9a1l6db8x"))))
2013 (build-system gnu-build-system)
2014 (inputs
2015 `(("gmp" ,gmp)
2016 ("cblas" ,openblas))) ; or any other BLAS library; the documentation
2017 ; mentions ATLAS in particular
2018 (arguments
2019 `(#:configure-flags
2020 (list
2021 "--enable-shared"
2022 (string-append "--with-gmp-include="
2023 (assoc-ref %build-inputs "gmp") "/include")
2024 (string-append "--with-gmp-lib="
2025 (assoc-ref %build-inputs "gmp") "/lib")
2026 "--with-cblas=-lopenblas"
2027 (string-append "--with-cblas-include="
2028 (assoc-ref %build-inputs "cblas") "/include")
2029 (string-append "--with-cblas-lib="
2030 (assoc-ref %build-inputs "cblas") "/lib"))))
2031 (home-page "https://cs.uwaterloo.ca/~astorjoh/iml.html")
2032 (synopsis
2033 "Solver for systems of linear equations over the integers")
2034 (description
2035 "IML is a C library implementing algorithms for computing exact
2036solutions to dense systems of linear equations over the integers.
2037Currently, IML provides the following functionality:
2038
2039@itemize
2040@item Nonsingular rational system solving:
2041compute the unique rational solution X to the system AX=B, where A and B
2042are integer matrices, A nonsingular.
2043@item Compute the right nullspace or kernel of an integer matrix.
2044@item Certified linear system solving:
2045compute a minimal denominator solution x to a system Ax=b, where b is an
2046integer vector and A is an integer matrix with arbitrary shape and
2047rank profile.
2048@end itemize
2049
2050In addition, IML provides some low level routines for a variety of mod p
2051matrix operations: computing the row-echelon form, determinant, rank
2052profile, and inverse of a mod p matrix. These mod p routines are not
2053general purpose; they require that p satisfy some preconditions based on
2054the dimension of the input matrix (usually p should be prime and should be
2055no more than about 20 bits long).")
2056 (license license:bsd-3)))
2057
2058(define-public r-dtt
2059 (package
2060 (name "r-dtt")
2061 (version "0.1-2.1")
2062 (source
2063 (origin
2064 (method url-fetch)
2065 (uri (cran-uri "dtt" version))
2066 (sha256
2067 (base32
2068 "113qb6fjp08gcmv4cgq3cm2fk6k3r3j1wfsrygq8889i2bq4a073"))))
2069 (properties `((upstream-name . "dtt")))
2070 (build-system r-build-system)
2071 (home-page "https://www.r-project.org")
2072 (synopsis "Discrete Trigonometric Transforms")
2073 (description
2074 "This package provides functions for 1D and 2D Discrete Cosine Transform
2075(@dfn{DCT}), Discrete Sine Transform (@dfn{DST}) and Discrete Hartley Transform
2076(@dfn{DHT}).")
2077 (license license:gpl2+)))
2078
2079(define-public libsemigroups
2080 (package
2081 (name "libsemigroups")
2082 (version "2.7.3")
2083 (source (origin
2084 (method git-fetch)
2085 (uri (git-reference
2086 (url "https://github.com/libsemigroups/libsemigroups")
2087 (commit (string-append "v" version))))
2088 (file-name (git-file-name name version))
2089 (sha256
2090 (base32
2091 "0pk7887g4in7fskl0da8l2xppv293jm31ykacsss3vs5fff2pw7a"))))
2092 (build-system gnu-build-system)
2093 (arguments
2094 (list
2095 ;; FIXME: libsemigroup's build system doesn't have an option to use
2096 ;; external HPCombi. Try to work it around in the future and skip
2097 ;; support for now.
2098 #:configure-flags #~(list "--enable-fmt=yes"
2099 "--enable-hpcombi=no"
2100 "--with-external-eigen=yes"
2101 "--with-external-fmt=yes")
2102 #:phases #~(modify-phases %standard-phases
2103 (add-after 'unpack 'fix-version
2104 (lambda* (#:key inputs #:allow-other-keys)
2105 (substitute* "etc/version-number.sh"
2106 (("/bin/sh")
2107 (search-input-file inputs "/bin/bash"))))))))
2108 (native-inputs
2109 (list autoconf automake libtool pkg-config))
2110 (inputs (list eigen fmt))
2111 (home-page "https://github.com/libsemigroups/libsemigroups")
2112 (synopsis "Library for semigroups and monoids")
2113 (description
2114 "@code{libsemigroups} is a C++14 library containing implementations of
2115several algorithms for computing finite, and finitely presented,
2116semigroups and monoids.")
2117 (license license:gpl3+)))
2118
2119(define-public sollya
2120 (package
2121 (name "sollya")
2122 (version "8.0")
2123 (source (origin
2124 (method url-fetch)
2125 (uri (string-append "https://www.sollya.org/releases/"
2126 "sollya-" version "/sollya-" version ".tar.bz2"))
2127 (sha256
2128 (base32
2129 "1sf1cjcr6x035n97l64ppzb9pzq5568h7waz0zfc3120894gcnjz"))))
2130 (build-system gnu-build-system)
2131 (inputs
2132 (list fplll
2133 gmp
2134 gnuplot
2135 libxml2
2136 mpfi
2137 mpfr))
2138 (arguments
2139 `(#:configure-flags
2140 (list (string-append "--docdir=${datadir}/doc/sollya-" ,version))
2141 #:phases
2142 (modify-phases %standard-phases
2143 (add-after 'unpack 'patch-test-shebang
2144 (lambda _
2145 (substitute* (list "tests-tool/Makefile.in"
2146 "tests-lib/Makefile.in")
2147 (("#!/bin/sh") (string-append "#!" (which "sh"))))
2148 #t))
2149 (add-before 'build 'patch-gnuplot-reference
2150 (lambda _
2151 (substitute* "general.c"
2152 (("\"gnuplot\"") (string-append "\"" (which "gnuplot") "\"")))
2153 #t)))))
2154 (home-page "https://www.sollya.org")
2155 (synopsis "Development environment for safe floating-point code")
2156 (description "Sollya is a computer program whose purpose is to
2157provide an environment for safe floating-point code development. It
2158is particularly targeted to the automated implementation of
2159mathematical floating-point libraries (libm). Amongst other features,
2160it offers a certified infinity norm, an automatic polynomial
2161implementer, and a fast Remez algorithm.")
2162 (license license:cecill-c)))
2163
2164(define-public form
2165 ;; using this commit as it removes some invalid/ambiguous license info
2166 (let ((commit "e7c52d3b07abe21f21718f5e70ee138e856f15ac")
2167 (revision "0"))
2168 (package
2169 (name "form")
2170 (version (git-version "4.3.0" revision commit))
2171 (source (origin
2172 (method git-fetch)
2173 (uri (git-reference
2174 (url "https://github.com/vermaseren/form")
2175 (commit commit)))
2176 (file-name (git-file-name name version))
2177 (sha256
2178 (base32
2179 "15pjpn5s8d3sva18syhyymh5v1dijchk0xkf6d0m7cl2sj3qxxxq"))))
2180 (build-system gnu-build-system)
2181 (arguments
2182 (list #:configure-flags #~'("--enable-native=no")
2183 #:phases #~(modify-phases %standard-phases
2184 (add-after 'unpack 'patch-src
2185 (lambda _
2186 (substitute* "check/examples.frm"
2187 ;; skip test that causes memory leak and fails
2188 (("#pend_if valgrind\\?")
2189 "#pend_if 0"))
2190 (substitute* "sources/extcmd.c"
2191 (("/bin/sh")
2192 (string-append
2193 #$(this-package-input "bash-minimal")
2194 "/bin/sh")))))
2195 (add-after 'build 'build-doxygen
2196 (lambda _
2197 (with-directory-excursion "doc/doxygen"
2198 (invoke "make" "html"))))
2199 (add-after 'install 'install-docs
2200 (lambda _
2201 (let ((doc (string-append
2202 #$output "/share/doc/" #$name "-"
2203 #$version "/html")))
2204 (mkdir-p doc)
2205 (copy-recursively "doc/doxygen/html" doc)))))))
2206 (native-inputs (list autoconf automake doxygen ruby))
2207 (inputs (list bash-minimal))
2208 (home-page "https://www.nikhef.nl/~form/")
2209 (synopsis "Symbolic manipulation system for very big expressions")
2210 (description
2211 "FORM is a symbolic manipulation system. It reads symbolic expressions
2212from files and executes symbolic/algebraic transformations upon them. The
2213answers are returned in a textual mathematical representation. The size of
2214the considered expressions in FORM is only limited by the available disk space
2215and not by the available RAM.")
2216 ;; XXX: Ignore this CVE to work around a name clash with the unrelated
2217 ;; "neos/forms" package.
2218 (properties '((lint-hidden-cve . ("CVE-2021-32697"))))
2219 ;; x86_64 only due to test failures on other platforms.
2220 ;; Developers say other platforms are not "tier 1" supported:
2221 ;; https://github.com/vermaseren/form/issues/426
2222 (supported-systems '("x86_64-linux"))
2223 (license license:gpl3+))))
2224
2225(define-public parform
2226 (package
2227 (inherit form)
2228 (name "parform")
2229 (arguments
2230 (substitute-keyword-arguments arguments
2231 ((#:configure-flags flags)
2232 #~(cons* "--enable-parform=yes" #$flags))
2233 ((#:phases phases)
2234 #~(modify-phases #$phases
2235 (add-before 'check 'mpi-setup
2236 #$%openmpi-setup)))))
2237 (inputs (list bash-minimal openmpi))
2238 (description (string-append (package-description form)
2239 " This package also includes
2240@code{parform}, a version of FORM parallelized using OpenMPI."))))
2241
2242(define-public reduce
2243 (let ((revision 7333))
2244 (package
2245 (name "reduce")
2246 (version "2026-03-11")
2247 (source (origin
2248 (method svn-fetch)
2249 (uri (svn-reference
2250 (url "https://svn.code.sf.net/p/reduce-algebra/code/trunk")
2251 (revision revision)))
2252 (file-name (string-append name "-" version "-checkout"))
2253 (sha256
2254 (base32
2255 "04n7z6abfpqxgmdc1vpv2yy4qccvyxdp6klld94wr740dv8r49l2"))
2256 (modules '((guix build utils)))
2257 (patches (search-patches "reduce-unbundle-libffi.patch"))
2258 (snippet '(map delete-file-recursively
2259 (append (find-files "csl/generated-c" "\\.img$")
2260 '("common-lisp"
2261 "contrib"
2262 "csl/embedded"
2263 "csl/new-embedded"
2264 "csl/support-packages"
2265 "csl/winbuild"
2266 "generic/breduce"
2267 "generic/casefold"
2268 "generic/emacs"
2269 "generic/qreduce"
2270 "generic/rbench"
2271 "generic/rlsmt"
2272 "generic/texmacs"
2273 "jlisp"
2274 "jslisp"
2275 "libedit"
2276 "libraries/asmjit"
2277 "libraries/C-Quadratic-Sieve"
2278 "libraries/core-math"
2279 ;; "libraries/crlibm"
2280 ;; "libraries/libedit-20140620-3.1"
2281 "libraries/libedit-20210216-3.1"
2282 "libraries/libffi"
2283 "libraries/original"
2284 ;; "libraries/SoftFloat-3a"
2285 "libraries/SoftFloat-3e"
2286 "libraries/webview"
2287 "libraries/wineditline"
2288 "macbuild"
2289 "MacPorts"
2290 "mac-universal"
2291 "psl"
2292 "reduce2"
2293 "reduce2-2025"
2294 "vsl"
2295 "web"
2296 "winbuild64"
2297 "windows-config-cache"))))))
2298 (build-system gnu-build-system)
2299 (arguments
2300 (list #:parallel-build? #f
2301 #:configure-flags
2302 #~(list "--without-autogen"
2303 ;; fix conflict with internal build name determination
2304 "--build="
2305 "--with-csl"
2306 (string-append "CPPFLAGS=-I"
2307 #$freetype
2308 "/include/freetype2"))
2309 #:make-flags #~(list "csl")
2310 #:phases
2311 #~(modify-phases %standard-phases
2312 (replace 'check
2313 (lambda* (#:key tests? #:allow-other-keys)
2314 (when tests?
2315 (invoke "scripts/testall.sh" "--csl" "--noregressions"))))
2316 (add-before 'patch-source-shebangs 'autogen
2317 (lambda _
2318 (invoke "sh" "autogen.sh")))
2319 (add-after 'autogen 'fix-version
2320 (lambda _
2321 (substitute* "csl/cslbase/version.h"
2322 (("(#define VERSION_ID )\"\\$Id\\$\"" all def)
2323 (format #f
2324 "~a \"$Id: version.h ~a ~a 00:00:00Z somebody $\""
2325 def #$revision #$version)))))
2326 (add-after 'install 'fix-install
2327 (lambda _
2328 (copy-file "bin/rfcsl"
2329 (string-append #$output "/bin/rfcsl"))
2330 (copy-file "generic/newfront/redfront.1"
2331 (string-append #$output
2332 "/share/man/man1/rfcsl.1"))
2333 (let ((.desktop-file
2334 "debianbuild/reduce/debian/redcsl.desktop")
2335 (icon "debianbuild/reduce/debian/reduce.png"))
2336 (install-file .desktop-file
2337 (string-append #$output
2338 "/share/applications"))
2339 (install-file icon
2340 (string-append
2341 #$output
2342 "/share/icons/hicolor/32x32/apps")))
2343 (with-directory-excursion #$output
2344 (map (lambda (dir)
2345 (map (lambda (file)
2346 (chmod file #o444))
2347 (find-files dir)))
2348 '("share/man/man1" "share/reduce/fonts"))))))))
2349 (native-inputs (list autoconf automake libtool which))
2350 (inputs
2351 ;; bundled libraries: fox (adjusted) editline (adjusted)
2352 ;; crlibm softfloat
2353 (list freetype libffi libx11 libxext libxft ncurses))
2354 (synopsis "Portable general-purpose computer algebra system")
2355 (description
2356 "REDUCE is a portable general-purpose computer algebra system. It is a
2357system for doing scalar, vector and matrix algebra by computer, which also
2358supports arbitrary precision numerical approximation and interfaces to
2359gnuplot to provide graphics. It can be used interactively for simple
2360calculations but also provides a full programming language, with a syntax
2361similar to other modern programming languages. REDUCE supports alternative
2362user interfaces including Run-REDUCE, TeXmacs and GNU Emacs. This package
2363provides the Codemist Standard Lisp (CSL) version of REDUCE. It uses the
2364gnuplot program, if installed, to draw figures.")
2365 (home-page "https://reduce-algebra.sourceforge.io/")
2366 (license (license:non-copyleft "file://README"
2367 "See README in the distribution.")))))
2368
2369(define-public msolve
2370 (package
2371 (name "msolve")
2372 (version "0.10.1")
2373 (source (origin
2374 (method git-fetch)
2375 (uri (git-reference
2376 (url "https://github.com/algebraic-solving/msolve")
2377 (commit (string-append "v" version))))
2378 (file-name (git-file-name name version))
2379 (sha256
2380 (base32
2381 "1adxnl4y1dh13avsz2r51d52g9njgfav8s231mmg6bh4p3xjwm7c"))))
2382 (build-system gnu-build-system)
2383 (native-inputs (list autoconf automake libtool))
2384 (inputs (list flint gmp mpfr))
2385 (home-page "https://msolve.lip6.fr/")
2386 (synopsis
2387 "Library for polynomial system solving through algebraic methods")
2388 (description "@code{msolve} is a C library implementing computer algebra
2389algorithms for solving polynomial systems (with rational coefficients or
2390coefficients in a prime field).
2391
2392Currently, with msolve, you can basically solve multivariate polynomial
2393systems. This encompasses:
2394
2395@itemize
2396@item the computation of Groebner bases
2397@item real root isolation of the solutions to polynomial systems
2398@item the computation of the dimension and the degree of the solution set.
2399@end itemize")
2400 (license license:gpl2+)))