public static void assertDiagonallyDominant(IDoubleMatrix mat){
  assertSquare(mat);
  for (int i=0; i < mat.getRowNum(); ++i) {
    final double d=mat.get(i,i);
    if (Double.isNaN(d)) {
      continue;
    }
    for (int j=0; j < mat.getRowNum(); ++j) {
      double v;
      v=mat.get(i,j);
      if (!Double.isNaN(v) && v > d) {
        final String msg=String.format("Matrix is not diagonally dominant: (%d,%d)=%f (%d,%d)=%f diff=%f",i,j,v,i,i,d,d - v);
        throw new AdeCoreIllegalArgumentException(msg);
      }
      v=mat.get(j,i);
      if (!Double.isNaN(v) && v > d) {
        final String msg=String.format("Matrix is nSot diagonally dominant: (%d,%d)=%f (%d,%d)=%f",j,i,v,i,i,d);
        throw new AdeCoreIllegalArgumentException(msg);
      }
    }
  }
}

public static void assertDiagonallyDominant ( IDoubleMatrix mat ) { assertSquare ( mat ) ; for ( int i = 0 ; i < mat . getRowNum ( ) ; ++ i ) { final double d = mat . get ( i , i ) ; if ( Double . isNaN ( d ) ) { continue ; } for ( int j = 0 ; j < mat . getRowNum ( ) ; ++ j ) { double v ; v = mat . get ( i , j ) ; if ( ! Double . isNaN ( v ) && v > d ) { final String msg = String . format ( "Matrix is not diagonally dominant: (%d,%d)=%f (%d,%d)=%f diff=%f" , i , j , v , i , i , d , d - v ) ; throw new AdeCoreIllegalArgumentException ( msg ) ; } v = mat . get ( j , i ) ; if ( ! Double . isNaN ( v ) && v > d ) { final String msg = String . format ( "Matrix is nSot diagonally dominant: (%d,%d)=%f (%d,%d)=%f" , j , i , v , i , i , d ) ; throw new AdeCoreIllegalArgumentException ( msg ) ; } } } }
throws an exception if matrix is not diagonally dominant
