code: public static boolean isInverse(DMatrixRMaj a , DMatrixRMaj b , double tol ) {
          if( a.numRows != b.numRows || a.numCols != b.numCols ) {
              return false;
          }
  
          int numRows = a.numRows;
          int numCols = a.numCols;
  
          for( int i = 0; i < numRows; i++ ) {
              for( int j = 0; j < numCols; j++ ) {
                  double total = 0;
                  for( int k = 0; k < numCols; k++ ) {
                      total += a.get(i,k)*b.get(k,j);
                  }
  
                  if( i == j ) {
                      if( !(Math.abs(total-1) <= tol) )
                          return false;
                  } else if( !(Math.abs(total) <= tol) )
                      return false;
              }
          }
  
          return true;
      }
docs: Checks to see if the two matrices are inverses of each other.
  
  @param a A matrix. Not modified.
  @param b A matrix. Not modified.