Selaa lähdekoodia

is symmetric is not defined for empty input

Former-commit-id: 3630f8e794e9a15f9e0d40f7d927f099b82b0046
Alec Jacobson 11 vuotta sitten
vanhempi
commit
a6c7612f3f
1 muutettua tiedostoa jossa 3 lisäystä ja 0 poistoa
  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;
     return false;
   }
   }
+  assert(A.size() != 0);
   Eigen::SparseMatrix<T> AT = A.transpose();
   Eigen::SparseMatrix<T> AT = A.transpose();
   Eigen::SparseMatrix<T> AmAT = A-AT;
   Eigen::SparseMatrix<T> AmAT = A-AT;
   //// Eigen screws up something with LLT if you try to do
   //// Eigen screws up something with LLT if you try to do
@@ -32,6 +33,7 @@ IGL_INLINE bool igl::is_symmetric(
   {
   {
     return false;
     return false;
   }
   }
+  assert(A.size() != 0);
   const typename Eigen::PlainObjectBase<DerivedA>& AT = A.transpose();
   const typename Eigen::PlainObjectBase<DerivedA>& AT = A.transpose();
   const typename Eigen::PlainObjectBase<DerivedA>& AmAT = A-AT;
   const typename Eigen::PlainObjectBase<DerivedA>& AmAT = A-AT;
   //// Eigen screws up something with LLT if you try to do
   //// Eigen screws up something with LLT if you try to do
@@ -52,6 +54,7 @@ IGL_INLINE bool igl::is_symmetric(
   {
   {
     return false;
     return false;
   }
   }
+  assert(A.size() != 0);
   SparseMatrix<AType> AT = A.transpose();
   SparseMatrix<AType> AT = A.transpose();
   SparseMatrix<AType> AmAT = A-AT;
   SparseMatrix<AType> AmAT = A-AT;
   VectorXi AmATI,AmATJ;
   VectorXi AmATI,AmATJ;