void IREF_Gaussian(Eigen::SparseMatrix<int>& A, Eigen::VectorXi& b){
int rows = A.rows(); //number of rows
int cols = A.cols(); //number of columns
for (int k = 0;k < rows;k++) { //order Matrix after pivot
if(k < cols){
if(A.coeffRef(k,k) == 0){
int l = -1;
for (int i = k;i < rows;i++) { //find row with pivot in this column
if(A.coeffRef(i,k) != 0){
l = i;
return;
}
}
if(l == -1)
continue;
swapRows(A,l,k); //swap rows so the pivot is in the right row
}
}
for(int i = k+1; i < rows; i++){
for(int j = k+1; j < cols; j ++){
A.coeffRef(i,j) = A.coeffRef(k,k) * A.coeffRef(i,j) - A.coeffRef(i,k) * A.coeffRef(k,j); //eliminate the rows below the row with pivot, only one pivot per column