矩阵的秩
typedef int Matrix[maxn][maxn]; int rank(Matrix A, int m, int n) { int i = 0, j = 0, k, r, u; while(i < m && j < n) { r = i; for(k = i; k < m; k++) if(A[k][j]) { r = k; break; } if(A[r][j]) { if(r != i) for(k = 0; k <= n; k++) swap(A[r][k], A[i][k]); for(u = i+1; u < m; u++) if(A[u][j]) for(k = i; k <= n; k++) A[u][k] ^= A[i][k]; i++; } j++; } return i; }
原文:http://blog.csdn.net/u011686226/article/details/31755729