QuOc

 

Public Member Functions

aol::MeanOp< SampleType > Class Template Reference

For a number of samples (e.g. vectors or matrices), this operator computes the arithmetic mean and (if desired) the input samples with the mean subtracted. More...

#include <eigenvectors.h>

Inheritance diagram for aol::MeanOp< SampleType >:
aol::Op< aol::RandomAccessContainer< SampleType >, SampleType >

List of all members.

Public Member Functions

 MeanOp ()
void applyAdd (const aol::RandomAccessContainer< SampleType > &Arg, SampleType &Dest) const
void meanAndVariation (const aol::RandomAccessContainer< SampleType > &Samples, SampleType &Mean, aol::RandomAccessContainer< SampleType > &Variation) const

Detailed Description

template<typename SampleType>
class aol::MeanOp< SampleType >

For a number of samples (e.g. vectors or matrices), this operator computes the arithmetic mean and (if desired) the input samples with the mean subtracted.

Definition at line 587 of file eigenvectors.h.


Constructor & Destructor Documentation

template<typename SampleType >
aol::MeanOp< SampleType >::MeanOp (  )  [inline]

Definition at line 591 of file eigenvectors.h.

{}


Member Function Documentation

template<typename SampleType >
void aol::MeanOp< SampleType >::applyAdd ( const aol::RandomAccessContainer< SampleType > &  Arg,
SampleType &  Dest 
) const [inline]

Returns the arithmetic mean.

Definition at line 596 of file eigenvectors.h.

References aol::RandomAccessContainer< _DataType >::size(), and aol::STRUCT_COPY.

                                                                                            {

    // number of samples/probes
    int n = Arg.size();

    // compute the arithmetic mean
    SampleType mean ( Arg[0], aol::STRUCT_COPY );
    for ( int i = 0; i < n; i++ )
      mean += Arg[i];
    mean /= n;

    Dest += mean;
  }

template<typename SampleType >
void aol::MeanOp< SampleType >::meanAndVariation ( const aol::RandomAccessContainer< SampleType > &  Samples,
SampleType &  Mean,
aol::RandomAccessContainer< SampleType > &  Variation 
) const [inline]

Returns the arithmetic mean and the input samples minus the mean.

Definition at line 613 of file eigenvectors.h.

References aol::RandomAccessContainer< _DataType >::size().

                                                                                                                                                         {

    // number of samples/probes
    int n = Samples.size();

    // compute the arithmetic mean
    for ( int i = 0; i < n; i++ )
      Mean += Samples[i];
    Mean /= n;

    // subtract mean from samples
    Variation = Samples;
    for ( int i = 0; i < n; i++ )
      Variation[i] -= Mean;
  }


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

Generated on Fri Sep 9 2011 21:08:55 for QuocMesh by doxygen 1.7.1