Skip to content

Commit

Permalink
A small improvement.
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuDutSik committed Dec 24, 2023
1 parent b201fcf commit 0aeb11a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src_matrix/MAT_Matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -1971,13 +1971,15 @@ MyMatrix<T> ExpressVectorsInIndependentFamilt(MyMatrix<T> const &VF,
template <typename T> MyMatrix<T> SelectNonZeroRows(MyMatrix<T> const &EXT) {
int nbRow = EXT.rows();
int nbCol = EXT.cols();
auto IsLineZero=[&](int const& iLine) -> bool {
for (int iCol = 0; iCol < nbCol; iCol++)
if (EXT(iLine, iCol) != 0)
return false;
return true;
};
std::vector<int> ListIdx;
for (int iRow = 0; iRow < nbRow; iRow++) {
bool IsZero = true;
for (int iCol = 0; iCol < nbCol; iCol++)
if (EXT(iRow, iCol) != 0)
IsZero = false;
if (!IsZero)
if (!IsLineZero(iRow))
ListIdx.push_back(iRow);
}
return SelectRow(EXT, ListIdx);
Expand Down

0 comments on commit 0aeb11a

Please sign in to comment.