public static int process(double[][] matrix, int n, double toler) {
		double temp;
		int i, j, k;
		double eps, pivot;
		int rank;
		int nonneg;

		nonneg = 1;
		eps = 0;
		for (i = 0; i < n; i++) {
			if (matrix[i][i] > eps) {
				eps = matrix[i][i];
			}
			for (j = (i + 1); j < n; j++) {
				matrix[j][i] = matrix[i][j];
			}
		}
		eps *= toler;

		rank = 0;
		for (i = 0; i < n; i++) {
			pivot = matrix[i][i];
			if (pivot < eps) {
				matrix[i][i] = 0;
				if (pivot < -8 * eps) {
					nonneg = -1;
				}
			} else {
				rank++;
				for (j = (i + 1); j < n; j++) {
					temp = matrix[j][i] / pivot;
					matrix[j][i] = temp;
					matrix[j][j] -= temp * temp * pivot;
					for (k = (j + 1); k < n; k++) {
						matrix[k][j] -= temp * matrix[k][i];
					}
				}
			}
		}
		return (rank * nonneg);
	}
public static int process ( double [ ] [ ] matrix , int n , double toler ) { double temp ; int i , j , k ; double eps , pivot ; int rank ; int nonneg ; nonneg = 1 ; eps = 0 ; for ( i = 0 ; i < n ; i ++ ) { if ( matrix [ i ] [ i ] > eps ) { eps = matrix [ i ] [ i ] ; } for ( j = ( i + 1 ) ; j < n ; j ++ ) { matrix [ j ] [ i ] = matrix [ i ] [ j ] ; } } eps *= toler ; rank = 0 ; for ( i = 0 ; i < n ; i ++ ) { pivot = matrix [ i ] [ i ] ; if ( pivot < eps ) { matrix [ i ] [ i ] = 0 ; if ( pivot < - 8 * eps ) { nonneg = - 1 ; } } else { rank ++ ; for ( j = ( i + 1 ) ; j < n ; j ++ ) { temp = matrix [ j ] [ i ] / pivot ; matrix [ j ] [ i ] = temp ; matrix [ j ] [ j ] -= temp * temp * pivot ; for ( k = ( j + 1 ) ; k < n ; k ++ ) { matrix [ k ] [ j ] -= temp * matrix [ k ] [ i ] ; } } } } return ( rank * nonneg ) ; }
@param matrix
@param n
@param toler
@return