SCPPNT::Standardize< T > Class Template Reference

Standardize a set of values so they sum to a particular value. More...

#include <statfunc.h>

List of all members.

Public Member Functions

 Standardize (T s=1)
 Constructor.
template<class I>
void operator() (Subscript nelem, I begin)
 Compute standardized values for data pointed to by begin.


Detailed Description

template<class T>
class SCPPNT::Standardize< T >

Standardize a set of values so they sum to a particular value.

Parameters:
T A floating point type.

Definition at line 39 of file statfunc.h.


Constructor & Destructor Documentation

template<class T>
SCPPNT::Standardize< T >::Standardize ( s = 1  )  [inline]

Constructor.

Parameters:
s The value the sequence should sum to.

Definition at line 47 of file statfunc.h.

00048     {
00049       sum = s;
00050     }


Member Function Documentation

template<class T>
template<class I>
void SCPPNT::Standardize< T >::operator() ( Subscript  nelem,
begin 
) [inline]

Compute standardized values for data pointed to by begin.

Parameters:
I An iterator type pointing to values which are standardized.
nelem Number of values to be standardized.
begin Iterator to values to be standardized.

Definition at line 60 of file statfunc.h.

00061     {
00062       int i;
00063       T oldsum = 0;
00064 
00065       I ib = begin;
00066       for (i = nelem; i--; ++ib)
00067       {
00068         oldsum += *ib;
00069       }
00070 
00071       oldsum *= sum;
00072       for (i = nelem; i--; ++begin)
00073       {
00074         *begin /= oldsum;
00075       }
00076     }


The documentation for this class was generated from the following file:
Generated on Tue Dec 18 23:34:48 2007 for SCPPNT by  doxygen 1.5.4