2015-09-20 17:01:41 +00:00
|
|
|
#
|
|
|
|
# spec file for package perl-Math-Prime-Util
|
|
|
|
#
|
2024-07-24 20:26:55 +00:00
|
|
|
# Copyright (c) 2024 SUSE LLC
|
2015-09-20 17:01:41 +00:00
|
|
|
#
|
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
Accepting request 730893 from devel:languages:perl:autoupdate
- updated to 0.73
see /usr/share/doc/packages/perl-Math-Prime-Util/Changes
0.73 2018-11-15
[ADDED]
- inverse_totient(n) the image of euler_phi(n)
[FIXES]
- Try to work around 32-bit platforms in semiprime approximations.
Cannot reproduce on any of my 32-bit test platforms.
- Fix RT 127605, memory use in for... iterators.
0.72 2018-11-08
[ADDED]
- nth_semiprime(n) the nth semiprime
- nth_semiprime_approx(n) fast approximate nth semiprime
- semiprime_count_approx(n) fast approximate semiprime count
- semi_primes as primes but for semiprimes
- forsetproduct {...} \@a,\@b,... Cartesian product of list refs
[FIXES]
- Some platforms are extremely slow for is_pillai. Speed up tests.
- Ensure random_factored_integer factor list is sorted min->max.
- forcomposites didn't check lastfor on every callback.
- Sun's compilers, in a valid interpretation of the code, generated
divide by zero code for pillai testing.
[FUNCTIONALITY AND PERFORMANCE]
- chebyshev_theta and chebyshev_psi redone and uses a table.
Large inputs are significantly faster.
- Convert some FP functions to use quadmath if possible. Without
quadmath there should be no change. With quadmath functions like
LogarithmicIntegral and LambertW will be slower but more accurate.
- semiprime_count for non-trivial inputs uses a segmented sieve and
precalculates primes for larger values so can run 2-3x faster.
- forsemiprimes uses a sieve so large ranges are much faster.
- ranged moebius more efficient for small intervals.
- Thanks to GRAY for his module Set::Product which has clean and
clever XS code, which I used to improve my code.
- forfactored uses multicall. Up to 2x faster.
- forperm, forcomb, forderange uses multicall. 2-3x faster.
- Frobenius-Khashin algorithm changed from 2013 version to 2016/2018.
0.71 2018-08-28
[ADDED]
- forfactored { ... } a,b loop n=a..b setting $_=n, @_=factor(n)
- forsquarefree { ... } a,b as forfactored, but only square-free n
- forsemiprimes { ... } a,b as forcomposites, but only semiprimes
- random_factored_integer(n) random [1..n] w/ array ref of factors
- semiprime_count([lo],hi) counts semiprimes in range
[FIXES]
- Monolithic sieves beyond 30*2^32 (~ 1.2 * 10^11) overflowed.
- is_semiprime was wrong for five small values since 0.69. Fixed.
[FUNCTIONALITY AND PERFORMANCE]
- is_primitive_root much faster (doesn't need to calulate totient,
and faster rejection when n has no primitive root).
- znprimroot and znorder use Montgomery, 1.2x to 2x faster.
- slightly faster sieve_range for native size inputs (use factor_one).
- bin/primes.pl faster for palindromic primes and works for 10^17
[OTHER]
- Added ability to use -DBENCH_SEG for benchmarking sieves using
prime_count and ntheory::_segment_pi without table optimizations.
- Reorg of main factor loop. Should be identical from external view.
- Internal change to is_semiprime and is_catalan_pseudoprime.
0.70 2017-12-02
[FIXES]
- prime_count(a,b) incorrect for a={3..7} and b < 66000000.
First appeared in v0.65 (May 2017).
Reported by Trizen. Fixed.
- Also impacted were nth_ramanujan_prime and _lower/_upper for
small input values.
[FUNCTIONALITY AND PERFORMANCE]
- Some utility functions used prime counts. Unlink for more isolation.
- prime_count_approx uses full precision for bigint or string input.
- LogarithmicIntegral and ExponentialIntegral will try to use
our GMP backend if possible.
- Work around old Math::BigInt::FastCalc (as_int() doesn't work right).
- prime_memfree also calls GMP's memfree function. This will clear the
cached constants (e.g. Pi, Euler).
- Calling srand or csrand will also result in the GMP backend CSPRNG
functions being called. This gives more consistent behavior.
[OTHER]
- Turned off threads testing unless release or extended testing is used.
A few smokers seem to have threads lib that die before we event start.
- Removed all Math::MPFR code and references. The latest GMP backend
has everything we need.
- The MPU_NO_XS and MPU_NO_GMP environment variables are documented.
0.69 2017-11-08
[ADDED]
- is_totient(n) true if euler_phi(x) == n for some x
[FUNCTIONALITY AND PERFORMANCE]
- is_square_free uses abs(n), like Pari and moebius.
- is_primitive_root could be wrong with even n on some platforms.
- euler_phi and moebius with negative range inputs weren't consistent.
- factorialmod given a large n and m where m was a composite with
large square factors was incorrect. Fixed.
- numtoperm will accept negative k values (k is always mod n!)
- Split XS mapping of many primality tests. Makes more sense and
improves performance for some calls.
- Split final test in PP cluster sieve.
- Support some new Math::Prime::Util::GMP functions from 0.47.
- C spigot Pi is 30-60% faster on x86_64 by using 32-bit types.
- Reworked some factoring code.
- Remove ISAAC (Perl and C) since we use ChaCha.
- Each thread allocs a new const array again instead of sharing.
0.68 2017-10-19
[API Changes]
- forcomb with one argument iterates over the power set, so k=0..n
instead of k=n. The previous behavior was undocumented. The new
behavior matches Pari/GP (forsubset) and Perl6 (combinations).
[ADDED]
- factorialmod(n,m) n! mod m calculated efficiently
- is_fundamental(d) true if d a fundamental discriminant
[FUNCTIONALITY AND PERFORMANCE]
- Unknown bigint classes no longer return two values after objectify.
Thanks to Daniel Șuteu for finding this.
- Using lastfor inside a formultiperm works correctly now.
- randperm a little faster for k < n cases, and can handle big n
values without running out of memory as long as k << n.
E.g. 5000 random native ints without dups: @r = randperm(~0,5000);
- forpart with primes pulls min/max values in for a small speedup.
- forderange 10-20% faster.
- hammingweight for bigints 3-8x faster.
- Add Math::GMPq and Math::AnyNum as possible bigint classes. Inputs
of these types will be relied on to stringify correctly, and if this
results in an integer string, to intify correctly. This should give
a large speedup for these types.
- Factoring native integers is 1.2x - 2x faster. This is due to a
number of changes.
- Add Lehman factoring core. Since this is not exported or used by
default, the API for factor_lehman may change.
- All new Montgomery math. Uses mulredc asm from Ben Buhrow.
Faster and smaller. Most primality and factoring code 10% faster.
- Speedup for factoring by running more Pollard-Rho-Brent, revising
SQUFOF, updating HOLF, updating recipe.
0.67 2017-09-23
[ADDED]
- lastfor stops forprimes (etc.) iterations
- is_square(n) returns 1 if n is a perfect square
- is_polygonal(n,k) returns 1 if n is a k-gonal number
[FUNCTIONALITY AND PERFORMANCE]
- shuffle prototype is @ instead of ;@, so matches List::Util.
- On Perl 5.8 and earlier we will call PP instead of trying
direct-to-GMP. Works around a bug in XS trying to turn the
result into an object where 5.8.7 and earlier gets lost.
- We create more const integers, which speeds up common uses of
permutations.
- CSPRNG now stores context per-thread rather than using a single
mutex-protected context. This speeds up anything using random
numbers a fair amount, especially with threaded Perls.
- With the above two optimizations, randperm(144) is 2.5x faster.
- threading test has threaded srand/irand test added back in, showing
context is per-thread. Each thread gets its own sequence and calls
to srand/csrand and using randomness doesn't impact other threads.
OBS-URL: https://build.opensuse.org/request/show/730893
OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-Math-Prime-Util?expand=0&rev=4
2019-09-17 10:10:02 +00:00
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
2015-09-20 17:01:41 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
|
2024-07-24 20:26:55 +00:00
|
|
|
%define cpan_name Math-Prime-Util
|
2015-09-20 17:01:41 +00:00
|
|
|
Name: perl-Math-Prime-Util
|
2024-07-24 20:26:55 +00:00
|
|
|
Version: 0.730.0
|
2015-09-20 17:01:41 +00:00
|
|
|
Release: 0
|
2024-07-24 20:26:55 +00:00
|
|
|
# 0.73 -> normalize -> 0.730.0
|
|
|
|
%define cpan_version 0.73
|
Accepting request 730893 from devel:languages:perl:autoupdate
- updated to 0.73
see /usr/share/doc/packages/perl-Math-Prime-Util/Changes
0.73 2018-11-15
[ADDED]
- inverse_totient(n) the image of euler_phi(n)
[FIXES]
- Try to work around 32-bit platforms in semiprime approximations.
Cannot reproduce on any of my 32-bit test platforms.
- Fix RT 127605, memory use in for... iterators.
0.72 2018-11-08
[ADDED]
- nth_semiprime(n) the nth semiprime
- nth_semiprime_approx(n) fast approximate nth semiprime
- semiprime_count_approx(n) fast approximate semiprime count
- semi_primes as primes but for semiprimes
- forsetproduct {...} \@a,\@b,... Cartesian product of list refs
[FIXES]
- Some platforms are extremely slow for is_pillai. Speed up tests.
- Ensure random_factored_integer factor list is sorted min->max.
- forcomposites didn't check lastfor on every callback.
- Sun's compilers, in a valid interpretation of the code, generated
divide by zero code for pillai testing.
[FUNCTIONALITY AND PERFORMANCE]
- chebyshev_theta and chebyshev_psi redone and uses a table.
Large inputs are significantly faster.
- Convert some FP functions to use quadmath if possible. Without
quadmath there should be no change. With quadmath functions like
LogarithmicIntegral and LambertW will be slower but more accurate.
- semiprime_count for non-trivial inputs uses a segmented sieve and
precalculates primes for larger values so can run 2-3x faster.
- forsemiprimes uses a sieve so large ranges are much faster.
- ranged moebius more efficient for small intervals.
- Thanks to GRAY for his module Set::Product which has clean and
clever XS code, which I used to improve my code.
- forfactored uses multicall. Up to 2x faster.
- forperm, forcomb, forderange uses multicall. 2-3x faster.
- Frobenius-Khashin algorithm changed from 2013 version to 2016/2018.
0.71 2018-08-28
[ADDED]
- forfactored { ... } a,b loop n=a..b setting $_=n, @_=factor(n)
- forsquarefree { ... } a,b as forfactored, but only square-free n
- forsemiprimes { ... } a,b as forcomposites, but only semiprimes
- random_factored_integer(n) random [1..n] w/ array ref of factors
- semiprime_count([lo],hi) counts semiprimes in range
[FIXES]
- Monolithic sieves beyond 30*2^32 (~ 1.2 * 10^11) overflowed.
- is_semiprime was wrong for five small values since 0.69. Fixed.
[FUNCTIONALITY AND PERFORMANCE]
- is_primitive_root much faster (doesn't need to calulate totient,
and faster rejection when n has no primitive root).
- znprimroot and znorder use Montgomery, 1.2x to 2x faster.
- slightly faster sieve_range for native size inputs (use factor_one).
- bin/primes.pl faster for palindromic primes and works for 10^17
[OTHER]
- Added ability to use -DBENCH_SEG for benchmarking sieves using
prime_count and ntheory::_segment_pi without table optimizations.
- Reorg of main factor loop. Should be identical from external view.
- Internal change to is_semiprime and is_catalan_pseudoprime.
0.70 2017-12-02
[FIXES]
- prime_count(a,b) incorrect for a={3..7} and b < 66000000.
First appeared in v0.65 (May 2017).
Reported by Trizen. Fixed.
- Also impacted were nth_ramanujan_prime and _lower/_upper for
small input values.
[FUNCTIONALITY AND PERFORMANCE]
- Some utility functions used prime counts. Unlink for more isolation.
- prime_count_approx uses full precision for bigint or string input.
- LogarithmicIntegral and ExponentialIntegral will try to use
our GMP backend if possible.
- Work around old Math::BigInt::FastCalc (as_int() doesn't work right).
- prime_memfree also calls GMP's memfree function. This will clear the
cached constants (e.g. Pi, Euler).
- Calling srand or csrand will also result in the GMP backend CSPRNG
functions being called. This gives more consistent behavior.
[OTHER]
- Turned off threads testing unless release or extended testing is used.
A few smokers seem to have threads lib that die before we event start.
- Removed all Math::MPFR code and references. The latest GMP backend
has everything we need.
- The MPU_NO_XS and MPU_NO_GMP environment variables are documented.
0.69 2017-11-08
[ADDED]
- is_totient(n) true if euler_phi(x) == n for some x
[FUNCTIONALITY AND PERFORMANCE]
- is_square_free uses abs(n), like Pari and moebius.
- is_primitive_root could be wrong with even n on some platforms.
- euler_phi and moebius with negative range inputs weren't consistent.
- factorialmod given a large n and m where m was a composite with
large square factors was incorrect. Fixed.
- numtoperm will accept negative k values (k is always mod n!)
- Split XS mapping of many primality tests. Makes more sense and
improves performance for some calls.
- Split final test in PP cluster sieve.
- Support some new Math::Prime::Util::GMP functions from 0.47.
- C spigot Pi is 30-60% faster on x86_64 by using 32-bit types.
- Reworked some factoring code.
- Remove ISAAC (Perl and C) since we use ChaCha.
- Each thread allocs a new const array again instead of sharing.
0.68 2017-10-19
[API Changes]
- forcomb with one argument iterates over the power set, so k=0..n
instead of k=n. The previous behavior was undocumented. The new
behavior matches Pari/GP (forsubset) and Perl6 (combinations).
[ADDED]
- factorialmod(n,m) n! mod m calculated efficiently
- is_fundamental(d) true if d a fundamental discriminant
[FUNCTIONALITY AND PERFORMANCE]
- Unknown bigint classes no longer return two values after objectify.
Thanks to Daniel Șuteu for finding this.
- Using lastfor inside a formultiperm works correctly now.
- randperm a little faster for k < n cases, and can handle big n
values without running out of memory as long as k << n.
E.g. 5000 random native ints without dups: @r = randperm(~0,5000);
- forpart with primes pulls min/max values in for a small speedup.
- forderange 10-20% faster.
- hammingweight for bigints 3-8x faster.
- Add Math::GMPq and Math::AnyNum as possible bigint classes. Inputs
of these types will be relied on to stringify correctly, and if this
results in an integer string, to intify correctly. This should give
a large speedup for these types.
- Factoring native integers is 1.2x - 2x faster. This is due to a
number of changes.
- Add Lehman factoring core. Since this is not exported or used by
default, the API for factor_lehman may change.
- All new Montgomery math. Uses mulredc asm from Ben Buhrow.
Faster and smaller. Most primality and factoring code 10% faster.
- Speedup for factoring by running more Pollard-Rho-Brent, revising
SQUFOF, updating HOLF, updating recipe.
0.67 2017-09-23
[ADDED]
- lastfor stops forprimes (etc.) iterations
- is_square(n) returns 1 if n is a perfect square
- is_polygonal(n,k) returns 1 if n is a k-gonal number
[FUNCTIONALITY AND PERFORMANCE]
- shuffle prototype is @ instead of ;@, so matches List::Util.
- On Perl 5.8 and earlier we will call PP instead of trying
direct-to-GMP. Works around a bug in XS trying to turn the
result into an object where 5.8.7 and earlier gets lost.
- We create more const integers, which speeds up common uses of
permutations.
- CSPRNG now stores context per-thread rather than using a single
mutex-protected context. This speeds up anything using random
numbers a fair amount, especially with threaded Perls.
- With the above two optimizations, randperm(144) is 2.5x faster.
- threading test has threaded srand/irand test added back in, showing
context is per-thread. Each thread gets its own sequence and calls
to srand/csrand and using randomness doesn't impact other threads.
OBS-URL: https://build.opensuse.org/request/show/730893
OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-Math-Prime-Util?expand=0&rev=4
2019-09-17 10:10:02 +00:00
|
|
|
License: Artistic-1.0 OR GPL-1.0-or-later
|
2024-07-24 20:26:55 +00:00
|
|
|
Summary: Utilities related to prime numbers, including fast sieves and factoring
|
|
|
|
URL: https://metacpan.org/release/%{cpan_name}
|
|
|
|
Source0: https://cpan.metacpan.org/authors/id/D/DA/DANAJ/%{cpan_name}-%{cpan_version}.tar.gz
|
2016-06-24 04:57:02 +00:00
|
|
|
Source1: cpanspec.yml
|
2025-08-12 18:15:21 +02:00
|
|
|
Source100: README.md
|
2015-09-20 17:01:41 +00:00
|
|
|
BuildRequires: perl
|
|
|
|
BuildRequires: perl-macros
|
|
|
|
BuildRequires: perl(Math::BigFloat) >= 1.59
|
|
|
|
BuildRequires: perl(Math::BigInt) >= 1.88
|
2024-07-24 20:26:55 +00:00
|
|
|
BuildRequires: perl(Math::Prime::Util::GMP) >= 0.500
|
Accepting request 730893 from devel:languages:perl:autoupdate
- updated to 0.73
see /usr/share/doc/packages/perl-Math-Prime-Util/Changes
0.73 2018-11-15
[ADDED]
- inverse_totient(n) the image of euler_phi(n)
[FIXES]
- Try to work around 32-bit platforms in semiprime approximations.
Cannot reproduce on any of my 32-bit test platforms.
- Fix RT 127605, memory use in for... iterators.
0.72 2018-11-08
[ADDED]
- nth_semiprime(n) the nth semiprime
- nth_semiprime_approx(n) fast approximate nth semiprime
- semiprime_count_approx(n) fast approximate semiprime count
- semi_primes as primes but for semiprimes
- forsetproduct {...} \@a,\@b,... Cartesian product of list refs
[FIXES]
- Some platforms are extremely slow for is_pillai. Speed up tests.
- Ensure random_factored_integer factor list is sorted min->max.
- forcomposites didn't check lastfor on every callback.
- Sun's compilers, in a valid interpretation of the code, generated
divide by zero code for pillai testing.
[FUNCTIONALITY AND PERFORMANCE]
- chebyshev_theta and chebyshev_psi redone and uses a table.
Large inputs are significantly faster.
- Convert some FP functions to use quadmath if possible. Without
quadmath there should be no change. With quadmath functions like
LogarithmicIntegral and LambertW will be slower but more accurate.
- semiprime_count for non-trivial inputs uses a segmented sieve and
precalculates primes for larger values so can run 2-3x faster.
- forsemiprimes uses a sieve so large ranges are much faster.
- ranged moebius more efficient for small intervals.
- Thanks to GRAY for his module Set::Product which has clean and
clever XS code, which I used to improve my code.
- forfactored uses multicall. Up to 2x faster.
- forperm, forcomb, forderange uses multicall. 2-3x faster.
- Frobenius-Khashin algorithm changed from 2013 version to 2016/2018.
0.71 2018-08-28
[ADDED]
- forfactored { ... } a,b loop n=a..b setting $_=n, @_=factor(n)
- forsquarefree { ... } a,b as forfactored, but only square-free n
- forsemiprimes { ... } a,b as forcomposites, but only semiprimes
- random_factored_integer(n) random [1..n] w/ array ref of factors
- semiprime_count([lo],hi) counts semiprimes in range
[FIXES]
- Monolithic sieves beyond 30*2^32 (~ 1.2 * 10^11) overflowed.
- is_semiprime was wrong for five small values since 0.69. Fixed.
[FUNCTIONALITY AND PERFORMANCE]
- is_primitive_root much faster (doesn't need to calulate totient,
and faster rejection when n has no primitive root).
- znprimroot and znorder use Montgomery, 1.2x to 2x faster.
- slightly faster sieve_range for native size inputs (use factor_one).
- bin/primes.pl faster for palindromic primes and works for 10^17
[OTHER]
- Added ability to use -DBENCH_SEG for benchmarking sieves using
prime_count and ntheory::_segment_pi without table optimizations.
- Reorg of main factor loop. Should be identical from external view.
- Internal change to is_semiprime and is_catalan_pseudoprime.
0.70 2017-12-02
[FIXES]
- prime_count(a,b) incorrect for a={3..7} and b < 66000000.
First appeared in v0.65 (May 2017).
Reported by Trizen. Fixed.
- Also impacted were nth_ramanujan_prime and _lower/_upper for
small input values.
[FUNCTIONALITY AND PERFORMANCE]
- Some utility functions used prime counts. Unlink for more isolation.
- prime_count_approx uses full precision for bigint or string input.
- LogarithmicIntegral and ExponentialIntegral will try to use
our GMP backend if possible.
- Work around old Math::BigInt::FastCalc (as_int() doesn't work right).
- prime_memfree also calls GMP's memfree function. This will clear the
cached constants (e.g. Pi, Euler).
- Calling srand or csrand will also result in the GMP backend CSPRNG
functions being called. This gives more consistent behavior.
[OTHER]
- Turned off threads testing unless release or extended testing is used.
A few smokers seem to have threads lib that die before we event start.
- Removed all Math::MPFR code and references. The latest GMP backend
has everything we need.
- The MPU_NO_XS and MPU_NO_GMP environment variables are documented.
0.69 2017-11-08
[ADDED]
- is_totient(n) true if euler_phi(x) == n for some x
[FUNCTIONALITY AND PERFORMANCE]
- is_square_free uses abs(n), like Pari and moebius.
- is_primitive_root could be wrong with even n on some platforms.
- euler_phi and moebius with negative range inputs weren't consistent.
- factorialmod given a large n and m where m was a composite with
large square factors was incorrect. Fixed.
- numtoperm will accept negative k values (k is always mod n!)
- Split XS mapping of many primality tests. Makes more sense and
improves performance for some calls.
- Split final test in PP cluster sieve.
- Support some new Math::Prime::Util::GMP functions from 0.47.
- C spigot Pi is 30-60% faster on x86_64 by using 32-bit types.
- Reworked some factoring code.
- Remove ISAAC (Perl and C) since we use ChaCha.
- Each thread allocs a new const array again instead of sharing.
0.68 2017-10-19
[API Changes]
- forcomb with one argument iterates over the power set, so k=0..n
instead of k=n. The previous behavior was undocumented. The new
behavior matches Pari/GP (forsubset) and Perl6 (combinations).
[ADDED]
- factorialmod(n,m) n! mod m calculated efficiently
- is_fundamental(d) true if d a fundamental discriminant
[FUNCTIONALITY AND PERFORMANCE]
- Unknown bigint classes no longer return two values after objectify.
Thanks to Daniel Șuteu for finding this.
- Using lastfor inside a formultiperm works correctly now.
- randperm a little faster for k < n cases, and can handle big n
values without running out of memory as long as k << n.
E.g. 5000 random native ints without dups: @r = randperm(~0,5000);
- forpart with primes pulls min/max values in for a small speedup.
- forderange 10-20% faster.
- hammingweight for bigints 3-8x faster.
- Add Math::GMPq and Math::AnyNum as possible bigint classes. Inputs
of these types will be relied on to stringify correctly, and if this
results in an integer string, to intify correctly. This should give
a large speedup for these types.
- Factoring native integers is 1.2x - 2x faster. This is due to a
number of changes.
- Add Lehman factoring core. Since this is not exported or used by
default, the API for factor_lehman may change.
- All new Montgomery math. Uses mulredc asm from Ben Buhrow.
Faster and smaller. Most primality and factoring code 10% faster.
- Speedup for factoring by running more Pollard-Rho-Brent, revising
SQUFOF, updating HOLF, updating recipe.
0.67 2017-09-23
[ADDED]
- lastfor stops forprimes (etc.) iterations
- is_square(n) returns 1 if n is a perfect square
- is_polygonal(n,k) returns 1 if n is a k-gonal number
[FUNCTIONALITY AND PERFORMANCE]
- shuffle prototype is @ instead of ;@, so matches List::Util.
- On Perl 5.8 and earlier we will call PP instead of trying
direct-to-GMP. Works around a bug in XS trying to turn the
result into an object where 5.8.7 and earlier gets lost.
- We create more const integers, which speeds up common uses of
permutations.
- CSPRNG now stores context per-thread rather than using a single
mutex-protected context. This speeds up anything using random
numbers a fair amount, especially with threaded Perls.
- With the above two optimizations, randperm(144) is 2.5x faster.
- threading test has threaded srand/irand test added back in, showing
context is per-thread. Each thread gets its own sequence and calls
to srand/csrand and using randomness doesn't impact other threads.
OBS-URL: https://build.opensuse.org/request/show/730893
OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-Math-Prime-Util?expand=0&rev=4
2019-09-17 10:10:02 +00:00
|
|
|
BuildRequires: perl(bignum) >= 0.22
|
2015-09-20 17:01:41 +00:00
|
|
|
Requires: perl(Math::BigFloat) >= 1.59
|
|
|
|
Requires: perl(Math::BigInt) >= 1.88
|
2024-07-24 20:26:55 +00:00
|
|
|
Requires: perl(Math::Prime::Util::GMP) >= 0.500
|
|
|
|
Provides: perl(Math::Prime::Util) = %{version}
|
|
|
|
Provides: perl(Math::Prime::Util::ChaCha) = %{version}
|
|
|
|
Provides: perl(Math::Prime::Util::Entropy) = %{version}
|
|
|
|
Provides: perl(Math::Prime::Util::MemFree) = %{version}
|
|
|
|
Provides: perl(Math::Prime::Util::PP) = %{version}
|
|
|
|
Provides: perl(Math::Prime::Util::PrimeArray) = %{version}
|
|
|
|
Provides: perl(Math::Prime::Util::PrimeIterator) = %{version}
|
|
|
|
Provides: perl(ntheory) = %{version}
|
|
|
|
%undefine __perllib_provides
|
2015-09-20 17:01:41 +00:00
|
|
|
Recommends: perl(Digest::SHA) >= 5.87
|
|
|
|
Recommends: perl(Math::BigInt::GMP)
|
2024-07-24 20:26:55 +00:00
|
|
|
Recommends: perl(Math::Prime::Util::GMP) >= 0.510
|
2015-09-20 17:01:41 +00:00
|
|
|
%{perl_requires}
|
|
|
|
|
|
|
|
%description
|
|
|
|
A module for number theory in Perl. This includes prime sieving, primality
|
|
|
|
tests, primality proofs, integer factoring, counts / bounds /
|
|
|
|
approximations for primes, nth primes, and twin primes, random prime
|
|
|
|
generation, and much more.
|
|
|
|
|
|
|
|
This module is the fastest on CPAN for almost all operations it supports.
|
2017-09-17 17:49:33 +00:00
|
|
|
This includes Math::Prime::XS, Math::Prime::FastSieve, Math::Factor::XS,
|
2016-06-24 04:57:02 +00:00
|
|
|
Math::Prime::TiedArray, Math::Big::Factors, Math::Factoring, and
|
|
|
|
Math::Primality (when the GMP module is available). For numbers in the
|
|
|
|
10-20 digit range, it is often orders of magnitude faster. Typically it is
|
|
|
|
faster than Math::Pari for 64-bit operations.
|
2015-09-20 17:01:41 +00:00
|
|
|
|
|
|
|
All operations support both Perl UV's (32-bit or 64-bit) and bignums. If
|
|
|
|
you want high performance with big numbers (larger than Perl's native
|
2016-06-24 04:57:02 +00:00
|
|
|
32-bit or 64-bit size), you should install Math::Prime::Util::GMP and
|
|
|
|
Math::BigInt::GMP. This will be a recurring theme throughout this
|
|
|
|
documentation -- while all bignum operations are supported in pure Perl,
|
|
|
|
most methods will be much slower than the C+GMP alternative.
|
2015-09-20 17:01:41 +00:00
|
|
|
|
|
|
|
The module is thread-safe and allows concurrency between Perl threads while
|
|
|
|
still sharing a prime cache. It is not itself multi-threaded. See the
|
2016-06-24 04:57:02 +00:00
|
|
|
Limitations section if you are using Win32 and threads in your program.
|
|
|
|
Also note that Math::Pari is not thread-safe (and will crash as soon as it
|
|
|
|
is loaded in threads), so if you use Math::BigInt::Pari rather than
|
|
|
|
Math::BigInt::GMP or the default backend, things will go pear-shaped.
|
2015-09-20 17:01:41 +00:00
|
|
|
|
|
|
|
Two scripts are also included and installed by default:
|
|
|
|
|
2016-06-24 04:57:02 +00:00
|
|
|
* primes.pl displays primes between start and end values or expressions, with
|
|
|
|
many options for filtering (e.g. twin, safe, circular, good, lucky, etc.).
|
|
|
|
Use '--help' to see all the options.
|
2015-09-20 17:01:41 +00:00
|
|
|
|
2016-06-24 04:57:02 +00:00
|
|
|
* factor.pl operates similar to the GNU 'factor' program. It supports bigint
|
|
|
|
and expression inputs.
|
2015-09-20 17:01:41 +00:00
|
|
|
|
|
|
|
%prep
|
2024-07-24 20:26:55 +00:00
|
|
|
%autosetup -n %{cpan_name}-%{cpan_version}
|
|
|
|
|
|
|
|
find . -type f ! -path "*/t/*" ! -name "*.pl" ! -path "*/bin/*" ! -path "*/script/*" ! -path "*/scripts/*" ! -name "configure" -print0 | xargs -0 chmod 644
|
2015-09-20 17:01:41 +00:00
|
|
|
|
|
|
|
%build
|
Accepting request 730893 from devel:languages:perl:autoupdate
- updated to 0.73
see /usr/share/doc/packages/perl-Math-Prime-Util/Changes
0.73 2018-11-15
[ADDED]
- inverse_totient(n) the image of euler_phi(n)
[FIXES]
- Try to work around 32-bit platforms in semiprime approximations.
Cannot reproduce on any of my 32-bit test platforms.
- Fix RT 127605, memory use in for... iterators.
0.72 2018-11-08
[ADDED]
- nth_semiprime(n) the nth semiprime
- nth_semiprime_approx(n) fast approximate nth semiprime
- semiprime_count_approx(n) fast approximate semiprime count
- semi_primes as primes but for semiprimes
- forsetproduct {...} \@a,\@b,... Cartesian product of list refs
[FIXES]
- Some platforms are extremely slow for is_pillai. Speed up tests.
- Ensure random_factored_integer factor list is sorted min->max.
- forcomposites didn't check lastfor on every callback.
- Sun's compilers, in a valid interpretation of the code, generated
divide by zero code for pillai testing.
[FUNCTIONALITY AND PERFORMANCE]
- chebyshev_theta and chebyshev_psi redone and uses a table.
Large inputs are significantly faster.
- Convert some FP functions to use quadmath if possible. Without
quadmath there should be no change. With quadmath functions like
LogarithmicIntegral and LambertW will be slower but more accurate.
- semiprime_count for non-trivial inputs uses a segmented sieve and
precalculates primes for larger values so can run 2-3x faster.
- forsemiprimes uses a sieve so large ranges are much faster.
- ranged moebius more efficient for small intervals.
- Thanks to GRAY for his module Set::Product which has clean and
clever XS code, which I used to improve my code.
- forfactored uses multicall. Up to 2x faster.
- forperm, forcomb, forderange uses multicall. 2-3x faster.
- Frobenius-Khashin algorithm changed from 2013 version to 2016/2018.
0.71 2018-08-28
[ADDED]
- forfactored { ... } a,b loop n=a..b setting $_=n, @_=factor(n)
- forsquarefree { ... } a,b as forfactored, but only square-free n
- forsemiprimes { ... } a,b as forcomposites, but only semiprimes
- random_factored_integer(n) random [1..n] w/ array ref of factors
- semiprime_count([lo],hi) counts semiprimes in range
[FIXES]
- Monolithic sieves beyond 30*2^32 (~ 1.2 * 10^11) overflowed.
- is_semiprime was wrong for five small values since 0.69. Fixed.
[FUNCTIONALITY AND PERFORMANCE]
- is_primitive_root much faster (doesn't need to calulate totient,
and faster rejection when n has no primitive root).
- znprimroot and znorder use Montgomery, 1.2x to 2x faster.
- slightly faster sieve_range for native size inputs (use factor_one).
- bin/primes.pl faster for palindromic primes and works for 10^17
[OTHER]
- Added ability to use -DBENCH_SEG for benchmarking sieves using
prime_count and ntheory::_segment_pi without table optimizations.
- Reorg of main factor loop. Should be identical from external view.
- Internal change to is_semiprime and is_catalan_pseudoprime.
0.70 2017-12-02
[FIXES]
- prime_count(a,b) incorrect for a={3..7} and b < 66000000.
First appeared in v0.65 (May 2017).
Reported by Trizen. Fixed.
- Also impacted were nth_ramanujan_prime and _lower/_upper for
small input values.
[FUNCTIONALITY AND PERFORMANCE]
- Some utility functions used prime counts. Unlink for more isolation.
- prime_count_approx uses full precision for bigint or string input.
- LogarithmicIntegral and ExponentialIntegral will try to use
our GMP backend if possible.
- Work around old Math::BigInt::FastCalc (as_int() doesn't work right).
- prime_memfree also calls GMP's memfree function. This will clear the
cached constants (e.g. Pi, Euler).
- Calling srand or csrand will also result in the GMP backend CSPRNG
functions being called. This gives more consistent behavior.
[OTHER]
- Turned off threads testing unless release or extended testing is used.
A few smokers seem to have threads lib that die before we event start.
- Removed all Math::MPFR code and references. The latest GMP backend
has everything we need.
- The MPU_NO_XS and MPU_NO_GMP environment variables are documented.
0.69 2017-11-08
[ADDED]
- is_totient(n) true if euler_phi(x) == n for some x
[FUNCTIONALITY AND PERFORMANCE]
- is_square_free uses abs(n), like Pari and moebius.
- is_primitive_root could be wrong with even n on some platforms.
- euler_phi and moebius with negative range inputs weren't consistent.
- factorialmod given a large n and m where m was a composite with
large square factors was incorrect. Fixed.
- numtoperm will accept negative k values (k is always mod n!)
- Split XS mapping of many primality tests. Makes more sense and
improves performance for some calls.
- Split final test in PP cluster sieve.
- Support some new Math::Prime::Util::GMP functions from 0.47.
- C spigot Pi is 30-60% faster on x86_64 by using 32-bit types.
- Reworked some factoring code.
- Remove ISAAC (Perl and C) since we use ChaCha.
- Each thread allocs a new const array again instead of sharing.
0.68 2017-10-19
[API Changes]
- forcomb with one argument iterates over the power set, so k=0..n
instead of k=n. The previous behavior was undocumented. The new
behavior matches Pari/GP (forsubset) and Perl6 (combinations).
[ADDED]
- factorialmod(n,m) n! mod m calculated efficiently
- is_fundamental(d) true if d a fundamental discriminant
[FUNCTIONALITY AND PERFORMANCE]
- Unknown bigint classes no longer return two values after objectify.
Thanks to Daniel Șuteu for finding this.
- Using lastfor inside a formultiperm works correctly now.
- randperm a little faster for k < n cases, and can handle big n
values without running out of memory as long as k << n.
E.g. 5000 random native ints without dups: @r = randperm(~0,5000);
- forpart with primes pulls min/max values in for a small speedup.
- forderange 10-20% faster.
- hammingweight for bigints 3-8x faster.
- Add Math::GMPq and Math::AnyNum as possible bigint classes. Inputs
of these types will be relied on to stringify correctly, and if this
results in an integer string, to intify correctly. This should give
a large speedup for these types.
- Factoring native integers is 1.2x - 2x faster. This is due to a
number of changes.
- Add Lehman factoring core. Since this is not exported or used by
default, the API for factor_lehman may change.
- All new Montgomery math. Uses mulredc asm from Ben Buhrow.
Faster and smaller. Most primality and factoring code 10% faster.
- Speedup for factoring by running more Pollard-Rho-Brent, revising
SQUFOF, updating HOLF, updating recipe.
0.67 2017-09-23
[ADDED]
- lastfor stops forprimes (etc.) iterations
- is_square(n) returns 1 if n is a perfect square
- is_polygonal(n,k) returns 1 if n is a k-gonal number
[FUNCTIONALITY AND PERFORMANCE]
- shuffle prototype is @ instead of ;@, so matches List::Util.
- On Perl 5.8 and earlier we will call PP instead of trying
direct-to-GMP. Works around a bug in XS trying to turn the
result into an object where 5.8.7 and earlier gets lost.
- We create more const integers, which speeds up common uses of
permutations.
- CSPRNG now stores context per-thread rather than using a single
mutex-protected context. This speeds up anything using random
numbers a fair amount, especially with threaded Perls.
- With the above two optimizations, randperm(144) is 2.5x faster.
- threading test has threaded srand/irand test added back in, showing
context is per-thread. Each thread gets its own sequence and calls
to srand/csrand and using randomness doesn't impact other threads.
OBS-URL: https://build.opensuse.org/request/show/730893
OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-Math-Prime-Util?expand=0&rev=4
2019-09-17 10:10:02 +00:00
|
|
|
perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
|
2024-07-24 20:26:55 +00:00
|
|
|
%make_build
|
2015-09-20 17:01:41 +00:00
|
|
|
|
|
|
|
%check
|
Accepting request 730893 from devel:languages:perl:autoupdate
- updated to 0.73
see /usr/share/doc/packages/perl-Math-Prime-Util/Changes
0.73 2018-11-15
[ADDED]
- inverse_totient(n) the image of euler_phi(n)
[FIXES]
- Try to work around 32-bit platforms in semiprime approximations.
Cannot reproduce on any of my 32-bit test platforms.
- Fix RT 127605, memory use in for... iterators.
0.72 2018-11-08
[ADDED]
- nth_semiprime(n) the nth semiprime
- nth_semiprime_approx(n) fast approximate nth semiprime
- semiprime_count_approx(n) fast approximate semiprime count
- semi_primes as primes but for semiprimes
- forsetproduct {...} \@a,\@b,... Cartesian product of list refs
[FIXES]
- Some platforms are extremely slow for is_pillai. Speed up tests.
- Ensure random_factored_integer factor list is sorted min->max.
- forcomposites didn't check lastfor on every callback.
- Sun's compilers, in a valid interpretation of the code, generated
divide by zero code for pillai testing.
[FUNCTIONALITY AND PERFORMANCE]
- chebyshev_theta and chebyshev_psi redone and uses a table.
Large inputs are significantly faster.
- Convert some FP functions to use quadmath if possible. Without
quadmath there should be no change. With quadmath functions like
LogarithmicIntegral and LambertW will be slower but more accurate.
- semiprime_count for non-trivial inputs uses a segmented sieve and
precalculates primes for larger values so can run 2-3x faster.
- forsemiprimes uses a sieve so large ranges are much faster.
- ranged moebius more efficient for small intervals.
- Thanks to GRAY for his module Set::Product which has clean and
clever XS code, which I used to improve my code.
- forfactored uses multicall. Up to 2x faster.
- forperm, forcomb, forderange uses multicall. 2-3x faster.
- Frobenius-Khashin algorithm changed from 2013 version to 2016/2018.
0.71 2018-08-28
[ADDED]
- forfactored { ... } a,b loop n=a..b setting $_=n, @_=factor(n)
- forsquarefree { ... } a,b as forfactored, but only square-free n
- forsemiprimes { ... } a,b as forcomposites, but only semiprimes
- random_factored_integer(n) random [1..n] w/ array ref of factors
- semiprime_count([lo],hi) counts semiprimes in range
[FIXES]
- Monolithic sieves beyond 30*2^32 (~ 1.2 * 10^11) overflowed.
- is_semiprime was wrong for five small values since 0.69. Fixed.
[FUNCTIONALITY AND PERFORMANCE]
- is_primitive_root much faster (doesn't need to calulate totient,
and faster rejection when n has no primitive root).
- znprimroot and znorder use Montgomery, 1.2x to 2x faster.
- slightly faster sieve_range for native size inputs (use factor_one).
- bin/primes.pl faster for palindromic primes and works for 10^17
[OTHER]
- Added ability to use -DBENCH_SEG for benchmarking sieves using
prime_count and ntheory::_segment_pi without table optimizations.
- Reorg of main factor loop. Should be identical from external view.
- Internal change to is_semiprime and is_catalan_pseudoprime.
0.70 2017-12-02
[FIXES]
- prime_count(a,b) incorrect for a={3..7} and b < 66000000.
First appeared in v0.65 (May 2017).
Reported by Trizen. Fixed.
- Also impacted were nth_ramanujan_prime and _lower/_upper for
small input values.
[FUNCTIONALITY AND PERFORMANCE]
- Some utility functions used prime counts. Unlink for more isolation.
- prime_count_approx uses full precision for bigint or string input.
- LogarithmicIntegral and ExponentialIntegral will try to use
our GMP backend if possible.
- Work around old Math::BigInt::FastCalc (as_int() doesn't work right).
- prime_memfree also calls GMP's memfree function. This will clear the
cached constants (e.g. Pi, Euler).
- Calling srand or csrand will also result in the GMP backend CSPRNG
functions being called. This gives more consistent behavior.
[OTHER]
- Turned off threads testing unless release or extended testing is used.
A few smokers seem to have threads lib that die before we event start.
- Removed all Math::MPFR code and references. The latest GMP backend
has everything we need.
- The MPU_NO_XS and MPU_NO_GMP environment variables are documented.
0.69 2017-11-08
[ADDED]
- is_totient(n) true if euler_phi(x) == n for some x
[FUNCTIONALITY AND PERFORMANCE]
- is_square_free uses abs(n), like Pari and moebius.
- is_primitive_root could be wrong with even n on some platforms.
- euler_phi and moebius with negative range inputs weren't consistent.
- factorialmod given a large n and m where m was a composite with
large square factors was incorrect. Fixed.
- numtoperm will accept negative k values (k is always mod n!)
- Split XS mapping of many primality tests. Makes more sense and
improves performance for some calls.
- Split final test in PP cluster sieve.
- Support some new Math::Prime::Util::GMP functions from 0.47.
- C spigot Pi is 30-60% faster on x86_64 by using 32-bit types.
- Reworked some factoring code.
- Remove ISAAC (Perl and C) since we use ChaCha.
- Each thread allocs a new const array again instead of sharing.
0.68 2017-10-19
[API Changes]
- forcomb with one argument iterates over the power set, so k=0..n
instead of k=n. The previous behavior was undocumented. The new
behavior matches Pari/GP (forsubset) and Perl6 (combinations).
[ADDED]
- factorialmod(n,m) n! mod m calculated efficiently
- is_fundamental(d) true if d a fundamental discriminant
[FUNCTIONALITY AND PERFORMANCE]
- Unknown bigint classes no longer return two values after objectify.
Thanks to Daniel Șuteu for finding this.
- Using lastfor inside a formultiperm works correctly now.
- randperm a little faster for k < n cases, and can handle big n
values without running out of memory as long as k << n.
E.g. 5000 random native ints without dups: @r = randperm(~0,5000);
- forpart with primes pulls min/max values in for a small speedup.
- forderange 10-20% faster.
- hammingweight for bigints 3-8x faster.
- Add Math::GMPq and Math::AnyNum as possible bigint classes. Inputs
of these types will be relied on to stringify correctly, and if this
results in an integer string, to intify correctly. This should give
a large speedup for these types.
- Factoring native integers is 1.2x - 2x faster. This is due to a
number of changes.
- Add Lehman factoring core. Since this is not exported or used by
default, the API for factor_lehman may change.
- All new Montgomery math. Uses mulredc asm from Ben Buhrow.
Faster and smaller. Most primality and factoring code 10% faster.
- Speedup for factoring by running more Pollard-Rho-Brent, revising
SQUFOF, updating HOLF, updating recipe.
0.67 2017-09-23
[ADDED]
- lastfor stops forprimes (etc.) iterations
- is_square(n) returns 1 if n is a perfect square
- is_polygonal(n,k) returns 1 if n is a k-gonal number
[FUNCTIONALITY AND PERFORMANCE]
- shuffle prototype is @ instead of ;@, so matches List::Util.
- On Perl 5.8 and earlier we will call PP instead of trying
direct-to-GMP. Works around a bug in XS trying to turn the
result into an object where 5.8.7 and earlier gets lost.
- We create more const integers, which speeds up common uses of
permutations.
- CSPRNG now stores context per-thread rather than using a single
mutex-protected context. This speeds up anything using random
numbers a fair amount, especially with threaded Perls.
- With the above two optimizations, randperm(144) is 2.5x faster.
- threading test has threaded srand/irand test added back in, showing
context is per-thread. Each thread gets its own sequence and calls
to srand/csrand and using randomness doesn't impact other threads.
OBS-URL: https://build.opensuse.org/request/show/730893
OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-Math-Prime-Util?expand=0&rev=4
2019-09-17 10:10:02 +00:00
|
|
|
make test
|
2015-09-20 17:01:41 +00:00
|
|
|
|
|
|
|
%install
|
|
|
|
%perl_make_install
|
|
|
|
%perl_process_packlist
|
|
|
|
%perl_gen_filelist
|
|
|
|
|
|
|
|
%files -f %{name}.files
|
2017-09-17 17:49:33 +00:00
|
|
|
%doc Changes examples README TODO
|
|
|
|
%license LICENSE
|
2015-09-20 17:01:41 +00:00
|
|
|
|
|
|
|
%changelog
|