Skip to content

Commit

Permalink
Merge pull request #246 from athrva98/multiple-thread-build-KDTreeEig…
Browse files Browse the repository at this point in the history
…enMatrixAdaptor

Add multiple thread kdtree build support for KDTreeEigenMatrixAdaptor
  • Loading branch information
jlblancoc authored Aug 19, 2024
2 parents e68fd0f + 57ea5fa commit b404d8f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions include/nanoflann.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2620,7 +2620,8 @@ struct KDTreeEigenMatrixAdaptor
explicit KDTreeEigenMatrixAdaptor(
const Dimension dimensionality,
const std::reference_wrapper<const MatrixType>& mat,
const int leaf_max_size = 10)
const int leaf_max_size = 10,
const unsigned int n_thread_build = 1)
: m_data_matrix(mat)
{
const auto dims = row_major ? mat.get().cols() : mat.get().rows();
Expand All @@ -2634,7 +2635,9 @@ struct KDTreeEigenMatrixAdaptor
"argument");
index_ = new index_t(
dims, *this /* adaptor */,
nanoflann::KDTreeSingleIndexAdaptorParams(leaf_max_size));
nanoflann::KDTreeSingleIndexAdaptorParams(leaf_max_size,
nanoflann::KDTreeSingleIndexAdaptorFlags::None,
n_thread_build));
}

public:
Expand Down

0 comments on commit b404d8f

Please sign in to comment.