FindAFactor 3.6.6__tar.gz → 3.6.7__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -682,7 +682,7 @@ bool isMultiple(const BigInteger &p, const std::vector<size_t> &knownPrimes) {
682
682
 
683
683
  boost::dynamic_bitset<size_t> wheel_inc(std::vector<size_t> primes) {
684
684
  BigInteger radius = 1U;
685
- for (const BigInteger &i : primes) {
685
+ for (const size_t &i : primes) {
686
686
  radius *= i;
687
687
  }
688
688
  const size_t prime = primes.back();
@@ -1231,8 +1231,6 @@ std::string find_a_factor(const std::string &toFactorStr, const bool &isConOfSqr
1231
1231
 
1232
1232
  // Range per parallel node
1233
1233
  const BigInteger nodeRange = (((backward(SMALLEST_WHEEL)(fullMaxBase) + nodeCount - 1U) / nodeCount) + wheelEntryCount - 1U) / wheelEntryCount;
1234
- // This is used by all threads:
1235
- std::vector<std::vector<BigInteger>> semiSmoothParts(CpuCount);
1236
1234
  // This manages the work of all threads.
1237
1235
  Factorizer worker(toFactor * toFactor, toFactor, fullMaxBase,
1238
1236
  nodeRange, nodeCount, nodeId,
@@ -1269,7 +1267,7 @@ std::string find_a_factor(const std::string &toFactorStr, const bool &isConOfSqr
1269
1267
  return boost::lexical_cast<std::string>(result);
1270
1268
  }
1271
1269
 
1272
- const auto smoothNumberFn = [&inc_seqs, &wheelEntryCount, &semiSmoothParts, &worker, &isGaussElim] (unsigned cpu) {
1270
+ const auto smoothNumberFn = [&inc_seqs, &wheelEntryCount, &batchSizeMultiplier, &worker, &isGaussElim] {
1273
1271
  // inc_seq needs to be independent per thread.
1274
1272
  std::vector<boost::dynamic_bitset<size_t>> inc_seqs_clone;
1275
1273
  inc_seqs_clone.reserve(inc_seqs.size());
@@ -1278,10 +1276,11 @@ std::string find_a_factor(const std::string &toFactorStr, const bool &isConOfSqr
1278
1276
  }
1279
1277
 
1280
1278
  // Different collections per thread;
1281
- semiSmoothParts.reserve(wheelEntryCount << 1U);
1279
+ std::vector<BigInteger> semiSmoothParts;
1280
+ semiSmoothParts.reserve((size_t)((wheelEntryCount << 1U) * batchSizeMultiplier));
1282
1281
 
1283
1282
  // While brute-forcing, use the "exhaust" to feed "smooth" number generation and check conguence of squares.
1284
- return worker.smoothCongruences(&inc_seqs_clone, &(semiSmoothParts[cpu]), isGaussElim);
1283
+ return worker.smoothCongruences(&inc_seqs_clone, &semiSmoothParts, isGaussElim);
1285
1284
  };
1286
1285
 
1287
1286
  std::vector<std::future<BigInteger>> futures;
@@ -1289,7 +1288,7 @@ std::string find_a_factor(const std::string &toFactorStr, const bool &isConOfSqr
1289
1288
 
1290
1289
  do {
1291
1290
  for (unsigned cpu = 0U; cpu < CpuCount; ++cpu) {
1292
- futures.push_back(std::async(std::launch::async, smoothNumberFn, cpu));
1291
+ futures.push_back(std::async(std::launch::async, smoothNumberFn));
1293
1292
  }
1294
1293
 
1295
1294
  for (unsigned cpu = 0U; cpu < futures.size(); ++cpu) {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: FindAFactor
3
- Version: 3.6.6
3
+ Version: 3.6.7
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.6
3
+ Version: 3.6.7
4
4
  Summary: Find any nontrivial factor of a number
5
5
  Home-page: https://github.com/vm6502q/FindAFactor
6
6
  Author: Dan Strano
@@ -26,7 +26,7 @@ ext_modules = [
26
26
 
27
27
  setup(
28
28
  name='FindAFactor',
29
- version='3.6.6',
29
+ version='3.6.7',
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