2019年8月23日 星期五

Eigen skill note

eigen std::vector mapped to Eigen::VectorXd
Eigen::VectorXd b = Eigen::VectorXd::Map (tmp_b.data(), tmp_b.size());// the rbight hand side-vector

eigen出現下面的錯誤是因為Sparse A.size != n*n
Assertion failed: lhs.cols() == rhs.rows() && "invalid matrix product" && "if you wanted a coeff-wise or a dot product use the respective explicit functions", file d:\desktop\redhawkeffect\include\eigen\src/Core/Product.h, line 97
改成A'Ax=A'b即可

eigen -1.#IND代表跑到負無窮大或者有多個解
有多個解的話在邊界加上constrain即可解決(e.g.boundary vector=0)

要注意的點:
1.index別算錯
2.weight的type也要注意(int or double)

沒有留言:

張貼留言

Eclipse 5.27.1 環境主題修改

Eclipse 環境設定 1. 主題 Window->Preferences->General->Appearance->Theme->Dark 2. 文字大小 Window->Preferences->General-&...