code: public static boolean sameDimensions(Matrix A, Matrix B)
      {
          return A.rows() == B.rows() && A.cols() == B.cols();
      }
docs: Convenience method that will return {@code true} only if the two input
  matrices have the exact same dimensions.
  @param A the first matrix
  @param B the second matrix
  @return {@code true} if they have the exact same dimensions,
  {@code false} otherwise.