From 6f957e4f44c7f5c5ad6b2e534920d12ac34a8722 Mon Sep 17 00:00:00 2001 From: danieljankowski <daniel.jankowski@rub.de> Date: Wed, 3 Apr 2019 09:21:31 +0200 Subject: [PATCH] Fixed: use start row correctly in guassian with linear check --- gaussian.go | 6 +++--- resolver/lineardependency.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gaussian.go b/gaussian.go index caf9c43..63bc152 100644 --- a/gaussian.go +++ b/gaussian.go @@ -109,7 +109,7 @@ func (f *F2) partialDiagonalize(startRow, startCol, stopRow, stopCol int) { // choose each row from the top row to the one with the pivot bit for rowCounter := startRow; rowCounter < stopRow; rowCounter++ { // prevent xor with the row itself - if rowCounter == pivotBit-startCol { + if rowCounter == startRow+pivotBit-startCol { continue } @@ -154,9 +154,9 @@ func (f *F2) PartialGaussianWithLinearChecking( } // if the row with a valid pivot bit is not the first row... - if pivotBit-startCol != rowCounter { + if startRow+pivotBit-startCol != rowCounter { // ...swap it with first one - f.SwapRows(pivotBit-startCol, rowCounter) + f.SwapRows(startRow+pivotBit-startCol, rowCounter) } // iterate through all other rows except the first one diff --git a/resolver/lineardependency.go b/resolver/lineardependency.go index cdb9658..d67b78a 100644 --- a/resolver/lineardependency.go +++ b/resolver/lineardependency.go @@ -45,8 +45,8 @@ func LinearDependenciesInGauss( } // remove the 1 with a xor operation with the relating row - f.Rows[pivotBit-startCol].Xor( - f.Rows[pivotBit-startCol], + f.Rows[startRow+pivotBit-startCol].Xor( + f.Rows[startRow+pivotBit-startCol], f.Rows[startRow+i-startCol], ) } -- GitLab