Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Types | Public Member Functions | Protected Attributes

AveragePosition< D > Class Template Reference

Maintain an average position by summing up positions with weights. More...

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

List of all members.

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_

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)

Member Typedef Documentation

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

typedef DPosition<DIMENSION> PositionType

Position type (a D-dimensional position).


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

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

Add a position.

Referenced by SimpleExtender< PeakType, FeatureType >::extend().

void clear (  )  [inline]

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

Referenced by SimpleExtender< PeakType, FeatureType >::extend().

PositionType const& getPosition (  )  const [inline]

Returns the current average position.

Referenced by SimpleExtender< PeakType, FeatureType >::isTooFarFromCentroid_().

CoordinateType const& getWeight (  )  const [inline]

Returns the total weight.


Member Data Documentation

PositionType position_ [protected]

OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:43:00 using doxygen 1.7.1