Hi, everyone. I need to find matrix n*n (or 5*5) determinant. I have a function translated from Pascal, but there's INDEX OUT OF RANGE EXCEPTION. Could somebody help me?
Here's my code:
public static double DET(double[,] a, int n)
{
int i, j, k;
double det = 0;
for (i = 0; i < n - 1; i++)
{
for (j = i + 1; j < n + 1; j++)
{
det = a[j, i] / a[i, i];
for (k = i; k < n; j++)
a[j, k] = a[j, k] - det * a[i, k]; // Here's exception
}
}
det = 1;
for (i = 0; i < n; i++)
det = det * a[i, i];
return det;
}
Thanx for any help.