FindAFactor 3.6.1__tar.gz → 3.6.2__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -738,6 +738,7 @@ struct Factorizer {
738
738
  BigInteger batchNumber;
739
739
  BigInteger batchOffset;
740
740
  BigInteger batchTotal;
741
+ BigInteger wheelRadius;
741
742
  size_t wheelEntryCount;
742
743
  size_t smoothPartsLimit;
743
744
  size_t rowOffset;
@@ -751,10 +752,11 @@ struct Factorizer {
751
752
  Factorizer(const BigInteger &tfsqr, const BigInteger &tf, const BigInteger &tfsqrt, const BigInteger &range, size_t nodeCount, size_t nodeId, size_t w, size_t spl,
752
753
  const std::vector<BigInteger> &p, ForwardFn fn)
753
754
  : rng({}), gen(rng()), dis(0U, p.size() - 1U), toFactorSqr(tfsqr), toFactor(tf), toFactorSqrt(tfsqrt), batchRange(range), batchNumber(0U), batchOffset(nodeId * range), batchTotal(nodeCount * range),
754
- wheelEntryCount(w), smoothPartsLimit(spl), rowOffset(p.size()), isIncomplete(true), primes(p), forwardFn(fn)
755
+ wheelRadius(1U), wheelEntryCount(w), smoothPartsLimit(spl), rowOffset(p.size()), isIncomplete(true), primes(p), forwardFn(fn)
755
756
  {
756
757
  for (size_t i = 0U; i < primes.size(); ++i) {
757
758
  const BigInteger& p = primes[i];
759
+ wheelRadius *= p;
758
760
  sqrPrimes.push_back(p * p);
759
761
  smoothNumberKeys.push_back(p);
760
762
  smoothNumberValues.emplace_back(primes.size(), false);
@@ -827,18 +829,23 @@ struct Factorizer {
827
829
  // Compute the prime factorization modulo 2
828
830
  boost::dynamic_bitset<size_t> factorizationVector(BigInteger num) {
829
831
  boost::dynamic_bitset<size_t> vec(primes.size(), false);
830
- for (size_t i = 0U; i < primes.size(); ++i) {
831
- bool count = false;
832
- const BigInteger &p = primes[i];
833
- while (!(num % p)) {
834
- num /= p;
835
- count = !count;
832
+ BigInteger factor = 1U;
833
+ do {
834
+ factor = gcd(num, wheelRadius);
835
+ if (factor == 1U) {
836
+ break;
837
+ }
838
+ num /= factor;
839
+ for (size_t pi = 0U; pi < primes.size(); ++pi) {
840
+ if (!(factor % primes[pi])) {
841
+ vec[pi] = !vec[pi];
842
+ }
836
843
  }
837
- vec[i] = count;
838
844
  if (num == 1U) {
839
845
  break;
840
846
  }
841
- }
847
+ } while (factor != 1U);
848
+
842
849
  if (num != 1U) {
843
850
  return boost::dynamic_bitset<size_t>();
844
851
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: FindAFactor
3
- Version: 3.6.1
3
+ Version: 3.6.2
4
4
  Summary: Find any nontrivial factor of a number
5
5
  Home-page: https://github.com/vm6502q/FindAFactor
6
6
  Author: Dan Strano
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: FindAFactor
3
- Version: 3.6.1
3
+ Version: 3.6.2
4
4
  Summary: Find any nontrivial factor of a number
5
5
  Home-page: https://github.com/vm6502q/FindAFactor
6
6
  Author: Dan Strano
@@ -7,7 +7,7 @@ except ImportError:
7
7
  import setuptools
8
8
  from distutils.core import setup, Extension
9
9
 
10
- cpp_args = ['-std=c++17', '-lpthread']
10
+ cpp_args = ['-std=c++17', '-lpthread', '-O3']
11
11
 
12
12
  README_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'README.md')
13
13
  with open(README_PATH) as readme_file:
@@ -26,7 +26,7 @@ ext_modules = [
26
26
 
27
27
  setup(
28
28
  name='FindAFactor',
29
- version='3.6.1',
29
+ version='3.6.2',
30
30
  author='Dan Strano',
31
31
  author_email='dan@unitary.fund',
32
32
  description='Find any nontrivial factor of a number',
File without changes
File without changes
File without changes