Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

AveragePosition Class Template Reference

#include <OpenMS/MATH/STATISTICS/AveragePosition.h>

List of all members.


Detailed Description

template<UInt D>
class OpenMS::Math::AveragePosition< D >

Maintain an average position by summing up positions with weights.

Improvement:
A lot of convenience methods could be added. For example, we could overload operator + and -, consequently +=, -=, even < and ==, inherit the whole thing from an extended DPosition with similar methods, initialize from iterator ranges, ... but there are not concrete use cases at the moment. Please contact the maintainer if you need something for your application field. (Clemens)

Public Types

enum  { DIMENSION = D }
 Dimensionality. More...
typedef DPosition< DIMENSION > PositionType
 Position type (a D-dimensional position).
typedef
PositionType::CoordinateType 
CoordinateType
 Weight type (for weighted average - a scalar type).

Public Member Functions

 AveragePosition ()
 Default constructor.
 AveragePosition (AveragePosition const &rhs)
 Copy constructor.
PositionType const & getPosition () const
 Returns the current average position.
CoordinateType const & getWeight () const
 Returns the total weight.
void clear ()
 Reset everything. (Note that update() will cause a division by zero after that.).
void add (PositionType position, CoordinateType const weight=1)
 Add a position.

Protected Attributes

PositionType position_
PositionType position_weighted_sum_
CoordinateType weight_sum_

Member Typedef Documentation

typedef DPosition<DIMENSION> PositionType

Position type (a D-dimensional position).

typedef PositionType::CoordinateType CoordinateType

Weight type (for weighted average - a scalar type).


Member Enumeration Documentation

anonymous enum

Dimensionality.

Enumerator:
DIMENSION 


Constructor & Destructor Documentation

AveragePosition (  )  [inline]

Default constructor.

AveragePosition ( AveragePosition< D > const &  rhs  )  [inline]

Copy constructor.


Member Function Documentation

PositionType const& getPosition (  )  const [inline]

Returns the current average position.

CoordinateType const& getWeight (  )  const [inline]

Returns the total weight.

void clear (  )  [inline]

Reset everything. (Note that update() will cause a division by zero after that.).

void add ( PositionType  position,
CoordinateType const   weight = 1 
) [inline]

Add a position.


Member Data Documentation

PositionType position_ [protected]

PositionType position_weighted_sum_ [protected]

CoordinateType weight_sum_ [protected]


The documentation for this class was generated from the following file:
Generated Tue Apr 1 15:36:50 2008 -- using doxygen 1.5.4 OpenMS / TOPP 1.1