Skip to content

Commit 0852e41

Browse files
Fix gauss. elim.
1 parent f4230df commit 0852e41

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

FindAFactor/_find_a_factor.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ struct Factorizer {
887887
auto mColIt = smoothNumberValues.begin();
888888
auto nColIt = smoothNumberKeys.begin();
889889
const size_t rows = smoothNumberValues.size();
890-
GaussianEliminationResult result(primes.size());
890+
GaussianEliminationResult result(rows);
891891

892892
for (size_t col = 0U; col < primes.size(); ++col) {
893893
auto mRowIt = mColIt;
@@ -896,6 +896,8 @@ struct Factorizer {
896896

897897
// Look for a pivot row in this column
898898
for (size_t row = colPlus1; row < rows; ++row) {
899+
++mRowIt;
900+
++nRowIt;
899901
if ((*mRowIt)[col]) {
900902
// Swapping matrix rows corresponds
901903
// with swapping factorized numbers.
@@ -905,8 +907,6 @@ struct Factorizer {
905907
result.marks[col] = true;
906908
break;
907909
}
908-
++mRowIt;
909-
++nRowIt;
910910
}
911911

912912
if (result.marks[col]) {
@@ -954,7 +954,7 @@ struct Factorizer {
954954
}
955955

956956
// Step 2: Identify free rows
957-
for (size_t i = 0U; i < primes.size(); i++) {
957+
for (size_t i = 0U; i < rows; i++) {
958958
if (result.marks[i]) {
959959
continue;
960960
}

0 commit comments

Comments
 (0)