online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <vector> bool gaussianElimination_binary(std::vector<std::vector<int>> &A) { std::vector<std::vector<int>> B = A; std::size_t max_col = B[0].size() - 1; //cols std::size_t max_row = B.size() -1 ; //rows std::size_t col_pivot = 0; //perform "gaussian" elimination for (std::size_t row = 0; row <= max_row; ++row) //for every column { if (col_pivot > max_col) break; // Search for first row having "1" in column "lead" std::size_t i = row; //Start searching from row "i"=row while (B[i][col_pivot] == 0) { ++i; if (i > max_row) // no "1" was found across rows { i = row; // set "i" back to "row" ++col_pivot; // move to next column if (col_pivot > max_col) //if no more columns break; } } // swap "i" and "row" rows if ((0 <= i) && (i <= max_row) && (0 <= row) && (row <= max_row)) { for (std::size_t col = 0; col <= max_col; ++col) { std::swap(B[i][col], B[row][col]); } } // perform XOR in "k-th" row against "row-th" row for (int k = 0; k <= max_row; ++k) //k=col_pivot? { if ( (k != row) ) // && (B[k][row] != 0) //Apply only to "1"s { int check_zero_row = 0; for (std::size_t j = 0; j <= max_col; j++) { B[k][j] = B[k][j] ^ B[row][j]; //XOR: Use "1" to set other "1" rows to 0 (and 0 to 1) check_zero_row = check_zero_row | B[k][j]; //OR: Result will be "0" only if the entire row is "0" } if (check_zero_row == 0 ) { return false; } } } } return true; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue