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

More content for RcppAnnoy.h #65

Closed
eddelbuettel opened this issue Nov 17, 2020 · 4 comments
Closed

More content for RcppAnnoy.h #65

eddelbuettel opened this issue Nov 17, 2020 · 4 comments

Comments

@eddelbuettel
Copy link
Owner

Per discussion in #64 we may as well add both these, no?

Comments, @LTLA @jlmelville ? Useful? Useless? Other additions?

#ifdef ANNOYLIB_MULTITHREADED_BUILD
  typedef AnnoyIndexMultiThreadedBuildPolicy AnnoyIndexThreadedBuildPolicy;
#else
  typedef AnnoyIndexSingleThreadedBuildPolicy AnnoyIndexThreadedBuildPolicy;
#endif

typedef Annoy<int32_t, float,    Angular,   Kiss64Random, AnnoyIndexThreadedBuildPolicy> AnnoyAngular;
typedef Annoy<int32_t, float,    Euclidean, Kiss64Random, AnnoyIndexThreadedBuildPolicy> AnnoyEuclidean;
typedef Annoy<int32_t, float,    Manhattan, Kiss64Random, AnnoyIndexThreadedBuildPolicy> AnnoyManhattan;
typedef Annoy<int32_t, uint64_t, Hamming,   Kiss64Random, AnnoyIndexThreadedBuildPolicy> AnnoyHamming;
@eddelbuettel
Copy link
Owner Author

See #64 for more content regarding prefixing.

@eddelbuettel
Copy link
Owner Author

One possible variant (currently in my file)

// -- convenience typedefs
//    prefixed with Rcpp to ensure we are most unlikely to clash with upstream defines
//    usage of these is entire optional

#ifdef ANNOYLIB_MULTITHREADED_BUILD
  typedef AnnoyIndexMultiThreadedBuildPolicy RcppAnnoyIndexThreadPolicy;
#else
  typedef AnnoyIndexSingleThreadedBuildPolicy RcppAnnoyIndexThreadPolicy;
#endif

typedef Annoy<int32_t, float,    Angular,   Kiss64Random, RcppAnnoyIndexThreadPolicy> RcppAnnoyAngular;
typedef Annoy<int32_t, float,    Euclidean, Kiss64Random, RcppAnnoyIndexThreadPolicy> RcppAnnoyEuclidean;
typedef Annoy<int32_t, float,    Manhattan, Kiss64Random, RcppAnnoyIndexThreadPolicy> RcppAnnoyManhattan;
typedef Annoy<int32_t, uint64_t, Hamming,   Kiss64Random, RcppAnnoyIndexThreadPolicy> RcppAnnoyHamming;

Comments, @LTLA @jlmelville ? Useful? Useless? Other additions?

@LTLA
Copy link
Contributor

LTLA commented Nov 19, 2020

Yes, that would help. I'm looking at https://github.com/LTLA/BiocNeighbors/blob/master/src/annoy.h and I can see that I could basically delete lines 5 to 26 and also lines 41-45. Not entirely sure why I needed to define NO_MANUAL_VECTORIZATION; I think it was some attempt at debugging a test failure from differences in compilation settings.

@eddelbuettel
Copy link
Owner Author

eddelbuettel commented Nov 19, 2020

Turns out I was too ambitious (and had not tried to compile the above). The typedef Annoy<...> does not fly as Annoy is not yet known at that point. So I am reducing it to to just the single/multi threaded policy typedef.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants