Improve nurbs surface fitting efficiency with Eigen sparse matrix solver#6379
Conversation
|
Thank you for your pull request. |
|
Efficiency test result of pcl::on_nurbs::FittingSurface:
Note of the table:
Sinces the time of sparse solve funtion is small, I think no need to compare to SuiteSparse solver. And I find there is no tests for on_nurbs in test/surface, I just test my commit by my own private application code. |
|
It works well with the nurbs fitting example and when run on the bun0.pcd (small cloud) the performance increase is still nice, from about 5 secs to about 800ms. |
|
@larshg Could it make sense to convert the nurbs fitting example to a test? Since the new sparse solver is used by default, I think it is important to have at least some kind of test to make sure it works correctly. |
|
The unittest from #6407 also passes with this new sparse solver. But we can merge the unittest first and then rebase this afterwards? |
|
@ZhuLingfeng1993 can you rebase this on main, thanks. |
dbd3c62 to
a020310
Compare
|
@larshg I have rebase this on main |
Compared to the existing Eigen dense solver, using the Eigen sparse solver significantly reduces solution time and memory usage, without relying on UMFPACK/SuiteSparse libraries that are based on the GPL open source license.
a020310 to
e0e0e29
Compare
| /* | ||
| Eigen::MatrixXd | ||
| NurbsSolve::diff () | ||
| { | ||
| int n_rows, n_cols; | ||
| m_Ksparse.size (n_rows, n_cols); | ||
|
|
||
| // Convert to Eigen sparse for multiplication | ||
| std::vector<int> rowinds, colinds; | ||
| std::vector<double> values; | ||
| m_Ksparse.get (rowinds, colinds, values); | ||
|
|
||
| std::vector<Eigen::Triplet<double>> tripletList; | ||
| for (size_t k = 0; k < values.size(); ++k) | ||
| { | ||
| tripletList.emplace_back(rowinds[k], colinds[k], values[k]); | ||
| } | ||
|
|
||
| Eigen::SparseMatrix<double> Keig_sparse(n_rows, n_cols); | ||
| Keig_sparse.setFromTriplets(tripletList.begin(), tripletList.end()); | ||
|
|
||
| Eigen::MatrixXd Kx = Keig_sparse * m_xeig; | ||
| return Kx - m_feig; | ||
| }*/ |
There was a problem hiding this comment.
Thanks for the rebase. Looks good otherwise, just a question regarding this commented-out code: Is there a reason to keep this, or can it be removed?
Compared to the existing Eigen dense solver, using the Eigen sparse solver significantly reduces solution time and memory usage, without relying on UMFPACK/SuiteSparse libraries that are based on the GPL open source license.