swift-nav/albatross

Define IndexingFunctions

Closed this issue · 0 comments

At the moment the definition of an IndexingFunction is pretty loose. They are often used in things like cross validation (and in turn in Ransac) and are expected to functors which take a vector of features and return a map from a group name (string) to the indices which correspond to that group.

Like the models, index functions need to be capable of dealing with a variety of different feature types which could make the CRTP approach a good option.

template <typename T>
struct IndexingFunc {
  template <typename FeatureType,
               typename enable_if<is_valid<T, FeatureType>::value, int>::type = 0>
  FoldIndexer operator()(const std::vector<FeatureType> &features) const {
    derived()._call_impl(features);
  }
}