Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:16

0001 #ifndef RecoTracker_MkFitCore_interface_radix_sort_h
0002 #define RecoTracker_MkFitCore_interface_radix_sort_h
0003 
0004 #include <type_traits>
0005 #include <vector>
0006 
0007 namespace mkfit {
0008 
0009   template <typename V, typename R>
0010   class radix_sort {
0011   public:
0012     static_assert(std::is_same<V, unsigned short>() || std::is_same<V, unsigned int>());
0013     static_assert(std::is_same<R, unsigned short>() || std::is_same<R, unsigned int>());
0014 
0015     typedef unsigned char ubyte_t;
0016     typedef V value_t;
0017     typedef R rank_t;
0018     static constexpr rank_t c_NBytes = sizeof(V);
0019 
0020     void sort(const std::vector<V>& values, std::vector<R>& ranks);
0021 
0022   private:
0023     void histo_loop(const std::vector<V>& values, rank_t* histos);
0024     void radix_loop(const std::vector<V>& values, rank_t* histos, std::vector<R>& ranks);
0025   };
0026 }  // namespace mkfit
0027 
0028 #endif