}
//求arr5AA的逆矩
public static double[,] nijuzhen(double[,] a) {
double[,] B = new double[6, 6]; int i, j, k; int row = 0; int col = 0; double max, temp; int[] p = new int[6]; for (i = 0; i < 6; i++) {
p[i] = i; B[i, i] = 1; }
for (k = 0; k < 6; k++) {
//找主元
max = 0; row = col = i; for (i = k; i < 6; i++) {
for (j = k; j < 6; j++) {
temp = Math.Abs(a[i, j]); if (max < temp) {
max = temp; row = i; col = j; } } }
//交换行列,将主元调整到k行k列上 if (row != k) {
for (j = 0; j < 6; j++) {
temp = a[row, j]; a[row, j] = a[k, j]; a[k, j] = temp; temp = B[row, j]; B[row, j] = B[k, j]; B[k, j] = temp;