CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
IceRevisitedRadix.h
Go to the documentation of this file.
1 //----------------------------------------------------------------------
8 //----------------------------------------------------------------------
9 
10 //----------------------------------------------------------------------
11 // Include Guard
12 #ifndef RecoTracker_MkFitCore_src_Ice_IceRevisitedRadix_h
13 #define RecoTracker_MkFitCore_src_Ice_IceRevisitedRadix_h
14 
15 #include "IcePreprocessor.h"
16 #include "IceTypes.h"
17 
19 #define RADIX_LOCAL_RAM
20 
21 enum RadixHint {
24 
25  RADIX_FORCE_DWORD = 0x7fffffff
26 };
27 
28 class RadixSort {
29 public:
30  // Constructor/Destructor
31  RadixSort();
32  ~RadixSort();
33  // Sorting methods
34  RadixSort& Sort(const udword* input, udword nb, RadixHint hint = RADIX_SIGNED);
35  RadixSort& Sort(const float* input, udword nb);
36 
38  //i.e. in the order you may further process your data
39  const udword* GetRanks() const { return mRanks; }
40 
44 
46  //otherwise you can recycle it the way you want.
47  udword* GetRecyclable() const { return mRanks2; }
48 
49  // Stats
50  udword GetUsedRam() const;
52  udword GetNbTotalCalls() const { return mTotalCalls; }
54  udword GetNbHits() const { return mNbHits; }
55 
56 private:
57 #ifndef RADIX_LOCAL_RAM
58  udword* mHistogram;
59  udword* mLink;
60 #endif
64  // Stats
67 
68  // Internal methods
69  void CheckResize(udword nb);
70  bool Resize(udword nb);
71 };
72 
73 #endif // __ICERADIXSORT_H__
bool Resize(udword nb)
udword mTotalCalls
Total number of calls to the sort routine.
udword * RelinquishRanks()
udword mCurrentSize
Current size of the indices list.
udword * mRanks2
udword GetUsedRam() const
Input values are signed.
RadixSort & Sort(const udword *input, udword nb, RadixHint hint=RADIX_SIGNED)
static std::string const input
Definition: EdmProvDump.cc:47
udword GetNbTotalCalls() const
Returns the total number of calls to the radix sorter.
unsigned int udword
sizeof(udword) must be 4
Definition: IceTypes.h:52
udword GetNbHits() const
Returns the number of eraly exits due to temporal coherence.
const udword * GetRanks() const
Access to results. mRanks is a list of indices in sorted order,.
void CheckResize(udword nb)
udword * GetRecyclable() const
mIndices2 gets trashed on calling the sort routine, but
RadixHint
Input values are unsigned.
udword * mRanks
Two lists, swapped each pass.
udword mNbHits
Number of early exits due to coherence.