summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Orlitzky <mjo@gentoo.org>2020-03-27 15:38:30 -0400
committerMichael Orlitzky <mjo@gentoo.org>2020-03-30 08:46:12 -0400
commit1e6e5e555c6c6436d130ecab77dbda167ef8f897 (patch)
tree78e13b58a7b46034513a7feb30179ca58a686b4b /sci-mathematics/flintqs/flintqs-1.0.ebuild
parentdev-python/html2text: Drop old (diff)
downloadgentoo-1e6e5e555c6c6436d130ecab77dbda167ef8f897.tar.gz
gentoo-1e6e5e555c6c6436d130ecab77dbda167ef8f897.tar.bz2
gentoo-1e6e5e555c6c6436d130ecab77dbda167ef8f897.zip
sci-mathematics/flintqs: new package for quadratic sieve factoring.
A straightforward import of the ebuild that François Bissey has been maintaining in the sage-on-gentoo overlay. I added a test suite that factors a large composite number based on the doctests for qsieve() in SageMath. Closes: https://bugs.gentoo.org/715090 Package-Manager: Portage-2.3.89, Repoman-2.3.20 Signed-off-by: Michael Orlitzky <mjo@gentoo.org>
Diffstat (limited to 'sci-mathematics/flintqs/flintqs-1.0.ebuild')
-rw-r--r--sci-mathematics/flintqs/flintqs-1.0.ebuild39
1 files changed, 39 insertions, 0 deletions
diff --git a/sci-mathematics/flintqs/flintqs-1.0.ebuild b/sci-mathematics/flintqs/flintqs-1.0.ebuild
new file mode 100644
index 000000000000..676e751c8bd8
--- /dev/null
+++ b/sci-mathematics/flintqs/flintqs-1.0.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Multi-polynomial quadratic sieve for integer factorization"
+HOMEPAGE="https://github.com/sagemath/FlintQS"
+# The github tarball is missing the autotools stuff.
+SRC_URI="http://files.sagemath.org/spkg/upstream/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos"
+IUSE=""
+
+DEPEND="dev-libs/gmp:="
+RDEPEND="${DEPEND}"
+
+src_test() {
+ # Factor,
+ #
+ # 1000000000000000005490000000000000001989
+ #
+ # to get
+ #
+ # 10000000000000000051 * 100000000000000000039.
+ #
+ # The sed command deletes all lines up to the pattern match.
+ #
+ ACTUAL=$(echo 1000000000000000005490000000000000001989 | \
+ QuadraticSieve | \
+ sed '0,/FACTORS:/d' | \
+ sort --numeric | \
+ uniq |
+ tr '\n' ' ')
+ EXPECTED="10000000000000000051 100000000000000000039 "
+
+ [[ "${ACTUAL}" == "${EXPECTED}" ]] || die "test factorization failed"
+}