GithubHelp home page GithubHelp logo

Comments (3)

Nelthirion avatar Nelthirion commented on August 17, 2024

And also when I looked inside the constructor for mat_index I saw that we have a call to index->buildIndex(); so why do we have to explicitly call this again in the next line:

my_kd_tree_t   mat_index(dim /*dim*/, samples, 10 /* max leaf */ ); // This already calls `index->buildIndex()`
mat_index.index->buildIndex();

from nanoflann.

jlblancoc avatar jlblancoc commented on August 17, 2024

But When using 1e7 samples which is 10 times larger, the tree takes a LOT more time to build and also to index.

No, I think you didn't do anything wrong. But you might have hit a performance limit related to the size of your L3 cache memory.
However, I would not recommend the vector_of_vector container for very large datasets, since it involves N calls to the memory allocator (once per vector). Instead, use the Matrix adaptor or even better write your own wrapper to avoid data duplication, directly accessing to data in whatever form it's originally kept in your program.

And also when I looked inside the constructor for mat_index I saw that we
have a call to index->buildIndex(); so why do we have to explicitly call this again in the next line:

Good point. Please, feel free of opening a pull request to fix the code/example. I guess that keeping the call inside the ctor is the expected behavior by the user, so the second one is the one that needs to be removed.

from nanoflann.

jlblancoc avatar jlblancoc commented on August 17, 2024

PS: An efficient kind of Matrix for this case is not Eigen::MatrixXd, but a matrix with one dimension (e.g. number of cols) fixed in compile-time to 128 or whatever is the feature length.

from nanoflann.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.