Closed idryanov closed 9 years ago
Update:
I managed to narrow down the issue somewhat.
Building a NNSearchF
from MatrixXf works as expected, using large numbers of points.
Eigen::MatrixXf points = Eigen::MatrixXf::Random(3, n_points);
Replacing that with a matrix with fixed rows will exhibit the failures described above (fail on 10921 or more columns)
Eigen::Matrix<float, 3, Eigen::Dynamic> points =
Eigen::Matrix<float, 3, Eigen::Dynamic>::Random(3, n_points);
Moreover, even when not segfaulting, passing a Matrix3Xf
instead of a Matrixf
seems to sometimes be producing the wrong knn results.
I have managed to work around the problem by evaluating all my Matrix3Xf
mats to Matrix3f
- however, it's not immediately obvious (to me) how this is creating an issue.
@simonlynen as per our offline conversation
@idryanov This rather seems to be an issue in Eigen. It is actually not obvious to me how a reference of (partially) fixed size can be allowed to be created to a dynamic matrix (given that this can be compile-time checked).
It seems this issue is resolved best by looking into how Eigen determines between fixed and dynamic matrices for block operations etc. as used by Nabo.
This could only be resolved by actually passing the correct derived type into nabo and holding the correct reference type. This would however mean that the entire library would need to be a template which is suboptimal. For now the fix to this is to use the correct Eigen type of dynamic sizes on both dimensions.
I get a segfault when attempting to do a knn search on an Eigen float matrix with 3 rows and more than 10920 columns. Interestingly, that works out to close to 2^15 floats.
I compiled a minimum test program, included below, and the gdb output. In short, it runs fine with a
3 x 10920
matrix, and segfaults on a3 x 10921
matrixHere's the code:
Here's the gdb output: