Browse Source

is symmetric is not defined for empty input

Former-commit-id: 3630f8e794e9a15f9e0d40f7d927f099b82b0046
Alec Jacobson 11 năm trước cách đây
mục cha
commit
a6c7612f3f
1 tập tin đã thay đổi với 3 bổ sung0 xóa
  1. 3 0
      include/igl/is_symmetric.cpp

+ 3 - 0
include/igl/is_symmetric.cpp

@@ -15,6 +15,7 @@ IGL_INLINE bool igl::is_symmetric(const Eigen::SparseMatrix<T>& A)
   {
     return false;
   }
+  assert(A.size() != 0);
   Eigen::SparseMatrix<T> AT = A.transpose();
   Eigen::SparseMatrix<T> AmAT = A-AT;
   //// Eigen screws up something with LLT if you try to do
@@ -32,6 +33,7 @@ IGL_INLINE bool igl::is_symmetric(
   {
     return false;
   }
+  assert(A.size() != 0);
   const typename Eigen::PlainObjectBase<DerivedA>& AT = A.transpose();
   const typename Eigen::PlainObjectBase<DerivedA>& AmAT = A-AT;
   //// Eigen screws up something with LLT if you try to do
@@ -52,6 +54,7 @@ IGL_INLINE bool igl::is_symmetric(
   {
     return false;
   }
+  assert(A.size() != 0);
   SparseMatrix<AType> AT = A.transpose();
   SparseMatrix<AType> AmAT = A-AT;
   VectorXi AmATI,AmATJ;