Import math/p5-Math-Prime-Util-GMP

A module for number theory in Perl using GMP. This includes primality
tests, getting primes in a range, factoring, and more.

While it certainly can be used directly, the main purpose of this
module is for Math::Prime::Util. That module will automatically
load this one if it is installed, greatly speeding up many of its
operations on big numbers.

Inputs and outputs for big numbers are via strings, so you do not
need to use a bigint package in your program. However if you do use
bigints, inputs will be converted internally so there is no need
to convert before a call. Output results are returned as either
Perl scalars (for native-size) or strings (for bigints). Math::Prime::Util
tries to reconvert all strings back into the callers bigint type
if possible, which makes it more convenient for calculations.

The various is_*_pseudoprime tests are more appropriately called
is_*_probable_prime or is_*_prp. They return 1 if the input is a
probable prime based on their test. The naming convention is
historical and follows Pari, Math::Primality, and some other math
packages. The modern definition of pseudoprime is a composite that
passes the test, rather than any number.

Originally from henning@ with adjustments by me
OK sthen@
This commit is contained in:
afresh1 2020-08-13 03:02:20 +00:00
parent 404acfbb21
commit 80c75785b3
4 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,20 @@
# $OpenBSD: Makefile,v 1.1.1.1 2020/08/13 03:02:20 afresh1 Exp $
COMMENT = utilities related to prime numbers, using GMP
DISTNAME = Math-Prime-Util-GMP-0.52
CATEGORIES = math
# Perl
PERMIT_PACKAGE = Yes
MODULES = cpan
WANTLIB = perl c m gmp
LIB_DEPENDS = devel/gmp
# Extend "LIBS" from Makefile.PL,
# not sure how other than to replicate what is in there already
CONFIGURE_ARGS = INC="-I${LOCALBASE}/include" \
LIBS="-lm -L${LOCALBASE}/lib -lgmp"
.include <bsd.port.mk>

View File

@ -0,0 +1,2 @@
SHA256 (Math-Prime-Util-GMP-0.52.tar.gz) = JpfH/Vx+Nf3sf1DtVqZ76Aei8iZXWJ5jfa01knRAA74=
SIZE (Math-Prime-Util-GMP-0.52.tar.gz) = 341681

View File

@ -0,0 +1,22 @@
A module for number theory in Perl using GMP. This includes primality
tests, getting primes in a range, factoring, and more.
While it certainly can be used directly, the main purpose of this
module is for Math::Prime::Util. That module will automatically
load this one if it is installed, greatly speeding up many of its
operations on big numbers.
Inputs and outputs for big numbers are via strings, so you do not
need to use a bigint package in your program. However if you do use
bigints, inputs will be converted internally so there is no need
to convert before a call. Output results are returned as either
Perl scalars (for native-size) or strings (for bigints). Math::Prime::Util
tries to reconvert all strings back into the callers bigint type
if possible, which makes it more convenient for calculations.
The various is_*_pseudoprime tests are more appropriately called
is_*_probable_prime or is_*_prp. They return 1 if the input is a
probable prime based on their test. The naming convention is
historical and follows Pari, Math::Primality, and some other math
packages. The modern definition of pseudoprime is a composite that
passes the test, rather than any number.

View File

@ -0,0 +1,13 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2020/08/13 03:02:20 afresh1 Exp $
${P5ARCH}/
${P5ARCH}/Math/
${P5ARCH}/Math/Prime/
${P5ARCH}/Math/Prime/Util/
${P5ARCH}/Math/Prime/Util/GMP.pm
${P5ARCH}/auto/
${P5ARCH}/auto/Math/
${P5ARCH}/auto/Math/Prime/
${P5ARCH}/auto/Math/Prime/Util/
${P5ARCH}/auto/Math/Prime/Util/GMP/
@so ${P5ARCH}/auto/Math/Prime/Util/GMP/GMP.so
@man man/man3p/Math::Prime::Util::GMP.3p