proj home

Files   Classes   Functions   Hierarchy  

unitdouble Class Reference

Maps a normalized double to an integer. More...

#include <unitdouble.h>

Collaboration diagram for unitdouble:

List of all members.

Public Member Functions

uintc index (doublec &x) const
 The hash function.
boolc operator() (doublec &a, doublec &b) const
 Compare two doubles.
 unitdouble (uintc bucketsize_)
 Construct the hash function.

Public Attributes

uintc bucketsize
 Configures the number of buckets.


Detailed Description

Maps a normalized double to an integer.

This is a hash function for a uniform distribution. It is assumend the double has been normalized: 0.0 < x < 1.0

Definition at line 12 of file unitdouble.h.


Constructor & Destructor Documentation

unitdouble::unitdouble ( uintc  bucketsize_  )  [inline]

Construct the hash function.

Definition at line 30 of file unitdouble.h.

00031     : bucketsize(bucketsize_) {}


Member Function Documentation

uintc unitdouble::index ( doublec x  )  const [inline]

The hash function.

Definition at line 19 of file unitdouble.h.

References bucketsize.

00020     { return (uint)((x*bucketsize)) % bucketsize; }

boolc unitdouble::operator() ( doublec a,
doublec b 
) const [inline]

Compare two doubles.

Definition at line 23 of file unitdouble.h.

00027     { return a < b; }


Member Data Documentation

Configures the number of buckets.

Definition at line 17 of file unitdouble.h.

Referenced by index().


The documentation for this class was generated from the following file:

Generated on Fri Mar 4 00:50:22 2011 for Chelton Evans Source by  doxygen 1.5.8