浏览代码

bug fix in eigs; orthogonality check was totally wrong

Former-commit-id: 95f704df80d211ad6bdac9e1964e6f96ef62b4de
Alec Jacobson 8 年之前
父节点
当前提交
617ca88591
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5 3
      include/igl/eigs.cpp

+ 5 - 3
include/igl/eigs.cpp

@@ -137,7 +137,7 @@ IGL_INLINE bool igl::eigs(
     if(
     if(
       i==0 || 
       i==0 || 
       (S.head(i).array()-sigma).abs().maxCoeff()>1e-14 ||
       (S.head(i).array()-sigma).abs().maxCoeff()>1e-14 ||
-      ((S.transpose()*B*x).array().abs()>=1e-7).all()
+      ((U.leftCols(i).transpose()*B*x).array().abs()<=1e-7).all()
       )
       )
     {
     {
       //cout<<"Found "<<i<<"th mode"<<endl;
       //cout<<"Found "<<i<<"th mode"<<endl;
@@ -150,8 +150,10 @@ IGL_INLINE bool igl::eigs(
       }
       }
     }else
     }else
     {
     {
-      std::cout<<(S.head(i).array()-sigma).abs().maxCoeff()<<std::endl;
-      std::cout<<(S.transpose()*B*x).array().abs().transpose()<<std::endl;
+      //std::cout<<"i: "<<i<<std::endl;
+      //std::cout<<"  "<<S.head(i).transpose()<<" << "<<sigma<<std::endl;
+      //std::cout<<"  "<<(S.head(i).array()-sigma).abs().maxCoeff()<<std::endl;
+      //std::cout<<"  "<<(U.leftCols(i).transpose()*B*x).array().abs().transpose()<<std::endl;
       // restart with new random guess.
       // restart with new random guess.
       cout<<"igl::eigs RESTART"<<endl;
       cout<<"igl::eigs RESTART"<<endl;
     }
     }