[mathicgb] 135/393: Fixed bug in F4 matrix reduction.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Fri Apr 3 15:58:49 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch upstream
in repository mathicgb.
commit c850f4deb65079b131d179ffd0c6a9266b564b71
Author: Bjarke Hammersholt Roune <bjarkehr.code at gmail.com>
Date: Fri Jan 11 18:37:27 2013 +0100
Fixed bug in F4 matrix reduction.
---
src/mathicgb/F4MatrixReducer.cpp | 38 ++++++++++++++++++++++++++++++++++++--
1 file changed, 36 insertions(+), 2 deletions(-)
diff --git a/src/mathicgb/F4MatrixReducer.cpp b/src/mathicgb/F4MatrixReducer.cpp
index 243fd51..730d1aa 100644
--- a/src/mathicgb/F4MatrixReducer.cpp
+++ b/src/mathicgb/F4MatrixReducer.cpp
@@ -212,6 +212,11 @@ namespace {
MATHICGB_ASSERT(rowThatReducesCol[col] == pivotCount);
rowThatReducesCol[col] = pivot;
}
+#ifdef MATHICGB_DEBUG
+ for (SparseMatrix::ColIndex col = 0; col < pivotCount; ++col) {
+ MATHICGB_ASSERT(rowThatReducesCol[col] < pivotCount);
+ }
+#endif
SparseMatrix reduced(qm.topRight.memoryQuantum());
@@ -316,7 +321,7 @@ namespace {
{
const size_t row = it;
if (toReduce.emptyRow(row))
- return;
+ continue;
dense[row].clear(colCount);
dense[row].addRow(toReduce, row);
}});
@@ -353,7 +358,7 @@ namespace {
MATHICGB_ASSERT(leadCols[row] <= colCount);
DenseRow& denseRow = dense[row];
if (denseRow.empty())
- return;
+ continue;
// reduce by each row of reduced.
for (size_t reducerRow = 0; reducerRow < reducerCount; ++reducerRow) {
@@ -420,6 +425,35 @@ namespace {
dense[row].takeModulus(modulus);
}});
+#ifdef MATHICGB_DEBUG
+ std::vector<char> sawPivot(colCount);
+ for (SparseMatrix::RowIndex row = 0; row < rowCount; ++row) {
+ if (dense[row].empty()) {
+ MATHICGB_ASSERT(!isPivotRow[row]);
+ MATHICGB_ASSERT(leadCols[row] == colCount);
+ } else {
+ MATHICGB_ASSERT(isPivotRow[row]);
+
+ const auto leadCol = leadCols[row];
+ MATHICGB_ASSERT(leadCol < colCount);
+ MATHICGB_ASSERT(columnHasPivot[leadCol]);
+ MATHICGB_ASSERT(dense[row][leadCol] == 1);
+ MATHICGB_ASSERT(!sawPivot[leadCol]);
+ sawPivot[leadCol] = true;
+ for (size_t col = 0; col < colCount; ++col) {
+ const auto scalar = dense[row][col];
+ if (col < leadCol) {
+ MATHICGB_ASSERT(scalar == 0);
+ } else if (col == leadCol) {
+ MATHICGB_ASSERT(scalar == 1);
+ } else {
+ MATHICGB_ASSERT(scalar == 0 || !columnHasPivot[col]);
+ }
+ }
+ }
+ }
+#endif
+
reduced.clear();
for (size_t row = 0; row < rowCount; ++row)
if (!dense[row].empty())
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mathicgb.git
More information about the debian-science-commits
mailing list