psHistogram.h

Go to the documentation of this file.
00001 /* @file  psHistogram.h
00002  * @brief basic histogram functions
00003  *
00004  * This file holds the definition of the histogram data structures.  It also contains
00005  * prototypes for procedures which operate on those data structures.
00006  *
00007  * @author GLG, MHPCC
00008  *
00009  * @version $Revision: 1.2 $ $Name:  $
00010  * @date $Date: 2007/01/23 22:47:23 $
00011  *
00012  * Copyright 2004-2005 IfA, University of Hawaii
00013  */
00014 
00015 #ifndef PS_HISTOGRAM_H
00016 #define PS_HISTOGRAM_H
00017 
00018 /// @addtogroup MathOps Mathematical Operations
00019 /// @{
00020 
00021 /******************************************************************************
00022     Histogram functions and data structures.
00023  *****************************************************************************/
00024 
00025 /** The basic histogram structure which contains bounds and bins.
00026  *
00027  *  In this structure, the vector bounds specifies the boundaries of the
00028  *  histogram bins, and must of type psF32, while nums specifies the number
00029  *  of entries in the bin, and must of type psU32. The value of bounds.n must
00030  *  therefore be 1 greater than than nums.n. The two values minNum and maxNum
00031  *  are the number of data values which fell below the lower limit bound or
00032  *  above the upper limit bound, respectively.
00033  */
00034 typedef struct
00035 {
00036     const psVector* bounds;            ///< Bounds for the bins (type F32)
00037     psVector* nums;                    ///< Number in each of the bins (INT)
00038     int minNum;                        ///< Number below the minimum
00039     int maxNum;                        ///< Number above the maximum
00040     bool uniform;                      ///< Is it a uniform distribution?
00041 }
00042 psHistogram;
00043 
00044 /** Allocator for psHistogram where the bounds of the bins are implicitly
00045  *  specified through simply specifying an upper and lower limit along with
00046  *  the size of the bins.
00047  *
00048  *  @return psHistogram*    Newly allocated psHistogram
00049  */
00050 psHistogram* psHistogramAlloc(
00051     float lower,                       ///< Lower limit for the bins
00052     float upper,                       ///< Upper limit for the bins
00053     int n                              ///< Number of bins
00054 );
00055 
00056 
00057 /** Checks the type of a particular pointer.
00058  *
00059  *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
00060  *
00061  *  @return bool:       True if the pointer matches a psHistogram structure, false otherwise.
00062  */
00063 bool psMemCheckHistogram(
00064     psPtr ptr                          ///< the pointer whose type to check
00065 );
00066 
00067 
00068 /** Allocator for psHistogram where the bounds of the bins are explicitly
00069  *  specified.
00070  *
00071  *  @return psHistogram*    Newly allocated psHistogram
00072  */
00073 psHistogram* psHistogramAllocGeneric(
00074     const psVector* bounds             ///< Bounds for the bins
00075 );
00076 
00077 /** Calculate a histogram
00078  *
00079  *  The following function populates the histogram bins from the specified
00080  *  vector (in). It alters and returns the histogram out structure. The input
00081  *  vector may be of types psU8, psU16, psF32, psF64.
00082  *
00083  *  @return psHistogram*   histogram result
00084  */
00085 psHistogram* psVectorHistogram(
00086     psHistogram* out,                  ///< Histogram data
00087     const psVector* values,            ///< Vector to analyse
00088     const psVector* errors,            ///< Errors
00089     const psVector* mask,              ///< Mask dat for input vector
00090     psMaskType maskVal                 ///< Mask value
00091 );
00092 
00093 /// @}
00094 #endif // #ifndef PS_HISTOGRAM_H

Generated on Fri Feb 2 22:24:35 2007 for pslib by  doxygen 1.5.1