hello
I am doing some problem which include part of finding greatest matching and perfect matching in graph. I found that it is easy to implement it by tutte's matrix. I read algorithm here.
for (int i=0;i<n;++i) {
int k = i;
for (int j=i+1;j<n;++j)
if (abs(a[j][i])>abs(a[k][i]))
k=j;//find row number in which current column has maximum value
if (abs(a[k][i])<EPS) {
det = 0;
break;
}``
for(int s=i;s<m;s++){
double tmp=a[i][s];
a[i][s]=a[k][s];
a[k][s]=tmp;
}//swap current row with the maximum value row found
if(i!=k)
det =-det;//if row swapped then determinant would be multiplied by (-1)
det*= a[i][i];
for (int j=i+1;j<n;++j)
a[i][j]/= a[i][i]; //divide the row by a[i][i] where colun number is greater then i
for (int j=0;j<n;++j)
if (j!=i&&abs(a[j][i])>EPS)
for (int k=i+1;k<n;++k)
a[j][k]-= a[i][k]*a[j][i];
}
but i am unable to understand the last two loops of algorithm what actually they are doing.and i also printed the matrix after each operation and at the end i am not getting upper triangular matrix but determinant calculated is always right.