public static boolean isSymmetric(Matrix A,double eps){
  if (!A.isSquare())   return false;
  for (int i=0; i < A.rows(); i++)   for (int j=i + 1; j < A.cols(); j++)   if (Math.abs(A.get(i,j) - A.get(j,i)) > eps)   return false;
  return true;
}

public static boolean isSymmetric ( Matrix A , double eps ) { if ( ! A . isSquare ( ) ) return false ; for ( int i = 0 ; i < A . rows ( ) ; i ++ ) for ( int j = i + 1 ; j < A . cols ( ) ; j ++ ) if ( Math . abs ( A . get ( i , j ) - A . get ( j , i ) ) > eps ) return false ; return true ; }
checks to see if the given input is approximately symmetric . rounding errors may cause the computation of a matrix to come out non symmetric , where | a [ i , h ] - a [ j , i ] | & lt ; eps . despite these errors , it may be preferred to treat the matrix as perfectly symmetric regardless .
