Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiple thread kdtree build support for KDTreeEigenMatrixAdaptor #246

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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